1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTreeItemId
4 // Author: wxWidgets team
6 // Licence: wxWindows licence
7 /////////////////////////////////////////////////////////////////////////////
12 An opaque reference to a tree item.
17 @see wxTreeCtrl, wxTreeItemData, @ref overview_treectrl
23 Default constructor. A wxTreeItemId is not meant to be constructed
24 explicitly by the user; only those returned by the wxTreeCtrl functions
30 Returns @true if this instance is referencing a valid tree item.
38 bool operator==(const wxTreeItemId
& left
, const wxTreeItemId
& right
);
39 bool operator!=(const wxTreeItemId
& left
, const wxTreeItemId
& right
);
46 wxTreeItemData is some (arbitrary) user class associated with some item. The
47 main advantage of having this class is that wxTreeItemData objects are
48 destroyed automatically by the tree and, as this class has virtual
49 destructor, it means that the memory and any other resources associated with
50 a tree item will be automatically freed when it is deleted. Note that we
51 don't use wxObject as the base class for wxTreeItemData because the size of
52 this class is critical: in many applications, each tree leaf will have
53 wxTreeItemData associated with it and the number of leaves may be quite big.
55 Also please note that because the objects of this class are deleted by the
56 tree using the operator @c delete, they must always be allocated on the heap
64 class wxTreeItemData
: public wxClientData
71 In wxPerl the constructor accepts a scalar as an optional parameter
72 and stores it as client data; use
73 - GetData() to retrieve the value.
74 - SetData(data) to set it.
82 virtual ~wxTreeItemData();
85 Returns the item associated with this node.
87 const wxTreeItemId
& GetId() const;
90 Sets the item associated with this node.
92 Notice that this function is automatically called by wxTreeCtrl methods
93 associating an object of this class with a tree control item such as
94 wxTreeCtrl::AppendItem(), wxTreeCtrl::InsertItem() and
95 wxTreeCtrl::SetItemData() so there is usually no need to call it
98 void SetId(const wxTreeItemId
& id
);
102 Indicates which type to associate an image with a wxTreeCtrl item.
104 @see wxTreeCtrl::GetItemImage(), wxTreeCtrl::SetItemImage()
109 To get/set the item image for when the item is
110 @b not selected and @b not expanded.
112 wxTreeItemIcon_Normal
,
114 To get/set the item image for when the item is
115 @b selected and @b not expanded.
117 wxTreeItemIcon_Selected
,
119 To get/set the item image for when the item is
120 @b not selected and @b expanded.
122 wxTreeItemIcon_Expanded
,
124 To get/set the item image for when the item is
125 @b selected and @b expanded.
127 wxTreeItemIcon_SelectedExpanded
,
132 /// special values for the 'state' parameter of wxTreeCtrl::SetItemState()
133 static const int wxTREE_ITEMSTATE_NONE
= -1; // not state (no display state image)
134 static const int wxTREE_ITEMSTATE_NEXT
= -2; // cycle to the next state
135 static const int wxTREE_ITEMSTATE_PREV
= -3; // cycle to the previous state
137 #define wxTR_NO_BUTTONS 0x0000 // for convenience
138 #define wxTR_HAS_BUTTONS 0x0001 // draw collapsed/expanded btns
139 #define wxTR_NO_LINES 0x0004 // don't draw lines at all
140 #define wxTR_LINES_AT_ROOT 0x0008 // connect top-level nodes
141 #define wxTR_TWIST_BUTTONS 0x0010 // still used by wxTreeListCtrl
143 #define wxTR_SINGLE 0x0000 // for convenience
144 #define wxTR_MULTIPLE 0x0020 // can select multiple items
146 #define wxTR_HAS_VARIABLE_ROW_HEIGHT 0x0080 // what it says
148 #define wxTR_EDIT_LABELS 0x0200 // can edit item labels
149 #define wxTR_ROW_LINES 0x0400 // put border around items
150 #define wxTR_HIDE_ROOT 0x0800 // don't display root node
152 #define wxTR_FULL_ROW_HIGHLIGHT 0x2000 // highlight full horz space
154 // make the default control appearance look more native-like depending on the
156 #define wxTR_DEFAULT_STYLE (wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT)
159 // values for the `flags' parameter of wxTreeCtrl::HitTest() which determine
160 // where exactly the specified point is situated:
162 static const int wxTREE_HITTEST_ABOVE
= 0x0001;
163 static const int wxTREE_HITTEST_BELOW
= 0x0002;
164 static const int wxTREE_HITTEST_NOWHERE
= 0x0004;
165 // on the button associated with an item.
166 static const int wxTREE_HITTEST_ONITEMBUTTON
= 0x0008;
167 // on the bitmap associated with an item.
168 static const int wxTREE_HITTEST_ONITEMICON
= 0x0010;
169 // on the indent associated with an item.
170 static const int wxTREE_HITTEST_ONITEMINDENT
= 0x0020;
171 // on the label (string) associated with an item.
172 static const int wxTREE_HITTEST_ONITEMLABEL
= 0x0040;
173 // on the right of the label associated with an item.
174 static const int wxTREE_HITTEST_ONITEMRIGHT
= 0x0080;
175 // on the label (string) associated with an item.
176 static const int wxTREE_HITTEST_ONITEMSTATEICON
= 0x0100;
177 // on the left of the wxTreeCtrl.
178 static const int wxTREE_HITTEST_TOLEFT
= 0x0200;
179 // on the right of the wxTreeCtrl.
180 static const int wxTREE_HITTEST_TORIGHT
= 0x0400;
181 // on the upper part (first half) of the item.
182 static const int wxTREE_HITTEST_ONITEMUPPERPART
= 0x0800;
183 // on the lower part (second half) of the item.
184 static const int wxTREE_HITTEST_ONITEMLOWERPART
= 0x1000;
186 // anywhere on the item
187 static const int wxTREE_HITTEST_ONITEM
= wxTREE_HITTEST_ONITEMICON
|
188 wxTREE_HITTEST_ONITEMLABEL
;