.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. _wx.HeaderColumn: ========================================================================================================================================== |phoenix_title| **wx.HeaderColumn** ========================================================================================================================================== Represents a column header in controls displaying tabular data such as :ref:`wx.dataview.DataViewCtrl` or :ref:`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 :ref:`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 :ref:`wx.grid.Grid` for example). If you do want to allow changing them directly using the column itself, you should inherit from :ref:`wx.SettableHeaderColumn` instead of this class. Finally, if you don't already store the column information at all anywhere, you should use the concrete :ref:`wx.HeaderColumnSimple` class and :ref:`wx.HeaderCtrlSimple`. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class HeaderColumn:
| |sub_classes| Known Subclasses ============================== :ref:`wx.SettableHeaderColumn` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.HeaderColumn.GetAlignment` Returns the current column alignment. :meth:`~wx.HeaderColumn.GetBitmap` This function exists only for backwards compatibility, it's recommended to override :meth:`~HeaderColumn.GetBitmapBundle` in the new code and override this one to do nothing, as it will never be called if :meth:`~HeaderColumn.GetBitmapBundle` is overridden. :meth:`~wx.HeaderColumn.GetBitmapBundle` Returns the bitmap in the header of the column, if any. :meth:`~wx.HeaderColumn.GetFlags` Get the column flags. :meth:`~wx.HeaderColumn.GetMinWidth` Return the minimal column width. :meth:`~wx.HeaderColumn.GetTitle` Get the text shown in the column header. :meth:`~wx.HeaderColumn.GetWidth` Returns the current width of the column. :meth:`~wx.HeaderColumn.HasFlag` Return ``True`` if the specified flag is currently set for this column. :meth:`~wx.HeaderColumn.IsHidden` Returns ``True`` if the column is currently hidden. :meth:`~wx.HeaderColumn.IsReorderable` Returns ``True`` if the column can be dragged by user to change its order. :meth:`~wx.HeaderColumn.IsResizeable` Return ``True`` if the column can be resized by the user. :meth:`~wx.HeaderColumn.IsShown` Returns ``True`` if the column is currently shown. :meth:`~wx.HeaderColumn.IsSortKey` Returns ``True`` if the column is currently used for sorting. :meth:`~wx.HeaderColumn.IsSortOrderAscending` Returns ``True``, if the sort order is ascending. :meth:`~wx.HeaderColumn.IsSortable` Returns ``True`` if the column can be clicked by user to sort the control contents by the field in this column. ================================================================================ ================================================================================ | |property_summary| Properties Summary ===================================== ================================================================================ ================================================================================ :attr:`~wx.HeaderColumn.Alignment` See :meth:`~wx.HeaderColumn.GetAlignment` :attr:`~wx.HeaderColumn.Bitmap` See :meth:`~wx.HeaderColumn.GetBitmap` :attr:`~wx.HeaderColumn.BitmapBundle` See :meth:`~wx.HeaderColumn.GetBitmapBundle` :attr:`~wx.HeaderColumn.Flags` See :meth:`~wx.HeaderColumn.GetFlags` :attr:`~wx.HeaderColumn.Hidden` See :meth:`~wx.HeaderColumn.IsHidden` :attr:`~wx.HeaderColumn.MinWidth` See :meth:`~wx.HeaderColumn.GetMinWidth` :attr:`~wx.HeaderColumn.Reorderable` See :meth:`~wx.HeaderColumn.IsReorderable` :attr:`~wx.HeaderColumn.Resizeable` See :meth:`~wx.HeaderColumn.IsResizeable` :attr:`~wx.HeaderColumn.Shown` See :meth:`~wx.HeaderColumn.IsShown` :attr:`~wx.HeaderColumn.SortKey` See :meth:`~wx.HeaderColumn.IsSortKey` :attr:`~wx.HeaderColumn.SortOrderAscending` See :meth:`~wx.HeaderColumn.IsSortOrderAscending` :attr:`~wx.HeaderColumn.Sortable` See :meth:`~wx.HeaderColumn.IsSortable` :attr:`~wx.HeaderColumn.Title` See :meth:`~wx.HeaderColumn.GetTitle` :attr:`~wx.HeaderColumn.Width` See :meth:`~wx.HeaderColumn.GetWidth` ================================================================================ ================================================================================ | |api| Class API =============== .. class:: wx.HeaderColumn(object) Represents a column header in controls displaying tabular data such as DataViewCtrl or Grid. .. method:: GetAlignment(self) Returns the current column alignment. :rtype: :ref:`wx.Alignment` :returns: One of ``wx.ALIGN_CENTRE``, ``wx.ALIGN_LEFT`` or ``wx.ALIGN_RIGHT``. .. method:: GetBitmap(self) This function exists only for backwards compatibility, it's recommended to override :meth:`GetBitmapBundle` in the new code and override this one to do nothing, as it will never be called if :meth:`GetBitmapBundle` is overridden. :rtype: :ref:`wx.Bitmap` .. method:: GetBitmapBundle(self) Returns the bitmap in the header of the column, if any. If the column has no associated bitmap, empty :ref:`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 :meth:`GetBitmap` but should be overridden if the bitmaps are used. :rtype: :ref:`wx.BitmapBundle` .. versionadded:: 4.1/wxWidgets-3.1.6 .. method:: GetFlags(self) Get the column flags. This method retrieves all the flags at once, you can also use :meth:`HasFlag` to test for any individual flag or :meth:`IsResizeable` , :meth:`IsSortable` , :meth:`IsReorderable` and :meth:`IsHidden` to test for particular flags. :rtype: `int` .. method:: GetMinWidth(self) Return the minimal column width. :rtype: `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. .. method:: GetTitle(self) Get the text shown in the column header. :rtype: `string` .. method:: GetWidth(self) Returns the current width of the column. :rtype: `int` :returns: Width of the column in pixels, never ``wx.COL_WIDTH_DEFAULT`` or ``wx.COL_WIDTH_AUTOSIZE``. .. method:: HasFlag(self, flag) Return ``True`` if the specified flag is currently set for this column. :param `flag`: :type `flag`: int :rtype: `bool` .. method:: IsHidden(self) Returns ``True`` if the column is currently hidden. This corresponds to ``wx.COL_HIDDEN`` flag which is off by default. :rtype: `bool` .. method:: 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. :rtype: `bool` .. method:: IsResizeable(self) Return ``True`` if the column can be resized by the user. Equivalent to HasFlag(wxCOL_RESIZABLE). :rtype: `bool` .. method:: IsShown(self) Returns ``True`` if the column is currently shown. This corresponds to the absence of ``wx.COL_HIDDEN`` flag. :rtype: `bool` .. method:: IsSortKey(self) Returns ``True`` if the column is currently used for sorting. :rtype: `bool` .. method:: 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 :meth:`IsSortKey` returns ``True``. :rtype: `bool` .. method:: 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. :rtype: `bool` .. attribute:: Alignment See :meth:`~wx.HeaderColumn.GetAlignment` .. attribute:: Bitmap See :meth:`~wx.HeaderColumn.GetBitmap` .. attribute:: BitmapBundle See :meth:`~wx.HeaderColumn.GetBitmapBundle` .. attribute:: Flags See :meth:`~wx.HeaderColumn.GetFlags` .. attribute:: Hidden See :meth:`~wx.HeaderColumn.IsHidden` .. attribute:: MinWidth See :meth:`~wx.HeaderColumn.GetMinWidth` .. attribute:: Reorderable See :meth:`~wx.HeaderColumn.IsReorderable` .. attribute:: Resizeable See :meth:`~wx.HeaderColumn.IsResizeable` .. attribute:: Shown See :meth:`~wx.HeaderColumn.IsShown` .. attribute:: SortKey See :meth:`~wx.HeaderColumn.IsSortKey` .. attribute:: SortOrderAscending See :meth:`~wx.HeaderColumn.IsSortOrderAscending` .. attribute:: Sortable See :meth:`~wx.HeaderColumn.IsSortable` .. attribute:: Title See :meth:`~wx.HeaderColumn.GetTitle` .. attribute:: Width See :meth:`~wx.HeaderColumn.GetWidth`