]>
Commit | Line | Data |
---|---|---|
afbe150a WS |
1 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
2 | %% Name: treectrl.tex | |
3 | %% Purpose: wxTreeCtrl documentation | |
4 | %% Author: wxWidgets Team | |
5 | %% Modified by: | |
6 | %% Created: | |
7 | %% RCS-ID: $Id$ | |
8 | %% Copyright: (c) wxWidgets Team | |
9 | %% License: wxWindows license | |
10 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
11 | ||
a660d684 KB |
12 | \section{\class{wxTreeCtrl}}\label{wxtreectrl} |
13 | ||
14 | A tree control presents information as a hierarchy, with items that may be expanded | |
2b5f62a0 | 15 | to show further items. Items in a tree control are referenced by wxTreeItemId handles, |
9248adc8 | 16 | which may be tested for validity by calling \helpref{wxTreeItemId::IsOk}{wxtreeitemidisok}. |
a660d684 KB |
17 | |
18 | To intercept events from a tree control, use the event table macros described in \helpref{wxTreeEvent}{wxtreeevent}. | |
19 | ||
20 | \wxheading{Derived from} | |
21 | ||
22 | \helpref{wxControl}{wxcontrol}\\ | |
23 | \helpref{wxWindow}{wxwindow}\\ | |
24 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
25 | \helpref{wxObject}{wxobject} | |
26 | ||
954b8ae6 JS |
27 | \wxheading{Include files} |
28 | ||
29 | <wx/treectrl.h> | |
30 | ||
a660d684 KB |
31 | \wxheading{Window styles} |
32 | ||
33 | \twocolwidtha{5cm} | |
34 | \begin{twocollist}\itemsep=0pt | |
ea91314f VS |
35 | \twocolitem{\windowstyle{wxTR\_EDIT\_LABELS}}{Use this style |
36 | if you wish the user to be able to edit labels in the tree control.} | |
37 | \twocolitem{\windowstyle{wxTR\_NO\_BUTTONS}}{For convenience | |
38 | to document that no buttons are to be drawn.} | |
39 | \twocolitem{\windowstyle{wxTR\_HAS\_BUTTONS}}{Use this style | |
40 | to show + and - buttons to the left of parent items.} | |
ea91314f VS |
41 | \twocolitem{\windowstyle{wxTR\_NO\_LINES}}{Use this style |
42 | to hide vertical level connectors.} | |
c6f4913a VS |
43 | \twocolitem{\windowstyle{wxTR\_FULL\_ROW\_HIGHLIGHT}}{Use this style to have the background |
44 | colour and the selection highlight extend over the entire horizontal | |
afbe150a | 45 | row of the tree control window. (This flag is ignored under Windows unless you |
63969272 | 46 | specify wxTR\_NO\_LINES as well.) } |
ea91314f VS |
47 | \twocolitem{\windowstyle{wxTR\_LINES\_AT\_ROOT}}{Use this style |
48 | to show lines between root nodes. | |
49 | Only applicable if wxTR\_HIDE\_ROOT is set and wxTR\_NO\_LINES is not set.} | |
50 | \twocolitem{\windowstyle{wxTR\_HIDE\_ROOT}}{Use this style | |
51 | to suppress the display of the root node, | |
52 | effectively causing the first-level nodes | |
f6ed3823 | 53 | to appear as a series of root nodes.} |
ea91314f VS |
54 | \twocolitem{\windowstyle{wxTR\_ROW\_LINES}}{Use this style |
55 | to draw a contrasting border between displayed rows.} | |
56 | \twocolitem{\windowstyle{wxTR\_HAS\_VARIABLE\_ROW\_HEIGHT}}{Use this style | |
57 | to cause row heights to be just big enough to fit the content. | |
58 | If not set, all rows use the largest row height. | |
59 | The default is that this flag is unset. | |
60 | Generic only.} | |
61 | \twocolitem{\windowstyle{wxTR\_SINGLE}}{For convenience | |
62 | to document that only one item may be selected at a time. | |
63 | Selecting another item causes the current selection, if any, | |
64 | to be deselected. This is the default.} | |
65 | \twocolitem{\windowstyle{wxTR\_MULTIPLE}}{Use this style | |
66 | to allow a range of items to be selected. | |
67 | If a second range is selected, the current range, if any, is deselected.} | |
ea91314f VS |
68 | \twocolitem{\windowstyle{wxTR\_DEFAULT\_STYLE}}{The set of flags that are |
69 | closest to the defaults for the native control for a particular toolkit.} | |
a660d684 KB |
70 | \end{twocollist} |
71 | ||
72 | See also \helpref{window styles overview}{windowstyles}. | |
73 | ||
5de76427 JS |
74 | \wxheading{Event handling} |
75 | ||
76 | To process input from a tree control, use these event handler macros to direct input to member | |
77 | functions that take a \helpref{wxTreeEvent}{wxtreeevent} argument. | |
78 | ||
79 | \twocolwidtha{7cm} | |
80 | \begin{twocollist}\itemsep=0pt | |
81 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_DRAG(id, func)}}{Begin dragging with the left mouse button.} | |
82 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_RDRAG(id, func)}}{Begin dragging with the right mouse button.} | |
01a01d10 | 83 | \twocolitem{{\bf EVT\_TREE\_END\_DRAG(id, func)}}{End dragging with the left or right mouse button.} |
fd128b0c RR |
84 | \twocolitem{{\bf EVT\_TREE\_BEGIN\_LABEL\_EDIT(id, func)}}{Begin editing a label. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} |
85 | \twocolitem{{\bf EVT\_TREE\_END\_LABEL\_EDIT(id, func)}}{Finish editing a label. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} | |
5de76427 JS |
86 | \twocolitem{{\bf EVT\_TREE\_DELETE\_ITEM(id, func)}}{Delete an item.} |
87 | \twocolitem{{\bf EVT\_TREE\_GET\_INFO(id, func)}}{Request information from the application.} | |
88 | \twocolitem{{\bf EVT\_TREE\_SET\_INFO(id, func)}}{Information is being supplied.} | |
9711961c | 89 | \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 |
90 | \twocolitem{{\bf EVT\_TREE\_ITEM\_COLLAPSED(id, func)}}{The item has been collapsed.} |
91 | \twocolitem{{\bf EVT\_TREE\_ITEM\_COLLAPSING(id, func)}}{The item is being collapsed. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} | |
92 | \twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDED(id, func)}}{The item has been expanded.} | |
93 | \twocolitem{{\bf EVT\_TREE\_ITEM\_EXPANDING(id, func)}}{The item is being expanded. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} | |
f525dc54 JS |
94 | \twocolitem{{\bf EVT\_TREE\_ITEM\_RIGHT\_CLICK(id, func)}}{The user has clicked the item with the right mouse button.} |
95 | \twocolitem{{\bf EVT\_TREE\_ITEM\_MIDDLE\_CLICK(id, func)}}{The user has clicked the item with the middle mouse button.} | |
5de76427 | 96 | \twocolitem{{\bf EVT\_TREE\_SEL\_CHANGED(id, func)}}{Selection has changed.} |
fd128b0c | 97 | \twocolitem{{\bf EVT\_TREE\_SEL\_CHANGING(id, func)}}{Selection is changing. This can be prevented by calling \helpref{Veto()}{wxnotifyeventveto}.} |
5de76427 | 98 | \twocolitem{{\bf EVT\_TREE\_KEY\_DOWN(id, func)}}{A key has been pressed.} |
156194e1 JS |
99 | \twocolitem{{\bf EVT\_TREE\_ITEM\_GETTOOLTIP(id, func)}}{The opportunity to set the item tooltip |
100 | is being given to the application (call wxTreeEvent::SetToolTip). Windows only.} | |
6eb7ee61 | 101 | \twocolitem{{\bf EVT\_TREE\_ITEM\_MENU(id, func)}}{The context menu for the selected item has been requested, either by a right click or by using the menu key.} |
6bce9756 KH |
102 | \twocolitem{{\bf EVT\_TREE\_STATE\_IMAGE\_CLICK(id, func)}}{The state image has been clicked. Windows only.} |
103 | \end{twocollist} | |
104 | ||
a660d684 KB |
105 | \wxheading{See also} |
106 | ||
4fabb575 | 107 | \helpref{wxTreeItemData}{wxtreeitemdata}, \helpref{wxTreeCtrl overview}{wxtreectrloverview}, \helpref{wxListBox}{wxlistbox}, \helpref{wxListCtrl}{wxlistctrl},\rtfsp |
a660d684 KB |
108 | \helpref{wxImageList}{wximagelist}, \helpref{wxTreeEvent}{wxtreeevent} |
109 | ||
61714c23 VZ |
110 | \wxheading{Win32 notes} |
111 | ||
112 | wxTreeCtrl class uses the standard common treeview control under Win32 | |
113 | implemented in the system library {\tt comctl32.dll}. Some versions of this | |
114 | library are known to have bugs with handling the tree control colours: the | |
115 | usual symptom is that the expanded items leave black (or otherwise incorrectly | |
4e43c815 | 116 | coloured) background behind them, especially for the controls using non-default background colour. The recommended solution is to upgrade the {\tt comctl32.dll} |
afbe150a | 117 | to a newer version: see |
ad4a6192 | 118 | \urlref{http://www.microsoft.com/downloads/release.asp?ReleaseID=11916}{http://www.microsoft.com/downloads/release.asp?ReleaseID=11916}. |
61714c23 | 119 | |
a660d684 KB |
120 | \latexignore{\rtfignore{\wxheading{Members}}} |
121 | ||
3e9af289 | 122 | |
a660d684 KB |
123 | \membersection{wxTreeCtrl::wxTreeCtrl}\label{wxtreectrlconstr} |
124 | ||
125 | \func{}{wxTreeCtrl}{\void} | |
126 | ||
127 | Default constructor. | |
128 | ||
eaaa6a06 | 129 | \func{}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 130 | \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
ab3165fb | 131 | \param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``treeCtrl"}} |
a660d684 KB |
132 | |
133 | Constructor, creating and showing a tree control. | |
134 | ||
135 | \wxheading{Parameters} | |
136 | ||
513e0cea | 137 | \docparam{parent}{Parent window. Must not be {\tt NULL}.} |
a660d684 KB |
138 | |
139 | \docparam{id}{Window identifier. A value of -1 indicates a default value.} | |
140 | ||
141 | \docparam{pos}{Window position.} | |
142 | ||
143 | \docparam{size}{Window size. If the default size (-1, -1) is specified then the window is sized | |
144 | appropriately.} | |
145 | ||
146 | \docparam{style}{Window style. See \helpref{wxTreeCtrl}{wxtreectrl}.} | |
147 | ||
148 | \docparam{validator}{Window validator.} | |
149 | ||
150 | \docparam{name}{Window name.} | |
151 | ||
152 | \wxheading{See also} | |
153 | ||
154 | \helpref{wxTreeCtrl::Create}{wxtreectrlcreate}, \helpref{wxValidator}{wxvalidator} | |
155 | ||
3e9af289 | 156 | |
6d06e061 | 157 | \membersection{wxTreeCtrl::\destruct{wxTreeCtrl}}\label{wxtreectrldtor} |
a660d684 KB |
158 | |
159 | \func{void}{\destruct{wxTreeCtrl}}{\void} | |
160 | ||
ab3165fb | 161 | Destructor, destroying the tree control. |
a660d684 | 162 | |
3e9af289 | 163 | |
4fabb575 JS |
164 | \membersection{wxTreeCtrl::AddRoot}\label{wxtreectrladdroot} |
165 | ||
166 | \func{wxTreeItemId}{AddRoot}{\param{const wxString\&}{ text}, | |
513e0cea | 167 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = {\tt NULL}}} |
4fabb575 JS |
168 | |
169 | Adds the root node to the tree, returning the new item. | |
170 | ||
ea91314f VS |
171 | The {\it image} and {\it selImage} parameters are an index within |
172 | the normal image list specifying the image to use for unselected and | |
173 | selected items, respectively. | |
4fabb575 JS |
174 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for |
175 | both selected and unselected items. | |
176 | ||
3e9af289 | 177 | |
4fabb575 JS |
178 | \membersection{wxTreeCtrl::AppendItem}\label{wxtreectrlappenditem} |
179 | ||
180 | \func{wxTreeItemId}{AppendItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxString\&}{ text}, | |
513e0cea | 181 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = {\tt NULL}}} |
4fabb575 JS |
182 | |
183 | Appends an item to the end of the branch identified by {\it parent}, return a new item id. | |
184 | ||
ea91314f VS |
185 | The {\it image} and {\it selImage} parameters are an index within |
186 | the normal image list specifying the image to use for unselected and | |
187 | selected items, respectively. | |
4fabb575 JS |
188 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for |
189 | both selected and unselected items. | |
190 | ||
3e9af289 | 191 | |
ea91314f VS |
192 | \membersection{wxTreeCtrl::AssignButtonsImageList}\label{wxtreectrlassignbuttonsimagelist} |
193 | ||
194 | \func{void}{AssignButtonsImageList}{\param{wxImageList*}{ imageList}} | |
195 | ||
196 | Sets the buttons image list. The button images assigned with this method will | |
197 | be automatically deleted by wxTreeCtrl as appropriate | |
198 | (i.e. it takes ownership of the list). | |
199 | ||
200 | Setting or assigning the button image list enables the display of image buttons. | |
201 | Once enabled, the only way to disable the display of button images is to set | |
513e0cea | 202 | the button image list to {\tt NULL}. |
ea91314f VS |
203 | |
204 | This function is only available in the generic version. | |
205 | ||
206 | See also \helpref{SetButtonsImageList}{wxtreectrlsetbuttonsimagelist}. | |
207 | ||
3e9af289 | 208 | |
46cd520d VS |
209 | \membersection{wxTreeCtrl::AssignImageList}\label{wxtreectrlassignimagelist} |
210 | ||
211 | \func{void}{AssignImageList}{\param{wxImageList*}{ imageList}} | |
212 | ||
213 | Sets the normal image list. Image list assigned with this method will | |
ea91314f VS |
214 | be automatically deleted by wxTreeCtrl as appropriate |
215 | (i.e. it takes ownership of the list). | |
46cd520d VS |
216 | |
217 | See also \helpref{SetImageList}{wxtreectrlsetimagelist}. | |
218 | ||
3e9af289 | 219 | |
46cd520d VS |
220 | \membersection{wxTreeCtrl::AssignStateImageList}\label{wxtreectrlassignstateimagelist} |
221 | ||
222 | \func{void}{AssignStateImageList}{\param{wxImageList*}{ imageList}} | |
223 | ||
224 | Sets the state image list. Image list assigned with this method will | |
ea91314f VS |
225 | be automatically deleted by wxTreeCtrl as appropriate |
226 | (i.e. it takes ownership of the list). | |
46cd520d VS |
227 | |
228 | See also \helpref{SetStateImageList}{wxtreectrlsetstateimagelist}. | |
229 | ||
230 | ||
3e9af289 | 231 | |
4fabb575 JS |
232 | \membersection{wxTreeCtrl::Collapse}\label{wxtreectrlcollapse} |
233 | ||
234 | \func{void}{Collapse}{\param{const wxTreeItemId\&}{ item}} | |
235 | ||
236 | Collapses the given item. | |
237 | ||
3e9af289 | 238 | |
9248adc8 VZ |
239 | \membersection{wxTreeCtrl::CollapseAll}\label{wxtreectrlcollapseall} |
240 | ||
241 | \func{void}{CollapseAll}{\void} | |
242 | ||
243 | Collapses the root item. | |
244 | ||
245 | \wxheading{See also} | |
246 | ||
247 | \helpref{ExpandAll}{wxtreectrlexpandall} | |
248 | ||
249 | ||
250 | \membersection{wxTreeCtrl::CollapseAllChildren}\label{wxtreectrlcollapseallchildren} | |
251 | ||
252 | \func{void}{CollapseAllChildren}{\param{const wxTreeItemId\&}{ item}} | |
253 | ||
254 | Collapses this item and all of its children, recursively. | |
255 | ||
256 | \wxheading{See also} | |
257 | ||
258 | \helpref{ExpandAllChildren}{wxtreectrlexpandallchildren} | |
259 | ||
260 | ||
4fabb575 JS |
261 | \membersection{wxTreeCtrl::CollapseAndReset}\label{wxtreectrlcollapseandreset} |
262 | ||
263 | \func{void}{CollapseAndReset}{\param{const wxTreeItemId\&}{ item}} | |
264 | ||
265 | Collapses the given item and removes all children. | |
266 | ||
3e9af289 | 267 | |
a660d684 KB |
268 | \membersection{wxTreeCtrl::Create}\label{wxtreectrlcreate} |
269 | ||
eaaa6a06 | 270 | \func{bool}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp |
a660d684 | 271 | \param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp |
ab3165fb | 272 | \param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``treeCtrl"}} |
a660d684 KB |
273 | |
274 | Creates the tree control. See \helpref{wxTreeCtrl::wxTreeCtrl}{wxtreectrlconstr} for further details. | |
275 | ||
3e9af289 | 276 | |
4fabb575 | 277 | \membersection{wxTreeCtrl::Delete}\label{wxtreectrldelete} |
a660d684 | 278 | |
4fabb575 | 279 | \func{void}{Delete}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 280 | |
2b5f62a0 VZ |
281 | Deletes the specified item. A {\tt EVT\_TREE\_DELETE\_ITEM} event will be |
282 | generated. | |
a660d684 | 283 | |
2f930c85 JS |
284 | This function may cause a subsequent call to GetNextChild to fail. |
285 | ||
3e9af289 | 286 | |
4fabb575 | 287 | \membersection{wxTreeCtrl::DeleteAllItems}\label{wxtreectrldeleteallitems} |
a660d684 | 288 | |
4fabb575 | 289 | \func{void}{DeleteAllItems}{\void} |
a660d684 | 290 | |
afbe150a | 291 | Deletes all items in the control. Note that this may not generate |
64f590ea VZ |
292 | {\tt EVT\_TREE\_DELETE\_ITEM} events under some Windows versions although |
293 | normally such event is generated for each removed item. | |
2b5f62a0 | 294 | |
3e9af289 | 295 | |
2b5f62a0 VZ |
296 | \membersection{wxTreeCtrl::DeleteChildren}\label{wxtreectrldeletechildren} |
297 | ||
298 | \func{void}{DeleteChildren}{\param{const wxTreeItemId\& }{item}} | |
299 | ||
300 | Deletes all children of the given item (but not the item itself). Note that | |
afbe150a | 301 | this will {\bf not} generate any events unlike |
2b5f62a0 | 302 | \helpref{Delete}{wxtreectrldelete} method. |
a660d684 | 303 | |
2f930c85 JS |
304 | If you have called \helpref{wxTreeCtrl::SetItemHasChildren}{wxtreectrlsetitemhaschildren}, you |
305 | may need to call it again since {\it DeleteChildren} does not automatically | |
306 | clear the setting. | |
307 | ||
3e9af289 | 308 | |
bbcdf8bc | 309 | \membersection{wxTreeCtrl::EditLabel}\label{wxtreectrleditlabel} |
a660d684 | 310 | |
fd128b0c | 311 | \func{void}{EditLabel}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 312 | |
fd128b0c RR |
313 | Starts editing the label of the given item. This function generates a |
314 | EVT\_TREE\_BEGIN\_LABEL\_EDIT event which can be vetoed so that no | |
315 | text control will appear for in-place editing. | |
a660d684 | 316 | |
fd128b0c | 317 | If the user changed the label (i.e. s/he does not press ESC or leave |
76e1c2de | 318 | the text control without changes, a EVT\_TREE\_END\_LABEL\_EDIT event |
fd128b0c | 319 | will be sent which can be vetoed as well. |
bbcdf8bc JS |
320 | |
321 | \wxheading{See also} | |
322 | ||
f6bcfd97 | 323 | \helpref{wxTreeCtrl::EndEditLabel}{wxtreectrlendeditlabel}, |
86f975a8 | 324 | \helpref{wxTreeEvent}{wxtreeevent} |
bbcdf8bc | 325 | |
3e9af289 | 326 | |
bbcdf8bc JS |
327 | \membersection{wxTreeCtrl::EndEditLabel}\label{wxtreectrlendeditlabel} |
328 | ||
4fabb575 | 329 | \func{void}{EndEditLabel}{\param{bool }{cancelEdit}} |
bbcdf8bc | 330 | |
cc81d32f | 331 | Ends label editing. If {\it cancelEdit} is {\tt true}, the edit will be cancelled. |
bbcdf8bc JS |
332 | |
333 | This function is currently supported under Windows only. | |
334 | ||
335 | \wxheading{See also} | |
336 | ||
337 | \helpref{wxTreeCtrl::EditLabel}{wxtreectrleditlabel} | |
338 | ||
3e9af289 | 339 | |
a660d684 KB |
340 | \membersection{wxTreeCtrl::EnsureVisible}\label{wxtreectrlensurevisible} |
341 | ||
4fabb575 | 342 | \func{void}{EnsureVisible}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
343 | |
344 | Scrolls and/or expands items to ensure that the given item is visible. | |
345 | ||
3e9af289 | 346 | |
4fabb575 | 347 | \membersection{wxTreeCtrl::Expand}\label{wxtreectrlexpand} |
a660d684 | 348 | |
4fabb575 | 349 | \func{void}{Expand}{\param{const wxTreeItemId\&}{ item}} |
a660d684 KB |
350 | |
351 | Expands the given item. | |
352 | ||
3e9af289 | 353 | |
70934138 VZ |
354 | \membersection{wxTreeCtrl::ExpandAll}\label{wxtreectrlexpandall} |
355 | ||
9248adc8 | 356 | \func{void}{ExpandAll}{\void} |
70934138 VZ |
357 | |
358 | Expands all items in the tree. | |
359 | ||
360 | ||
361 | \membersection{wxTreeCtrl::ExpandAllChildren}\label{wxtreectrlexpandallchildren} | |
362 | ||
363 | \func{void}{ExpandAllChildren}{\param{const wxTreeItemId\&}{ item}} | |
364 | ||
365 | Expands the given item and all its children recursively. | |
366 | ||
367 | ||
4fabb575 | 368 | \membersection{wxTreeCtrl::GetBoundingRect}\label{wxtreectrlgetitemrect} |
a660d684 | 369 | |
cc81d32f | 370 | \constfunc{bool}{GetBoundingRect}{\param{const wxTreeItemId\&}{ item}, \param{wxRect\& }{rect}, \param{bool }{textOnly = {\tt false}}} |
4fabb575 | 371 | |
cc81d32f | 372 | Retrieves the rectangle bounding the {\it item}. If {\it textOnly} is {\tt true}, |
ea91314f VS |
373 | only the rectangle around the item's label will be returned, otherwise the |
374 | item's image is also taken into account. | |
296ec7d3 | 375 | |
cc81d32f | 376 | The return value is {\tt true} if the rectangle was successfully retrieved or {\tt false} |
402dfce7 | 377 | if it was not (in this case {\it rect} is not changed) -- for example, if the |
296ec7d3 | 378 | item is currently invisible. |
a660d684 | 379 | |
402dfce7 VZ |
380 | Notice that the rectangle coordinates are logical, not physical ones. So, for |
381 | example, the x coordinate may be negative if the tree has a horizontal | |
382 | scrollbar and its position is not $0$. | |
383 | ||
76e1c2de | 384 | \pythonnote{The wxPython version of this method requires only the |
c9110876 VS |
385 | {\tt item} and {\tt textOnly} parameters. The return value is either a |
386 | {\tt wxRect} object or {\tt None}.} | |
76e1c2de | 387 | |
afbe150a | 388 | \perlnote{In wxPerl this method only takes the parameters {\tt item} and |
f3539882 VZ |
389 | {\tt textOnly}, and returns a Wx::Rect ( or undef ).} |
390 | ||
3e9af289 | 391 | |
ea91314f VS |
392 | \membersection{wxTreeCtrl::GetButtonsImageList}\label{wxtreectrlgetbuttonsimagelist} |
393 | ||
394 | \constfunc{wxImageList*}{GetButtonsImageList}{\void} | |
395 | ||
396 | Returns the buttons image list (from which application-defined button images are taken). | |
397 | ||
398 | This function is only available in the generic version. | |
399 | ||
3e9af289 | 400 | |
4fabb575 | 401 | \membersection{wxTreeCtrl::GetChildrenCount}\label{wxtreectrlgetchildrencount} |
a660d684 | 402 | |
aa61d352 | 403 | \constfunc{unsigned int}{GetChildrenCount}{\param{const wxTreeItemId\&}{ item}, \param{bool}{ recursively = {\tt true}}} |
a660d684 | 404 | |
cc81d32f | 405 | Returns the number of items in the branch. If {\it recursively} is {\tt true}, returns the total number |
4fabb575 | 406 | of descendants, otherwise only one level of children is counted. |
a660d684 | 407 | |
3e9af289 | 408 | |
a660d684 KB |
409 | \membersection{wxTreeCtrl::GetCount}\label{wxtreectrlgetcount} |
410 | ||
aa61d352 | 411 | \constfunc{unsigned int}{GetCount}{\void} |
a660d684 KB |
412 | |
413 | Returns the number of items in the control. | |
414 | ||
3e9af289 | 415 | |
a660d684 KB |
416 | \membersection{wxTreeCtrl::GetEditControl}\label{wxtreectrlgeteditcontrol} |
417 | ||
513e0cea | 418 | \constfunc{wxTextCtrl *}{GetEditControl}{\void} |
a660d684 | 419 | |
513e0cea VZ |
420 | Returns the edit control being currently used to edit a label. Returns {\tt NULL} |
421 | if no label is being edited. | |
422 | ||
423 | {\bf NB:} It is currently only implemented for wxMSW. | |
a660d684 | 424 | |
3e9af289 | 425 | |
4fabb575 JS |
426 | \membersection{wxTreeCtrl::GetFirstChild}\label{wxtreectrlgetfirstchild} |
427 | ||
2f7b6734 | 428 | \constfunc{wxTreeItemId}{GetFirstChild}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemIdValue \& }{cookie}} |
4fabb575 JS |
429 | |
430 | Returns the first child; call \helpref{wxTreeCtrl::GetNextChild}{wxtreectrlgetnextchild} for the next child. | |
431 | ||
432 | For this enumeration function you must pass in a `cookie' parameter | |
433 | which is opaque for the application but is necessary for the library | |
434 | to make these functions reentrant (i.e. allow more than one | |
435 | enumeration on one and the same object simultaneously). The cookie passed to | |
2b5f62a0 | 436 | GetFirstChild and GetNextChild should be the same variable. |
4fabb575 | 437 | |
3980000c | 438 | Returns an invalid tree item (i.e. IsOk() returns {\tt false}) if there are no further children. |
4fabb575 JS |
439 | |
440 | \wxheading{See also} | |
441 | ||
2b5f62a0 VZ |
442 | \helpref{wxTreeCtrl::GetNextChild}{wxtreectrlgetnextchild}, |
443 | \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} | |
4fabb575 | 444 | |
f899db6d RD |
445 | \pythonnote{In wxPython the returned wxTreeItemId and the new cookie |
446 | value are both returned as a tuple containing the two values.} | |
447 | ||
f3539882 | 448 | \perlnote{In wxPerl this method only takes the {\tt item} parameter, and |
9722642d | 449 | returns a 2-element list {\tt ( item, cookie )}.} |
f3539882 | 450 | |
3e9af289 | 451 | |
a660d684 KB |
452 | \membersection{wxTreeCtrl::GetFirstVisibleItem}\label{wxtreectrlgetfirstvisibleitem} |
453 | ||
4fabb575 | 454 | \constfunc{wxTreeItemId}{GetFirstVisibleItem}{\void} |
a660d684 KB |
455 | |
456 | Returns the first visible item. | |
457 | ||
3e9af289 | 458 | |
a660d684 KB |
459 | \membersection{wxTreeCtrl::GetImageList}\label{wxtreectrlgetimagelist} |
460 | ||
e2b34251 | 461 | \constfunc{wxImageList*}{GetImageList}{\void} |
a660d684 | 462 | |
e2b34251 | 463 | Returns the normal image list. |
a660d684 | 464 | |
3e9af289 | 465 | |
a660d684 KB |
466 | \membersection{wxTreeCtrl::GetIndent}\label{wxtreectrlgetindent} |
467 | ||
468 | \constfunc{int}{GetIndent}{\void} | |
469 | ||
470 | Returns the current tree control indentation. | |
471 | ||
3e9af289 | 472 | |
2b5f62a0 VZ |
473 | \membersection{wxTreeCtrl::GetItemBackgroundColour}\label{wxtreectrlgetitembackgroundcolour} |
474 | ||
475 | \constfunc{wxColour}{GetItemBackgroundColour}{\param{const wxTreeItemId\&}{ item}} | |
476 | ||
477 | Returns the background colour of the item. | |
478 | ||
3e9af289 | 479 | |
4fabb575 | 480 | \membersection{wxTreeCtrl::GetItemData}\label{wxtreectrlgetitemdata} |
a660d684 | 481 | |
4fabb575 | 482 | \constfunc{wxTreeItemData*}{GetItemData}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 483 | |
4fabb575 | 484 | Returns the tree item data associated with the item. |
a660d684 | 485 | |
4fabb575 | 486 | \wxheading{See also} |
a660d684 | 487 | |
4fabb575 | 488 | \helpref{wxTreeItemData}{wxtreeitemdata} |
a660d684 | 489 | |
ecf527c0 JS |
490 | \pythonnote{wxPython provides the following shortcut method: |
491 | ||
492 | \indented{2cm}{\begin{twocollist}\itemsep=0pt | |
c9110876 | 493 | \twocolitem{{\bf GetPyData(item)}}{Returns the Python Object |
f899db6d RD |
494 | associated with the wxTreeItemData for the given item Id.} |
495 | \end{twocollist}} | |
d2c2afc9 | 496 | }% |
f899db6d | 497 | |
f3539882 VZ |
498 | \perlnote{wxPerl provides the following shortcut method: |
499 | \indented{2cm}{ | |
500 | \begin{twocollist}\itemsep=0pt | |
501 | \twocolitem{{\bf GetPlData( item )}}{Returns the Perl data | |
d2c2afc9 JS |
502 | associated with the Wx::TreeItemData. It is just the same as |
503 | tree->GetItemData(item)->GetData().} | |
f3539882 | 504 | \end{twocollist}} |
d2c2afc9 | 505 | }% |
3e9af289 | 506 | |
2b5f62a0 VZ |
507 | \membersection{wxTreeCtrl::GetItemFont}\label{wxtreectrlgetitemfont} |
508 | ||
509 | \constfunc{wxFont}{GetItemFont}{\param{const wxTreeItemId\&}{ item}} | |
510 | ||
511 | Returns the font of the item label. | |
512 | ||
3e9af289 | 513 | |
4fabb575 | 514 | \membersection{wxTreeCtrl::GetItemImage}\label{wxtreectrlgetitemimage} |
a660d684 | 515 | |
74b31181 | 516 | \constfunc{int}{GetItemImage}{\param{const wxTreeItemId\& }{item}, |
ecf527c0 | 517 | \param{wxTreeItemIcon }{which = wxTreeItemIcon\_Normal}} |
74b31181 VZ |
518 | |
519 | Gets the specified item image. The value of {\it which} may be: | |
ecf527c0 | 520 | |
74b31181 VZ |
521 | \begin{itemize}\itemsep=0pt |
522 | \item{wxTreeItemIcon\_Normal} to get the normal item image | |
523 | \item{wxTreeItemIcon\_Selected} to get the selected item image (i.e. the image | |
524 | which is shown when the item is currently selected) | |
525 | \item{wxTreeItemIcon\_Expanded} to get the expanded image (this only | |
526 | makes sense for items which have children - then this image is shown when the | |
527 | item is expanded and the normal image is shown when it is collapsed) | |
528 | \item{wxTreeItemIcon\_SelectedExpanded} to get the selected expanded image | |
529 | (which is shown when an expanded item is currently selected) | |
530 | \end{itemize} | |
a660d684 | 531 | |
3e9af289 | 532 | |
4fabb575 | 533 | \membersection{wxTreeCtrl::GetItemText}\label{wxtreectrlgetitemtext} |
a660d684 | 534 | |
4fabb575 | 535 | \constfunc{wxString}{GetItemText}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 536 | |
4fabb575 | 537 | Returns the item label. |
a660d684 | 538 | |
3e9af289 | 539 | |
2b5f62a0 VZ |
540 | \membersection{wxTreeCtrl::GetItemTextColour}\label{wxtreectrlgetitemtextcolour} |
541 | ||
542 | \constfunc{wxColour}{GetItemTextColour}{\param{const wxTreeItemId\&}{ item}} | |
543 | ||
544 | Returns the colour of the item label. | |
545 | ||
3e9af289 | 546 | |
978f38c2 VZ |
547 | \membersection{wxTreeCtrl::GetLastChild}\label{wxtreectrlgetlastchild} |
548 | ||
549 | \constfunc{wxTreeItemId}{GetLastChild}{\param{const wxTreeItemId\&}{ item}} | |
550 | ||
ed93168b | 551 | Returns the last child of the item (or an invalid tree item if this item has no children). |
978f38c2 VZ |
552 | |
553 | \wxheading{See also} | |
554 | ||
f6bcfd97 | 555 | \helpref{GetFirstChild}{wxtreectrlgetfirstchild}, |
2b5f62a0 | 556 | \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling}, |
978f38c2 VZ |
557 | \helpref{GetLastChild}{wxtreectrlgetlastchild} |
558 | ||
3e9af289 | 559 | |
4fabb575 | 560 | \membersection{wxTreeCtrl::GetNextChild}\label{wxtreectrlgetnextchild} |
a660d684 | 561 | |
2f7b6734 | 562 | \constfunc{wxTreeItemId}{GetNextChild}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemIdValue \& }{cookie}} |
a660d684 | 563 | |
4fabb575 | 564 | Returns the next child; call \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild} for the first child. |
a660d684 | 565 | |
4fabb575 JS |
566 | For this enumeration function you must pass in a `cookie' parameter |
567 | which is opaque for the application but is necessary for the library | |
568 | to make these functions reentrant (i.e. allow more than one | |
569 | enumeration on one and the same object simultaneously). The cookie passed to | |
570 | GetFirstChild and GetNextChild should be the same. | |
a660d684 | 571 | |
ed93168b | 572 | Returns an invalid tree item if there are no further children. |
a660d684 | 573 | |
4fabb575 | 574 | \wxheading{See also} |
a660d684 | 575 | |
4fabb575 | 576 | \helpref{wxTreeCtrl::GetFirstChild}{wxtreectrlgetfirstchild} |
a660d684 | 577 | |
f899db6d RD |
578 | \pythonnote{In wxPython the returned wxTreeItemId and the new cookie |
579 | value are both returned as a tuple containing the two values.} | |
580 | ||
f3539882 | 581 | \perlnote{In wxPerl this method returns a 2-element list |
9722642d | 582 | {\tt ( item, cookie )}, instead of modifying its parameters.} |
f3539882 | 583 | |
3e9af289 | 584 | |
4fabb575 | 585 | \membersection{wxTreeCtrl::GetNextSibling}\label{wxtreectrlgetnextsibling} |
a660d684 | 586 | |
4fabb575 | 587 | \constfunc{wxTreeItemId}{GetNextSibling}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 588 | |
4fabb575 | 589 | Returns the next sibling of the specified item; call \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} for the previous sibling. |
a660d684 | 590 | |
ed93168b | 591 | Returns an invalid tree item if there are no further siblings. |
a660d684 | 592 | |
4fabb575 JS |
593 | \wxheading{See also} |
594 | ||
595 | \helpref{wxTreeCtrl::GetPrevSibling}{wxtreectrlgetprevsibling} | |
596 | ||
3e9af289 | 597 | |
4fabb575 JS |
598 | \membersection{wxTreeCtrl::GetNextVisible}\label{wxtreectrlgetnextvisible} |
599 | ||
600 | \constfunc{wxTreeItemId}{GetNextVisible}{\param{const wxTreeItemId\&}{ item}} | |
a660d684 KB |
601 | |
602 | Returns the next visible item. | |
603 | ||
3e9af289 | 604 | |
99006e44 RL |
605 | \membersection{wxTreeCtrl::GetItemParent}\label{wxtreectrlgetitemparent} |
606 | ||
607 | \constfunc{wxTreeItemId}{GetItemParent}{\param{const wxTreeItemId\&}{ item}} | |
608 | ||
609 | Returns the item's parent. | |
610 | ||
3e9af289 | 611 | |
4fabb575 JS |
612 | \membersection{wxTreeCtrl::GetPrevSibling}\label{wxtreectrlgetprevsibling} |
613 | ||
614 | \constfunc{wxTreeItemId}{GetPrevSibling}{\param{const wxTreeItemId\&}{ item}} | |
615 | ||
616 | Returns the previous sibling of the specified item; call \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} for the next sibling. | |
617 | ||
ed93168b | 618 | Returns an invalid tree item if there are no further children. |
4fabb575 JS |
619 | |
620 | \wxheading{See also} | |
621 | ||
622 | \helpref{wxTreeCtrl::GetNextSibling}{wxtreectrlgetnextsibling} | |
623 | ||
3e9af289 | 624 | |
4fabb575 JS |
625 | \membersection{wxTreeCtrl::GetPrevVisible}\label{wxtreectrlgetprevvisible} |
626 | ||
627 | \constfunc{wxTreeItemId}{GetPrevVisible}{\param{const wxTreeItemId\&}{ item}} | |
628 | ||
629 | Returns the previous visible item. | |
630 | ||
3e9af289 | 631 | |
77a17719 JS |
632 | \membersection{wxTreeCtrl::GetQuickBestSize}\label{wxtreectrlgetquickbestsize} |
633 | ||
634 | \constfunc{bool}{GetQuickBestSize}{\void} | |
635 | ||
636 | Returns true if the control will use a quick calculation for the best size, | |
637 | looking only at the first and last items. The default is false. | |
638 | ||
639 | \wxheading{See also} | |
640 | ||
641 | \helpref{wxTreeCtrl::SetQuickBestSize}{wxtreectrlsetquickbestsize} | |
642 | ||
643 | ||
a660d684 KB |
644 | \membersection{wxTreeCtrl::GetRootItem}\label{wxtreectrlgetrootitem} |
645 | ||
4fabb575 | 646 | \constfunc{wxTreeItemId}{GetRootItem}{\void} |
a660d684 KB |
647 | |
648 | Returns the root item for the tree control. | |
649 | ||
3e9af289 | 650 | |
ed93168b | 651 | \membersection{wxTreeCtrl::GetItemSelectedImage}\label{wxtreectrlgetitemselectedimage} |
4fabb575 | 652 | |
ed93168b | 653 | \constfunc{int}{GetItemSelectedImage}{\param{const wxTreeItemId\& }{item}} |
4fabb575 | 654 | |
f6bcfd97 | 655 | Gets the selected item image (this function is obsolete, use |
b2cf617c | 656 | {\tt GetItemImage(item, wxTreeItemIcon\_Selected}) instead). |
4fabb575 | 657 | |
3e9af289 | 658 | |
a660d684 KB |
659 | \membersection{wxTreeCtrl::GetSelection}\label{wxtreectrlgetselection} |
660 | ||
4fabb575 | 661 | \constfunc{wxTreeItemId}{GetSelection}{\void} |
a660d684 | 662 | |
ed93168b | 663 | Returns the selection, or an invalid item if there is no selection. |
f6bcfd97 | 664 | This function only works with the controls without wxTR\_MULTIPLE style, use |
9dfbf520 VZ |
665 | \helpref{GetSelections}{wxtreectrlgetselections} for the controls which do have |
666 | this style. | |
667 | ||
3e9af289 | 668 | |
9dfbf520 VZ |
669 | \membersection{wxTreeCtrl::GetSelections}\label{wxtreectrlgetselections} |
670 | ||
aa61d352 | 671 | \constfunc{unsigned int}{GetSelections}{\param{wxArrayTreeItemIds\& }{selection}} |
9dfbf520 VZ |
672 | |
673 | Fills the array of tree items passed in with the currently selected items. This | |
674 | function can be called only if the control has the wxTR\_MULTIPLE style. | |
675 | ||
676 | Returns the number of selected items. | |
a660d684 | 677 | |
76e1c2de | 678 | \pythonnote{The wxPython version of this method accepts no parameters |
ecf527c0 | 679 | and returns a Python list of {\tt wxTreeItemId}s.} |
76e1c2de | 680 | |
f3539882 VZ |
681 | \perlnote{In wxPerl this method takes no parameters and returns a list of |
682 | {\tt Wx::TreeItemId}s.} | |
683 | ||
3e9af289 | 684 | |
e2b34251 JS |
685 | \membersection{wxTreeCtrl::GetStateImageList}\label{wxtreectrlgetstateimagelist} |
686 | ||
687 | \constfunc{wxImageList*}{GetStateImageList}{\void} | |
688 | ||
689 | Returns the state image list (from which application-defined state images are taken). | |
690 | ||
3e9af289 | 691 | |
a660d684 KB |
692 | \membersection{wxTreeCtrl::HitTest}\label{wxtreectrlhittest} |
693 | ||
be0e5d69 | 694 | \constfunc{wxTreeItemId}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}} |
a660d684 | 695 | |
f6bcfd97 BP |
696 | Calculates which (if any) item is under the given point, returning the tree item |
697 | id at this point plus extra information {\it flags}. {\it flags} is a bitlist of the following: | |
a660d684 KB |
698 | |
699 | \twocolwidtha{5cm} | |
700 | \begin{twocollist}\itemsep=0pt | |
701 | \twocolitem{wxTREE\_HITTEST\_ABOVE}{Above the client area.} | |
702 | \twocolitem{wxTREE\_HITTEST\_BELOW}{Below the client area.} | |
703 | \twocolitem{wxTREE\_HITTEST\_NOWHERE}{In the client area but below the last item.} | |
704 | \twocolitem{wxTREE\_HITTEST\_ONITEMBUTTON}{On the button associated with an item.} | |
705 | \twocolitem{wxTREE\_HITTEST\_ONITEMICON}{On the bitmap associated with an item.} | |
706 | \twocolitem{wxTREE\_HITTEST\_ONITEMINDENT}{In the indentation associated with an item.} | |
707 | \twocolitem{wxTREE\_HITTEST\_ONITEMLABEL}{On the label (string) associated with an item.} | |
708 | \twocolitem{wxTREE\_HITTEST\_ONITEMRIGHT}{In the area to the right of an item.} | |
709 | \twocolitem{wxTREE\_HITTEST\_ONITEMSTATEICON}{On the state icon for a tree view item that is in a user-defined state.} | |
710 | \twocolitem{wxTREE\_HITTEST\_TOLEFT}{To the right of the client area.} | |
711 | \twocolitem{wxTREE\_HITTEST\_TORIGHT}{To the left of the client area.} | |
712 | \end{twocollist} | |
713 | ||
aa9fb2be RD |
714 | \pythonnote{in wxPython both the wxTreeItemId and the flags are |
715 | returned as a tuple.} | |
716 | ||
f3539882 | 717 | \perlnote{In wxPerl this method only takes the {\tt point} parameter |
9722642d | 718 | and returns a 2-element list {\tt ( item, flags )}.} |
f3539882 | 719 | |
3e9af289 | 720 | |
a660d684 KB |
721 | \membersection{wxTreeCtrl::InsertItem}\label{wxtreectrlinsertitem} |
722 | ||
4fabb575 | 723 | \func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxTreeItemId\& }{previous}, \param{const wxString\&}{ text}, |
513e0cea | 724 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = {\tt NULL}}} |
a660d684 | 725 | |
f2593d0d | 726 | \func{wxTreeItemId}{InsertItem}{\param{const wxTreeItemId\& }{parent}, \param{size\_t}{ before}, \param{const wxString\&}{ text}, |
513e0cea | 727 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = {\tt NULL}}} |
f2593d0d RR |
728 | |
729 | Inserts an item after a given one ({\it previous}) or before one identified by its position ({\it before}). | |
2f930c85 | 730 | {\it before} must be less than the number of children. |
a660d684 | 731 | |
ea91314f VS |
732 | The {\it image} and {\it selImage} parameters are an index within |
733 | the normal image list specifying the image to use for unselected and | |
734 | selected items, respectively. | |
a660d684 KB |
735 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for |
736 | both selected and unselected items. | |
737 | ||
f6bcfd97 | 738 | \pythonnote{The second form of this method is called |
7af3ca16 | 739 | {\tt InsertItemBefore} in wxPython.} |
f6bcfd97 | 740 | |
3e9af289 | 741 | |
ed93168b VZ |
742 | \membersection{wxTreeCtrl::IsBold}\label{wxtreectrlisbold} |
743 | ||
744 | \constfunc{bool}{IsBold}{\param{const wxTreeItemId\& }{item}} | |
745 | ||
cc81d32f | 746 | Returns {\tt true} if the given item is in bold state. |
ed93168b VZ |
747 | |
748 | See also: \helpref{SetItemBold}{wxtreectrlsetitembold} | |
749 | ||
3e9af289 | 750 | |
9248adc8 VZ |
751 | \membersection{wxTreeCtrl::IsEmpty}\label{wxtreectrlisempty} |
752 | ||
753 | \constfunc{bool}{IsEmpty}{} | |
754 | ||
755 | Returns \true if the control is empty (i.e. has no items, even no root one). | |
756 | ||
757 | ||
4fabb575 JS |
758 | \membersection{wxTreeCtrl::IsExpanded}\label{wxtreectrlisexpanded} |
759 | ||
760 | \constfunc{bool}{IsExpanded}{\param{const wxTreeItemId\&}{ item}} | |
761 | ||
cc81d32f | 762 | Returns {\tt true} if the item is expanded (only makes sense if it has children). |
4fabb575 | 763 | |
3e9af289 | 764 | |
4fabb575 JS |
765 | \membersection{wxTreeCtrl::IsSelected}\label{wxtreectrlisselected} |
766 | ||
767 | \constfunc{bool}{IsSelected}{\param{const wxTreeItemId\&}{ item}} | |
768 | ||
cc81d32f | 769 | Returns {\tt true} if the item is selected. |
4fabb575 | 770 | |
3e9af289 | 771 | |
4fabb575 JS |
772 | \membersection{wxTreeCtrl::IsVisible}\label{wxtreectrlisvisible} |
773 | ||
774 | \constfunc{bool}{IsVisible}{\param{const wxTreeItemId\&}{ item}} | |
775 | ||
cc81d32f | 776 | Returns {\tt true} if the item is visible (it might be outside the view, or not expanded). |
4fabb575 | 777 | |
3e9af289 | 778 | |
a660d684 KB |
779 | \membersection{wxTreeCtrl::ItemHasChildren}\label{wxtreectrlitemhaschildren} |
780 | ||
4fabb575 | 781 | \constfunc{bool}{ItemHasChildren}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 782 | |
cc81d32f | 783 | Returns {\tt true} if the item has children. |
a660d684 | 784 | |
3e9af289 | 785 | |
ed93168b VZ |
786 | \membersection{wxTreeCtrl::OnCompareItems}\label{wxtreectrloncompareitems} |
787 | ||
788 | \func{int}{OnCompareItems}{\param{const wxTreeItemId\& }{item1}, \param{const wxTreeItemId\& }{item2}} | |
789 | ||
790 | Override this function in the derived class to change the sort order of the | |
791 | items in the tree control. The function should return a negative, zero or | |
792 | positive value if the first item is less than, equal to or greater than the | |
793 | second one. | |
794 | ||
22bea944 VZ |
795 | Please note that you \textbf{must} use wxRTTI macros |
796 | \helpref{DECLARE\_DYNAMIC\_CLASS}{declaredynamicclass} and | |
797 | \helpref{IMPLEMENT\_DYNAMIC\_CLASS}{implementdynamicclass} if you override this | |
798 | function because otherwise the base class considers that it is not overridden | |
799 | and uses the default comparison, i.e. sorts the items alphabetically, which | |
800 | allows it optimize away the calls to the virtual function completely. | |
ed93168b VZ |
801 | |
802 | See also: \helpref{SortChildren}{wxtreectrlsortchildren} | |
803 | ||
3e9af289 | 804 | |
4fabb575 JS |
805 | \membersection{wxTreeCtrl::PrependItem}\label{wxtreectrlprependitem} |
806 | ||
807 | \func{wxTreeItemId}{PrependItem}{\param{const wxTreeItemId\& }{parent}, \param{const wxString\&}{ text}, | |
513e0cea | 808 | \param{int}{ image = -1}, \param{int}{ selImage = -1}, \param{wxTreeItemData*}{ data = {\tt NULL}}} |
4fabb575 JS |
809 | |
810 | Appends an item as the first child of {\it parent}, return a new item id. | |
811 | ||
ea91314f VS |
812 | The {\it image} and {\it selImage} parameters are an index within |
813 | the normal image list specifying the image to use for unselected and | |
814 | selected items, respectively. | |
4fabb575 JS |
815 | If {\it image} > -1 and {\it selImage} is -1, the same image is used for |
816 | both selected and unselected items. | |
817 | ||
3e9af289 | 818 | |
a660d684 KB |
819 | \membersection{wxTreeCtrl::ScrollTo}\label{wxtreectrlscrollto} |
820 | ||
4fabb575 | 821 | \func{void}{ScrollTo}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 822 | |
4fabb575 | 823 | Scrolls the specified item into view. |
a660d684 | 824 | |
3e9af289 | 825 | |
a660d684 KB |
826 | \membersection{wxTreeCtrl::SelectItem}\label{wxtreectrlselectitem} |
827 | ||
3f1ed856 | 828 | \func{void}{SelectItem}{\param{const wxTreeItemId\&}{ item}, \param{bool }{select = \true}} |
3e9af289 VZ |
829 | |
830 | Selects the given item. In multiple selection controls, can be also used to | |
831 | deselect a currently selected item if the value of \arg{select} is false. | |
a660d684 | 832 | |
a660d684 | 833 | |
ea91314f VS |
834 | \membersection{wxTreeCtrl::SetButtonsImageList}\label{wxtreectrlsetbuttonsimagelist} |
835 | ||
836 | \func{void}{SetButtonsImageList}{\param{wxImageList*}{ imageList}} | |
837 | ||
838 | Sets the buttons image list (from which application-defined button images are taken). | |
839 | The button images assigned with this method will | |
840 | {\bf not} be deleted by wxTreeCtrl's destructor, you must delete it yourself. | |
841 | ||
842 | Setting or assigning the button image list enables the display of image buttons. | |
843 | Once enabled, the only way to disable the display of button images is to set | |
513e0cea | 844 | the button image list to {\tt NULL}. |
ea91314f VS |
845 | |
846 | This function is only available in the generic version. | |
847 | ||
848 | See also \helpref{AssignButtonsImageList}{wxtreectrlassignbuttonsimagelist}. | |
849 | ||
3e9af289 | 850 | |
a660d684 KB |
851 | \membersection{wxTreeCtrl::SetIndent}\label{wxtreectrlsetindent} |
852 | ||
853 | \func{void}{SetIndent}{\param{int }{indent}} | |
854 | ||
855 | Sets the indentation for the tree control. | |
856 | ||
3e9af289 | 857 | |
a660d684 KB |
858 | \membersection{wxTreeCtrl::SetImageList}\label{wxtreectrlsetimagelist} |
859 | ||
e2b34251 | 860 | \func{void}{SetImageList}{\param{wxImageList*}{ imageList}} |
a660d684 | 861 | |
46cd520d VS |
862 | Sets the normal image list. Image list assigned with this method will |
863 | {\bf not} be deleted by wxTreeCtrl's destructor, you must delete it yourself. | |
864 | ||
865 | See also \helpref{AssignImageList}{wxtreectrlassignimagelist}. | |
866 | ||
a660d684 | 867 | |
3e9af289 | 868 | |
9ec64fa7 VZ |
869 | \membersection{wxTreeCtrl::SetItemBackgroundColour}\label{wxtreectrlsetitembackgroundcolour} |
870 | ||
871 | \func{void}{SetItemBackgroundColour}{\param{const wxTreeItemId\&}{ item}, \param{const wxColour\& }{col}} | |
872 | ||
ea91314f | 873 | Sets the colour of the item's background. |
9ec64fa7 | 874 | |
3e9af289 | 875 | |
ed93168b VZ |
876 | \membersection{wxTreeCtrl::SetItemBold}\label{wxtreectrlsetitembold} |
877 | ||
cc81d32f | 878 | \func{void}{SetItemBold}{\param{const wxTreeItemId\& }{item}, \param{bool}{ bold = {\tt true}}} |
ed93168b | 879 | |
cc81d32f | 880 | Makes item appear in bold font if {\it bold} parameter is {\tt true} or resets it to |
ed93168b VZ |
881 | the normal state. |
882 | ||
883 | See also: \helpref{IsBold}{wxtreectrlisbold} | |
884 | ||
3e9af289 | 885 | |
4fabb575 | 886 | \membersection{wxTreeCtrl::SetItemData}\label{wxtreectrlsetitemdata} |
a660d684 | 887 | |
4fabb575 | 888 | \func{void}{SetItemData}{\param{const wxTreeItemId\&}{ item}, \param{wxTreeItemData* }{data}} |
a660d684 | 889 | |
4fabb575 | 890 | Sets the item client data. |
a660d684 | 891 | |
f899db6d | 892 | \pythonnote{wxPython provides the following shortcut method:\par |
ecf527c0 | 893 | \indented{2cm}{\begin{twocollist}\itemsep=0pt |
c9110876 | 894 | \twocolitem{{\bf SetPyData(item, obj)}}{Associate the given Python |
f899db6d RD |
895 | Object with the wxTreeItemData for the given item Id.} |
896 | \end{twocollist}} | |
d2c2afc9 | 897 | }% |
f899db6d | 898 | |
f3539882 VZ |
899 | \perlnote{wxPerl provides the following shortcut method: |
900 | \indented{2cm}{ | |
901 | \begin{twocollist}\itemsep=0pt | |
902 | \twocolitem{{\bf SetPlData( item, data )}}{Sets the Perl data | |
d2c2afc9 JS |
903 | associated with the Wx::TreeItemData. It is just the same as |
904 | tree->GetItemData(item)->SetData(data).} | |
f3539882 | 905 | \end{twocollist}} |
d2c2afc9 | 906 | }% |
3e9af289 | 907 | |
bee44427 | 908 | \membersection{wxTreeCtrl::SetItemDropHighlight}\label{wxtreectrlsetitemdrophighlight} |
18832389 RR |
909 | |
910 | \func{void}{SetItemDropHighlight}{\param{const wxTreeItemId\&}{ item}, \param{bool}{highlight = {\tt true}}} | |
911 | ||
912 | Gives the item the visual feedback for Drag'n'Drop actions, which is | |
913 | useful if something is dragged from the outside onto the tree control | |
914 | (as opposed to a DnD operation within the tree control, which already | |
915 | is implemented internally). | |
916 | ||
9ec64fa7 VZ |
917 | \membersection{wxTreeCtrl::SetItemFont}\label{wxtreectrlsetitemfont} |
918 | ||
919 | \func{void}{SetItemFont}{\param{const wxTreeItemId\&}{ item}, \param{const wxFont\& }{font}} | |
920 | ||
ea91314f | 921 | Sets the item's font. All items in the tree should have the same height to avoid |
9ec64fa7 VZ |
922 | text clipping, so the fonts height should be the same for all of them, |
923 | although font attributes may vary. | |
924 | ||
925 | \wxheading{See also} | |
926 | ||
927 | \helpref{SetItemBold}{wxtreectrlsetitembold} | |
928 | ||
3e9af289 | 929 | |
4fabb575 | 930 | \membersection{wxTreeCtrl::SetItemHasChildren}\label{wxtreectrlsetitemhaschildren} |
a660d684 | 931 | |
cc81d32f | 932 | \func{void}{SetItemHasChildren}{\param{const wxTreeItemId\&}{ item}, \param{bool }{hasChildren = {\tt true}}} |
a660d684 | 933 | |
4fabb575 JS |
934 | Force appearance of the button next to the item. This is useful to |
935 | allow the user to expand the items which don't have any children now, | |
936 | but instead adding them only when needed, thus minimizing memory | |
937 | usage and loading time. | |
a660d684 | 938 | |
3e9af289 | 939 | |
a660d684 KB |
940 | \membersection{wxTreeCtrl::SetItemImage}\label{wxtreectrlsetitemimage} |
941 | ||
74b31181 | 942 | \func{void}{SetItemImage}{\param{const wxTreeItemId\&}{ item}, |
ecf527c0 | 943 | \param{int }{image}, \param{wxTreeItemIcon }{which = wxTreeItemIcon\_Normal}} |
a660d684 | 944 | |
f6bcfd97 | 945 | Sets the specified item image. See \helpref{GetItemImage}{wxtreectrlgetitemimage} |
b2cf617c | 946 | for the description of the {\it which} parameter. |
a660d684 | 947 | |
3e9af289 | 948 | |
4fabb575 | 949 | \membersection{wxTreeCtrl::SetItemSelectedImage}\label{wxtreectrlsetitemselectedimage} |
a660d684 | 950 | |
4fabb575 | 951 | \func{void}{SetItemSelectedImage}{\param{const wxTreeItemId\&}{ item}, \param{int }{selImage}} |
a660d684 | 952 | |
b2cf617c | 953 | Sets the selected item image (this function is obsolete, use {\tt SetItemImage(item, wxTreeItemIcon\_Selected}) instead). |
a660d684 | 954 | |
3e9af289 | 955 | |
a660d684 KB |
956 | \membersection{wxTreeCtrl::SetItemText}\label{wxtreectrlsetitemtext} |
957 | ||
4fabb575 | 958 | \func{void}{SetItemText}{\param{const wxTreeItemId\&}{ item}, \param{const wxString\& }{text}} |
a660d684 KB |
959 | |
960 | Sets the item label. | |
961 | ||
3e9af289 | 962 | |
9ec64fa7 VZ |
963 | \membersection{wxTreeCtrl::SetItemTextColour}\label{wxtreectrlsetitemtextcolour} |
964 | ||
965 | \func{void}{SetItemTextColour}{\param{const wxTreeItemId\&}{ item}, \param{const wxColour\& }{col}} | |
966 | ||
ea91314f | 967 | Sets the colour of the item's text. |
9ec64fa7 | 968 | |
3e9af289 | 969 | |
77a17719 JS |
970 | \membersection{wxTreeCtrl::SetQuickBestSize}\label{wxtreectrlsetquickbestsize} |
971 | ||
972 | \func{void}{SetQuickBestSize}{\param{bool}{ quickBestSize}} | |
973 | ||
974 | If true is passed, specifies that the control will use a quick calculation for the best size, | |
975 | looking only at the first and last items. Otherwise, it will look at all items. | |
976 | The default is false. | |
977 | ||
978 | \wxheading{See also} | |
979 | ||
980 | \helpref{wxTreeCtrl::GetQuickBestSize}{wxtreectrlgetquickbestsize} | |
981 | ||
982 | ||
e2b34251 JS |
983 | \membersection{wxTreeCtrl::SetStateImageList}\label{wxtreectrlsetstateimagelist} |
984 | ||
985 | \func{void}{SetStateImageList}{\param{wxImageList*}{ imageList}} | |
986 | ||
987 | Sets the state image list (from which application-defined state images are taken). | |
46cd520d VS |
988 | Image list assigned with this method will |
989 | {\bf not} be deleted by wxTreeCtrl's destructor, you must delete it yourself. | |
990 | ||
991 | See also \helpref{AssignStateImageList}{wxtreectrlassignstateimagelist}. | |
e2b34251 | 992 | |
d2c2afc9 JS |
993 | \membersection{wxTreeCtrl::SetWindowStyle}\label{wxtreectrlsetwindowstyle} |
994 | ||
ea91314f VS |
995 | \func{void}{SetWindowStyle}{\param{long}{styles}} |
996 | ||
997 | Sets the mode flags associated with the display of the tree control. | |
998 | The new mode takes effect immediately. | |
999 | (Generic only; MSW ignores changes.) | |
1000 | ||
3e9af289 | 1001 | |
4fabb575 | 1002 | \membersection{wxTreeCtrl::SortChildren}\label{wxtreectrlsortchildren} |
a660d684 | 1003 | |
ed93168b | 1004 | \func{void}{SortChildren}{\param{const wxTreeItemId\&}{ item}} |
a660d684 | 1005 | |
f6bcfd97 | 1006 | Sorts the children of the given item using |
ed93168b | 1007 | \helpref{OnCompareItems}{wxtreectrloncompareitems} method of wxTreeCtrl. You |
b2cf617c | 1008 | should override that method to change the sort order (the default is ascending |
2f930c85 | 1009 | case-sensitive alphabetical order). |
4fabb575 JS |
1010 | |
1011 | \wxheading{See also} | |
1012 | ||
ed93168b | 1013 | \helpref{wxTreeItemData}{wxtreeitemdata}, \helpref{OnCompareItems}{wxtreectrloncompareitems} |
4fabb575 | 1014 | |
3e9af289 | 1015 | |
4fabb575 JS |
1016 | \membersection{wxTreeCtrl::Toggle}\label{wxtreectrltoggle} |
1017 | ||
1018 | \func{void}{Toggle}{\param{const wxTreeItemId\&}{ item}} | |
1019 | ||
1020 | Toggles the given item between collapsed and expanded states. | |
1021 | ||
3e9af289 VZ |
1022 | |
1023 | \membersection{wxTreeCtrl::ToggleItemSelection}\label{wxtreectrltoggleitemselection} | |
1024 | ||
1025 | \func{void}{ToggleItemSelection}{\param{const wxTreeItemId\&}{ item}} | |
1026 | ||
1027 | Toggles the given item between selected and unselected states. For | |
1028 | multiselection controls only. | |
1029 | ||
1030 | ||
4fabb575 JS |
1031 | \membersection{wxTreeCtrl::Unselect}\label{wxtreectrlunselect} |
1032 | ||
1033 | \func{void}{Unselect}{\void} | |
1034 | ||
1035 | Removes the selection from the currently selected item (if any). | |
1036 | ||
3e9af289 | 1037 | |
9dfbf520 VZ |
1038 | \membersection{wxTreeCtrl::UnselectAll}\label{wxtreectrlunselectall} |
1039 | ||
1040 | \func{void}{UnselectAll}{\void} | |
1041 | ||
f6bcfd97 | 1042 | This function either behaves the same as \helpref{Unselect}{wxtreectrlunselect} |
9dfbf520 VZ |
1043 | if the control doesn't have wxTR\_MULTIPLE style, or removes the selection from |
1044 | all items if it does have this style. | |
1045 | ||
3e9af289 VZ |
1046 | |
1047 | \membersection{wxTreeCtrl::UnselectItem}\label{wxtreectrlunselectitem} | |
1048 | ||
1049 | \func{void}{UnselectItem}{\param{const wxTreeItemId\& }{item}} | |
1050 | ||
1051 | Unselects the given item. This works in multiselection controls only. | |
77a17719 | 1052 | |
9248adc8 VZ |
1053 | |
1054 | ||
1055 | ||
1056 | ||
1057 | %% the wxTreeItemId opaque class | |
1058 | ||
1059 | ||
1060 | \section{\class{wxTreeItemId}}\label{wxtreeitemid} | |
1061 | ||
1062 | An opaque reference to a tree item. | |
1063 | ||
1064 | ||
1065 | \wxheading{Derived from} | |
1066 | ||
1067 | None | |
1068 | ||
1069 | \wxheading{Include files} | |
1070 | ||
1071 | <wx/treebase.h> | |
1072 | ||
1073 | \wxheading{See also} | |
1074 | ||
df0468c7 | 1075 | \helpref{wxTreeCtrl}{wxtreectrl}, \helpref{wxTreeItemData}{wxtreeitemdata},\\ |
9248adc8 VZ |
1076 | \helpref{wxTreeCtrl overview}{wxtreectrloverview} |
1077 | ||
1078 | ||
1079 | \latexignore{\rtfignore{\wxheading{Members}}} | |
1080 | ||
1081 | \membersection{wxTreeItemId::wxTreeItemId}\label{wxtreeitemidconstr} | |
1082 | ||
1083 | \func{}{wxTreeItemId}{\void} | |
1084 | ||
1085 | Default constructor. wxTreemItemIds are not meant to be constructed explicitly by | |
df0468c7 | 1086 | the user; they are returned by the \helpref{wxTreeCtrl}{wxtreectrl} functions instead. |
9248adc8 VZ |
1087 | |
1088 | ||
1089 | \membersection{wxTreeItemId::IsOk}\label{wxtreeitemidisok} | |
1090 | ||
1091 | \constfunc{bool}{IsOk}{} | |
1092 | ||
1093 | Returns \true if this instance is referencing a valid tree item. | |
1094 | ||
1095 | ||
1096 | \membersection{Operators}\label{wxtreeitemidoperators} | |
1097 | ||
1098 | \constfunc{void}{operator $!$}{} | |
1099 | ||
1100 | Synonim for \helpref{IsOk}{wxtreeitemidisok} | |
1101 | ||
1102 | ||
1103 | \constfunc{bool}{operator $==$}{\param{const wxTreeItemId\& }{item}} | |
1104 | ||
1105 | \constfunc{bool}{operator $!=$}{\param{const wxTreeItemId\& }{item}} | |
1106 | ||
1107 | Operators for comparison between \helpref{wxTreeItemId}{wxtreeitemid} objects. | |
1108 |