Version: 3.0.5
Loading...
Searching...
No Matches
wxHeaderColumnSimple Class Reference

#include <wx/headercol.h>

+ Inheritance diagram for wxHeaderColumnSimple:

Detailed Description

Simple container for the information about the column.

This is a concrete class implementing all wxSettableHeaderColumn class methods in a trivial way, i.e. by just storing the information in the object itself. It is used by and with wxHeaderCtrlSimple, e.g.

wxHeaderColumnSimple col("Title");
col.SetWidth(100);
col.SetSortable(100);
header->AppendColumn(col);
Simple container for the information about the column.
Definition headercol.h:398
wxHeaderCtrlSimple is a concrete header control which can be used directly, without inheriting from i...
Definition headerctrl.h:544
void AppendColumn(const wxHeaderColumnSimple &col)
Append the column to the end of the control.

Library:  wxCore

<>< =''>:</>&;&;< =''>\ </></>

Public Member Functions

 wxHeaderColumnSimple (const wxString &title, int width=wxCOL_WIDTH_DEFAULT, wxAlignment align=wxALIGN_NOT, int flags=wxCOL_DEFAULT_FLAGS)
 Constructor for a column header.
 
 wxHeaderColumnSimple (const wxBitmap &bitmap, int width=wxCOL_WIDTH_DEFAULT, wxAlignment align=wxALIGN_CENTER, int flags=wxCOL_DEFAULT_FLAGS)
 
virtual void SetTitle (const wxString &title)
 Trivial implementations of the base class pure virtual functions.
 
virtual wxString GetTitle () const
 Get the text shown in the column header.
 
virtual void SetBitmap (const wxBitmap &bitmap)
 Set the bitmap to be displayed in the column header.
 
virtual wxBitmap GetBitmap () const
 Returns the bitmap in the header of the column, if any.
 
virtual void SetWidth (int width)
 Set the column width.
 
virtual int GetWidth () const
 Returns the current width of the column.
 
virtual void SetMinWidth (int minWidth)
 Set the minimal column width.
 
virtual int GetMinWidth () const
 Return the minimal column width.
 
virtual void SetAlignment (wxAlignment align)
 Set the alignment of the column header.
 
virtual wxAlignment GetAlignment () const
 Returns the current column alignment.
 
virtual void SetFlags (int flags)
 Set the column flags.
 
virtual int GetFlags () const
 Get the column flags.
 
virtual bool IsSortKey () const
 Returns true if the column is currently used for sorting.
 
virtual void SetSortOrder (bool ascending)
 Sets this column as the sort key for the associated control.
 
virtual bool IsSortOrderAscending () const
 Returns true, if the sort order is ascending.
 
- Public Member Functions inherited from wxSettableHeaderColumn
virtual void SetTitle (const wxString &title)=0
 Set the text to display in the column header.
 
virtual void SetBitmap (const wxBitmap &bitmap)=0
 Set the bitmap to be displayed in the column header.
 
virtual void SetWidth (int width)=0
 Set the column width.
 
virtual void SetMinWidth (int minWidth)=0
 Set the minimal column width.
 
virtual void SetAlignment (wxAlignment align)=0
 Set the alignment of the column header.
 
virtual void SetFlags (int flags)=0
 Set the column flags.
 
void ChangeFlag (int flag, bool set)
 Set or clear the given flag.
 
void SetFlag (int flag)
 Set the specified flag for the column.
 
void ClearFlag (int flag)
 Clear the specified flag for the column.
 
void ToggleFlag (int flag)
 Toggle the specified flag for the column.
 
virtual void SetResizeable (bool resizable)
 Call this to enable or disable interactive resizing of the column by the user.
 
virtual void SetSortable (bool sortable)
 Allow clicking the column to sort the control contents by the field in this column.
 
virtual void SetReorderable (bool reorderable)
 Allow changing the column order by dragging it.
 
virtual void SetHidden (bool hidden)
 Hide or show the column.
 
void UnsetAsSortKey ()
 Don't use this column for sorting.
 
virtual void SetSortOrder (bool ascending)=0
 Sets this column as the sort key for the associated control.
 
void ToggleSortOrder ()
 Inverses the sort order.
 
- Public Member Functions inherited from wxHeaderColumn
virtual wxString GetTitle () const =0
 Get the text shown in the column header.
 
virtual wxBitmap GetBitmap () const =0
 Returns the bitmap in the header of the column, if any.
 
virtual int GetWidth () const =0
 Returns the current width of the column.
 
virtual int GetMinWidth () const =0
 Return the minimal column width.
 
virtual wxAlignment GetAlignment () const =0
 Returns the current column alignment.
 
virtual int GetFlags () const =0
 Get the column flags.
 
bool HasFlag (int flag) const
 Return true if the specified flag is currently set for this column.
 
virtual bool IsResizeable () const
 Return true if the column can be resized by the user.
 
virtual bool IsSortable () const
 Returns true if the column can be clicked by user to sort the control contents by the field in this column.
 
virtual bool IsReorderable () const
 Returns true if the column can be dragged by user to change its order.
 
virtual bool IsHidden () const
 Returns true if the column is currently hidden.
 
bool IsShown () const
 Returns true if the column is currently shown.
 
virtual bool IsSortKey () const =0
 Returns true if the column is currently used for sorting.
 
virtual bool IsSortOrderAscending () const =0
 Returns true, if the sort order is ascending.
 

Constructor & Destructor Documentation

◆ wxHeaderColumnSimple() [1/2]

wxHeaderColumnSimple::wxHeaderColumnSimple ( const wxString title,
int  width = wxCOL_WIDTH_DEFAULT,
wxAlignment  align = wxALIGN_NOT,
int  flags = wxCOL_DEFAULT_FLAGS 
)

Constructor for a column header.

The first constructor creates a header showing the given text title while the second one creates one showing the specified bitmap image.

◆ wxHeaderColumnSimple() [2/2]

wxHeaderColumnSimple::wxHeaderColumnSimple ( const wxBitmap bitmap,
int  width = wxCOL_WIDTH_DEFAULT,
wxAlignment  align = wxALIGN_CENTER,
int  flags = wxCOL_DEFAULT_FLAGS 
)

Member Function Documentation

◆ GetAlignment()

virtual wxAlignment wxHeaderColumnSimple::GetAlignment ( ) const
virtual

Returns the current column alignment.

Returns
One of wxALIGN_CENTRE, wxALIGN_LEFT or wxALIGN_RIGHT.

Implements wxHeaderColumn.

◆ GetBitmap()

virtual wxBitmap wxHeaderColumnSimple::GetBitmap ( ) const
virtual

Returns the bitmap in the header of the column, if any.

If the column has no associated bitmap, wxNullBitmap should be returned.

Implements wxHeaderColumn.

◆ GetFlags()

virtual int wxHeaderColumnSimple::GetFlags ( ) const
virtual

Get the column flags.

This method retrieves all the flags at once, you can also use HasFlag() to test for any individual flag or IsResizeable(), IsSortable(), IsReorderable() and IsHidden() to test for particular flags.

Implements wxHeaderColumn.

◆ GetMinWidth()

virtual int wxHeaderColumnSimple::GetMinWidth ( ) const
virtual

Return the minimal column width.

Returns
The minimal width such that the user can't resize the column to lesser size (notice that it is still possible to set the column width to smaller value from the program code). Return 0 from here to allow resizing the column to arbitrarily small size.

Implements wxHeaderColumn.

◆ GetTitle()

virtual wxString wxHeaderColumnSimple::GetTitle ( ) const
virtual

Get the text shown in the column header.

Implements wxHeaderColumn.

◆ GetWidth()

virtual int wxHeaderColumnSimple::GetWidth ( ) const
virtual

Returns the current width of the column.

Returns
Width of the column in pixels, never wxCOL_WIDTH_DEFAULT or wxCOL_WIDTH_AUTOSIZE.

Implements wxHeaderColumn.

◆ IsSortKey()

virtual bool wxHeaderColumnSimple::IsSortKey ( ) const
virtual

Returns true if the column is currently used for sorting.

Implements wxHeaderColumn.

◆ IsSortOrderAscending()

virtual bool wxHeaderColumnSimple::IsSortOrderAscending ( ) const
virtual

Returns true, if the sort order is ascending.

Notice that it only makes sense to call this function if the column is used for sorting at all, i.e. if IsSortKey() returns true.

Implements wxHeaderColumn.

◆ SetAlignment()

virtual void wxHeaderColumnSimple::SetAlignment ( wxAlignment  align)
virtual

Set the alignment of the column header.

Parameters
alignThe text alignment in horizontal direction only or wxALIGN_NOT to use the default alignment, The possible values here are wxALIGN_CENTRE, wxALIGN_LEFT or wxALIGN_RIGHT with wxALIGN_CENTRE_HORIZONTAL being also supported as synonym for wxALIGN_CENTRE for consistency (but notice that GetAlignment() never returns it).

Implements wxSettableHeaderColumn.

◆ SetBitmap()

virtual void wxHeaderColumnSimple::SetBitmap ( const wxBitmap bitmap)
virtual

Set the bitmap to be displayed in the column header.

Notice that the bitmaps displayed in different columns of the same control must all be of the same size.

Implements wxSettableHeaderColumn.

◆ SetFlags()

virtual void wxHeaderColumnSimple::SetFlags ( int  flags)
virtual

Set the column flags.

This method allows setting all flags at once, see also generic ChangeFlag(), SetFlag(), ClearFlag() and ToggleFlag() methods below as well as specific SetResizeable(), SetSortable(), SetReorderable() and SetHidden() ones.

Parameters
flagsCombination of wxCOL_RESIZABLE, wxCOL_SORTABLE, wxCOL_REORDERABLE and wxCOL_HIDDEN bit flags.

Implements wxSettableHeaderColumn.

◆ SetMinWidth()

virtual void wxHeaderColumnSimple::SetMinWidth ( int  minWidth)
virtual

Set the minimal column width.

This method can be used with resizable columns (i.e. those for which wxCOL_RESIZABLE flag is set in GetFlags() or, alternatively, IsResizeable() returns true) to prevent the user from making them narrower than the given width.

Parameters
minWidthThe minimal column width in pixels, may be 0 to remove any previously set restrictions.

Implements wxSettableHeaderColumn.

◆ SetSortOrder()

virtual void wxHeaderColumnSimple::SetSortOrder ( bool  ascending)
virtual

Sets this column as the sort key for the associated control.

This function indicates that this column is currently used for sorting the control and also sets the sorting direction. Notice that actual sorting is only done in the control associated with the header, this function doesn't do any sorting on its own.

Don't confuse this function with SetSortable() which should be used to indicate that the column may be used for sorting while this one is used to indicate that it currently is used for sorting. Of course, SetSortOrder() can be only called for sortable columns.

Parameters
ascendingIf true, sort in ascending order, otherwise in descending order.

Implements wxSettableHeaderColumn.

◆ SetTitle()

virtual void wxHeaderColumnSimple::SetTitle ( const wxString title)
virtual

Trivial implementations of the base class pure virtual functions.

Implements wxSettableHeaderColumn.

◆ SetWidth()

virtual void wxHeaderColumnSimple::SetWidth ( int  width)
virtual

Set the column width.

Parameters
widthThe column width in pixels or the special wxCOL_WIDTH_DEFAULT (meaning to use default width) or wxCOL_WIDTH_AUTOSIZE (size to fit the content) value.

Implements wxSettableHeaderColumn.