]>
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 | ||
954b8ae6 JS |
15 | \wxheading{Include files} |
16 | ||
17 | <wx/treectrl.h> | |
18 | ||
a660d684 KB |
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 | ||
5de76427 JS |
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 | ||
a660d684 KB |
52 | \wxheading{See also} |
53 | ||
4fabb575 | 54 | \helpref{wxTreeItemData}{wxtreeitemdata}, \helpref{wxTreeCtrl overview}{wxtreectrloverview}, \helpref{wxListBox}{wxlistbox}, \helpref{wxListCtrl}{wxlistctrl},\rtfsp |
a660d684 KB |
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 | ||
eaaa6a06 | 65 | \func{}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 66 | \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
eaaa6a06 | 67 | \param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}} |
a660d684 KB |
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 | ||
4fabb575 JS |
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 | ||
a660d684 KB |
130 | \membersection{wxTreeCtrl::Create}\label{wxtreectrlcreate} |
131 | ||
eaaa6a06 | 132 | \func{bool}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 133 | \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
eaaa6a06 | 134 | \param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}} |
a660d684 KB |
135 | |
136 | Creates the tree control. See \helpref{wxTreeCtrl::wxTreeCtrl}{wxtreectrlconstr} for further details. | |
137 | ||
4fabb575 | 138 | \membersection{wxTreeCtrl::Delete}\label{wxtreectrldelete} |
a660d684 | 139 | |
4fabb575 | 140 | \func{void}{Delete}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 141 | |
4fabb575 | 142 | Deletes the specified item. |
a660d684 | 143 | |
4fabb575 | 144 | \membersection{wxTreeCtrl::DeleteAllItems}\label{wxtreectrldeleteallitems} |
a660d684 | 145 | |
4fabb575 | 146 | \func{void}{DeleteAllItems}{\void} |
a660d684 | 147 | |
4fabb575 | 148 | Deletes all the items in the control. |
a660d684 | 149 | |
bbcdf8bc | 150 | \membersection{wxTreeCtrl::EditLabel}\label{wxtreectrleditlabel} |
a660d684 | 151 | |
4fabb575 | 152 | \func{wxTextCtrl*}{EditLabel}{\param{const wxTreeItemId\&}{ item}, \param{wxClassInfo*}{ textControlClass = CLASSINFO(wxTextCtrl)}} |
a660d684 KB |
153 | |
154 | Starts editing the label of the given item, returning the text control that the tree control uses for editing. | |
155 | ||
bbcdf8bc JS |
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 | ||
4fabb575 | 169 | \func{void}{EndEditLabel}{\param{bool }{cancelEdit}} |
bbcdf8bc JS |
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 | ||
a660d684 KB |
179 | \membersection{wxTreeCtrl::EnsureVisible}\label{wxtreectrlensurevisible} |
180 | ||
4fabb575 | 181 | \func{void}{EnsureVisible}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
182 | |
183 | Scrolls and/or expands items to ensure that the given item is visible. | |
184 | ||
4fabb575 | 185 | \membersection{wxTreeCtrl::Expand}\label{wxtreectrlexpand} |
a660d684 | 186 | |
4fabb575 | 187 | \func{void}{Expand}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
188 | |
189 | Expands the given item. | |
190 | ||
4fabb575 | 191 | \membersection{wxTreeCtrl::GetBoundingRect}\label{wxtreectrlgetitemrect} |
a660d684 | 192 | |
296ec7d3 | 193 | \constfunc{bool}{GetBoundingRect}{\param{const wxTreeItemId\&}{ item}, \param{wxRect\& }{rect}, \param{bool }{textOnly = FALSE}} |
4fabb575 | 194 | |
296ec7d3 VZ |
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. | |
a660d684 | 202 | |
4fabb575 | 203 | \membersection{wxTreeCtrl::GetChildrenCount}\label{wxtreectrlgetchildrencount} |
a660d684 | 204 | |
4fabb575 | 205 | \constfunc{size\_t}{GetChildrenCount}{\param{const wxTreeItemId\&}{ item}, \param{bool}{ recursively = TRUE}} |
a660d684 | 206 | |
4fabb575 JS |
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. | |
a660d684 KB |
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 | ||
4fabb575 JS |
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 | ||
ed93168b | 234 | Returns an invalid tree item if there are no further children. |
4fabb575 JS |
235 | |
236 | \wxheading{See also} | |
237 | ||
238 | \helpref{wxTreeCtrl::GetNextChild}{wxtreectrlgetnextchild} | |
239 | ||
a660d684 KB |
240 | \membersection{wxTreeCtrl::GetFirstVisibleItem}\label{wxtreectrlgetfirstvisibleitem} |
241 | ||
4fabb575 | 242 | \constfunc{wxTreeItemId}{GetFirstVisibleItem}{\void} |
a660d684 KB |
243 | |
244 | Returns the first visible item. | |
245 | ||
246 | \membersection{wxTreeCtrl::GetImageList}\label{wxtreectrlgetimagelist} | |
247 | ||
eaaa6a06 | 248 | \constfunc{wxImageList*}{GetImageList}{\param{int }{which = wxIMAGE\_LIST\_NORMAL}} |
a660d684 KB |
249 | |
250 | Returns the specified image list. {\it which} may be one of: | |
251 | ||
252 | \twocolwidtha{5cm} | |
253 | \begin{twocollist}\itemsep=0pt | |
254 | \twocolitem{\windowstyle{wxIMAGE\_LIST\_NORMAL}}{The normal (large icon) image list.} | |
255 | \twocolitem{\windowstyle{wxIMAGE\_LIST\_SMALL}}{The small icon image list.} | |
256 | \twocolitem{\windowstyle{wxIMAGE\_LIST\_STATE}}{The user-defined state image list (unimplemented).} | |
257 | \end{twocollist} | |
258 | ||
259 | \membersection{wxTreeCtrl::GetIndent}\label{wxtreectrlgetindent} | |
260 | ||
261 | \constfunc{int}{GetIndent}{\void} | |
262 | ||
263 | Returns the current tree control indentation. | |
264 | ||
4fabb575 | 265 | \membersection{wxTreeCtrl::GetItemData}\label{wxtreectrlgetitemdata} |
a660d684 | 266 | |
4fabb575 | 267 | \constfunc{wxTreeItemData*}{GetItemData}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 268 | |
4fabb575 | 269 | Returns the tree item data associated with the item. |
a660d684 | 270 | |
4fabb575 | 271 | \wxheading{See also} |
a660d684 | 272 | |
4fabb575 | 273 | \helpref{wxTreeItemData}{wxtreeitemdata} |
a660d684 | 274 | |
4fabb575 | 275 | \membersection{wxTreeCtrl::GetItemImage}\label{wxtreectrlgetitemimage} |
a660d684 | 276 | |
4fabb575 | 277 | \constfunc{int}{GetItemImage}{\param{const wxTreeItemId\& }{item}} |
a660d684 | 278 | |
4fabb575 | 279 | Gets the normal item image. |
a660d684 | 280 | |
4fabb575 | 281 | \membersection{wxTreeCtrl::GetItemText}\label{wxtreectrlgetitemtext} |
a660d684 | 282 | |
4fabb575 | 283 | \constfunc{wxString}{GetItemText}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 284 | |
4fabb575 | 285 | Returns the item label. |
a660d684 | 286 | |
978f38c2 VZ |
287 | \membersection{wxTreeCtrl::GetLastChild}\label{wxtreectrlgetlastchild} |
288 | ||
289 | \constfunc{wxTreeItemId}{GetLastChild}{\param{const wxTreeItemId\&}{ item}} | |
290 | ||
ed93168b | 291 | Returns the last child of the item (or an invalid tree item if this item has no children). |
978f38c2 VZ |
292 | |
293 | \wxheading{See also} | |
294 | ||
295 | \helpref{GetFirstChild}{wxtreectrlgetfirstchild}, | |
296 | \helpref{GetLastChild}{wxtreectrlgetlastchild} | |
297 | ||
4fabb575 | 298 | \membersection{wxTreeCtrl::GetNextChild}\label{wxtreectrlgetnextchild} |
a660d684 | 299 | |
4fabb575 | 300 | \constfunc{wxTreeItemId}{GetNextChild}{\param{const wxTreeItemId\&}{ item}, \param{long\& }{cookie}} |
a660d684 | 301 | |
4fabb575 | 302 | Returns the next child; call \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild} for the first child. |
a660d684 | 303 | |
4fabb575 JS |
304 | For this enumeration function you must pass in a `cookie' parameter |
305 | which is opaque for the application but is necessary for the library | |
306 | to make these functions reentrant (i.e. allow more than one | |
307 | enumeration on one and the same object simultaneously). The cookie passed to | |
308 | GetFirstChild and GetNextChild should be the same. | |
a660d684 | 309 | |
ed93168b | 310 | Returns an invalid tree item if there are no further children. |
a660d684 | 311 | |
4fabb575 | 312 | \wxheading{See also} |
a660d684 | 313 | |
4fabb575 | 314 | \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild} |
a660d684 | 315 | |
4fabb575 | 316 | \membersection{wxTreeCtrl::GetNextSibling}\label{wxtreectrlgetnextsibling} |
a660d684 | 317 | |
4fabb575 | 318 | \constfunc{wxTreeItemId}{GetNextSibling}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 319 | |
4fabb575 | 320 | Returns the next sibling of the specified item; call \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} for the previous sibling. |
a660d684 | 321 | |
ed93168b | 322 | Returns an invalid tree item if there are no further siblings. |
a660d684 | 323 | |
4fabb575 JS |
324 | \wxheading{See also} |
325 | ||
326 | \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} | |
327 | ||
328 | \membersection{wxTreeCtrl::GetNextVisible}\label{wxtreectrlgetnextvisible} | |
329 | ||
330 | \constfunc{wxTreeItemId}{GetNextVisible}{\param{const wxTreeItemId\&}{ item}} | |
a660d684 KB |
331 | |
332 | Returns the next visible item. | |
333 | ||
334 | \membersection{wxTreeCtrl::GetParent}\label{wxtreectrlgetparent} | |
335 | ||
4fabb575 | 336 | \constfunc{wxTreeItemId}{GetParent}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
337 | |
338 | Returns the item's parent. | |
339 | ||
4fabb575 JS |
340 | \membersection{wxTreeCtrl::GetPrevSibling}\label{wxtreectrlgetprevsibling} |
341 | ||
342 | \constfunc{wxTreeItemId}{GetPrevSibling}{\param{const wxTreeItemId\&}{ item}} | |
343 | ||
344 | Returns the previous sibling of the specified item; call \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} for the next sibling. | |
345 | ||
ed93168b | 346 | Returns an invalid tree item if there are no further children. |
4fabb575 JS |
347 | |
348 | \wxheading{See also} | |
349 | ||
350 | \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} | |
351 | ||
352 | \membersection{wxTreeCtrl::GetPrevVisible}\label{wxtreectrlgetprevvisible} | |
353 | ||
354 | \constfunc{wxTreeItemId}{GetPrevVisible}{\param{const wxTreeItemId\&}{ item}} | |
355 | ||
356 | Returns the previous visible item. | |
357 | ||
a660d684 KB |
358 | \membersection{wxTreeCtrl::GetRootItem}\label{wxtreectrlgetrootitem} |
359 | ||
4fabb575 | 360 | \constfunc{wxTreeItemId}{GetRootItem}{\void} |
a660d684 KB |
361 | |
362 | Returns the root item for the tree control. | |
363 | ||
ed93168b | 364 | \membersection{wxTreeCtrl::GetItemSelectedImage}\label{wxtreectrlgetitemselectedimage} |
4fabb575 | 365 | |
ed93168b | 366 | \constfunc{int}{GetItemSelectedImage}{\param{const wxTreeItemId\& }{item}} |
4fabb575 JS |
367 | |
368 | Gets the selected item image. | |
369 | ||
a660d684 KB |
370 | \membersection{wxTreeCtrl::GetSelection}\label{wxtreectrlgetselection} |
371 | ||
4fabb575 | 372 | \constfunc{wxTreeItemId}{GetSelection}{\void} |
a660d684 | 373 | |
ed93168b | 374 | Returns the selection, or an invalid item if there is no selection. |
a660d684 KB |
375 | |
376 | \membersection{wxTreeCtrl::HitTest}\label{wxtreectrlhittest} | |
377 | ||
378 | \func{long}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}} | |
379 | ||
380 | Calculates which (if any) item is under the given point, returning extra information | |
381 | in {\it flags}. {\it flags} is a bitlist of the following: | |
382 | ||
383 | \twocolwidtha{5cm} | |
384 | \begin{twocollist}\itemsep=0pt | |
385 | \twocolitem{wxTREE\_HITTEST\_ABOVE}{Above the client area.} | |
386 | \twocolitem{wxTREE\_HITTEST\_BELOW}{Below the client area.} | |
387 | \twocolitem{wxTREE\_HITTEST\_NOWHERE}{In the client area but below the last item.} | |
388 | \twocolitem{wxTREE\_HITTEST\_ONITEMBUTTON}{On the button associated with an item.} | |
389 | \twocolitem{wxTREE\_HITTEST\_ONITEMICON}{On the bitmap associated with an item.} | |
390 | \twocolitem{wxTREE\_HITTEST\_ONITEMINDENT}{In the indentation associated with an item.} | |
391 | \twocolitem{wxTREE\_HITTEST\_ONITEMLABEL}{On the label (string) associated with an item.} | |
392 | \twocolitem{wxTREE\_HITTEST\_ONITEMRIGHT}{In the area to the right of an item.} | |
393 | \twocolitem{wxTREE\_HITTEST\_ONITEMSTATEICON}{On the state icon for a tree view item that is in a user-defined state.} | |
394 | \twocolitem{wxTREE\_HITTEST\_TOLEFT}{To the right of the client area.} | |
395 | \twocolitem{wxTREE\_HITTEST\_TORIGHT}{To the left of the client area.} | |
396 | \end{twocollist} | |
397 | ||
398 | \membersection{wxTreeCtrl::InsertItem}\label{wxtreectrlinsertitem} | |
399 | ||
4fabb575 JS |
400 | \func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxTreeItemId\& }{previous}, \param{const wxString\&}{ text}, |
401 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
a660d684 | 402 | |
4fabb575 | 403 | Inserts an item after a given one. |
a660d684 KB |
404 | |
405 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for | |
406 | both selected and unselected items. | |
407 | ||
ed93168b VZ |
408 | \membersection{wxTreeCtrl::IsBold}\label{wxtreectrlisbold} |
409 | ||
410 | \constfunc{bool}{IsBold}{\param{const wxTreeItemId\& }{item}} | |
411 | ||
412 | Returns TRUE if the given item is in bold state. | |
413 | ||
414 | See also: \helpref{SetItemBold}{wxtreectrlsetitembold} | |
415 | ||
4fabb575 JS |
416 | \membersection{wxTreeCtrl::IsExpanded}\label{wxtreectrlisexpanded} |
417 | ||
418 | \constfunc{bool}{IsExpanded}{\param{const wxTreeItemId\&}{ item}} | |
419 | ||
420 | Returns TRUE if the item is expanded (only makes sense if it has children). | |
421 | ||
422 | \membersection{wxTreeCtrl::IsSelected}\label{wxtreectrlisselected} | |
423 | ||
424 | \constfunc{bool}{IsSelected}{\param{const wxTreeItemId\&}{ item}} | |
425 | ||
426 | Returns TRUE if the item is selected. | |
427 | ||
428 | \membersection{wxTreeCtrl::IsVisible}\label{wxtreectrlisvisible} | |
429 | ||
430 | \constfunc{bool}{IsVisible}{\param{const wxTreeItemId\&}{ item}} | |
431 | ||
432 | Returns TRUE if the item is visible (it might be outside the view, or not expanded). | |
433 | ||
a660d684 KB |
434 | \membersection{wxTreeCtrl::ItemHasChildren}\label{wxtreectrlitemhaschildren} |
435 | ||
4fabb575 | 436 | \constfunc{bool}{ItemHasChildren}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
437 | |
438 | Returns TRUE if the item has children. | |
439 | ||
ed93168b VZ |
440 | \membersection{wxTreeCtrl::OnCompareItems}\label{wxtreectrloncompareitems} |
441 | ||
442 | \func{int}{OnCompareItems}{\param{const wxTreeItemId\& }{item1}, \param{const wxTreeItemId\& }{item2}} | |
443 | ||
444 | Override this function in the derived class to change the sort order of the | |
445 | items in the tree control. The function should return a negative, zero or | |
446 | positive value if the first item is less than, equal to or greater than the | |
447 | second one. | |
448 | ||
449 | The base class version compares items alphabetically. | |
450 | ||
451 | See also: \helpref{SortChildren}{wxtreectrlsortchildren} | |
452 | ||
4fabb575 JS |
453 | \membersection{wxTreeCtrl::PrependItem}\label{wxtreectrlprependitem} |
454 | ||
455 | \func{wxTreeItemId}{PrependItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxString\&}{ text}, | |
456 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
457 | ||
458 | Appends an item as the first child of {\it parent}, return a new item id. | |
459 | ||
460 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for | |
461 | both selected and unselected items. | |
462 | ||
a660d684 KB |
463 | \membersection{wxTreeCtrl::ScrollTo}\label{wxtreectrlscrollto} |
464 | ||
4fabb575 | 465 | \func{void}{ScrollTo}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 466 | |
4fabb575 | 467 | Scrolls the specified item into view. |
a660d684 KB |
468 | |
469 | \membersection{wxTreeCtrl::SelectItem}\label{wxtreectrlselectitem} | |
470 | ||
4fabb575 | 471 | \func{bool}{SelectItem}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
472 | |
473 | Selects the given item. | |
474 | ||
475 | \membersection{wxTreeCtrl::SetIndent}\label{wxtreectrlsetindent} | |
476 | ||
477 | \func{void}{SetIndent}{\param{int }{indent}} | |
478 | ||
479 | Sets the indentation for the tree control. | |
480 | ||
481 | \membersection{wxTreeCtrl::SetImageList}\label{wxtreectrlsetimagelist} | |
482 | ||
eaaa6a06 | 483 | \func{void}{SetImageList}{\param{wxImageList*}{ imageList}, \param{int }{which = wxIMAGE\_LIST\_NORMAL}} |
a660d684 KB |
484 | |
485 | Sets the image list. {\it which} should be one of wxIMAGE\_LIST\_NORMAL, wxIMAGE\_LIST\_SMALL and | |
486 | wxIMAGE\_LIST\_STATE. | |
487 | ||
ed93168b VZ |
488 | \membersection{wxTreeCtrl::SetItemBold}\label{wxtreectrlsetitembold} |
489 | ||
490 | \func{void}{SetItemBold}{\param{const wxTreeItemId\& }{item}, \param{bool}{ bold = TRUE}} | |
491 | ||
492 | Makes item appear in bold font if {\it bold} parameter is TRUE or resets it to | |
493 | the normal state. | |
494 | ||
495 | See also: \helpref{IsBold}{wxtreectrlisbold} | |
496 | ||
4fabb575 | 497 | \membersection{wxTreeCtrl::SetItemData}\label{wxtreectrlsetitemdata} |
a660d684 | 498 | |
4fabb575 | 499 | \func{void}{SetItemData}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemData* }{data}} |
a660d684 | 500 | |
4fabb575 | 501 | Sets the item client data. |
a660d684 | 502 | |
4fabb575 | 503 | \membersection{wxTreeCtrl::SetItemHasChildren}\label{wxtreectrlsetitemhaschildren} |
a660d684 | 504 | |
4fabb575 | 505 | \func{void}{SetItemHasChildren}{\param{const wxTreeItemId\&}{ item}, \param{bool }{hasChildren = TRUE}} |
a660d684 | 506 | |
4fabb575 JS |
507 | Force appearance of the button next to the item. This is useful to |
508 | allow the user to expand the items which don't have any children now, | |
509 | but instead adding them only when needed, thus minimizing memory | |
510 | usage and loading time. | |
a660d684 KB |
511 | |
512 | \membersection{wxTreeCtrl::SetItemImage}\label{wxtreectrlsetitemimage} | |
513 | ||
4fabb575 | 514 | \func{void}{SetItemImage}{\param{const wxTreeItemId\&}{ item}, \param{int }{image}} |
a660d684 | 515 | |
4fabb575 | 516 | Sets the normal item image. This is an index into the assciated image list. |
a660d684 | 517 | |
4fabb575 | 518 | \membersection{wxTreeCtrl::SetItemSelectedImage}\label{wxtreectrlsetitemselectedimage} |
a660d684 | 519 | |
4fabb575 | 520 | \func{void}{SetItemSelectedImage}{\param{const wxTreeItemId\&}{ item}, \param{int }{selImage}} |
a660d684 | 521 | |
4fabb575 | 522 | Sets the item selected image. This is an index into the assciated image list. |
a660d684 KB |
523 | |
524 | \membersection{wxTreeCtrl::SetItemText}\label{wxtreectrlsetitemtext} | |
525 | ||
4fabb575 | 526 | \func{void}{SetItemText}{\param{const wxTreeItemId\&}{ item}, \param{const wxString\& }{text}} |
a660d684 KB |
527 | |
528 | Sets the item label. | |
529 | ||
4fabb575 | 530 | \membersection{wxTreeCtrl::SortChildren}\label{wxtreectrlsortchildren} |
a660d684 | 531 | |
ed93168b | 532 | \func{void}{SortChildren}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 533 | |
ed93168b VZ |
534 | Sorts the children of the given item using |
535 | \helpref{OnCompareItems}{wxtreectrloncompareitems} method of wxTreeCtrl. You | |
536 | should override that method to change the sort order (default is ascending | |
537 | alphabetical order). | |
4fabb575 JS |
538 | |
539 | \wxheading{See also} | |
540 | ||
ed93168b | 541 | \helpref{wxTreeItemData}{wxtreeitemdata}, \helpref{OnCompareItems}{wxtreectrloncompareitems} |
4fabb575 JS |
542 | |
543 | \membersection{wxTreeCtrl::Toggle}\label{wxtreectrltoggle} | |
544 | ||
545 | \func{void}{Toggle}{\param{const wxTreeItemId\&}{ item}} | |
546 | ||
547 | Toggles the given item between collapsed and expanded states. | |
548 | ||
549 | \membersection{wxTreeCtrl::Unselect}\label{wxtreectrlunselect} | |
550 | ||
551 | \func{void}{Unselect}{\void} | |
552 | ||
553 | Removes the selection from the currently selected item (if any). | |
554 | ||
555 | \section{\class{wxTreeItemData}}\label{wxtreeitemdata} | |
556 | ||
557 | wxTreeItemData is some (arbitrary) user class associated with some item. The | |
558 | main advantage of having this class (compared to the old untyped interface) is | |
559 | that wxTreeItemData's are destroyed automatically by the tree and, as this | |
560 | class has virtual dtor, it means that the memory will be automatically | |
561 | freed. We don't just use wxObject instead of wxTreeItemData because | |
562 | the size of this class is critical: in any real application, each tree leaf | |
563 | will have wxTreeItemData associated with it and number of leaves may be | |
564 | quite big. | |
565 | ||
566 | Because the objects of this class are deleted by the tree, they should | |
567 | always be allocated on the heap. | |
568 | ||
569 | \wxheading{Derived from} | |
570 | ||
571 | wxTreeItemId | |
572 | ||
954b8ae6 JS |
573 | \wxheading{Include files} |
574 | ||
575 | <wx/treectrl.h> | |
576 | ||
4fabb575 JS |
577 | \wxheading{See also} |
578 | ||
579 | \helpref{wxTreeCtrl}{wxtreectrl} | |
580 | ||
581 | \latexignore{\rtfignore{\wxheading{Members}}} | |
582 | ||
583 | \membersection{wxTreeItemData::wxTreeItemData}\label{wxtreeitemdataconstr} | |
584 | ||
585 | \func{}{wxTreeItemData}{\void} | |
586 | ||
587 | Default constructor. | |
588 | ||
589 | \membersection{wxTreeItemData::\destruct{wxTreeItemData}} | |
590 | ||
591 | \func{void}{\destruct{wxTreeItemData}}{\void} | |
592 | ||
593 | Virtual destructor. | |
594 | ||
595 | \membersection{wxTreeItemData::GetId}\label{wxtreeitemdatagetid} | |
596 | ||
597 | \func{const wxTreeItem\&}{GetId}{\void} | |
598 | ||
599 | Returns the item associated with this node. | |
600 | ||
601 | \membersection{wxTreeItemData::SetId}\label{wxtreeitemdatasetid} | |
a660d684 | 602 | |
4fabb575 | 603 | \func{void}{SetId}{\param{const wxTreeItemId\&}{ id}} |
a660d684 | 604 | |
4fabb575 | 605 | Sets the item associated with this node. |
a660d684 | 606 |