wxTreeItemData

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.

Derived from

wxClientData

Include files

<wx/treectrl.h>

See also

wxTreeCtrl



wxTreeItemData::wxTreeItemData



wxTreeItemData(void)

Default constructor.

wxPython での注意点: The wxPython version of this constructor optionally accepts any Python object as a parameter. This object is then associated with the tree item using the wxTreeItemData as a container.

In addition, the following methods are added in wxPython for accessing the object:

2cm
GetData() Returns a reference to the Python Object
SetData(obj) Associates a new Python Object with the wxTreeItemData

wxPerl での注意点: In wxPerl the constructor accepts as parameter an optional scalar, and stores it as client data. You may retrieve this data by calling GetData(), and set it by calling SetData( data ).



wxTreeItemData::~wxTreeItemData



void ~wxTreeItemData(void)

Virtual destructor.



wxTreeItemData::GetId



const wxTreeItemId& GetId(void)

Returns the item associated with this node.



wxTreeItemData::SetId



void SetId(const wxTreeItemId& id)

Sets the item associated with this node.

ymasuda 平成17年11月19日