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