Version: 3.2.5
wxHeaderColumn Class Referenceabstract

#include <wx/headercol.h>

+ Inheritance diagram for wxHeaderColumn:

Detailed Description

Represents a column header in controls displaying tabular data such as wxDataViewCtrl or wxGrid.

Notice that this is an abstract base class which is implemented (usually using the information stored in the associated control) by the different controls using wxHeaderCtrl. As the control only needs to retrieve the information about the column, this class defines only the methods for accessing the various column properties but not for changing them as the setters might not be needed at all, e.g. if the column attributes can only be changed via the methods of the main associated control (this is the case for wxGrid for example). If you do want to allow changing them directly using the column itself, you should inherit from wxSettableHeaderColumn instead of this class.

Finally, if you don't already store the column information at all anywhere, you should use the concrete wxHeaderColumnSimple class and wxHeaderCtrlSimple.

Library:  wxCore
Category:  Controls

Public Member Functions

virtual wxString GetTitle () const =0
 Get the text shown in the column header. More...
 
virtual wxBitmap GetBitmap () const =0
 This function exists only for backwards compatibility, it's recommended to override GetBitmapBundle() in the new code and override this one to do nothing, as it will never be called if GetBitmapBundle() is overridden. More...
 
virtual wxBitmapBundle GetBitmapBundle () const
 Returns the bitmap in the header of the column, if any. More...
 
virtual int GetWidth () const =0
 Returns the current width of the column. More...
 
virtual int GetMinWidth () const =0
 Return the minimal column width. More...
 
virtual wxAlignment GetAlignment () const =0
 Returns the current column alignment. More...
 
virtual int GetFlags () const =0
 Get the column flags. More...
 
bool HasFlag (int flag) const
 Return true if the specified flag is currently set for this column. More...
 
virtual bool IsResizeable () const
 Return true if the column can be resized by the user. More...
 
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. More...
 
virtual bool IsReorderable () const
 Returns true if the column can be dragged by user to change its order. More...
 
virtual bool IsHidden () const
 Returns true if the column is currently hidden. More...
 
bool IsShown () const
 Returns true if the column is currently shown. More...
 
virtual bool IsSortKey () const =0
 Returns true if the column is currently used for sorting. More...
 
virtual bool IsSortOrderAscending () const =0
 Returns true, if the sort order is ascending. More...
 

Member Function Documentation

◆ GetAlignment()

virtual wxAlignment wxHeaderColumn::GetAlignment ( ) const
pure virtual

Returns the current column alignment.

Returns
One of wxALIGN_CENTRE, wxALIGN_LEFT or wxALIGN_RIGHT.

Implemented in wxHeaderColumnSimple.

◆ GetBitmap()

virtual wxBitmap wxHeaderColumn::GetBitmap ( ) const
pure virtual

This function exists only for backwards compatibility, it's recommended to override GetBitmapBundle() in the new code and override this one to do nothing, as it will never be called if GetBitmapBundle() is overridden.

Implemented in wxHeaderColumnSimple.

◆ GetBitmapBundle()

virtual wxBitmapBundle wxHeaderColumn::GetBitmapBundle ( ) const
virtual

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

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

Override this function to return the bundle containing the bitmap to show in the column header. By default delegates to GetBitmap() but should be overridden if the bitmaps are used.

Since
3.1.6

Reimplemented in wxHeaderColumnSimple.

◆ GetFlags()

virtual int wxHeaderColumn::GetFlags ( ) const
pure 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.

Implemented in wxHeaderColumnSimple.

◆ GetMinWidth()

virtual int wxHeaderColumn::GetMinWidth ( ) const
pure 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.

Implemented in wxHeaderColumnSimple.

◆ GetTitle()

virtual wxString wxHeaderColumn::GetTitle ( ) const
pure virtual

Get the text shown in the column header.

Implemented in wxHeaderColumnSimple.

◆ GetWidth()

virtual int wxHeaderColumn::GetWidth ( ) const
pure virtual

Returns the current width of the column.

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

Implemented in wxHeaderColumnSimple.

◆ HasFlag()

bool wxHeaderColumn::HasFlag ( int  flag) const

Return true if the specified flag is currently set for this column.

◆ IsHidden()

virtual bool wxHeaderColumn::IsHidden ( ) const
virtual

Returns true if the column is currently hidden.

This corresponds to wxCOL_HIDDEN flag which is off by default.

◆ IsReorderable()

virtual bool wxHeaderColumn::IsReorderable ( ) const
virtual

Returns true if the column can be dragged by user to change its order.

This corresponds to wxCOL_REORDERABLE flag which is on by default.

◆ IsResizeable()

virtual bool wxHeaderColumn::IsResizeable ( ) const
virtual

Return true if the column can be resized by the user.

Equivalent to HasFlag(wxCOL_RESIZABLE).

◆ IsShown()

bool wxHeaderColumn::IsShown ( ) const

Returns true if the column is currently shown.

This corresponds to the absence of wxCOL_HIDDEN flag.

◆ IsSortable()

virtual bool wxHeaderColumn::IsSortable ( ) const
virtual

Returns true if the column can be clicked by user to sort the control contents by the field in this column.

This corresponds to wxCOL_SORTABLE flag which is off by default.

◆ IsSortKey()

virtual bool wxHeaderColumn::IsSortKey ( ) const
pure virtual

Returns true if the column is currently used for sorting.

Implemented in wxHeaderColumnSimple.

◆ IsSortOrderAscending()

virtual bool wxHeaderColumn::IsSortOrderAscending ( ) const
pure 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.

Implemented in wxHeaderColumnSimple.