]>
Commit | Line | Data |
---|---|---|
a660d684 KB |
1 | \section{\class{wxTreeCtrl}}\label{wxtreectrl} |
2 | ||
3 | A tree control presents information as a hierarchy, with items that may be expanded | |
4fabb575 | 4 | to show further items. Items in a tree control are referenced by wxTreeItemId handles. |
a660d684 KB |
5 | |
6 | To intercept events from a tree control, use the event table macros described in \helpref{wxTreeEvent}{wxtreeevent}. | |
7 | ||
8 | \wxheading{Derived from} | |
9 | ||
10 | \helpref{wxControl}{wxcontrol}\\ | |
11 | \helpref{wxWindow}{wxwindow}\\ | |
12 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
13 | \helpref{wxObject}{wxobject} | |
14 | ||
15 | \wxheading{Window styles} | |
16 | ||
17 | \twocolwidtha{5cm} | |
18 | \begin{twocollist}\itemsep=0pt | |
19 | \twocolitem{\windowstyle{wxTR\_HAS\_BUTTONS}}{Use this style to show + and - buttons to the | |
20 | left of parent items.} | |
21 | \twocolitem{\windowstyle{wxTR\_EDIT\_LABELS}}{Use this style if you wish the user to be | |
22 | able to edit labels in the tree control.} | |
23 | \end{twocollist} | |
24 | ||
25 | See also \helpref{window styles overview}{windowstyles}. | |
26 | ||
5de76427 JS |
27 | \wxheading{Event handling} |
28 | ||
29 | To process input from a tree control, use these event handler macros to direct input to member | |
30 | functions that take a \helpref{wxTreeEvent}{wxtreeevent} argument. | |
31 | ||
32 | \twocolwidtha{7cm} | |
33 | \begin{twocollist}\itemsep=0pt | |
34 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_DRAG(id, func)}}{Begin dragging with the left mouse button.} | |
35 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_RDRAG(id, func)}}{Begin dragging with the right mouse button.} | |
36 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_LABEL\_EDIT(id, func)}}{Begin editing a label.} | |
37 | \twocolitem{{\bf EVT\_TREE\_END\_LABEL\_EDIT(id, func)}}{Finish editing a label.} | |
38 | \twocolitem{{\bf EVT\_TREE\_DELETE\_ITEM(id, func)}}{Delete an item.} | |
39 | \twocolitem{{\bf EVT\_TREE\_GET\_INFO(id, func)}}{Request information from the application.} | |
40 | \twocolitem{{\bf EVT\_TREE\_SET\_INFO(id, func)}}{Information is being supplied.} | |
41 | \twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDED(id, func)}}{Parent has been expanded.} | |
42 | \twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDING(id, func)}}{Parent is being expanded.} | |
43 | \twocolitem{{\bf EVT\_TREE\_SEL\_CHANGED(id, func)}}{Selection has changed.} | |
44 | \twocolitem{{\bf EVT\_TREE\_SEL\_CHANGING(id, func)}}{Selection is changing.} | |
45 | \twocolitem{{\bf EVT\_TREE\_KEY\_DOWN(id, func)}}{A key has been pressed.} | |
46 | \end{twocollist}% | |
47 | ||
a660d684 KB |
48 | \wxheading{See also} |
49 | ||
4fabb575 | 50 | \helpref{wxTreeItemData}{wxtreeitemdata}, \helpref{wxTreeCtrl overview}{wxtreectrloverview}, \helpref{wxListBox}{wxlistbox}, \helpref{wxListCtrl}{wxlistctrl},\rtfsp |
a660d684 KB |
51 | \helpref{wxImageList}{wximagelist}, \helpref{wxTreeEvent}{wxtreeevent} |
52 | ||
53 | \latexignore{\rtfignore{\wxheading{Members}}} | |
54 | ||
55 | \membersection{wxTreeCtrl::wxTreeCtrl}\label{wxtreectrlconstr} | |
56 | ||
57 | \func{}{wxTreeCtrl}{\void} | |
58 | ||
59 | Default constructor. | |
60 | ||
eaaa6a06 | 61 | \func{}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 62 | \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
eaaa6a06 | 63 | \param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}} |
a660d684 KB |
64 | |
65 | Constructor, creating and showing a tree control. | |
66 | ||
67 | \wxheading{Parameters} | |
68 | ||
69 | \docparam{parent}{Parent window. Must not be NULL.} | |
70 | ||
71 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
72 | ||
73 | \docparam{pos}{Window position.} | |
74 | ||
75 | \docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized | |
76 | appropriately.} | |
77 | ||
78 | \docparam{style}{Window style. See \helpref{wxTreeCtrl}{wxtreectrl}.} | |
79 | ||
80 | \docparam{validator}{Window validator.} | |
81 | ||
82 | \docparam{name}{Window name.} | |
83 | ||
84 | \wxheading{See also} | |
85 | ||
86 | \helpref{wxTreeCtrl::Create}{wxtreectrlcreate}, \helpref{wxValidator}{wxvalidator} | |
87 | ||
88 | \membersection{wxTreeCtrl::\destruct{wxTreeCtrl}} | |
89 | ||
90 | \func{void}{\destruct{wxTreeCtrl}}{\void} | |
91 | ||
92 | Destructor, destroying the list control. | |
93 | ||
4fabb575 JS |
94 | \membersection{wxTreeCtrl::AddRoot}\label{wxtreectrladdroot} |
95 | ||
96 | \func{wxTreeItemId}{AddRoot}{\param{const wxString\&}{ text}, | |
97 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
98 | ||
99 | Adds the root node to the tree, returning the new item. | |
100 | ||
101 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for | |
102 | both selected and unselected items. | |
103 | ||
104 | \membersection{wxTreeCtrl::AppendItem}\label{wxtreectrlappenditem} | |
105 | ||
106 | \func{wxTreeItemId}{AppendItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxString\&}{ text}, | |
107 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
108 | ||
109 | Appends an item to the end of the branch identified by {\it parent}, return a new item id. | |
110 | ||
111 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for | |
112 | both selected and unselected items. | |
113 | ||
114 | \membersection{wxTreeCtrl::Collapse}\label{wxtreectrlcollapse} | |
115 | ||
116 | \func{void}{Collapse}{\param{const wxTreeItemId\&}{ item}} | |
117 | ||
118 | Collapses the given item. | |
119 | ||
120 | \membersection{wxTreeCtrl::CollapseAndReset}\label{wxtreectrlcollapseandreset} | |
121 | ||
122 | \func{void}{CollapseAndReset}{\param{const wxTreeItemId\&}{ item}} | |
123 | ||
124 | Collapses the given item and removes all children. | |
125 | ||
a660d684 KB |
126 | \membersection{wxTreeCtrl::Create}\label{wxtreectrlcreate} |
127 | ||
eaaa6a06 | 128 | \func{bool}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 129 | \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
eaaa6a06 | 130 | \param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}} |
a660d684 KB |
131 | |
132 | Creates the tree control. See \helpref{wxTreeCtrl::wxTreeCtrl}{wxtreectrlconstr} for further details. | |
133 | ||
4fabb575 | 134 | \membersection{wxTreeCtrl::Delete}\label{wxtreectrldelete} |
a660d684 | 135 | |
4fabb575 | 136 | \func{void}{Delete}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 137 | |
4fabb575 | 138 | Deletes the specified item. |
a660d684 | 139 | |
4fabb575 | 140 | \membersection{wxTreeCtrl::DeleteAllItems}\label{wxtreectrldeleteallitems} |
a660d684 | 141 | |
4fabb575 | 142 | \func{void}{DeleteAllItems}{\void} |
a660d684 | 143 | |
4fabb575 | 144 | Deletes all the items in the control. |
a660d684 | 145 | |
bbcdf8bc | 146 | \membersection{wxTreeCtrl::EditLabel}\label{wxtreectrleditlabel} |
a660d684 | 147 | |
4fabb575 | 148 | \func{wxTextCtrl*}{EditLabel}{\param{const wxTreeItemId\&}{ item}, \param{wxClassInfo*}{ textControlClass = CLASSINFO(wxTextCtrl)}} |
a660d684 KB |
149 | |
150 | Starts editing the label of the given item, returning the text control that the tree control uses for editing. | |
151 | ||
bbcdf8bc JS |
152 | Pass another {\it textControlClass} if a derived class is required. It usually will be, in order for |
153 | the application to detect when editing has finished and to call \helpref{wxTreeCtrl::EndEditLabel}{wxtreectrlendeditlabel}. | |
154 | ||
155 | Do not delete the text control yourself. | |
156 | ||
157 | This function is currently supported under Windows only. | |
158 | ||
159 | \wxheading{See also} | |
160 | ||
161 | \helpref{wxTreeCtrl::EndEditLabel}{wxtreectrlendeditlabel} | |
162 | ||
163 | \membersection{wxTreeCtrl::EndEditLabel}\label{wxtreectrlendeditlabel} | |
164 | ||
4fabb575 | 165 | \func{void}{EndEditLabel}{\param{bool }{cancelEdit}} |
bbcdf8bc JS |
166 | |
167 | Ends label editing. If {\it cancelEdit} is TRUE, the edit will be cancelled. | |
168 | ||
169 | This function is currently supported under Windows only. | |
170 | ||
171 | \wxheading{See also} | |
172 | ||
173 | \helpref{wxTreeCtrl::EditLabel}{wxtreectrleditlabel} | |
174 | ||
a660d684 KB |
175 | \membersection{wxTreeCtrl::EnsureVisible}\label{wxtreectrlensurevisible} |
176 | ||
4fabb575 | 177 | \func{void}{EnsureVisible}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
178 | |
179 | Scrolls and/or expands items to ensure that the given item is visible. | |
180 | ||
4fabb575 | 181 | \membersection{wxTreeCtrl::Expand}\label{wxtreectrlexpand} |
a660d684 | 182 | |
4fabb575 | 183 | \func{void}{Expand}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
184 | |
185 | Expands the given item. | |
186 | ||
4fabb575 | 187 | \membersection{wxTreeCtrl::GetBoundingRect}\label{wxtreectrlgetitemrect} |
a660d684 | 188 | |
4fabb575 JS |
189 | \constfunc{void}{GetBoundingRect}{\param{const wxTreeItemId\&}{ item}, \param{wxRect\& }{rect}, \param{bool }{textOnly = FALSE}} |
190 | ||
191 | Returns the position and size of the rectangle bounding the item. | |
a660d684 | 192 | |
4fabb575 | 193 | \membersection{wxTreeCtrl::GetChildrenCount}\label{wxtreectrlgetchildrencount} |
a660d684 | 194 | |
4fabb575 | 195 | \constfunc{size\_t}{GetChildrenCount}{\param{const wxTreeItemId\&}{ item}, \param{bool}{ recursively = TRUE}} |
a660d684 | 196 | |
4fabb575 JS |
197 | Returns the number of items in the branch. If {\it recursively} is TRUE, returns the total number |
198 | of descendants, otherwise only one level of children is counted. | |
a660d684 KB |
199 | |
200 | \membersection{wxTreeCtrl::GetCount}\label{wxtreectrlgetcount} | |
201 | ||
202 | \constfunc{int}{GetCount}{\void} | |
203 | ||
204 | Returns the number of items in the control. | |
205 | ||
206 | \membersection{wxTreeCtrl::GetEditControl}\label{wxtreectrlgeteditcontrol} | |
207 | ||
208 | \constfunc{wxTextCtrl\&}{GetEditControl}{\void} | |
209 | ||
210 | Returns the edit control used to edit a label. | |
211 | ||
4fabb575 JS |
212 | \membersection{wxTreeCtrl::GetFirstChild}\label{wxtreectrlgetfirstchild} |
213 | ||
214 | \constfunc{wxTreeItemId}{GetFirstChild}{\param{const wxTreeItemId\&}{ item}, \param{long\& }{cookie}} | |
215 | ||
216 | Returns the first child; call \helpref{wxTreeCtrl::GetNextChild}{wxtreectrlgetnextchild} for the next child. | |
217 | ||
218 | For this enumeration function you must pass in a `cookie' parameter | |
219 | which is opaque for the application but is necessary for the library | |
220 | to make these functions reentrant (i.e. allow more than one | |
221 | enumeration on one and the same object simultaneously). The cookie passed to | |
222 | GetFirstChild and GetNextChild should be the same. | |
223 | ||
224 | Returns 0 if there are no further children. | |
225 | ||
226 | \wxheading{See also} | |
227 | ||
228 | \helpref{wxTreeCtrl::GetNextChild}{wxtreectrlgetnextchild} | |
229 | ||
a660d684 KB |
230 | \membersection{wxTreeCtrl::GetFirstVisibleItem}\label{wxtreectrlgetfirstvisibleitem} |
231 | ||
4fabb575 | 232 | \constfunc{wxTreeItemId}{GetFirstVisibleItem}{\void} |
a660d684 KB |
233 | |
234 | Returns the first visible item. | |
235 | ||
236 | \membersection{wxTreeCtrl::GetImageList}\label{wxtreectrlgetimagelist} | |
237 | ||
eaaa6a06 | 238 | \constfunc{wxImageList*}{GetImageList}{\param{int }{which = wxIMAGE\_LIST\_NORMAL}} |
a660d684 KB |
239 | |
240 | Returns the specified image list. {\it which} may be one of: | |
241 | ||
242 | \twocolwidtha{5cm} | |
243 | \begin{twocollist}\itemsep=0pt | |
244 | \twocolitem{\windowstyle{wxIMAGE\_LIST\_NORMAL}}{The normal (large icon) image list.} | |
245 | \twocolitem{\windowstyle{wxIMAGE\_LIST\_SMALL}}{The small icon image list.} | |
246 | \twocolitem{\windowstyle{wxIMAGE\_LIST\_STATE}}{The user-defined state image list (unimplemented).} | |
247 | \end{twocollist} | |
248 | ||
249 | \membersection{wxTreeCtrl::GetIndent}\label{wxtreectrlgetindent} | |
250 | ||
251 | \constfunc{int}{GetIndent}{\void} | |
252 | ||
253 | Returns the current tree control indentation. | |
254 | ||
4fabb575 | 255 | \membersection{wxTreeCtrl::GetItemData}\label{wxtreectrlgetitemdata} |
a660d684 | 256 | |
4fabb575 | 257 | \constfunc{wxTreeItemData*}{GetItemData}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 258 | |
4fabb575 | 259 | Returns the tree item data associated with the item. |
a660d684 | 260 | |
4fabb575 | 261 | \wxheading{See also} |
a660d684 | 262 | |
4fabb575 | 263 | \helpref{wxTreeItemData}{wxtreeitemdata} |
a660d684 | 264 | |
4fabb575 | 265 | \membersection{wxTreeCtrl::GetItemImage}\label{wxtreectrlgetitemimage} |
a660d684 | 266 | |
4fabb575 | 267 | \constfunc{int}{GetItemImage}{\param{const wxTreeItemId\& }{item}} |
a660d684 | 268 | |
4fabb575 | 269 | Gets the normal item image. |
a660d684 | 270 | |
4fabb575 | 271 | \membersection{wxTreeCtrl::GetItemText}\label{wxtreectrlgetitemtext} |
a660d684 | 272 | |
4fabb575 | 273 | \constfunc{wxString}{GetItemText}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 274 | |
4fabb575 | 275 | Returns the item label. |
a660d684 | 276 | |
4fabb575 | 277 | \membersection{wxTreeCtrl::GetNextChild}\label{wxtreectrlgetnextchild} |
a660d684 | 278 | |
4fabb575 | 279 | \constfunc{wxTreeItemId}{GetNextChild}{\param{const wxTreeItemId\&}{ item}, \param{long\& }{cookie}} |
a660d684 | 280 | |
4fabb575 | 281 | Returns the next child; call \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild} for the first child. |
a660d684 | 282 | |
4fabb575 JS |
283 | For this enumeration function you must pass in a `cookie' parameter |
284 | which is opaque for the application but is necessary for the library | |
285 | to make these functions reentrant (i.e. allow more than one | |
286 | enumeration on one and the same object simultaneously). The cookie passed to | |
287 | GetFirstChild and GetNextChild should be the same. | |
a660d684 | 288 | |
4fabb575 | 289 | Returns 0 if there are no further children. |
a660d684 | 290 | |
4fabb575 | 291 | \wxheading{See also} |
a660d684 | 292 | |
4fabb575 | 293 | \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild} |
a660d684 | 294 | |
4fabb575 | 295 | \membersection{wxTreeCtrl::GetNextSibling}\label{wxtreectrlgetnextsibling} |
a660d684 | 296 | |
4fabb575 | 297 | \constfunc{wxTreeItemId}{GetNextSibling}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 298 | |
4fabb575 | 299 | Returns the next sibling of the specified item; call \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} for the previous sibling. |
a660d684 | 300 | |
4fabb575 | 301 | Returns 0 if there are no further siblings. |
a660d684 | 302 | |
4fabb575 JS |
303 | \wxheading{See also} |
304 | ||
305 | \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} | |
306 | ||
307 | \membersection{wxTreeCtrl::GetNextVisible}\label{wxtreectrlgetnextvisible} | |
308 | ||
309 | \constfunc{wxTreeItemId}{GetNextVisible}{\param{const wxTreeItemId\&}{ item}} | |
a660d684 KB |
310 | |
311 | Returns the next visible item. | |
312 | ||
313 | \membersection{wxTreeCtrl::GetParent}\label{wxtreectrlgetparent} | |
314 | ||
4fabb575 | 315 | \constfunc{wxTreeItemId}{GetParent}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
316 | |
317 | Returns the item's parent. | |
318 | ||
4fabb575 JS |
319 | \membersection{wxTreeCtrl::GetPrevSibling}\label{wxtreectrlgetprevsibling} |
320 | ||
321 | \constfunc{wxTreeItemId}{GetPrevSibling}{\param{const wxTreeItemId\&}{ item}} | |
322 | ||
323 | Returns the previous sibling of the specified item; call \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} for the next sibling. | |
324 | ||
325 | Returns 0 if there are no further children. | |
326 | ||
327 | \wxheading{See also} | |
328 | ||
329 | \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} | |
330 | ||
331 | \membersection{wxTreeCtrl::GetPrevVisible}\label{wxtreectrlgetprevvisible} | |
332 | ||
333 | \constfunc{wxTreeItemId}{GetPrevVisible}{\param{const wxTreeItemId\&}{ item}} | |
334 | ||
335 | Returns the previous visible item. | |
336 | ||
a660d684 KB |
337 | \membersection{wxTreeCtrl::GetRootItem}\label{wxtreectrlgetrootitem} |
338 | ||
4fabb575 | 339 | \constfunc{wxTreeItemId}{GetRootItem}{\void} |
a660d684 KB |
340 | |
341 | Returns the root item for the tree control. | |
342 | ||
4fabb575 JS |
343 | \membersection{wxTreeCtrl::GetSelectedItemImage}\label{wxtreectrlgetselecteditemimage} |
344 | ||
345 | \constfunc{int}{GetSelectedItemImage}{\param{const wxTreeItemId\& }{item}} | |
346 | ||
347 | Gets the selected item image. | |
348 | ||
a660d684 KB |
349 | \membersection{wxTreeCtrl::GetSelection}\label{wxtreectrlgetselection} |
350 | ||
4fabb575 | 351 | \constfunc{wxTreeItemId}{GetSelection}{\void} |
a660d684 KB |
352 | |
353 | Returns the selection, or 0 if there is no selection. | |
354 | ||
355 | \membersection{wxTreeCtrl::HitTest}\label{wxtreectrlhittest} | |
356 | ||
357 | \func{long}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}} | |
358 | ||
359 | Calculates which (if any) item is under the given point, returning extra information | |
360 | in {\it flags}. {\it flags} is a bitlist of the following: | |
361 | ||
362 | \twocolwidtha{5cm} | |
363 | \begin{twocollist}\itemsep=0pt | |
364 | \twocolitem{wxTREE\_HITTEST\_ABOVE}{Above the client area.} | |
365 | \twocolitem{wxTREE\_HITTEST\_BELOW}{Below the client area.} | |
366 | \twocolitem{wxTREE\_HITTEST\_NOWHERE}{In the client area but below the last item.} | |
367 | \twocolitem{wxTREE\_HITTEST\_ONITEMBUTTON}{On the button associated with an item.} | |
368 | \twocolitem{wxTREE\_HITTEST\_ONITEMICON}{On the bitmap associated with an item.} | |
369 | \twocolitem{wxTREE\_HITTEST\_ONITEMINDENT}{In the indentation associated with an item.} | |
370 | \twocolitem{wxTREE\_HITTEST\_ONITEMLABEL}{On the label (string) associated with an item.} | |
371 | \twocolitem{wxTREE\_HITTEST\_ONITEMRIGHT}{In the area to the right of an item.} | |
372 | \twocolitem{wxTREE\_HITTEST\_ONITEMSTATEICON}{On the state icon for a tree view item that is in a user-defined state.} | |
373 | \twocolitem{wxTREE\_HITTEST\_TOLEFT}{To the right of the client area.} | |
374 | \twocolitem{wxTREE\_HITTEST\_TORIGHT}{To the left of the client area.} | |
375 | \end{twocollist} | |
376 | ||
377 | \membersection{wxTreeCtrl::InsertItem}\label{wxtreectrlinsertitem} | |
378 | ||
4fabb575 JS |
379 | \func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxTreeItemId\& }{previous}, \param{const wxString\&}{ text}, |
380 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
a660d684 | 381 | |
4fabb575 | 382 | Inserts an item after a given one. |
a660d684 KB |
383 | |
384 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for | |
385 | both selected and unselected items. | |
386 | ||
4fabb575 JS |
387 | \membersection{wxTreeCtrl::IsExpanded}\label{wxtreectrlisexpanded} |
388 | ||
389 | \constfunc{bool}{IsExpanded}{\param{const wxTreeItemId\&}{ item}} | |
390 | ||
391 | Returns TRUE if the item is expanded (only makes sense if it has children). | |
392 | ||
393 | \membersection{wxTreeCtrl::IsSelected}\label{wxtreectrlisselected} | |
394 | ||
395 | \constfunc{bool}{IsSelected}{\param{const wxTreeItemId\&}{ item}} | |
396 | ||
397 | Returns TRUE if the item is selected. | |
398 | ||
399 | \membersection{wxTreeCtrl::IsVisible}\label{wxtreectrlisvisible} | |
400 | ||
401 | \constfunc{bool}{IsVisible}{\param{const wxTreeItemId\&}{ item}} | |
402 | ||
403 | Returns TRUE if the item is visible (it might be outside the view, or not expanded). | |
404 | ||
a660d684 KB |
405 | \membersection{wxTreeCtrl::ItemHasChildren}\label{wxtreectrlitemhaschildren} |
406 | ||
4fabb575 | 407 | \constfunc{bool}{ItemHasChildren}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
408 | |
409 | Returns TRUE if the item has children. | |
410 | ||
4fabb575 JS |
411 | \membersection{wxTreeCtrl::PrependItem}\label{wxtreectrlprependitem} |
412 | ||
413 | \func{wxTreeItemId}{PrependItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxString\&}{ text}, | |
414 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
415 | ||
416 | Appends an item as the first child of {\it parent}, return a new item id. | |
417 | ||
418 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for | |
419 | both selected and unselected items. | |
420 | ||
a660d684 KB |
421 | \membersection{wxTreeCtrl::ScrollTo}\label{wxtreectrlscrollto} |
422 | ||
4fabb575 | 423 | \func{void}{ScrollTo}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 424 | |
4fabb575 | 425 | Scrolls the specified item into view. |
a660d684 KB |
426 | |
427 | \membersection{wxTreeCtrl::SelectItem}\label{wxtreectrlselectitem} | |
428 | ||
4fabb575 | 429 | \func{bool}{SelectItem}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
430 | |
431 | Selects the given item. | |
432 | ||
433 | \membersection{wxTreeCtrl::SetIndent}\label{wxtreectrlsetindent} | |
434 | ||
435 | \func{void}{SetIndent}{\param{int }{indent}} | |
436 | ||
437 | Sets the indentation for the tree control. | |
438 | ||
439 | \membersection{wxTreeCtrl::SetImageList}\label{wxtreectrlsetimagelist} | |
440 | ||
eaaa6a06 | 441 | \func{void}{SetImageList}{\param{wxImageList*}{ imageList}, \param{int }{which = wxIMAGE\_LIST\_NORMAL}} |
a660d684 KB |
442 | |
443 | Sets the image list. {\it which} should be one of wxIMAGE\_LIST\_NORMAL, wxIMAGE\_LIST\_SMALL and | |
444 | wxIMAGE\_LIST\_STATE. | |
445 | ||
4fabb575 | 446 | \membersection{wxTreeCtrl::SetItemData}\label{wxtreectrlsetitemdata} |
a660d684 | 447 | |
4fabb575 | 448 | \func{void}{SetItemData}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemData* }{data}} |
a660d684 | 449 | |
4fabb575 | 450 | Sets the item client data. |
a660d684 | 451 | |
4fabb575 | 452 | \membersection{wxTreeCtrl::SetItemHasChildren}\label{wxtreectrlsetitemhaschildren} |
a660d684 | 453 | |
4fabb575 | 454 | \func{void}{SetItemHasChildren}{\param{const wxTreeItemId\&}{ item}, \param{bool }{hasChildren = TRUE}} |
a660d684 | 455 | |
4fabb575 JS |
456 | Force appearance of the button next to the item. This is useful to |
457 | allow the user to expand the items which don't have any children now, | |
458 | but instead adding them only when needed, thus minimizing memory | |
459 | usage and loading time. | |
a660d684 KB |
460 | |
461 | \membersection{wxTreeCtrl::SetItemImage}\label{wxtreectrlsetitemimage} | |
462 | ||
4fabb575 | 463 | \func{void}{SetItemImage}{\param{const wxTreeItemId\&}{ item}, \param{int }{image}} |
a660d684 | 464 | |
4fabb575 | 465 | Sets the normal item image. This is an index into the assciated image list. |
a660d684 | 466 | |
4fabb575 | 467 | \membersection{wxTreeCtrl::SetItemSelectedImage}\label{wxtreectrlsetitemselectedimage} |
a660d684 | 468 | |
4fabb575 | 469 | \func{void}{SetItemSelectedImage}{\param{const wxTreeItemId\&}{ item}, \param{int }{selImage}} |
a660d684 | 470 | |
4fabb575 | 471 | Sets the item selected image. This is an index into the assciated image list. |
a660d684 KB |
472 | |
473 | \membersection{wxTreeCtrl::SetItemText}\label{wxtreectrlsetitemtext} | |
474 | ||
4fabb575 | 475 | \func{void}{SetItemText}{\param{const wxTreeItemId\&}{ item}, \param{const wxString\& }{text}} |
a660d684 KB |
476 | |
477 | Sets the item label. | |
478 | ||
4fabb575 | 479 | \membersection{wxTreeCtrl::SortChildren}\label{wxtreectrlsortchildren} |
a660d684 | 480 | |
4fabb575 | 481 | \func{void}{SortChildren}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemCmpFunc*}{ cmpFunction = NULL}} |
a660d684 | 482 | |
4fabb575 JS |
483 | Sorts the children of the given item. If {\it cmpFunction} is NULL, sorts in ascending alphabetical order; |
484 | otherwise the custom sort function is used, as follows: | |
a660d684 | 485 | |
4fabb575 JS |
486 | {\small |
487 | \begin{verbatim} | |
488 | // a callback function used for sorting tree items, it should return -1 if the | |
489 | // first item precedes the second, +1 if the second precedes the first or 0 if | |
490 | // they're equivalent | |
491 | class wxTreeItemData; | |
492 | typedef int (*wxTreeItemCmpFunc)(wxTreeItemData *item1, wxTreeItemData *item2); | |
493 | \end{verbatim} | |
494 | } | |
495 | ||
496 | \wxheading{See also} | |
497 | ||
498 | \helpref{wxTreeItemData}{wxtreeitemdata} | |
499 | ||
500 | \membersection{wxTreeCtrl::Toggle}\label{wxtreectrltoggle} | |
501 | ||
502 | \func{void}{Toggle}{\param{const wxTreeItemId\&}{ item}} | |
503 | ||
504 | Toggles the given item between collapsed and expanded states. | |
505 | ||
506 | \membersection{wxTreeCtrl::Unselect}\label{wxtreectrlunselect} | |
507 | ||
508 | \func{void}{Unselect}{\void} | |
509 | ||
510 | Removes the selection from the currently selected item (if any). | |
511 | ||
512 | \section{\class{wxTreeItemData}}\label{wxtreeitemdata} | |
513 | ||
514 | wxTreeItemData is some (arbitrary) user class associated with some item. The | |
515 | main advantage of having this class (compared to the old untyped interface) is | |
516 | that wxTreeItemData's are destroyed automatically by the tree and, as this | |
517 | class has virtual dtor, it means that the memory will be automatically | |
518 | freed. We don't just use wxObject instead of wxTreeItemData because | |
519 | the size of this class is critical: in any real application, each tree leaf | |
520 | will have wxTreeItemData associated with it and number of leaves may be | |
521 | quite big. | |
522 | ||
523 | Because the objects of this class are deleted by the tree, they should | |
524 | always be allocated on the heap. | |
525 | ||
526 | \wxheading{Derived from} | |
527 | ||
528 | wxTreeItemId | |
529 | ||
530 | \wxheading{See also} | |
531 | ||
532 | \helpref{wxTreeCtrl}{wxtreectrl} | |
533 | ||
534 | \latexignore{\rtfignore{\wxheading{Members}}} | |
535 | ||
536 | \membersection{wxTreeItemData::wxTreeItemData}\label{wxtreeitemdataconstr} | |
537 | ||
538 | \func{}{wxTreeItemData}{\void} | |
539 | ||
540 | Default constructor. | |
541 | ||
542 | \membersection{wxTreeItemData::\destruct{wxTreeItemData}} | |
543 | ||
544 | \func{void}{\destruct{wxTreeItemData}}{\void} | |
545 | ||
546 | Virtual destructor. | |
547 | ||
548 | \membersection{wxTreeItemData::GetId}\label{wxtreeitemdatagetid} | |
549 | ||
550 | \func{const wxTreeItem\&}{GetId}{\void} | |
551 | ||
552 | Returns the item associated with this node. | |
553 | ||
554 | \membersection{wxTreeItemData::SetId}\label{wxtreeitemdatasetid} | |
a660d684 | 555 | |
4fabb575 | 556 | \func{void}{SetId}{\param{const wxTreeItemId\&}{ id}} |
a660d684 | 557 | |
4fabb575 | 558 | Sets the item associated with this node. |
a660d684 | 559 |