.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 by Total Control Software
   License:   wxWindows License

.. include:: headings.inc

.. currentmodule:: wx.lib.agw.persist.persist_handlers

.. highlight:: python



.. _wx.lib.agw.persist.persist_handlers.TreeCtrlHandler:

==========================================================================================================================================
|phoenix_title|  **wx.lib.agw.persist.persist_handlers.TreeCtrlHandler**
==========================================================================================================================================

Supports saving/restoring a :class:`TreeCtrl` expansion state, selections and
checked items state (meaningful only for :class:`lib.agw.customtreectrl.CustomTreeCtrl`).

This class handles the following wxPython widgets:

- :class:`TreeCtrl`;
- :class:`GenericDirCtrl`;
- :class:`lib.agw.customtreectrl.CustomTreeCtrl`;
- :class:`lib.agw.hypertreelist.HyperTreeList`;



|

|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>TreeCtrlHandler</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.persist.persist_handlers.TreeCtrlHandler_inheritance.png" alt="Inheritance diagram of TreeCtrlHandler" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.agw.persist.persist_handlers.AbstractHandler.html" title="wx.lib.agw.persist.persist_handlers.AbstractHandler" alt="" coords="5,5,352,35"/> <area shape="rect" id="node2" href="wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.html" title="wx.lib.agw.persist.persist_handlers.TreeCtrlHandler" alt="" coords="7,83,349,112"/> </map> 
   </p>

|


|sub_classes| Known Subclasses
==============================

:class:`wx.lib.agw.persist.persist_handlers.TreeListCtrlHandler`

|


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

:class:`wx.lib.agw.persist.persist_handlers.AbstractHandler`

|


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

======================================================================================== ================================================================================
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.__init__`                    
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetCheckedState`             Returns a list of checked items. Checked items are coded as determined by
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetCheckedStateOfChildren`   Returns the checked/unchecked state of the children of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetCheckedStateOfItem`       Returns the checked/unchecked state of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetExpansionState`           Returns list of expanded items. Expanded items are coded as determined by
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetExpansionStateOfChildren` Returns the expansion state of the children of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetExpansionStateOfItem`     Returns the expansion state of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetIndexOfItem`              Return the index of item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetItemChildren`             Return the children of item as a list.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetItemIdentity`             Return a hashable object that represents the identity of the
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetKind`                     
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetSelectionState`           Returns a list of selected items. Selected items are coded as determined by
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetSelectionStateOfChildren` Returns the selection state of the children of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.GetSelectionStateOfItem`     Returns the selection state of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.Restore`                     
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.Save`                        
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetCheckedState`             Checks all tree items whose identity, as determined by :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`, is present
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetCheckedStateOfChildren`   Sets the checked/unchecked state of the children of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetCheckedStateOfItem`       Sets the checked/unchecked state of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetExpansionState`           Expands all tree items whose identity, as determined by :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`,
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetExpansionStateOfChildren` Sets the expansion state of the children of a tree item (expanded or collapsed).
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetExpansionStateOfItem`     Sets the expansion state of a tree item (expanded or collapsed).
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetSelectedStateOfChildren`  Sets the selection state of the children of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetSelectedStateOfItem`      Sets the selection state of a tree item.
:meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetSelectionState`           Selects all tree items whose identity, as determined by :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`,
======================================================================================== ================================================================================


|


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


.. class:: TreeCtrlHandler(AbstractHandler)

   Supports saving/restoring a :class:`TreeCtrl` expansion state, selections and
   checked items state (meaningful only for :class:`lib.agw.customtreectrl.CustomTreeCtrl`).
   
   This class handles the following wxPython widgets:
   
   - :class:`TreeCtrl`;
   - :class:`GenericDirCtrl`;
   - :class:`lib.agw.customtreectrl.CustomTreeCtrl`;
   - :class:`lib.agw.hypertreelist.HyperTreeList`;

   .. method:: __init__(self, pObject)


   .. method:: GetCheckedState(self)

      Returns a list of checked items. Checked items are coded as determined by
      the result of :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`.
      
      :note:
      
       This is meaningful only for :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` and
       :class:`~wx.lib.agw.hypertreelist.HyperTreeList`.


   .. method:: GetCheckedStateOfChildren(self, item)

      Returns the checked/unchecked state of the children of a tree item.
      
      :param `item`: a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: GetCheckedStateOfItem(self, item)

      Returns the checked/unchecked state of a tree item.
      
      :param `item`: a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: GetExpansionState(self)

      Returns list of expanded items. Expanded items are coded as determined by
      the result of :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`.


   .. method:: GetExpansionStateOfChildren(self, item)

      Returns the expansion state of the children of a tree item.
      
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: GetExpansionStateOfItem(self, item)

      Returns the expansion state of a tree item.
      
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: GetIndexOfItem(self, item)

      Return the index of item.
      
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item;


   .. method:: GetItemChildren(self, item=None, recursively=False)

      Return the children of item as a list.
      
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item;
      :param `recursively`: whether to recurse into the item hierarchy or not.


   .. method:: GetItemIdentity(self, item)

      Return a hashable object that represents the identity of the
      item. By default this returns the position of the item in the
      tree. You may want to override this to return the item label
      (if you know that labels are unique and don't change), or return
      something that represents the underlying domain object, e.g.
      a database key.
      
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item;


   .. method:: GetKind(self)


   .. method:: GetSelectionState(self)

      Returns a list of selected items. Selected items are coded as determined by
      the result of :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`.


   .. method:: GetSelectionStateOfChildren(self, item)

      Returns the selection state of the children of a tree item.
      
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: GetSelectionStateOfItem(self, item)

      Returns the selection state of a tree item.
      
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: Restore(self)


   .. method:: Save(self)


   .. method:: SetCheckedState(self, listOfCheckedItems)

      Checks all tree items whose identity, as determined by :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`, is present
      in the list and unchecks all other tree items.
      
      :param `listOfCheckedItems`: a list of checked :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items.
      
      :note:
      
       This is meaningful only for :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` and
       :class:`~wx.lib.agw.hypertreelist.HyperTreeList`.


   .. method:: SetCheckedStateOfChildren(self, listOfCheckedItems, item)

      Sets the checked/unchecked state of the children of a tree item.
      
      :param `listOfCheckedItems`: a list of checked :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items;
      :param `item`: a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: SetCheckedStateOfItem(self, listOfCheckedItems, item)

      Sets the checked/unchecked state of a tree item.
      
      :param `listOfCheckedItems`: a list of checked :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items;
      :param `item`: a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: SetExpansionState(self, listOfExpandedItems)

      Expands all tree items whose identity, as determined by :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`,
      is present in the list and collapses all other tree items.
      
      :param `listOfExpandedItems`: a list of expanded :class:`TreeCtrl` or
       :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items.


   .. method:: SetExpansionStateOfChildren(self, listOfExpandedItems, item)

      Sets the expansion state of the children of a tree item (expanded or collapsed).
      
      :param `listOfExpandedItems`: a list of expanded :class:`TreeCtrl` or
       :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items;
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: SetExpansionStateOfItem(self, listOfExpandedItems, item)

      Sets the expansion state of a tree item (expanded or collapsed).
      
      :param `listOfExpandedItems`: a list of expanded :class:`TreeCtrl` or
       :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items;
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: SetSelectedStateOfChildren(self, listOfSelectedItems, item)

      Sets the selection state of the children of a tree item.
      
      :param `listOfSelectedItems`: a list of selected :class:`TreeCtrl` or
       :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items;
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: SetSelectedStateOfItem(self, listOfSelectedItems, item)

      Sets the selection state of a tree item.
      
      :param `listOfSelectedItems`: a list of selected :class:`TreeCtrl` or
       :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items;
      :param `item`: a :class:`TreeCtrl` item or a :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` item.


   .. method:: SetSelectionState(self, listOfSelectedItems)

      Selects all tree items whose identity, as determined by :meth:`TreeCtrlHandler.GetItemIdentity() <TreeCtrlHandler.GetItemIdentity>`,
      is present in the list and unselects all other tree items.
      
      :param `listOfSelectedItems`: a list of selected :class:`TreeCtrl` or
       :class:`~wx.lib.agw.customtreectrl.CustomTreeCtrl` items.


