.. 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.TreeListItem:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.hypertreelist.TreeListItem**
==========================================================================================================================================

This class holds all the information and methods for every single item in
:class:`HyperTreeList`.

:note: Subclassed from :class:`~wx.lib.agw.customtreectrl.GenericTreeItem`.



|

|class_hierarchy| Class Hierarchy
=================================

.. raw:: html

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>TreeListItem</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.agw.hypertreelist.TreeListItem_inheritance.png" alt="Inheritance diagram of TreeListItem" usemap="#dummy" class="inheritance"/></center>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.hypertreelist.TreeListItem.html" title="wx.lib.agw.hypertreelist.TreeListItem" alt="" coords="25,83,287,112"/> <area shape="rect" id="node2" href="wx.lib.agw.customtreectrl.GenericTreeItem.html" title="wx.lib.agw.customtreectrl.GenericTreeItem" alt="" coords="5,5,307,35"/> </map> 
   </p>
   </div>

|


|super_classes| Known Superclasses
==================================

:class:`wx.lib.agw.customtreectrl.GenericTreeItem`

|


|method_summary| Methods Summary
================================

================================================================================ ================================================================================
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.__init__`                          Default class constructor.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.DeleteChildren`                    Deletes the item children.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.DeleteWindow`                      Deletes the window associated to the item (if any).
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.GetBackgroundColour`               Returns the associated background colour
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.GetCurrentImage`                   Returns the current item image.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.GetImage`                          Returns the item image for a particular item state.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.GetText`                           Returns the item text label.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.GetTextX`                          Returns the `x` position of the item text.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.GetWindow`                         Returns the window associated to the item.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.GetWindowEnabled`                  Returns whether the window associated with an item is enabled or not.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.GetWindowSize`                     Returns the associated window size.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.Hide`                              Hides/shows the :class:`TreeListItem`.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.HitTest`                           HitTest method for an item. Called from the main window HitTest.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.IsEnabled`                         Returns whether the item is enabled or not.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.IsExpanded`                        Returns whether the item is expanded or not.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.IsHidden`                          Returns whether the item is hidden or not.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.OnSetFocus`                        Handles the ``wx.EVT_SET_FOCUS`` event for a window associated to an item.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.SetBackgroundColour`               Sets the associated background colour
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.SetImage`                          Sets the item image for a particular item state.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.SetText`                           Sets the item text label.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.SetTextX`                          Sets the `x` position of the item text. Used internally to position
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.SetWindow`                         Sets the window associated to the item. Internal use only.
:meth:`~wx.lib.agw.hypertreelist.TreeListItem.SetWindowEnabled`                  Sets whether the window associated with an item is enabled or not.
================================================================================ ================================================================================


|


|api| Class API
===============


.. class:: TreeListItem(GenericTreeItem)

   This class holds all the information and methods for every single item in
   :class:`HyperTreeList`.
   
   :note: Subclassed from :class:`~wx.lib.agw.customtreectrl.GenericTreeItem`.

   .. method:: __init__(self, mainWin, parent, text="", ct_type=0, wnd=None, image=-1, selImage=-1, data=None)

      Default class constructor.
      For internal use: do not call it in your code!
      
      :param `mainWin`: the main :class:`HyperTreeList` window, in this case an instance
       of :class:`TreeListMainWindow`;
      :param `parent`: the tree item parent (may be ``None`` for root items);
      :param `text`: the tree item text;
      :param `ct_type`: the tree item kind. May be one of the following integers:
      
       =============== ==========================
       `ct_type` Value Description
       =============== ==========================
              0        A normal item
              1        A checkbox-like item
              2        A radiobutton-type item
       =============== ==========================
      
      :param `wnd`: if not ``None``, a non-toplevel window to be displayed 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.
      
      :note: Regarding radiobutton-type items (with `ct_type` = 2), the following
       approach is used:
      
       - All peer-nodes that are radiobuttons will be mutually exclusive. In other words,
         only one of a set of radiobuttons that share a common parent can be checked at
         once. If a radiobutton node becomes checked, then all of its peer radiobuttons
         must be unchecked.
       - If a radiobutton node becomes unchecked, then all of its child nodes will become
         inactive.


   .. method:: DeleteChildren(self, tree)

      Deletes the item children.
      
      :param `tree`: the main :class:`TreeListMainWindow` instance.


   .. method:: DeleteWindow(self, column=None)

      Deletes the window associated to the item (if any).
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used.


   .. method:: GetBackgroundColour(self, column=0)

      Returns the associated background colour
      
      :param `column` an integer specifying the column index.


   .. method:: GetCurrentImage(self, column=None)

      Returns the current item image.
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used.


   .. method:: GetImage(self, which=wx.TreeItemIcon_Normal, column=None)

      Returns the item image for a particular item state.
      
      :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)
       ================================= ========================
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used.


   .. method:: GetText(self, column=None)

      Returns the item text label.
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used.


   .. method:: GetTextX(self)

      Returns the `x` position of the item text. 


   .. method:: GetWindow(self, column=None)

      Returns the window associated to the item.
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used.


   .. method:: GetWindowEnabled(self, column=None)

      Returns whether the window associated with an item is enabled or not.
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used.


   .. method:: GetWindowSize(self, column=None)

      Returns the associated window size.
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used.


   .. method:: Hide(self, hide)

      Hides/shows the :class:`TreeListItem`.
      
      :param `hide`: ``True`` to hide the item, ``False`` to show it.
      :note: Always use :meth:`~HyperTreeList.HideItem` instead to update the tree properly.


   .. method:: HitTest(self, point, theCtrl, flags, column, level)

      HitTest method for an item. Called from the main window HitTest.
      
      :param `point`: the point to test for the hit (an instance of :class:`wx.Point`);
      :param `theCtrl`: the main :class:`TreeListMainWindow` tree;
      :param `flags`: a bitlist of hit locations;
      :param `column`: an integer specifying the column index;
      :param `level`: the item's level inside the tree hierarchy.
      
      :see: :meth:`TreeListMainWindow.HitTest() <TreeListMainWindow.HitTest>` method for the flags explanation.


   .. method:: IsEnabled(self)

      Returns whether the item is enabled or not.
      
      :return: ``True`` if the item is enabled, ``False`` if it is disabled or hidden.


   .. method:: IsExpanded(self)

      Returns whether the item is expanded or not.
      
      :return: ``True`` if the item is expanded, ``False`` if it is collapsed or hidden.


   .. method:: IsHidden(self)

      Returns whether the item is hidden or not. 


   .. method:: OnSetFocus(self, event)

      Handles the ``wx.EVT_SET_FOCUS`` event for a window associated to an item.
      
      :param `event`: a :class:`FocusEvent` event to be processed.


   .. method:: SetBackgroundColour(self, colour, column=0)

      Sets the associated background colour
      
      :param `colour`: a valid :class:`wx.Colour` instance.
      :param integer `column`


   .. method:: SetImage(self, column, image, which)

      Sets the item image for a particular item state.
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used;
      :param `image`: an index within the normal image list specifying the image to use;
      :param `which`: the item state.
      
      :see: :meth:`~TreeListItem.GetImage` for a list of valid item states.
      :note: Call :meth:`~HyperTreeList.SetItemImage` instead to refresh the tree properly.


   .. method:: SetText(self, column, text)

      Sets the item text label.
      
      :param `column`: if not ``None``, an integer specifying the column index.
       If it is ``None``, the main column index is used;
      :param `text`: a string specifying the new item label.
      :note: Call :meth:`~HyperTreeList.SetItemText` instead to refresh the tree properly.


   .. method:: SetTextX(self, text_x)

      Sets the `x` position of the item text. Used internally to position
      text according to column alignment.
      
      :param `text_x`: the `x` position of the item text.


   .. method:: SetWindow(self, wnd, column=None)

      Sets the window associated to the item. Internal use only.
      
      :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: Always use :meth:`~HyperTreeList.SetItemWindow` instead to update the tree properly.


   .. method:: SetWindowEnabled(self, enable=True, column=None)

      Sets whether the window associated with an item is enabled or not.
      
      :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.


