wx.dataview.DataViewTreeStore¶
wx.dataview.DataViewTreeStore is a specialised wx.dataview.DataViewModel for storing simple trees very much like 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 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 HasDefaultCompare
method to return False
, which would result in items being sorted just in the order in which they were added, or its Compare
function to compare the items using some other criterion, e.g. alphabetically.
Class Hierarchy¶
Methods Summary¶
Constructor. |
|
Append a container. |
|
Append an item. |
|
Delete all item in the model. |
|
Delete all children of the item, but not the item itself. |
|
Delete this item. |
|
Return the number of children of item. |
|
Returns the client data associated with the item. |
|
Returns the icon to display in expanded containers. |
|
Returns the icon of the item. |
|
Returns the text of the item. |
|
Returns the nth child item of item. |
|
Inserts a container after previous. |
|
Inserts an item after previous. |
|
Inserts a container before the first child item or parent. |
|
Inserts an item before the first child item or parent. |
|
Sets the client data associated with the item. |
|
Sets the expanded icon for the item. |
|
Sets the icon for the item. |
Class API¶
- class wx.dataview.DataViewTreeStore(DataViewModel)¶
Possible constructors:
DataViewTreeStore() -> None
DataViewTreeStore is a specialised DataViewModel for storing simple trees very much like TreeCtrl does and it offers a similar API.
Methods¶
- __init__(self)¶
Constructor.
Creates the invisible root node internally.
- Return type:
None
- AppendContainer(self, parent, text, icon=BitmapBundle(), expanded=BitmapBundle(), data=None)¶
Append a container.
- Parameters:
parent (wx.dataview.DataViewItem)
text (string)
icon (wx.BitmapBundle)
expanded (wx.BitmapBundle)
data (ClientData)
- Return type:
- AppendItem(self, parent, text, icon=BitmapBundle(), data=None)¶
Append an item.
- Parameters:
parent (wx.dataview.DataViewItem)
text (string)
icon (wx.BitmapBundle)
data (ClientData)
- Return type:
- DeleteAllItems(self)¶
Delete all item in the model.
- Return type:
None
- DeleteChildren(self, item)¶
Delete all children of the item, but not the item itself.
- Parameters:
item (wx.dataview.DataViewItem)
- Return type:
None
- DeleteItem(self, item)¶
Delete this item.
- Parameters:
item (wx.dataview.DataViewItem)
- Return type:
None
- GetChildCount(self, parent)¶
Return the number of children of item.
- Parameters:
parent (wx.dataview.DataViewItem)
- Return type:
int
- GetItemData(self, item)¶
Returns the client data associated with the item.
- Parameters:
item (wx.dataview.DataViewItem)
- Return type:
ClientData
- GetItemExpandedIcon(self, item)¶
Returns the icon to display in expanded containers.
- Parameters:
item (wx.dataview.DataViewItem)
- Return type:
Icon
- GetItemIcon(self, item)¶
Returns the icon of the item.
- Parameters:
item (wx.dataview.DataViewItem)
- Return type:
Icon
- GetItemText(self, item)¶
Returns the text of the item.
- Parameters:
item (wx.dataview.DataViewItem)
- Return type:
str
- GetNthChild(self, parent, pos)¶
Returns the nth child item of item.
- Parameters:
parent (wx.dataview.DataViewItem)
pos (int)
- Return type:
- InsertContainer(self, parent, previous, text, icon=BitmapBundle(), expanded=BitmapBundle(), data=None)¶
Inserts a container after previous.
- Parameters:
parent (wx.dataview.DataViewItem)
previous (wx.dataview.DataViewItem)
text (string)
icon (wx.BitmapBundle)
expanded (wx.BitmapBundle)
data (ClientData)
- Return type:
- InsertItem(self, parent, previous, text, icon=BitmapBundle(), data=None)¶
Inserts an item after previous.
- Parameters:
parent (wx.dataview.DataViewItem)
previous (wx.dataview.DataViewItem)
text (string)
icon (wx.BitmapBundle)
data (ClientData)
- Return type:
- PrependContainer(self, parent, text, icon=BitmapBundle(), expanded=BitmapBundle(), data=None)¶
Inserts a container before the first child item or parent.
- Parameters:
parent (wx.dataview.DataViewItem)
text (string)
icon (wx.BitmapBundle)
expanded (wx.BitmapBundle)
data (ClientData)
- Return type:
- PrependItem(self, parent, text, icon=BitmapBundle(), data=None)¶
Inserts an item before the first child item or parent.
- Parameters:
parent (wx.dataview.DataViewItem)
text (string)
icon (wx.BitmapBundle)
data (ClientData)
- Return type:
- SetItemData(self, item, data)¶
Sets the client data associated with the item.
- Parameters:
item (wx.dataview.DataViewItem)
data (ClientData)
- Return type:
None
- SetItemExpandedIcon(self, item, icon)¶
Sets the expanded icon for the item.
- Parameters:
item (wx.dataview.DataViewItem)
icon (wx.BitmapBundle)
- Return type:
None
- SetItemIcon(self, item, icon)¶
Sets the icon for the item.
- Parameters:
item (wx.dataview.DataViewItem)
icon (wx.BitmapBundle)
- Return type:
None