.. 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.DataViewModel.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.DataViewModel.Compare` function to compare the items using some other criterion, e.g. alphabetically. | |class_hierarchy| Class Hierarchy ================================= .. raw:: html
Inheritance diagram for class DataViewTreeStore:
| |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=BitmapBundle(), expanded=BitmapBundle(), data=None) Append a container. :param `parent`: :type `parent`: wx.dataview.DataViewItem :param `text`: :type `text`: string :param `icon`: :type `icon`: wx.BitmapBundle :param `expanded`: :type `expanded`: wx.BitmapBundle :param `data`: :type `data`: ClientData :rtype: :ref:`wx.dataview.DataViewItem` .. method:: AppendItem(self, parent, text, icon=BitmapBundle(), data=None) Append an item. :param `parent`: :type `parent`: wx.dataview.DataViewItem :param `text`: :type `text`: string :param `icon`: :type `icon`: wx.BitmapBundle :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: `ClientData` .. method:: GetItemExpandedIcon(self, item) Returns the icon to display in expanded containers. :param `item`: :type `item`: wx.dataview.DataViewItem :rtype: `Icon` .. method:: GetItemIcon(self, item) Returns the icon of the item. :param `item`: :type `item`: wx.dataview.DataViewItem :rtype: `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=BitmapBundle(), expanded=BitmapBundle(), 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.BitmapBundle :param `expanded`: :type `expanded`: wx.BitmapBundle :param `data`: :type `data`: ClientData :rtype: :ref:`wx.dataview.DataViewItem` .. method:: InsertItem(self, parent, previous, text, icon=BitmapBundle(), 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.BitmapBundle :param `data`: :type `data`: ClientData :rtype: :ref:`wx.dataview.DataViewItem` .. method:: PrependContainer(self, parent, text, icon=BitmapBundle(), expanded=BitmapBundle(), 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.BitmapBundle :param `expanded`: :type `expanded`: wx.BitmapBundle :param `data`: :type `data`: ClientData :rtype: :ref:`wx.dataview.DataViewItem` .. method:: PrependItem(self, parent, text, icon=BitmapBundle(), 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.BitmapBundle :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.BitmapBundle .. method:: SetItemIcon(self, item, icon) Sets the icon for the item. :param `item`: :type `item`: wx.dataview.DataViewItem :param `icon`: :type `icon`: wx.BitmapBundle