.. 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.dataview.DataViewTreeStore:

==========================================================================================================================================
|phoenix_title|  **wx.dataview.DataViewTreeStore**
==========================================================================================================================================

:ref:`wx.dataview.DataViewTreeStore`  is a specialised :ref:`wx.dataview.DataViewModel`  for storing simple trees very much like :ref:`wx.TreeCtrl`  does and it offers a similar API.          

This class actually stores the entire tree and the values (therefore its name) and implements all virtual methods from the base class so it can be used directly without having to derive any class from it, but it is mostly used from within :ref:`wx.dataview.DataViewTreeCtrl`. 

Notice that by default this class sorts all items with children before the leaf items. If this behaviour is inappropriate, you need to derive a custom class from this one and override either its :meth:`~wx.dataview.DataViewTreeStore.HasDefaultCompare`  method to return ``False``, which would result in items being sorted just in the order in which they were added, or its :meth:`~wx.dataview.DataViewTreeStore.Compare`  function to compare the items using some other criterion, e.g. alphabetically. 









|

|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>DataViewTreeStore</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.dataview.DataViewTreeStore_inheritance.png" alt="Inheritance diagram of DataViewTreeStore" 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.dataview.DataViewTreeStore.html" title="wx.dataview.DataViewTreeStore" alt="" coords="5,160,237,189"/> <area shape="rect" id="node2" href="wx.dataview.DataViewModel.html" title="wx.dataview.DataViewModel" alt="" coords="16,83,227,112"/> <area shape="rect" id="node3" href="wx.RefCounter.html" title="wx.RefCounter" alt="" coords="63,5,180,35"/> </map> 
   </p>
   </div>

|


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

================================================================================ ================================================================================
:meth:`~wx.dataview.DataViewTreeStore.__init__`                                  Constructor.
:meth:`~wx.dataview.DataViewTreeStore.AppendContainer`                           Append a container.
:meth:`~wx.dataview.DataViewTreeStore.AppendItem`                                Append an item.
:meth:`~wx.dataview.DataViewTreeStore.DeleteAllItems`                            Delete all item in the model.
:meth:`~wx.dataview.DataViewTreeStore.DeleteChildren`                            Delete all children of the item, but not the item itself.
:meth:`~wx.dataview.DataViewTreeStore.DeleteItem`                                Delete this item.
:meth:`~wx.dataview.DataViewTreeStore.GetChildCount`                             Return the number of children of item.
:meth:`~wx.dataview.DataViewTreeStore.GetItemData`                               Returns the client data associated with the item.
:meth:`~wx.dataview.DataViewTreeStore.GetItemExpandedIcon`                       Returns the icon to display in expanded containers.
:meth:`~wx.dataview.DataViewTreeStore.GetItemIcon`                               Returns the icon of the item.
:meth:`~wx.dataview.DataViewTreeStore.GetItemText`                               Returns the text of the item.
:meth:`~wx.dataview.DataViewTreeStore.GetNthChild`                               Returns the nth child item of item.
:meth:`~wx.dataview.DataViewTreeStore.InsertContainer`                           Inserts a container after `previous`.
:meth:`~wx.dataview.DataViewTreeStore.InsertItem`                                Inserts an item after `previous`.
:meth:`~wx.dataview.DataViewTreeStore.PrependContainer`                          Inserts a container before the first child item or `parent`.
:meth:`~wx.dataview.DataViewTreeStore.PrependItem`                               Inserts an item before the first child item or `parent`.
:meth:`~wx.dataview.DataViewTreeStore.SetItemData`                               Sets the client data associated with the item.
:meth:`~wx.dataview.DataViewTreeStore.SetItemExpandedIcon`                       Sets the expanded icon for the item.
:meth:`~wx.dataview.DataViewTreeStore.SetItemIcon`                               Sets the icon for the item.
================================================================================ ================================================================================


|


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


.. class:: wx.dataview.DataViewTreeStore(DataViewModel)

   **Possible constructors**::

       DataViewTreeStore()
       
   
   DataViewTreeStore is a specialised DataViewModel for storing
   simple trees very much like TreeCtrl does and it offers a similar
   API.



   .. method:: __init__(self)

      Constructor.                  

      Creates the invisible root node internally.                   





   .. method:: AppendContainer(self, parent, text, icon=NullIcon, expanded=NullIcon, data=None)

      Append a container.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: wx.Icon
      :param `expanded`: 
      :type `expanded`: wx.Icon
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: AppendItem(self, parent, text, icon=NullIcon, data=None)

      Append an item.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: wx.Icon
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: DeleteAllItems(self)

      Delete all item in the model.                   





   .. method:: DeleteChildren(self, item)

      Delete all children of the item, but not the item itself.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem







   .. method:: DeleteItem(self, item)

      Delete this item.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem







   .. method:: GetChildCount(self, parent)

      Return the number of children of item.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem




      :rtype: `int`








   .. method:: GetItemData(self, item)

      Returns the client data associated with the item.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: :ref:`ClientData`








   .. method:: GetItemExpandedIcon(self, item)

      Returns the icon to display in expanded containers.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: :ref:`Icon`








   .. method:: GetItemIcon(self, item)

      Returns the icon of the item.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: :ref:`Icon`








   .. method:: GetItemText(self, item)

      Returns the text of the item.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem




      :rtype: `string`








   .. method:: GetNthChild(self, parent, pos)

      Returns the nth child item of item.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `pos`: 
      :type `pos`: int




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: InsertContainer(self, parent, previous, text, icon=NullIcon, expanded=NullIcon, data=None)

      Inserts a container after `previous`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `previous`: 
      :type `previous`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: wx.Icon
      :param `expanded`: 
      :type `expanded`: wx.Icon
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: InsertItem(self, parent, previous, text, icon=NullIcon, data=None)

      Inserts an item after `previous`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `previous`: 
      :type `previous`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: wx.Icon
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: PrependContainer(self, parent, text, icon=NullIcon, expanded=NullIcon, data=None)

      Inserts a container before the first child item or `parent`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: wx.Icon
      :param `expanded`: 
      :type `expanded`: wx.Icon
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: PrependItem(self, parent, text, icon=NullIcon, data=None)

      Inserts an item before the first child item or `parent`.                  


      :param `parent`: 
      :type `parent`: wx.dataview.DataViewItem
      :param `text`: 
      :type `text`: string
      :param `icon`: 
      :type `icon`: wx.Icon
      :param `data`: 
      :type `data`: ClientData




      :rtype: :ref:`wx.dataview.DataViewItem`








   .. method:: SetItemData(self, item, data)

      Sets the client data associated with the item.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem
      :param `data`: 
      :type `data`: ClientData







   .. method:: SetItemExpandedIcon(self, item, icon)

      Sets the expanded icon for the item.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem
      :param `icon`: 
      :type `icon`: wx.Icon







   .. method:: SetItemIcon(self, item, icon)

      Sets the icon for the item.                  


      :param `item`: 
      :type `item`: wx.dataview.DataViewItem
      :param `icon`: 
      :type `icon`: wx.Icon






