.. 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 .. currentmodule:: wx.lib.agw.hypertreelist .. highlight:: python .. _wx.lib.agw.hypertreelist.TreeListMainWindow: ========================================================================================================================================== |phoenix_title| **wx.lib.agw.hypertreelist.TreeListMainWindow** ========================================================================================================================================== This class represents the main window (and thus the main column) in :class:`HyperTreeList`. .. note:: This is a subclass of :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl`. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class TreeListMainWindow:
| |super_classes| Known Superclasses ================================== :class:`wx.lib.agw.customtreectrl.CustomTreeCtrl` | |method_summary| Methods Summary ================================ ================================================================================ ================================================================================ :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.__init__` Default class constructor. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.AddRoot` Adds a root item to the :class:`TreeListMainWindow`. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.AdjustMyScrollbars` Internal method used to adjust the :class:`ScrolledWindow` scrollbars. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.CalculateLevel` Calculates the level of an item inside the tree hierarchy. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.CalculatePositions` Recalculates all the items positions. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.CalculateSize` Calculates overall position and size of an item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.ChildrenClosing` We are about to destroy the item's children. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.Delete` Deletes an item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.DeleteAllItems` Delete all items in the :class:`TreeListMainWindow`. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.DeleteItemWindow` Deletes the window in the column associated to an item (if any). :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.DeleteRoot` Removes the tree root item (and subsequently all the items in :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.DoInsertItem` Actually inserts an item in the tree. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.EditLabel` Starts editing an item label. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.EnableItem` Enables/disables an item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetBestColumnWidth` Returns the best column's width based on the items width in this column. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetColumnCount` Returns the total number of columns. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetCurrentItem` Returns the current item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetFirstExpandedItem` Returns the first item which is in the expanded state. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetFirstVisibleItem` Returns the first visible item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetItemBackgroundColour` Returns the column background colour of the item :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetItemImage` Returns the item image. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetItemText` Returns the item text label. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetItemWidth` Returns the item width. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetItemWindow` Returns the window associated with an item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetItemWindowEnabled` Returns whether the window associated with an item is enabled or not. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetMainColumn` Returns the :class:`HyperTreeList` main column (i.e. the position of the underlying :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetNextExpanded` Returns the next expanded item after the input one. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetPrevChild` Returns the previous child of an item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetPrevExpanded` Returns the previous expanded item before the input one. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.GetPrevVisible` Returns the previous visible item before the input one. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.HideItemWindows` Hides all windows belonging to given item and its children. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.HideWindows` Scans all item windows in the tree and hides those whose items :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.HitTest` Calculates which (if any) item is under the given point, returning the tree item :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.IsItemEnabled` Returns whether an item is enabled or disabled. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.IsItemVisible` Returns whether the item is visible or not. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.IsVirtual` Returns ``True`` if :class:`TreeListMainWindow` has the ``TR_VIRTUAL`` flag set. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.OnAcceptEdit` Called by :class:`EditTextCtrl`, to accept the changes and to send the :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.OnCancelEdit` Called by :class:`EditCtrl`, to cancel the changes and to send the :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.OnEditTimer` The timer for editing has expired. Start editing. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.OnEraseBackground` Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`TreeListMainWindow`. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.OnMouse` Handles the ``wx.EVT_MOUSE_EVENTS`` event for :class:`TreeListMainWindow`. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.OnPaint` Handles the ``wx.EVT_PAINT`` event for :class:`TreeListMainWindow`. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.OnScroll` Handles the ``wx.EVT_SCROLLWIN`` event for :class:`TreeListMainWindow`. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.PaintItem` Actually draws an item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.PaintLevel` Paint a level in the hierarchy of :class:`TreeListMainWindow`. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.ScrollTo` Scrolls the specified item into view. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.SetBuffered` Sets/unsets the double buffering for the main window. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.SetDragItem` Sets the specified item as member of a current drag and drop operation. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.SetItemBackgroundColour` Sets the column background colour of the item :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.SetItemImage` Sets the item image for a particular item state. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.SetItemText` Sets the item text label. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.SetItemWindow` Sets the window associated to an item. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.SetItemWindowEnabled` Sets whether the window associated with an item is enabled or not. :meth:`~wx.lib.agw.hypertreelist.TreeListMainWindow.SetMainColumn` Sets the :class:`HyperTreeList` main column (i.e. the position of the underlying ================================================================================ ================================================================================ | |api| Class API =============== .. class:: TreeListMainWindow(CustomTreeCtrl) This class represents the main window (and thus the main column) in :class:`HyperTreeList`. .. note:: This is a subclass of :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl`. .. method:: __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0, agwStyle=wx.TR_DEFAULT_STYLE, validator=wx.DefaultValidator, name="wxtreelistmainwindow") Default class constructor. :param `parent`: parent window. Must not be ``None``; :param `id`: window identifier. A value of -1 indicates a default value; :param `pos`: the control position. A value of (-1, -1) indicates a default position, chosen by either the windowing system or wxPython, depending on platform; :param `size`: the control size. A value of (-1, -1) indicates a default size, chosen by either the windowing system or wxPython, depending on platform; :param `style`: the underlying :class:`ScrolledWindow` style; :param `agwStyle`: can be a combination of various bits. See :mod:`~wx.lib.agw.hypertreelist` for a full list of flags. :param `validator`: window validator; :param `name`: window name. .. method:: AddRoot(self, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None) Adds a root item to the :class:`TreeListMainWindow`. :param `text`: the item text label; :param `ct_type`: the item type (see :meth:`CustomTreeCtrl.SetItemType() ` for a list of valid item types); :param `wnd`: if not ``None``, a non-toplevel window to show next to the item; :param `image`: an index within the normal image list specifying the image to use for the item in unselected state; :param `selImage`: an index within the normal image list specifying the image to use for the item in selected state; if `image` > -1 and `selImage` is -1, the same image is used for both selected and unselected items; :param `data`: associate the given Python object `data` with the item. .. warning:: Only one root is allowed to exist in any given instance of :class:`TreeListMainWindow`. .. method:: AdjustMyScrollbars(self) Internal method used to adjust the :class:`ScrolledWindow` scrollbars. .. method:: CalculateLevel(self, item, dc, level, y, x_colstart) Calculates the level of an item inside the tree hierarchy. :param `item`: an instance of :class:`TreeListItem`; :param `dc`: an instance of :class:`wx.DC`; :param `level`: the item level in the tree hierarchy; :param `y`: the current vertical position inside the :class:`ScrolledWindow`; :param `x_colstart`: the x coordinate at which the item's column starts. .. method:: CalculatePositions(self) Recalculates all the items positions. .. method:: CalculateSize(self, item, dc) Calculates overall position and size of an item. :param `item`: an instance of :class:`TreeListItem`; :param `dc`: an instance of :class:`wx.DC`. .. method:: ChildrenClosing(self, item) We are about to destroy the item's children. :param `item`: an instance of :class:`TreeListItem`. .. method:: Delete(self, item) Deletes an item. :param `item`: an instance of :class:`TreeListItem`. .. method:: DeleteAllItems(self) Delete all items in the :class:`TreeListMainWindow`. .. method:: DeleteItemWindow(self, item, column=None) Deletes the window in the column associated to an item (if any). :param `item`: an instance of :class:`GenericTreeItem`. :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used. .. method:: DeleteRoot(self) Removes the tree root item (and subsequently all the items in :class:`TreeListMainWindow`. .. method:: DoInsertItem(self, parent, previous, text, ct_type=0, wnd=None, image=-1, selImage=-1, data=None, \*ignored_args) Actually inserts an item in the tree. :param `parentId`: an instance of :class:`TreeListItem` representing the item's parent; :param `previous`: the index at which we should insert the item; :param `text`: the item text label; :param `ct_type`: the item type (see :meth:`CustomTreeCtrl.SetItemType() ` for a list of valid item types); :param `wnd`: if not ``None``, a non-toplevel window to show next to the item; :param `image`: an index within the normal image list specifying the image to use for the item in unselected state; :param `selImage`: an index within the normal image list specifying the image to use for the item in selected state; if `image` > -1 and `selImage` is -1, the same image is used for both selected and unselected items; :param `data`: associate the given Python object `data` with the item. :param `ignored_args`: unused at the moment, this parameter is present to comply with :meth:`CustomTreeCtrl.DoInsertItem() ` changed API. .. method:: EditLabel(self, item, column=None) Starts editing an item label. :param `item`: an instance of :class:`TreeListItem`; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used. .. method:: EnableItem(self, item, enable=True, torefresh=True) Enables/disables an item. :param `item`: an instance of :class:`TreeListItem`; :param `enable`: ``True`` to enable the item, ``False`` otherwise; :param `torefresh`: whether to redraw the item or not. .. method:: GetBestColumnWidth(self, column, parent=None) Returns the best column's width based on the items width in this column. :param `column`: an integer specifying the column index; :param `parent`: an instance of :class:`TreeListItem`. .. method:: GetColumnCount(self) Returns the total number of columns. .. method:: GetCurrentItem(self) Returns the current item. This is the same as :meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.GetSelection`. .. method:: GetFirstExpandedItem(self) Returns the first item which is in the expanded state. .. method:: GetFirstVisibleItem(self) Returns the first visible item. .. method:: GetItemBackgroundColour(self, item, column=0) Returns the column background colour of the item :param `item`: an instance of :class:`TreeListItem` :param integer `column` .. method:: GetItemImage(self, item, column=None, which=wx.TreeItemIcon_Normal) Returns the item image. :param `item`: an instance of :class:`TreeListItem`; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used; :param `which`: can be one of the following bits: ================================= ======================== Item State Description ================================= ======================== ``TreeItemIcon_Normal`` To get the normal item image ``TreeItemIcon_Selected`` To get the selected item image (i.e. the image which is shown when the item is currently selected) ``TreeItemIcon_Expanded`` To get the expanded image (this only makes sense for items which have children - then this image is shown when the item is expanded and the normal image is shown when it is collapsed) ``TreeItemIcon_SelectedExpanded`` To get the selected expanded image (which is shown when an expanded item is currently selected) ================================= ======================== .. method:: GetItemText(self, item, column=None) Returns the item text label. :param `item`: an instance of :class:`TreeListItem`; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used. .. method:: GetItemWidth(self, item, column) Returns the item width. :param `item`: an instance of :class:`TreeListItem`; :param `column`: an integer specifying the column index. .. method:: GetItemWindow(self, item, column=None) Returns the window associated with an item. :param `item`: an instance of :class:`TreeListItem`; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used. .. method:: GetItemWindowEnabled(self, item, column=None) Returns whether the window associated with an item is enabled or not. :param `item`: an instance of :class:`TreeListItem`; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used. .. method:: GetMainColumn(self) Returns the :class:`HyperTreeList` main column (i.e. the position of the underlying :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl`. .. method:: GetNextExpanded(self, item) Returns the next expanded item after the input one. :param `item`: an instance of :class:`TreeListItem`. .. method:: GetPrevChild(self, item, cookie) Returns the previous child of an item. :param `item`: an instance of :class:`TreeListItem`; :param `cookie`: a parameter which is opaque for the application but is necessary for the library to make these functions reentrant (i.e. allow more than one enumeration on one and the same object simultaneously). .. note:: This method returns ``None`` if there are no further siblings. .. method:: GetPrevExpanded(self, item) Returns the previous expanded item before the input one. :param `item`: an instance of :class:`TreeListItem`. .. method:: GetPrevVisible(self, item) Returns the previous visible item before the input one. :param `item`: an instance of :class:`TreeListItem`. .. method:: HideItemWindows(self, item) Hides all windows belonging to given item and its children. .. method:: HideWindows(self) Scans all item windows in the tree and hides those whose items they belong to are not currently visible. Used internally. .. method:: HitTest(self, point, flags=0) Calculates which (if any) item is under the given point, returning the tree item at this point plus extra information flags plus the item's column. :param `point`: an instance of :class:`wx.Point`, a point to test for hits; :param `flags`: a bitlist of the following values: ================================== =============== ================================= HitTest Flags Hex Value Description ================================== =============== ================================= ``TREE_HITTEST_ABOVE`` 0x1 Above the client area ``TREE_HITTEST_BELOW`` 0x2 Below the client area ``TREE_HITTEST_NOWHERE`` 0x4 No item has been hit ``TREE_HITTEST_ONITEMBUTTON`` 0x8 On the button associated to an item ``TREE_HITTEST_ONITEMICON`` 0x10 On the icon associated to an item ``TREE_HITTEST_ONITEMINDENT`` 0x20 On the indent associated to an item ``TREE_HITTEST_ONITEMLABEL`` 0x40 On the label (string) associated to an item ``TREE_HITTEST_ONITEM`` 0x50 Anywhere on the item ``TREE_HITTEST_ONITEMRIGHT`` 0x80 On the right of the label associated to an item ``TREE_HITTEST_TOLEFT`` 0x200 On the left of the client area ``TREE_HITTEST_TORIGHT`` 0x400 On the right of the client area ``TREE_HITTEST_ONITEMUPPERPART`` 0x800 On the upper part (first half) of the item ``TREE_HITTEST_ONITEMLOWERPART`` 0x1000 On the lower part (second half) of the item ``TREE_HITTEST_ONITEMCHECKICON`` 0x2000 On the check/radio icon, if present ================================== =============== ================================= :return: the item (if any, ``None`` otherwise), the `flags` and the column are always returned as a tuple. .. method:: IsItemEnabled(self, item) Returns whether an item is enabled or disabled. :param `item`: an instance of :class:`TreeListItem`. .. method:: IsItemVisible(self, item) Returns whether the item is visible or not. :param `item`: an instance of :class:`TreeListItem`; .. note:: This method is renamed from :meth:`~wx.lib.agw.customtreectrl.CustomTreeCtrl.IsVisible` .. method:: IsVirtual(self) Returns ``True`` if :class:`TreeListMainWindow` has the ``TR_VIRTUAL`` flag set. .. method:: OnAcceptEdit(self, value) Called by :class:`EditTextCtrl`, to accept the changes and to send the ``EVT_TREE_END_LABEL_EDIT`` event. :param `value`: the new value of the item label. .. method:: OnCancelEdit(self) Called by :class:`EditCtrl`, to cancel the changes and to send the ``EVT_TREE_END_LABEL_EDIT`` event. .. method:: OnEditTimer(self) The timer for editing has expired. Start editing. .. method:: OnEraseBackground(self, event) Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`TreeListMainWindow`. :param `event`: a :class:`EraseEvent` event to be processed. .. method:: OnMouse(self, event) Handles the ``wx.EVT_MOUSE_EVENTS`` event for :class:`TreeListMainWindow`. :param `event`: a :class:`MouseEvent` event to be processed. .. method:: OnPaint(self, event) Handles the ``wx.EVT_PAINT`` event for :class:`TreeListMainWindow`. :param `event`: a :class:`PaintEvent` event to be processed. .. method:: OnScroll(self, event) Handles the ``wx.EVT_SCROLLWIN`` event for :class:`TreeListMainWindow`. :param `event`: a :class:`ScrollEvent` event to be processed. .. method:: PaintItem(self, item, dc) Actually draws an item. :param `item`: an instance of :class:`TreeListItem`; :param `dc`: an instance of :class:`wx.DC`. .. method:: PaintLevel(self, item, dc, level, y, x_maincol) Paint a level in the hierarchy of :class:`TreeListMainWindow`. :param `item`: an instance of :class:`TreeListItem`; :param `dc`: an instance of :class:`wx.DC`; :param `level`: the item level in the tree hierarchy; :param `y`: the current vertical position in the :class:`ScrolledWindow`; :param `x_maincol`: the horizontal position of the main column. .. method:: ScrollTo(self, item) Scrolls the specified item into view. :param `item`: an instance of :class:`TreeListItem`. .. method:: SetBuffered(self, buffered) Sets/unsets the double buffering for the main window. :param `buffered`: ``True`` to use double-buffering, ``False`` otherwise. .. note:: Currently we are using double-buffering only on Windows XP. .. method:: SetDragItem(self, item) Sets the specified item as member of a current drag and drop operation. :param `item`: an instance of :class:`TreeListItem`. .. method:: SetItemBackgroundColour(self, item, colour, column=0) Sets the column background colour of the item :param `item`: an instance of :class:`TreeListItem` :param `colour`: a valid :class:`wx.Colour` instance. :param integer `column` .. method:: SetItemImage(self, item, image, column=None, which=wx.TreeItemIcon_Normal) Sets the item image for a particular item state. :param `item`: an instance of :class:`TreeListItem`; :param `image`: an index within the normal image list specifying the image to use; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used; :param `which`: the item state. .. seealso:: :meth:`~TreeListMainWindow.GetItemImage` for a list of valid item states. .. method:: SetItemText(self, item, text, column=None) Sets the item text label. :param `item`: an instance of :class:`TreeListItem`; :param `text`: a string specifying the new item label; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used. .. method:: SetItemWindow(self, item, window, column=None) Sets the window associated to an item. :param `item`: an instance of :class:`TreeListItem`; :param `wnd`: a non-toplevel window to be displayed next to the item; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used. .. note:: The window being added should have its parent set to the :class:`TreeListMainWindow` which can be obtained with :meth:`~HyperTreeList.GetHeaderWindow`. If this is not the case the window will be re-parented which may cause some flicker. .. method:: SetItemWindowEnabled(self, item, enable=True, column=None) Sets whether the window associated with an item is enabled or not. :param `item`: an instance of :class:`TreeListItem`; :param `enable`: ``True`` to enable the associated window, ``False`` to disable it; :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used. .. method:: SetMainColumn(self, column) Sets the :class:`HyperTreeList` main column (i.e. the position of the underlying :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl`. :param `column`: if not ``None``, an integer specifying the column index. If it is ``None``, the main column index is used.