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