wx.HeaderColumn¶
Represents a column header in controls displaying tabular data such as wx.dataview.DataViewCtrl or wx.grid.Grid.
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 wx.HeaderCtrl. 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 wx.grid.Grid for example). If you do want to allow changing them directly using the column itself, you should inherit from wx.SettableHeaderColumn instead of this class.
Finally, if you don’t already store the column information at all anywhere, you should use the concrete wx.HeaderColumnSimple class and wx.HeaderCtrlSimple.
Class Hierarchy¶
Known Subclasses¶
Methods Summary¶
Returns the current column alignment. |
|
This function exists only for backwards compatibility, it’s recommended to override |
|
Returns the bitmap in the header of the column, if any. |
|
Get the column flags. |
|
Return the minimal column width. |
|
Get the text shown in the column header. |
|
Returns the current width of the column. |
|
Return |
|
Returns |
|
Returns |
|
Return |
|
Returns |
|
Returns |
|
Returns |
|
Returns |
Properties Summary¶
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
|
See |
Class API¶
- class wx.HeaderColumn(object)¶
Represents a column header in controls displaying tabular data such as DataViewCtrl or Grid.
Methods¶
- GetAlignment(self)¶
Returns the current column alignment.
- Return type:
- Returns:
One of
wx.ALIGN_CENTRE
,wx.ALIGN_LEFT
orwx.ALIGN_RIGHT
.
- GetBitmap(self)¶
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 ifGetBitmapBundle
is overridden.- Return type:
- GetBitmapBundle(self)¶
Returns the bitmap in the header of the column, if any.
If the column has no associated bitmap, empty wx.BitmapBundle 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.- Return type:
Added in version 4.1/wxWidgets-3.1.6.
- GetFlags(self)¶
Get the column flags.
This method retrieves all the flags at once, you can also use
HasFlag
to test for any individual flag orIsResizeable
,IsSortable
,IsReorderable
andIsHidden
to test for particular flags.- Return type:
int
- GetMinWidth(self)¶
Return the minimal column width.
- Return type:
int
- 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.
- GetTitle(self)¶
Get the text shown in the column header.
- Return type:
str
- GetWidth(self)¶
Returns the current width of the column.
- Return type:
int
- Returns:
Width of the column in pixels, never
wx.COL_WIDTH_DEFAULT
orwx.COL_WIDTH_AUTOSIZE
.
- HasFlag(self, flag)¶
Return
True
if the specified flag is currently set for this column.- Parameters:
flag (int)
- Return type:
bool
- IsHidden(self)¶
Returns
True
if the column is currently hidden.This corresponds to
wx.COL_HIDDEN
flag which is off by default.- Return type:
bool
- IsReorderable(self)¶
Returns
True
if the column can be dragged by user to change its order.This corresponds to
wx.COL_REORDERABLE
flag which is on by default.- Return type:
bool
- IsResizeable(self)¶
Return
True
if the column can be resized by the user.Equivalent to HasFlag(wxCOL_RESIZABLE).
- Return type:
bool
- IsShown(self)¶
Returns
True
if the column is currently shown.This corresponds to the absence of
wx.COL_HIDDEN
flag.- Return type:
bool
- IsSortKey(self)¶
Returns
True
if the column is currently used for sorting.- Return type:
bool
- IsSortOrderAscending(self)¶
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
returnsTrue
.- Return type:
bool
- IsSortable(self)¶
Returns
True
if the column can be clicked by user to sort the control contents by the field in this column.This corresponds to
wx.COL_SORTABLE
flag which is off by default.- Return type:
bool
Properties¶
- Alignment¶
See
GetAlignment
- BitmapBundle¶
See
GetBitmapBundle
- MinWidth¶
See
GetMinWidth
- Reorderable¶
See
IsReorderable
- Resizeable¶
See
IsResizeable
- SortOrderAscending¶
- Sortable¶
See
IsSortable