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