Version: 3.2.7
wxSettableHeaderColumn Class Referenceabstract

#include <wx/headercol.h>

+ Inheritance diagram for wxSettableHeaderColumn:

Detailed Description

Adds methods to set the column attributes to wxHeaderColumn.

This class adds setters for the column attributes defined by wxHeaderColumn. It is still an abstract base class and needs to be implemented before using it with wxHeaderCtrl.

Library:  wxCore
Category:  Controls

Public Member Functions

virtual void SetTitle (const wxString &title)=0
 Set the text to display in the column header. More...
 
virtual void SetBitmap (const wxBitmapBundle &bitmap)=0
 Set the bitmap to be displayed in the column header. More...
 
virtual void SetWidth (int width)=0
 Set the column width. More...
 
virtual void SetMinWidth (int minWidth)=0
 Set the minimal column width. More...
 
virtual void SetAlignment (wxAlignment align)=0
 Set the alignment of the column header. More...
 
virtual void SetFlags (int flags)=0
 Set the column flags. More...
 
void ChangeFlag (int flag, bool set)
 Set or clear the given flag. More...
 
void SetFlag (int flag)
 Set the specified flag for the column. More...
 
void ClearFlag (int flag)
 Clear the specified flag for the column. More...
 
void ToggleFlag (int flag)
 Toggle the specified flag for the column. More...
 
virtual void SetResizeable (bool resizable)
 Call this to enable or disable interactive resizing of the column by the user. More...
 
virtual void SetSortable (bool sortable)
 Allow clicking the column to sort the control contents by the field in this column. More...
 
virtual void SetReorderable (bool reorderable)
 Allow changing the column order by dragging it. More...
 
virtual void SetHidden (bool hidden)
 Hide or show the column. More...
 
void UnsetAsSortKey ()
 Don't use this column for sorting. More...
 
virtual void SetSortOrder (bool ascending)=0
 Sets this column as the sort key for the associated control. More...
 
void ToggleSortOrder ()
 Inverses the sort order. More...
 
- Public Member Functions inherited from wxHeaderColumn
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

◆ ChangeFlag()

void wxSettableHeaderColumn::ChangeFlag ( int  flag,
bool  set 
)

Set or clear the given flag.

Parameters
flagThe flag to set or clear.
setIf true, set the flag, i.e. equivalent to calling SetFlag(), otherwise clear it, as ClearFlag().
See also
SetFlags()

◆ ClearFlag()

void wxSettableHeaderColumn::ClearFlag ( int  flag)

Clear the specified flag for the column.

See also
SetFlags()

◆ SetAlignment()

virtual void wxSettableHeaderColumn::SetAlignment ( wxAlignment  align)
pure 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).

Implemented in wxHeaderColumnSimple.

◆ SetBitmap()

virtual void wxSettableHeaderColumn::SetBitmap ( const wxBitmapBundle bitmap)
pure 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.

Implemented in wxHeaderColumnSimple.

◆ SetFlag()

void wxSettableHeaderColumn::SetFlag ( int  flag)

Set the specified flag for the column.

See also
SetFlags()

◆ SetFlags()

virtual void wxSettableHeaderColumn::SetFlags ( int  flags)
pure 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.

Implemented in wxHeaderColumnSimple.

◆ SetHidden()

virtual void wxSettableHeaderColumn::SetHidden ( bool  hidden)
virtual

Hide or show the column.

By default all columns are shown but some of them can be completely hidden from view by calling this function.

Equivalent to ChangeFlag(wxCOL_HIDDEN, hidden).

◆ SetMinWidth()

virtual void wxSettableHeaderColumn::SetMinWidth ( int  minWidth)
pure 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.

Implemented in wxHeaderColumnSimple.

◆ SetReorderable()

virtual void wxSettableHeaderColumn::SetReorderable ( bool  reorderable)
virtual

Allow changing the column order by dragging it.

Equivalent to ChangeFlag(wxCOL_REORDERABLE, reorderable).

◆ SetResizeable()

virtual void wxSettableHeaderColumn::SetResizeable ( bool  resizable)
virtual

Call this to enable or disable interactive resizing of the column by the user.

By default, the columns are resizable.

Equivalent to ChangeFlag(wxCOL_RESIZABLE, resizable).

◆ SetSortable()

virtual void wxSettableHeaderColumn::SetSortable ( bool  sortable)
virtual

Allow clicking the column to sort the control contents by the field in this column.

By default, the columns are not sortable so you need to explicitly call this function to allow sorting by the field corresponding to this column.

Equivalent to ChangeFlag(wxCOL_SORTABLE, sortable).

◆ SetSortOrder()

virtual void wxSettableHeaderColumn::SetSortOrder ( bool  ascending)
pure 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.

Implemented in wxHeaderColumnSimple.

◆ SetTitle()

virtual void wxSettableHeaderColumn::SetTitle ( const wxString title)
pure virtual

Set the text to display in the column header.

Implemented in wxHeaderColumnSimple.

◆ SetWidth()

virtual void wxSettableHeaderColumn::SetWidth ( int  width)
pure 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.

Implemented in wxHeaderColumnSimple.

◆ ToggleFlag()

void wxSettableHeaderColumn::ToggleFlag ( int  flag)

Toggle the specified flag for the column.

If the flag is currently set, equivalent to ClearFlag(), otherwise – to SetFlag().

See also
SetFlags()

◆ ToggleSortOrder()

void wxSettableHeaderColumn::ToggleSortOrder ( )

Inverses the sort order.

This function is typically called when the user clicks on a column used for sorting to change sort order from ascending to descending or vice versa.

See also
SetSortOrder(), IsSortOrderAscending()

◆ UnsetAsSortKey()

void wxSettableHeaderColumn::UnsetAsSortKey ( )

Don't use this column for sorting.

This is the reverse of SetSortOrder() and is called to indicate that this column is not used for sorting any longer.