]>
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 | |
ea91314f VS |
23 | \twocolitem{\windowstyle{wxTR\_EDIT\_LABELS}}{Use this style |
24 | if you wish the user to be able to edit labels in the tree control.} | |
25 | \twocolitem{\windowstyle{wxTR\_NO\_BUTTONS}}{For convenience | |
26 | to document that no buttons are to be drawn.} | |
27 | \twocolitem{\windowstyle{wxTR\_HAS\_BUTTONS}}{Use this style | |
28 | to show + and - buttons to the left of parent items.} | |
29 | \twocolitem{\windowstyle{wxTR\_TWIST\_BUTTONS}}{Use this style | |
30 | to show Mac-style twister buttons to the left of parent items. | |
31 | If both wxTR\_HAS\_BUTTONS and wxTR\_TWIST\_BUTTONS are given, | |
32 | twister buttons are generated. Generic only.} | |
33 | \twocolitem{\windowstyle{wxTR\_NO\_LINES}}{Use this style | |
34 | to hide vertical level connectors.} | |
c6f4913a VS |
35 | \twocolitem{\windowstyle{wxTR\_FULL\_ROW\_HIGHLIGHT}}{Use this style to have the background |
36 | colour and the selection highlight extend over the entire horizontal | |
37 | row of the tree control window. (This flag is ignored under Windows unless you | |
63969272 | 38 | specify wxTR\_NO\_LINES as well.) } |
ea91314f VS |
39 | \twocolitem{\windowstyle{wxTR\_LINES\_AT\_ROOT}}{Use this style |
40 | to show lines between root nodes. | |
41 | Only applicable if wxTR\_HIDE\_ROOT is set and wxTR\_NO\_LINES is not set.} | |
42 | \twocolitem{\windowstyle{wxTR\_HIDE\_ROOT}}{Use this style | |
43 | to suppress the display of the root node, | |
44 | effectively causing the first-level nodes | |
45 | to appear as a series of root nodes. Generic only.} | |
46 | \twocolitem{\windowstyle{wxTR\_ROW\_LINES}}{Use this style | |
47 | to draw a contrasting border between displayed rows.} | |
48 | \twocolitem{\windowstyle{wxTR\_HAS\_VARIABLE\_ROW\_HEIGHT}}{Use this style | |
49 | to cause row heights to be just big enough to fit the content. | |
50 | If not set, all rows use the largest row height. | |
51 | The default is that this flag is unset. | |
52 | Generic only.} | |
53 | \twocolitem{\windowstyle{wxTR\_SINGLE}}{For convenience | |
54 | to document that only one item may be selected at a time. | |
55 | Selecting another item causes the current selection, if any, | |
56 | to be deselected. This is the default.} | |
57 | \twocolitem{\windowstyle{wxTR\_MULTIPLE}}{Use this style | |
58 | to allow a range of items to be selected. | |
59 | If a second range is selected, the current range, if any, is deselected.} | |
60 | \twocolitem{\windowstyle{wxTR\_EXTENDED}}{Use this style | |
61 | to allow disjoint items to be selected. (Only partially implemented; may not work in all cases.)} | |
62 | \twocolitem{\windowstyle{wxTR\_DEFAULT\_STYLE}}{The set of flags that are | |
63 | closest to the defaults for the native control for a particular toolkit.} | |
a660d684 KB |
64 | \end{twocollist} |
65 | ||
66 | See also \helpref{window styles overview}{windowstyles}. | |
67 | ||
5de76427 JS |
68 | \wxheading{Event handling} |
69 | ||
70 | To process input from a tree control, use these event handler macros to direct input to member | |
71 | functions that take a \helpref{wxTreeEvent}{wxtreeevent} argument. | |
72 | ||
73 | \twocolwidtha{7cm} | |
74 | \begin{twocollist}\itemsep=0pt | |
75 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_DRAG(id, func)}}{Begin dragging with the left mouse button.} | |
76 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_RDRAG(id, func)}}{Begin dragging with the right mouse button.} | |
fd128b0c RR |
77 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_LABEL\_EDIT(id, func)}}{Begin editing a label. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} |
78 | \twocolitem{{\bf EVT\_TREE\_END\_LABEL\_EDIT(id, func)}}{Finish editing a label. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} | |
5de76427 JS |
79 | \twocolitem{{\bf EVT\_TREE\_DELETE\_ITEM(id, func)}}{Delete an item.} |
80 | \twocolitem{{\bf EVT\_TREE\_GET\_INFO(id, func)}}{Request information from the application.} | |
81 | \twocolitem{{\bf EVT\_TREE\_SET\_INFO(id, func)}}{Information is being supplied.} | |
9711961c | 82 | \twocolitem{{\bf EVT\_TREE\_ITEM\_ACTIVATED(id, func)}}{The item has been activated, i.e. chosen by double clicking it with mouse or from keyboard} |
fb96bc75 VZ |
83 | \twocolitem{{\bf EVT\_TREE\_ITEM\_COLLAPSED(id, func)}}{The item has been collapsed.} |
84 | \twocolitem{{\bf EVT\_TREE\_ITEM\_COLLAPSING(id, func)}}{The item is being collapsed. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} | |
85 | \twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDED(id, func)}}{The item has been expanded.} | |
86 | \twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDING(id, func)}}{The item is being expanded. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} | |
5de76427 | 87 | \twocolitem{{\bf EVT\_TREE\_SEL\_CHANGED(id, func)}}{Selection has changed.} |
fd128b0c | 88 | \twocolitem{{\bf EVT\_TREE\_SEL\_CHANGING(id, func)}}{Selection is changing. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} |
5de76427 JS |
89 | \twocolitem{{\bf EVT\_TREE\_KEY\_DOWN(id, func)}}{A key has been pressed.} |
90 | \end{twocollist}% | |
91 | ||
a660d684 KB |
92 | \wxheading{See also} |
93 | ||
4fabb575 | 94 | \helpref{wxTreeItemData}{wxtreeitemdata}, \helpref{wxTreeCtrl overview}{wxtreectrloverview}, \helpref{wxListBox}{wxlistbox}, \helpref{wxListCtrl}{wxlistctrl},\rtfsp |
a660d684 KB |
95 | \helpref{wxImageList}{wximagelist}, \helpref{wxTreeEvent}{wxtreeevent} |
96 | ||
61714c23 VZ |
97 | \wxheading{Win32 notes} |
98 | ||
99 | wxTreeCtrl class uses the standard common treeview control under Win32 | |
100 | implemented in the system library {\tt comctl32.dll}. Some versions of this | |
101 | library are known to have bugs with handling the tree control colours: the | |
102 | usual symptom is that the expanded items leave black (or otherwise incorrectly | |
103 | coloured) background behind them, especially for the controls using non | |
f6bcfd97 BP |
104 | default background colour. The recommended solution is to upgrade the {\tt comctl32.dll} |
105 | to a newer version: see | |
61714c23 VZ |
106 | \urlref{http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp}{http://www.microsoft.com/msdownload/ieplatform/ie/comctrlx86.asp}. |
107 | ||
a660d684 KB |
108 | \latexignore{\rtfignore{\wxheading{Members}}} |
109 | ||
110 | \membersection{wxTreeCtrl::wxTreeCtrl}\label{wxtreectrlconstr} | |
111 | ||
112 | \func{}{wxTreeCtrl}{\void} | |
113 | ||
114 | Default constructor. | |
115 | ||
eaaa6a06 | 116 | \func{}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 117 | \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
eaaa6a06 | 118 | \param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}} |
a660d684 KB |
119 | |
120 | Constructor, creating and showing a tree control. | |
121 | ||
122 | \wxheading{Parameters} | |
123 | ||
124 | \docparam{parent}{Parent window. Must not be NULL.} | |
125 | ||
126 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
127 | ||
128 | \docparam{pos}{Window position.} | |
129 | ||
130 | \docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized | |
131 | appropriately.} | |
132 | ||
133 | \docparam{style}{Window style. See \helpref{wxTreeCtrl}{wxtreectrl}.} | |
134 | ||
135 | \docparam{validator}{Window validator.} | |
136 | ||
137 | \docparam{name}{Window name.} | |
138 | ||
139 | \wxheading{See also} | |
140 | ||
141 | \helpref{wxTreeCtrl::Create}{wxtreectrlcreate}, \helpref{wxValidator}{wxvalidator} | |
142 | ||
143 | \membersection{wxTreeCtrl::\destruct{wxTreeCtrl}} | |
144 | ||
145 | \func{void}{\destruct{wxTreeCtrl}}{\void} | |
146 | ||
147 | Destructor, destroying the list control. | |
148 | ||
4fabb575 JS |
149 | \membersection{wxTreeCtrl::AddRoot}\label{wxtreectrladdroot} |
150 | ||
151 | \func{wxTreeItemId}{AddRoot}{\param{const wxString\&}{ text}, | |
152 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
153 | ||
154 | Adds the root node to the tree, returning the new item. | |
155 | ||
ea91314f VS |
156 | The {\it image} and {\it selImage} parameters are an index within |
157 | the normal image list specifying the image to use for unselected and | |
158 | selected items, respectively. | |
4fabb575 JS |
159 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for |
160 | both selected and unselected items. | |
161 | ||
162 | \membersection{wxTreeCtrl::AppendItem}\label{wxtreectrlappenditem} | |
163 | ||
164 | \func{wxTreeItemId}{AppendItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxString\&}{ text}, | |
165 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
166 | ||
167 | Appends an item to the end of the branch identified by {\it parent}, return a new item id. | |
168 | ||
ea91314f VS |
169 | The {\it image} and {\it selImage} parameters are an index within |
170 | the normal image list specifying the image to use for unselected and | |
171 | selected items, respectively. | |
4fabb575 JS |
172 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for |
173 | both selected and unselected items. | |
174 | ||
ea91314f VS |
175 | \membersection{wxTreeCtrl::AssignButtonsImageList}\label{wxtreectrlassignbuttonsimagelist} |
176 | ||
177 | \func{void}{AssignButtonsImageList}{\param{wxImageList*}{ imageList}} | |
178 | ||
179 | Sets the buttons image list. The button images assigned with this method will | |
180 | be automatically deleted by wxTreeCtrl as appropriate | |
181 | (i.e. it takes ownership of the list). | |
182 | ||
183 | Setting or assigning the button image list enables the display of image buttons. | |
184 | Once enabled, the only way to disable the display of button images is to set | |
185 | the button image list to NULL. | |
186 | ||
187 | This function is only available in the generic version. | |
188 | ||
189 | See also \helpref{SetButtonsImageList}{wxtreectrlsetbuttonsimagelist}. | |
190 | ||
46cd520d VS |
191 | \membersection{wxTreeCtrl::AssignImageList}\label{wxtreectrlassignimagelist} |
192 | ||
193 | \func{void}{AssignImageList}{\param{wxImageList*}{ imageList}} | |
194 | ||
195 | Sets the normal image list. Image list assigned with this method will | |
ea91314f VS |
196 | be automatically deleted by wxTreeCtrl as appropriate |
197 | (i.e. it takes ownership of the list). | |
46cd520d VS |
198 | |
199 | See also \helpref{SetImageList}{wxtreectrlsetimagelist}. | |
200 | ||
201 | \membersection{wxTreeCtrl::AssignStateImageList}\label{wxtreectrlassignstateimagelist} | |
202 | ||
203 | \func{void}{AssignStateImageList}{\param{wxImageList*}{ imageList}} | |
204 | ||
205 | Sets the state image list. Image list assigned with this method will | |
ea91314f VS |
206 | be automatically deleted by wxTreeCtrl as appropriate |
207 | (i.e. it takes ownership of the list). | |
46cd520d VS |
208 | |
209 | See also \helpref{SetStateImageList}{wxtreectrlsetstateimagelist}. | |
210 | ||
211 | ||
4fabb575 JS |
212 | \membersection{wxTreeCtrl::Collapse}\label{wxtreectrlcollapse} |
213 | ||
214 | \func{void}{Collapse}{\param{const wxTreeItemId\&}{ item}} | |
215 | ||
216 | Collapses the given item. | |
217 | ||
218 | \membersection{wxTreeCtrl::CollapseAndReset}\label{wxtreectrlcollapseandreset} | |
219 | ||
220 | \func{void}{CollapseAndReset}{\param{const wxTreeItemId\&}{ item}} | |
221 | ||
222 | Collapses the given item and removes all children. | |
223 | ||
a660d684 KB |
224 | \membersection{wxTreeCtrl::Create}\label{wxtreectrlcreate} |
225 | ||
eaaa6a06 | 226 | \func{bool}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 227 | \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
eaaa6a06 | 228 | \param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}} |
a660d684 KB |
229 | |
230 | Creates the tree control. See \helpref{wxTreeCtrl::wxTreeCtrl}{wxtreectrlconstr} for further details. | |
231 | ||
4fabb575 | 232 | \membersection{wxTreeCtrl::Delete}\label{wxtreectrldelete} |
a660d684 | 233 | |
4fabb575 | 234 | \func{void}{Delete}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 235 | |
4fabb575 | 236 | Deletes the specified item. |
a660d684 | 237 | |
4fabb575 | 238 | \membersection{wxTreeCtrl::DeleteAllItems}\label{wxtreectrldeleteallitems} |
a660d684 | 239 | |
4fabb575 | 240 | \func{void}{DeleteAllItems}{\void} |
a660d684 | 241 | |
4fabb575 | 242 | Deletes all the items in the control. |
a660d684 | 243 | |
bbcdf8bc | 244 | \membersection{wxTreeCtrl::EditLabel}\label{wxtreectrleditlabel} |
a660d684 | 245 | |
fd128b0c | 246 | \func{void}{EditLabel}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 247 | |
fd128b0c RR |
248 | Starts editing the label of the given item. This function generates a |
249 | EVT\_TREE\_BEGIN\_LABEL\_EDIT event which can be vetoed so that no | |
250 | text control will appear for in-place editing. | |
a660d684 | 251 | |
fd128b0c | 252 | If the user changed the label (i.e. s/he does not press ESC or leave |
76e1c2de | 253 | the text control without changes, a EVT\_TREE\_END\_LABEL\_EDIT event |
fd128b0c | 254 | will be sent which can be vetoed as well. |
bbcdf8bc JS |
255 | |
256 | \wxheading{See also} | |
257 | ||
f6bcfd97 | 258 | \helpref{wxTreeCtrl::EndEditLabel}{wxtreectrlendeditlabel}, |
86f975a8 | 259 | \helpref{wxTreeEvent}{wxtreeevent} |
bbcdf8bc JS |
260 | |
261 | \membersection{wxTreeCtrl::EndEditLabel}\label{wxtreectrlendeditlabel} | |
262 | ||
4fabb575 | 263 | \func{void}{EndEditLabel}{\param{bool }{cancelEdit}} |
bbcdf8bc JS |
264 | |
265 | Ends label editing. If {\it cancelEdit} is TRUE, the edit will be cancelled. | |
266 | ||
267 | This function is currently supported under Windows only. | |
268 | ||
269 | \wxheading{See also} | |
270 | ||
271 | \helpref{wxTreeCtrl::EditLabel}{wxtreectrleditlabel} | |
272 | ||
a660d684 KB |
273 | \membersection{wxTreeCtrl::EnsureVisible}\label{wxtreectrlensurevisible} |
274 | ||
4fabb575 | 275 | \func{void}{EnsureVisible}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
276 | |
277 | Scrolls and/or expands items to ensure that the given item is visible. | |
278 | ||
4fabb575 | 279 | \membersection{wxTreeCtrl::Expand}\label{wxtreectrlexpand} |
a660d684 | 280 | |
4fabb575 | 281 | \func{void}{Expand}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
282 | |
283 | Expands the given item. | |
284 | ||
4fabb575 | 285 | \membersection{wxTreeCtrl::GetBoundingRect}\label{wxtreectrlgetitemrect} |
a660d684 | 286 | |
296ec7d3 | 287 | \constfunc{bool}{GetBoundingRect}{\param{const wxTreeItemId\&}{ item}, \param{wxRect\& }{rect}, \param{bool }{textOnly = FALSE}} |
4fabb575 | 288 | |
296ec7d3 | 289 | Retrieves the rectangle bounding the {\it item}. If {\it textOnly} is TRUE, |
ea91314f VS |
290 | only the rectangle around the item's label will be returned, otherwise the |
291 | item's image is also taken into account. | |
296ec7d3 VZ |
292 | |
293 | The return value is TRUE if the rectangle was successfully retrieved or FALSE | |
294 | if it was not (in this case {\it rect} is not changed) - for example, if the | |
295 | item is currently invisible. | |
a660d684 | 296 | |
76e1c2de | 297 | \pythonnote{The wxPython version of this method requires only the |
c9110876 VS |
298 | {\tt item} and {\tt textOnly} parameters. The return value is either a |
299 | {\tt wxRect} object or {\tt None}.} | |
76e1c2de | 300 | |
f3539882 VZ |
301 | \perlnote{In wxPerl this method only takes the parameters {\tt item} and |
302 | {\tt textOnly}, and returns a Wx::Rect ( or undef ).} | |
303 | ||
ea91314f VS |
304 | \membersection{wxTreeCtrl::GetButtonsImageList}\label{wxtreectrlgetbuttonsimagelist} |
305 | ||
306 | \constfunc{wxImageList*}{GetButtonsImageList}{\void} | |
307 | ||
308 | Returns the buttons image list (from which application-defined button images are taken). | |
309 | ||
310 | This function is only available in the generic version. | |
311 | ||
4fabb575 | 312 | \membersection{wxTreeCtrl::GetChildrenCount}\label{wxtreectrlgetchildrencount} |
a660d684 | 313 | |
4fabb575 | 314 | \constfunc{size\_t}{GetChildrenCount}{\param{const wxTreeItemId\&}{ item}, \param{bool}{ recursively = TRUE}} |
a660d684 | 315 | |
4fabb575 JS |
316 | Returns the number of items in the branch. If {\it recursively} is TRUE, returns the total number |
317 | of descendants, otherwise only one level of children is counted. | |
a660d684 KB |
318 | |
319 | \membersection{wxTreeCtrl::GetCount}\label{wxtreectrlgetcount} | |
320 | ||
321 | \constfunc{int}{GetCount}{\void} | |
322 | ||
323 | Returns the number of items in the control. | |
324 | ||
325 | \membersection{wxTreeCtrl::GetEditControl}\label{wxtreectrlgeteditcontrol} | |
326 | ||
327 | \constfunc{wxTextCtrl\&}{GetEditControl}{\void} | |
328 | ||
329 | Returns the edit control used to edit a label. | |
330 | ||
4fabb575 JS |
331 | \membersection{wxTreeCtrl::GetFirstChild}\label{wxtreectrlgetfirstchild} |
332 | ||
333 | \constfunc{wxTreeItemId}{GetFirstChild}{\param{const wxTreeItemId\&}{ item}, \param{long\& }{cookie}} | |
334 | ||
335 | Returns the first child; call \helpref{wxTreeCtrl::GetNextChild}{wxtreectrlgetnextchild} for the next child. | |
336 | ||
337 | For this enumeration function you must pass in a `cookie' parameter | |
338 | which is opaque for the application but is necessary for the library | |
339 | to make these functions reentrant (i.e. allow more than one | |
340 | enumeration on one and the same object simultaneously). The cookie passed to | |
341 | GetFirstChild and GetNextChild should be the same. | |
342 | ||
ed93168b | 343 | Returns an invalid tree item if there are no further children. |
4fabb575 JS |
344 | |
345 | \wxheading{See also} | |
346 | ||
347 | \helpref{wxTreeCtrl::GetNextChild}{wxtreectrlgetnextchild} | |
348 | ||
f899db6d RD |
349 | \pythonnote{In wxPython the returned wxTreeItemId and the new cookie |
350 | value are both returned as a tuple containing the two values.} | |
351 | ||
f3539882 VZ |
352 | \perlnote{In wxPerl this method only takes the {\tt item} parameter, and |
353 | returns a 2-element list ( item, cookie ).} | |
354 | ||
a660d684 KB |
355 | \membersection{wxTreeCtrl::GetFirstVisibleItem}\label{wxtreectrlgetfirstvisibleitem} |
356 | ||
4fabb575 | 357 | \constfunc{wxTreeItemId}{GetFirstVisibleItem}{\void} |
a660d684 KB |
358 | |
359 | Returns the first visible item. | |
360 | ||
361 | \membersection{wxTreeCtrl::GetImageList}\label{wxtreectrlgetimagelist} | |
362 | ||
e2b34251 | 363 | \constfunc{wxImageList*}{GetImageList}{\void} |
a660d684 | 364 | |
e2b34251 | 365 | Returns the normal image list. |
a660d684 KB |
366 | |
367 | \membersection{wxTreeCtrl::GetIndent}\label{wxtreectrlgetindent} | |
368 | ||
369 | \constfunc{int}{GetIndent}{\void} | |
370 | ||
371 | Returns the current tree control indentation. | |
372 | ||
4fabb575 | 373 | \membersection{wxTreeCtrl::GetItemData}\label{wxtreectrlgetitemdata} |
a660d684 | 374 | |
4fabb575 | 375 | \constfunc{wxTreeItemData*}{GetItemData}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 376 | |
4fabb575 | 377 | Returns the tree item data associated with the item. |
a660d684 | 378 | |
4fabb575 | 379 | \wxheading{See also} |
a660d684 | 380 | |
4fabb575 | 381 | \helpref{wxTreeItemData}{wxtreeitemdata} |
a660d684 | 382 | |
ecf527c0 JS |
383 | \pythonnote{wxPython provides the following shortcut method: |
384 | ||
385 | \indented{2cm}{\begin{twocollist}\itemsep=0pt | |
c9110876 | 386 | \twocolitem{{\bf GetPyData(item)}}{Returns the Python Object |
f899db6d RD |
387 | associated with the wxTreeItemData for the given item Id.} |
388 | \end{twocollist}} | |
389 | } | |
390 | ||
f3539882 VZ |
391 | \perlnote{wxPerl provides the following shortcut method: |
392 | \indented{2cm}{ | |
393 | \begin{twocollist}\itemsep=0pt | |
394 | \twocolitem{{\bf GetPlData( item )}}{Returns the Perl data | |
395 | associated with the Wx::TreeItemData ( it is just the same as | |
396 | tree->GetItemData( item )->GetData(); ).} | |
397 | \end{twocollist}} | |
398 | } | |
399 | ||
4fabb575 | 400 | \membersection{wxTreeCtrl::GetItemImage}\label{wxtreectrlgetitemimage} |
a660d684 | 401 | |
74b31181 | 402 | \constfunc{int}{GetItemImage}{\param{const wxTreeItemId\& }{item}, |
ecf527c0 | 403 | \param{wxTreeItemIcon }{which = wxTreeItemIcon\_Normal}} |
74b31181 VZ |
404 | |
405 | Gets the specified item image. The value of {\it which} may be: | |
ecf527c0 | 406 | |
74b31181 VZ |
407 | \begin{itemize}\itemsep=0pt |
408 | \item{wxTreeItemIcon\_Normal} to get the normal item image | |
409 | \item{wxTreeItemIcon\_Selected} to get the selected item image (i.e. the image | |
410 | which is shown when the item is currently selected) | |
411 | \item{wxTreeItemIcon\_Expanded} to get the expanded image (this only | |
412 | makes sense for items which have children - then this image is shown when the | |
413 | item is expanded and the normal image is shown when it is collapsed) | |
414 | \item{wxTreeItemIcon\_SelectedExpanded} to get the selected expanded image | |
415 | (which is shown when an expanded item is currently selected) | |
416 | \end{itemize} | |
a660d684 | 417 | |
4fabb575 | 418 | \membersection{wxTreeCtrl::GetItemText}\label{wxtreectrlgetitemtext} |
a660d684 | 419 | |
4fabb575 | 420 | \constfunc{wxString}{GetItemText}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 421 | |
4fabb575 | 422 | Returns the item label. |
a660d684 | 423 | |
978f38c2 VZ |
424 | \membersection{wxTreeCtrl::GetLastChild}\label{wxtreectrlgetlastchild} |
425 | ||
426 | \constfunc{wxTreeItemId}{GetLastChild}{\param{const wxTreeItemId\&}{ item}} | |
427 | ||
ed93168b | 428 | Returns the last child of the item (or an invalid tree item if this item has no children). |
978f38c2 VZ |
429 | |
430 | \wxheading{See also} | |
431 | ||
f6bcfd97 | 432 | \helpref{GetFirstChild}{wxtreectrlgetfirstchild}, |
978f38c2 VZ |
433 | \helpref{GetLastChild}{wxtreectrlgetlastchild} |
434 | ||
4fabb575 | 435 | \membersection{wxTreeCtrl::GetNextChild}\label{wxtreectrlgetnextchild} |
a660d684 | 436 | |
4fabb575 | 437 | \constfunc{wxTreeItemId}{GetNextChild}{\param{const wxTreeItemId\&}{ item}, \param{long\& }{cookie}} |
a660d684 | 438 | |
4fabb575 | 439 | Returns the next child; call \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild} for the first child. |
a660d684 | 440 | |
4fabb575 JS |
441 | For this enumeration function you must pass in a `cookie' parameter |
442 | which is opaque for the application but is necessary for the library | |
443 | to make these functions reentrant (i.e. allow more than one | |
444 | enumeration on one and the same object simultaneously). The cookie passed to | |
445 | GetFirstChild and GetNextChild should be the same. | |
a660d684 | 446 | |
ed93168b | 447 | Returns an invalid tree item if there are no further children. |
a660d684 | 448 | |
4fabb575 | 449 | \wxheading{See also} |
a660d684 | 450 | |
4fabb575 | 451 | \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild} |
a660d684 | 452 | |
f899db6d RD |
453 | \pythonnote{In wxPython the returned wxTreeItemId and the new cookie |
454 | value are both returned as a tuple containing the two values.} | |
455 | ||
f3539882 VZ |
456 | \perlnote{In wxPerl this method returns a 2-element list |
457 | ( item, cookie ), instead of modifying its parameters.} | |
458 | ||
4fabb575 | 459 | \membersection{wxTreeCtrl::GetNextSibling}\label{wxtreectrlgetnextsibling} |
a660d684 | 460 | |
4fabb575 | 461 | \constfunc{wxTreeItemId}{GetNextSibling}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 462 | |
4fabb575 | 463 | Returns the next sibling of the specified item; call \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} for the previous sibling. |
a660d684 | 464 | |
ed93168b | 465 | Returns an invalid tree item if there are no further siblings. |
a660d684 | 466 | |
4fabb575 JS |
467 | \wxheading{See also} |
468 | ||
469 | \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} | |
470 | ||
471 | \membersection{wxTreeCtrl::GetNextVisible}\label{wxtreectrlgetnextvisible} | |
472 | ||
473 | \constfunc{wxTreeItemId}{GetNextVisible}{\param{const wxTreeItemId\&}{ item}} | |
a660d684 KB |
474 | |
475 | Returns the next visible item. | |
476 | ||
477 | \membersection{wxTreeCtrl::GetParent}\label{wxtreectrlgetparent} | |
478 | ||
4fabb575 | 479 | \constfunc{wxTreeItemId}{GetParent}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
480 | |
481 | Returns the item's parent. | |
482 | ||
c9110876 | 483 | \pythonnote{This method is named {\tt GetItemParent} to avoid a name |
874a1686 RD |
484 | clash with wxWindow::GetParent.} |
485 | ||
4fabb575 JS |
486 | \membersection{wxTreeCtrl::GetPrevSibling}\label{wxtreectrlgetprevsibling} |
487 | ||
488 | \constfunc{wxTreeItemId}{GetPrevSibling}{\param{const wxTreeItemId\&}{ item}} | |
489 | ||
490 | Returns the previous sibling of the specified item; call \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} for the next sibling. | |
491 | ||
ed93168b | 492 | Returns an invalid tree item if there are no further children. |
4fabb575 JS |
493 | |
494 | \wxheading{See also} | |
495 | ||
496 | \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} | |
497 | ||
498 | \membersection{wxTreeCtrl::GetPrevVisible}\label{wxtreectrlgetprevvisible} | |
499 | ||
500 | \constfunc{wxTreeItemId}{GetPrevVisible}{\param{const wxTreeItemId\&}{ item}} | |
501 | ||
502 | Returns the previous visible item. | |
503 | ||
a660d684 KB |
504 | \membersection{wxTreeCtrl::GetRootItem}\label{wxtreectrlgetrootitem} |
505 | ||
4fabb575 | 506 | \constfunc{wxTreeItemId}{GetRootItem}{\void} |
a660d684 KB |
507 | |
508 | Returns the root item for the tree control. | |
509 | ||
ed93168b | 510 | \membersection{wxTreeCtrl::GetItemSelectedImage}\label{wxtreectrlgetitemselectedimage} |
4fabb575 | 511 | |
ed93168b | 512 | \constfunc{int}{GetItemSelectedImage}{\param{const wxTreeItemId\& }{item}} |
4fabb575 | 513 | |
f6bcfd97 | 514 | Gets the selected item image (this function is obsolete, use |
b2cf617c | 515 | {\tt GetItemImage(item, wxTreeItemIcon\_Selected}) instead). |
4fabb575 | 516 | |
a660d684 KB |
517 | \membersection{wxTreeCtrl::GetSelection}\label{wxtreectrlgetselection} |
518 | ||
4fabb575 | 519 | \constfunc{wxTreeItemId}{GetSelection}{\void} |
a660d684 | 520 | |
ed93168b | 521 | Returns the selection, or an invalid item if there is no selection. |
f6bcfd97 | 522 | This function only works with the controls without wxTR\_MULTIPLE style, use |
9dfbf520 VZ |
523 | \helpref{GetSelections}{wxtreectrlgetselections} for the controls which do have |
524 | this style. | |
525 | ||
526 | \membersection{wxTreeCtrl::GetSelections}\label{wxtreectrlgetselections} | |
527 | ||
528 | \constfunc{size\_t}{GetSelections}{\param{wxArrayTreeItemIds\& }{selection}} | |
529 | ||
530 | Fills the array of tree items passed in with the currently selected items. This | |
531 | function can be called only if the control has the wxTR\_MULTIPLE style. | |
532 | ||
533 | Returns the number of selected items. | |
a660d684 | 534 | |
76e1c2de | 535 | \pythonnote{The wxPython version of this method accepts no parameters |
ecf527c0 | 536 | and returns a Python list of {\tt wxTreeItemId}s.} |
76e1c2de | 537 | |
f3539882 VZ |
538 | \perlnote{In wxPerl this method takes no parameters and returns a list of |
539 | {\tt Wx::TreeItemId}s.} | |
540 | ||
e2b34251 JS |
541 | \membersection{wxTreeCtrl::GetStateImageList}\label{wxtreectrlgetstateimagelist} |
542 | ||
543 | \constfunc{wxImageList*}{GetStateImageList}{\void} | |
544 | ||
545 | Returns the state image list (from which application-defined state images are taken). | |
546 | ||
a660d684 KB |
547 | \membersection{wxTreeCtrl::HitTest}\label{wxtreectrlhittest} |
548 | ||
aa9fb2be | 549 | \func{wxTreeItemId}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}} |
a660d684 | 550 | |
f6bcfd97 BP |
551 | Calculates which (if any) item is under the given point, returning the tree item |
552 | id at this point plus extra information {\it flags}. {\it flags} is a bitlist of the following: | |
a660d684 KB |
553 | |
554 | \twocolwidtha{5cm} | |
555 | \begin{twocollist}\itemsep=0pt | |
556 | \twocolitem{wxTREE\_HITTEST\_ABOVE}{Above the client area.} | |
557 | \twocolitem{wxTREE\_HITTEST\_BELOW}{Below the client area.} | |
558 | \twocolitem{wxTREE\_HITTEST\_NOWHERE}{In the client area but below the last item.} | |
559 | \twocolitem{wxTREE\_HITTEST\_ONITEMBUTTON}{On the button associated with an item.} | |
560 | \twocolitem{wxTREE\_HITTEST\_ONITEMICON}{On the bitmap associated with an item.} | |
561 | \twocolitem{wxTREE\_HITTEST\_ONITEMINDENT}{In the indentation associated with an item.} | |
562 | \twocolitem{wxTREE\_HITTEST\_ONITEMLABEL}{On the label (string) associated with an item.} | |
563 | \twocolitem{wxTREE\_HITTEST\_ONITEMRIGHT}{In the area to the right of an item.} | |
564 | \twocolitem{wxTREE\_HITTEST\_ONITEMSTATEICON}{On the state icon for a tree view item that is in a user-defined state.} | |
565 | \twocolitem{wxTREE\_HITTEST\_TOLEFT}{To the right of the client area.} | |
566 | \twocolitem{wxTREE\_HITTEST\_TORIGHT}{To the left of the client area.} | |
567 | \end{twocollist} | |
568 | ||
aa9fb2be RD |
569 | \pythonnote{in wxPython both the wxTreeItemId and the flags are |
570 | returned as a tuple.} | |
571 | ||
f3539882 VZ |
572 | \perlnote{In wxPerl this method only takes the {\tt point} parameter |
573 | and returns a 2-element list ( item, flags ).} | |
574 | ||
a660d684 KB |
575 | \membersection{wxTreeCtrl::InsertItem}\label{wxtreectrlinsertitem} |
576 | ||
4fabb575 JS |
577 | \func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxTreeItemId\& }{previous}, \param{const wxString\&}{ text}, |
578 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
a660d684 | 579 | |
f2593d0d RR |
580 | \func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{size\_t}{ before}, \param{const wxString\&}{ text}, |
581 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
582 | ||
583 | Inserts an item after a given one ({\it previous}) or before one identified by its position ({\it before}). | |
a660d684 | 584 | |
ea91314f VS |
585 | The {\it image} and {\it selImage} parameters are an index within |
586 | the normal image list specifying the image to use for unselected and | |
587 | selected items, respectively. | |
a660d684 KB |
588 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for |
589 | both selected and unselected items. | |
590 | ||
f6bcfd97 BP |
591 | \pythonnote{The second form of this method is called |
592 | \tt{InsertItemBefore} in wxPython.} | |
593 | ||
ed93168b VZ |
594 | \membersection{wxTreeCtrl::IsBold}\label{wxtreectrlisbold} |
595 | ||
596 | \constfunc{bool}{IsBold}{\param{const wxTreeItemId\& }{item}} | |
597 | ||
598 | Returns TRUE if the given item is in bold state. | |
599 | ||
600 | See also: \helpref{SetItemBold}{wxtreectrlsetitembold} | |
601 | ||
4fabb575 JS |
602 | \membersection{wxTreeCtrl::IsExpanded}\label{wxtreectrlisexpanded} |
603 | ||
604 | \constfunc{bool}{IsExpanded}{\param{const wxTreeItemId\&}{ item}} | |
605 | ||
606 | Returns TRUE if the item is expanded (only makes sense if it has children). | |
607 | ||
608 | \membersection{wxTreeCtrl::IsSelected}\label{wxtreectrlisselected} | |
609 | ||
610 | \constfunc{bool}{IsSelected}{\param{const wxTreeItemId\&}{ item}} | |
611 | ||
612 | Returns TRUE if the item is selected. | |
613 | ||
614 | \membersection{wxTreeCtrl::IsVisible}\label{wxtreectrlisvisible} | |
615 | ||
616 | \constfunc{bool}{IsVisible}{\param{const wxTreeItemId\&}{ item}} | |
617 | ||
618 | Returns TRUE if the item is visible (it might be outside the view, or not expanded). | |
619 | ||
a660d684 KB |
620 | \membersection{wxTreeCtrl::ItemHasChildren}\label{wxtreectrlitemhaschildren} |
621 | ||
4fabb575 | 622 | \constfunc{bool}{ItemHasChildren}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
623 | |
624 | Returns TRUE if the item has children. | |
625 | ||
ed93168b VZ |
626 | \membersection{wxTreeCtrl::OnCompareItems}\label{wxtreectrloncompareitems} |
627 | ||
628 | \func{int}{OnCompareItems}{\param{const wxTreeItemId\& }{item1}, \param{const wxTreeItemId\& }{item2}} | |
629 | ||
630 | Override this function in the derived class to change the sort order of the | |
631 | items in the tree control. The function should return a negative, zero or | |
632 | positive value if the first item is less than, equal to or greater than the | |
633 | second one. | |
634 | ||
635 | The base class version compares items alphabetically. | |
636 | ||
637 | See also: \helpref{SortChildren}{wxtreectrlsortchildren} | |
638 | ||
4fabb575 JS |
639 | \membersection{wxTreeCtrl::PrependItem}\label{wxtreectrlprependitem} |
640 | ||
641 | \func{wxTreeItemId}{PrependItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxString\&}{ text}, | |
642 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = NULL}} | |
643 | ||
644 | Appends an item as the first child of {\it parent}, return a new item id. | |
645 | ||
ea91314f VS |
646 | The {\it image} and {\it selImage} parameters are an index within |
647 | the normal image list specifying the image to use for unselected and | |
648 | selected items, respectively. | |
4fabb575 JS |
649 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for |
650 | both selected and unselected items. | |
651 | ||
a660d684 KB |
652 | \membersection{wxTreeCtrl::ScrollTo}\label{wxtreectrlscrollto} |
653 | ||
4fabb575 | 654 | \func{void}{ScrollTo}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 655 | |
4fabb575 | 656 | Scrolls the specified item into view. |
a660d684 KB |
657 | |
658 | \membersection{wxTreeCtrl::SelectItem}\label{wxtreectrlselectitem} | |
659 | ||
4fabb575 | 660 | \func{bool}{SelectItem}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
661 | |
662 | Selects the given item. | |
663 | ||
ea91314f VS |
664 | \membersection{wxTreeCtrl::SetButtonsImageList}\label{wxtreectrlsetbuttonsimagelist} |
665 | ||
666 | \func{void}{SetButtonsImageList}{\param{wxImageList*}{ imageList}} | |
667 | ||
668 | Sets the buttons image list (from which application-defined button images are taken). | |
669 | The button images assigned with this method will | |
670 | {\bf not} be deleted by wxTreeCtrl's destructor, you must delete it yourself. | |
671 | ||
672 | Setting or assigning the button image list enables the display of image buttons. | |
673 | Once enabled, the only way to disable the display of button images is to set | |
674 | the button image list to NULL. | |
675 | ||
676 | This function is only available in the generic version. | |
677 | ||
678 | See also \helpref{AssignButtonsImageList}{wxtreectrlassignbuttonsimagelist}. | |
679 | ||
a660d684 KB |
680 | \membersection{wxTreeCtrl::SetIndent}\label{wxtreectrlsetindent} |
681 | ||
682 | \func{void}{SetIndent}{\param{int }{indent}} | |
683 | ||
684 | Sets the indentation for the tree control. | |
685 | ||
686 | \membersection{wxTreeCtrl::SetImageList}\label{wxtreectrlsetimagelist} | |
687 | ||
e2b34251 | 688 | \func{void}{SetImageList}{\param{wxImageList*}{ imageList}} |
a660d684 | 689 | |
46cd520d VS |
690 | Sets the normal image list. Image list assigned with this method will |
691 | {\bf not} be deleted by wxTreeCtrl's destructor, you must delete it yourself. | |
692 | ||
693 | See also \helpref{AssignImageList}{wxtreectrlassignimagelist}. | |
694 | ||
a660d684 | 695 | |
9ec64fa7 VZ |
696 | \membersection{wxTreeCtrl::SetItemBackgroundColour}\label{wxtreectrlsetitembackgroundcolour} |
697 | ||
698 | \func{void}{SetItemBackgroundColour}{\param{const wxTreeItemId\&}{ item}, \param{const wxColour\& }{col}} | |
699 | ||
ea91314f | 700 | Sets the colour of the item's background. |
9ec64fa7 | 701 | |
ed93168b VZ |
702 | \membersection{wxTreeCtrl::SetItemBold}\label{wxtreectrlsetitembold} |
703 | ||
704 | \func{void}{SetItemBold}{\param{const wxTreeItemId\& }{item}, \param{bool}{ bold = TRUE}} | |
705 | ||
706 | Makes item appear in bold font if {\it bold} parameter is TRUE or resets it to | |
707 | the normal state. | |
708 | ||
709 | See also: \helpref{IsBold}{wxtreectrlisbold} | |
710 | ||
4fabb575 | 711 | \membersection{wxTreeCtrl::SetItemData}\label{wxtreectrlsetitemdata} |
a660d684 | 712 | |
4fabb575 | 713 | \func{void}{SetItemData}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemData* }{data}} |
a660d684 | 714 | |
4fabb575 | 715 | Sets the item client data. |
a660d684 | 716 | |
f899db6d | 717 | \pythonnote{wxPython provides the following shortcut method:\par |
ecf527c0 | 718 | \indented{2cm}{\begin{twocollist}\itemsep=0pt |
c9110876 | 719 | \twocolitem{{\bf SetPyData(item, obj)}}{Associate the given Python |
f899db6d RD |
720 | Object with the wxTreeItemData for the given item Id.} |
721 | \end{twocollist}} | |
722 | } | |
723 | ||
f3539882 VZ |
724 | \perlnote{wxPerl provides the following shortcut method: |
725 | \indented{2cm}{ | |
726 | \begin{twocollist}\itemsep=0pt | |
727 | \twocolitem{{\bf SetPlData( item, data )}}{Sets the Perl data | |
728 | associated with the Wx::TreeItemData ( it is just the same as | |
729 | tree->GetItemData( item )->SetData( data ); ).} | |
730 | \end{twocollist}} | |
731 | } | |
732 | ||
9ec64fa7 VZ |
733 | \membersection{wxTreeCtrl::SetItemFont}\label{wxtreectrlsetitemfont} |
734 | ||
735 | \func{void}{SetItemFont}{\param{const wxTreeItemId\&}{ item}, \param{const wxFont\& }{font}} | |
736 | ||
ea91314f | 737 | Sets the item's font. All items in the tree should have the same height to avoid |
9ec64fa7 VZ |
738 | text clipping, so the fonts height should be the same for all of them, |
739 | although font attributes may vary. | |
740 | ||
741 | \wxheading{See also} | |
742 | ||
743 | \helpref{SetItemBold}{wxtreectrlsetitembold} | |
744 | ||
4fabb575 | 745 | \membersection{wxTreeCtrl::SetItemHasChildren}\label{wxtreectrlsetitemhaschildren} |
a660d684 | 746 | |
4fabb575 | 747 | \func{void}{SetItemHasChildren}{\param{const wxTreeItemId\&}{ item}, \param{bool }{hasChildren = TRUE}} |
a660d684 | 748 | |
4fabb575 JS |
749 | Force appearance of the button next to the item. This is useful to |
750 | allow the user to expand the items which don't have any children now, | |
751 | but instead adding them only when needed, thus minimizing memory | |
752 | usage and loading time. | |
a660d684 KB |
753 | |
754 | \membersection{wxTreeCtrl::SetItemImage}\label{wxtreectrlsetitemimage} | |
755 | ||
74b31181 | 756 | \func{void}{SetItemImage}{\param{const wxTreeItemId\&}{ item}, |
ecf527c0 | 757 | \param{int }{image}, \param{wxTreeItemIcon }{which = wxTreeItemIcon\_Normal}} |
a660d684 | 758 | |
f6bcfd97 | 759 | Sets the specified item image. See \helpref{GetItemImage}{wxtreectrlgetitemimage} |
b2cf617c | 760 | for the description of the {\it which} parameter. |
a660d684 | 761 | |
4fabb575 | 762 | \membersection{wxTreeCtrl::SetItemSelectedImage}\label{wxtreectrlsetitemselectedimage} |
a660d684 | 763 | |
4fabb575 | 764 | \func{void}{SetItemSelectedImage}{\param{const wxTreeItemId\&}{ item}, \param{int }{selImage}} |
a660d684 | 765 | |
b2cf617c | 766 | Sets the selected item image (this function is obsolete, use {\tt SetItemImage(item, wxTreeItemIcon\_Selected}) instead). |
a660d684 KB |
767 | |
768 | \membersection{wxTreeCtrl::SetItemText}\label{wxtreectrlsetitemtext} | |
769 | ||
4fabb575 | 770 | \func{void}{SetItemText}{\param{const wxTreeItemId\&}{ item}, \param{const wxString\& }{text}} |
a660d684 KB |
771 | |
772 | Sets the item label. | |
773 | ||
9ec64fa7 VZ |
774 | \membersection{wxTreeCtrl::SetItemTextColour}\label{wxtreectrlsetitemtextcolour} |
775 | ||
776 | \func{void}{SetItemTextColour}{\param{const wxTreeItemId\&}{ item}, \param{const wxColour\& }{col}} | |
777 | ||
ea91314f | 778 | Sets the colour of the item's text. |
9ec64fa7 | 779 | |
e2b34251 JS |
780 | \membersection{wxTreeCtrl::SetStateImageList}\label{wxtreectrlsetstateimagelist} |
781 | ||
782 | \func{void}{SetStateImageList}{\param{wxImageList*}{ imageList}} | |
783 | ||
784 | Sets the state image list (from which application-defined state images are taken). | |
46cd520d VS |
785 | Image list assigned with this method will |
786 | {\bf not} be deleted by wxTreeCtrl's destructor, you must delete it yourself. | |
787 | ||
788 | See also \helpref{AssignStateImageList}{wxtreectrlassignstateimagelist}. | |
e2b34251 | 789 | |
ea91314f VS |
790 | \func{void}{SetWindowStyle}{\param{long}{styles}} |
791 | ||
792 | Sets the mode flags associated with the display of the tree control. | |
793 | The new mode takes effect immediately. | |
794 | (Generic only; MSW ignores changes.) | |
795 | ||
4fabb575 | 796 | \membersection{wxTreeCtrl::SortChildren}\label{wxtreectrlsortchildren} |
a660d684 | 797 | |
ed93168b | 798 | \func{void}{SortChildren}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 799 | |
f6bcfd97 | 800 | Sorts the children of the given item using |
ed93168b | 801 | \helpref{OnCompareItems}{wxtreectrloncompareitems} method of wxTreeCtrl. You |
b2cf617c | 802 | should override that method to change the sort order (the default is ascending |
ed93168b | 803 | alphabetical order). |
4fabb575 JS |
804 | |
805 | \wxheading{See also} | |
806 | ||
ed93168b | 807 | \helpref{wxTreeItemData}{wxtreeitemdata}, \helpref{OnCompareItems}{wxtreectrloncompareitems} |
4fabb575 JS |
808 | |
809 | \membersection{wxTreeCtrl::Toggle}\label{wxtreectrltoggle} | |
810 | ||
811 | \func{void}{Toggle}{\param{const wxTreeItemId\&}{ item}} | |
812 | ||
813 | Toggles the given item between collapsed and expanded states. | |
814 | ||
815 | \membersection{wxTreeCtrl::Unselect}\label{wxtreectrlunselect} | |
816 | ||
817 | \func{void}{Unselect}{\void} | |
818 | ||
819 | Removes the selection from the currently selected item (if any). | |
820 | ||
9dfbf520 VZ |
821 | \membersection{wxTreeCtrl::UnselectAll}\label{wxtreectrlunselectall} |
822 | ||
823 | \func{void}{UnselectAll}{\void} | |
824 | ||
f6bcfd97 | 825 | This function either behaves the same as \helpref{Unselect}{wxtreectrlunselect} |
9dfbf520 VZ |
826 | if the control doesn't have wxTR\_MULTIPLE style, or removes the selection from |
827 | all items if it does have this style. | |
828 |