]> git.saurik.com Git - wxWidgets.git/blame - interface/wx/treebase.h
Fixed problems caused by duplicated names across different style types.
[wxWidgets.git] / interface / wx / treebase.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: treebase.h
e54c96f1 3// Purpose: interface of wxTreeItemId
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
526954c5 6// Licence: wxWindows licence
23324ae1
FM
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxTreeItemId
7c913512 11
23324ae1 12 An opaque reference to a tree item.
7c913512 13
23324ae1 14 @library{wxcore}
3c99e2fd 15 @category{data}
7c913512 16
7977b62a 17 @see wxTreeCtrl, wxTreeItemData, @ref overview_treectrl
23324ae1 18*/
7c913512 19class wxTreeItemId
23324ae1
FM
20{
21public:
22 /**
7977b62a
BP
23 Default constructor. A wxTreeItemId is not meant to be constructed
24 explicitly by the user; only those returned by the wxTreeCtrl functions
25 should be used.
23324ae1
FM
26 */
27 wxTreeItemId();
28
29 /**
30 Returns @true if this instance is referencing a valid tree item.
31 */
328f5751 32 bool IsOk() const;
23324ae1
FM
33
34 //@{
35 /**
7977b62a 36 Operators for comparison between wxTreeItemId objects.
23324ae1 37 */
7977b62a
BP
38 bool operator ==(const wxTreeItemId& item) const;
39 bool operator !=(const wxTreeItemId& item) const;
23324ae1 40 //@}
7977b62a
BP
41
42 /**
43 Antonym of IsOk(), i.e. returns @true only if the item is not valid.
44 */
45 bool operator !() const;
23324ae1 46};
e54c96f1 47
7977b62a
BP
48/**
49 @class wxTreeItemData
7977b62a
BP
50
51 wxTreeItemData is some (arbitrary) user class associated with some item. The
52 main advantage of having this class is that wxTreeItemData objects are
53 destroyed automatically by the tree and, as this class has virtual
54 destructor, it means that the memory and any other resources associated with
55 a tree item will be automatically freed when it is deleted. Note that we
56 don't use wxObject as the base class for wxTreeItemData because the size of
57 this class is critical: in many applications, each tree leaf will have
58 wxTreeItemData associated with it and the number of leaves may be quite big.
59
60 Also please note that because the objects of this class are deleted by the
61 tree using the operator @c delete, they must always be allocated on the heap
62 using @c new.
63
64 @library{wxcore}
65 @category{containers}
66
67 @see wxTreeCtrl
68*/
69class wxTreeItemData : public wxClientData
70{
71public:
72 /**
73 Default constructor.
74
75 @beginWxPythonOnly
76 The following methods are added in wxPython for accessing the object:
77 - GetData(): Returns a reference to the Python Object.
78 - SetData(obj): Associates a new Python Object with the wxTreeItemData.
79 @endWxPythonOnly
1058f652
MB
80
81 @beginWxPerlOnly
82 In wxPerl the constructor accepts a scalar as an optional parameter
83 and stores it as client data; use
84 - GetData() to retrieve the value.
85 - SetData(data) to set it.
86 @endWxPerlOnly
7977b62a
BP
87 */
88 wxTreeItemData();
89
90 /**
91 Virtual destructor.
92 */
adaaa686 93 virtual ~wxTreeItemData();
7977b62a
BP
94
95 /**
96 Returns the item associated with this node.
97 */
cfbe5614 98 const wxTreeItemId& GetId() const;
7977b62a
BP
99
100 /**
101 Sets the item associated with this node.
727539d8
VZ
102
103 Notice that this function is automatically called by wxTreeCtrl methods
104 associating an object of this class with a tree control item such as
105 wxTreeCtrl::AppendItem(), wxTreeCtrl::InsertItem() and
106 wxTreeCtrl::SetItemData() so there is usually no need to call it
107 yourself.
7977b62a
BP
108 */
109 void SetId(const wxTreeItemId& id);
110};
111
112/**
113 Indicates which type to associate an image with a wxTreeCtrl item.
cfbe5614 114
7977b62a
BP
115 @see wxTreeCtrl::GetItemImage(), wxTreeCtrl::SetItemImage()
116*/
117enum wxTreeItemIcon
118{
119 /**
120 To get/set the item image for when the item is
121 @b not selected and @b not expanded.
122 */
123 wxTreeItemIcon_Normal,
124 /**
125 To get/set the item image for when the item is
126 @b selected and @b not expanded.
127 */
128 wxTreeItemIcon_Selected,
129 /**
130 To get/set the item image for when the item is
131 @b not selected and @b expanded.
132 */
133 wxTreeItemIcon_Expanded,
134 /**
135 To get/set the item image for when the item is
136 @b selected and @b expanded.
137 */
138 wxTreeItemIcon_SelectedExpanded,
139 wxTreeItemIcon_Max
140};