.. 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.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
Inheritance diagram for class TreeCtrlHandler:
| |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__` Default class constructor. :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` Returns a short and meaningful *string* description of your widget. :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` Restores the widget's settings by calling :meth:`PersistentObject.RestoreValue() `, which in :meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.Save` Saves the widget's settings by calling :meth:`PersistentObject.SaveValue() `, which in :meth:`~wx.lib.agw.persist.persist_handlers.TreeCtrlHandler.SetCheckedState` Checks all tree items whose identity, as determined by :meth:`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() `, :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() `, ======================================================================================== ================================================================================ | |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) Default class constructor. :param `pObject`: a :class:`~wx.lib.agw.persist.persistencemanager.PersistentObject` containing information about the persistent widget. .. method:: GetCheckedState(self) Returns a list of checked items. Checked items are coded as determined by the result of :meth:`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() `. .. 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) Returns a short and meaningful *string* description of your widget. .. note:: This method must be overridden in derived classes. .. method:: GetSelectionState(self) Returns a list of selected items. Selected items are coded as determined by the result of :meth:`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) Restores the widget's settings by calling :meth:`PersistentObject.RestoreValue() `, which in turns calls :meth:`PersistenceManager.RestoreValue() `. .. note:: This method must be overridden in derived classes. .. method:: Save(self) Saves the widget's settings by calling :meth:`PersistentObject.SaveValue() `, which in turns calls :meth:`PersistenceManager.SaveValue() `. .. note:: This method must be overridden in derived classes. .. method:: SetCheckedState(self, listOfCheckedItems) Checks all tree items whose identity, as determined by :meth:`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() `, 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() `, 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.