#include </home/zeitlin/src/wx/github/interface/wx/treebase.h>
wxTreeItemData is some (arbitrary) user class associated with some item.
The main advantage of having this class is that wxTreeItemData objects are destroyed automatically by the tree and, as this class has virtual destructor, it means that the memory and any other resources associated with a tree item will be automatically freed when it is deleted. Note that we don't use wxObject as the base class for wxTreeItemData because the size of this class is critical: in many applications, each tree leaf will have wxTreeItemData associated with it and the number of leaves may be quite big.
Also please note that because the objects of this class are deleted by the tree using the operator delete
, they must always be allocated on the heap using new
.
Public Member Functions | |
wxTreeItemData () | |
Default constructor. | |
virtual | ~wxTreeItemData () |
Virtual destructor. | |
const wxTreeItemId & | GetId () const |
Returns the item associated with this node. | |
void | SetId (const wxTreeItemId &id) |
Sets the item associated with this node. |
wxTreeItemData::wxTreeItemData | ( | ) |
Default constructor.
wxPerl Note: In wxPerl the constructor accepts a scalar as an optional parameter and stores it as client data; use
virtual wxTreeItemData::~wxTreeItemData | ( | ) | [virtual] |
Virtual destructor.
const wxTreeItemId& wxTreeItemData::GetId | ( | ) | const |
Returns the item associated with this node.
void wxTreeItemData::SetId | ( | const wxTreeItemId & | id | ) |
Sets the item associated with this node.
Notice that this function is automatically called by wxTreeCtrl methods associating an object of this class with a tree control item such as wxTreeCtrl::AppendItem(), wxTreeCtrl::InsertItem() and wxTreeCtrl::SetItemData() so there is usually no need to call it yourself.