]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: treectrl.h | |
e54c96f1 | 3 | // Purpose: interface of wxTreeItemData |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
e54c96f1 | 9 | |
23324ae1 FM |
10 | /** |
11 | @class wxTreeCtrl | |
7c913512 | 12 | |
23324ae1 | 13 | A tree control presents information as a hierarchy, with items that may be |
7977b62a BP |
14 | expanded to show further items. Items in a tree control are referenced by |
15 | wxTreeItemId handles, which may be tested for validity by calling | |
16 | wxTreeItemId::IsOk(). | |
03966fcb | 17 | |
f0871806 RR |
18 | A similar control with a fully native implemtation for GTK+ and OS X |
19 | as well is wxDataViewTreeCtrl. | |
7c913512 | 20 | |
7977b62a BP |
21 | To intercept events from a tree control, use the event table macros |
22 | described in wxTreeEvent. | |
7c913512 | 23 | |
23324ae1 | 24 | @beginStyleTable |
8c6791e4 | 25 | @style{wxTR_EDIT_LABELS} |
7977b62a BP |
26 | Use this style if you wish the user to be able to edit labels in the |
27 | tree control. | |
8c6791e4 | 28 | @style{wxTR_NO_BUTTONS} |
7977b62a | 29 | For convenience to document that no buttons are to be drawn. |
8c6791e4 | 30 | @style{wxTR_HAS_BUTTONS} |
7977b62a | 31 | Use this style to show + and - buttons to the left of parent items. |
8c6791e4 | 32 | @style{wxTR_NO_LINES} |
7977b62a | 33 | Use this style to hide vertical level connectors. |
8c6791e4 | 34 | @style{wxTR_FULL_ROW_HIGHLIGHT} |
7977b62a BP |
35 | Use this style to have the background colour and the selection highlight |
36 | extend over the entire horizontal row of the tree control window. (This | |
37 | flag is ignored under Windows unless you specify @c wxTR_NO_LINES as | |
38 | well.) | |
8c6791e4 | 39 | @style{wxTR_LINES_AT_ROOT} |
7977b62a BP |
40 | Use this style to show lines between root nodes. Only applicable if @c |
41 | wxTR_HIDE_ROOT is set and @c wxTR_NO_LINES is not set. | |
8c6791e4 | 42 | @style{wxTR_HIDE_ROOT} |
7977b62a BP |
43 | Use this style to suppress the display of the root node, effectively |
44 | causing the first-level nodes to appear as a series of root nodes. | |
8c6791e4 | 45 | @style{wxTR_ROW_LINES} |
7977b62a | 46 | Use this style to draw a contrasting border between displayed rows. |
8c6791e4 | 47 | @style{wxTR_HAS_VARIABLE_ROW_HEIGHT} |
7977b62a BP |
48 | Use this style to cause row heights to be just big enough to fit the |
49 | content. If not set, all rows use the largest row height. The default is | |
50 | that this flag is unset. Generic only. | |
8c6791e4 | 51 | @style{wxTR_SINGLE} |
7977b62a BP |
52 | For convenience to document that only one item may be selected at a |
53 | time. Selecting another item causes the current selection, if any, to be | |
54 | deselected. This is the default. | |
8c6791e4 | 55 | @style{wxTR_MULTIPLE} |
7977b62a BP |
56 | Use this style to allow a range of items to be selected. If a second |
57 | range is selected, the current range, if any, is deselected. | |
8c6791e4 | 58 | @style{wxTR_DEFAULT_STYLE} |
7977b62a BP |
59 | The set of flags that are closest to the defaults for the native control |
60 | for a particular toolkit. | |
23324ae1 | 61 | @endStyleTable |
7c913512 | 62 | |
98d45c55 RR |
63 | @beginEventTable{wxTreeEvent} |
64 | @event{EVT_TREE_BEGIN_DRAG(id, func)} | |
65 | Begin dragging with the left mouse button. | |
66 | @event{EVT_TREE_BEGIN_RDRAG(id, func)} | |
67 | Begin dragging with the right mouse button. | |
68 | @event{EVT_TREE_END_DRAG(id, func)} | |
69 | End dragging with the left or right mouse button. | |
70 | @event{EVT_TREE_BEGIN_LABEL_EDIT(id, func)} | |
71 | Begin editing a label. This can be prevented by calling Veto(). | |
72 | @event{EVT_TREE_END_LABEL_EDIT(id, func)} | |
73 | Finish editing a label. This can be prevented by calling Veto(). | |
74 | @event{EVT_TREE_DELETE_ITEM(id, func)} | |
75 | An item was deleted. | |
76 | @event{EVT_TREE_GET_INFO(id, func)} | |
77 | Request information from the application. | |
78 | @event{EVT_TREE_SET_INFO(id, func)} | |
79 | Information is being supplied. | |
80 | @event{EVT_TREE_ITEM_ACTIVATED(id, func)} | |
81 | The item has been activated, i.e. chosen by double clicking it with mouse or from keyboard. | |
82 | @event{EVT_TREE_ITEM_COLLAPSED(id, func)} | |
83 | The item has been collapsed. | |
84 | @event{EVT_TREE_ITEM_COLLAPSING(id, func)} | |
85 | The item is being collapsed. This can be prevented by calling Veto(). | |
86 | @event{EVT_TREE_ITEM_EXPANDED(id, func)} | |
87 | The item has been expanded. | |
88 | @event{EVT_TREE_ITEM_EXPANDING(id, func)} | |
89 | The item is being expanded. This can be prevented by calling Veto(). | |
90 | @event{EVT_TREE_ITEM_RIGHT_CLICK(id, func)} | |
91 | The user has clicked the item with the right mouse button. | |
92 | @event{EVT_TREE_ITEM_MIDDLE_CLICK(id, func)} | |
93 | The user has clicked the item with the middle mouse button. | |
94 | @event{EVT_TREE_SEL_CHANGED(id, func)} | |
95 | Selection has changed. | |
96 | @event{EVT_TREE_SEL_CHANGING(id, func)} | |
97 | Selection is changing. This can be prevented by calling Veto(). | |
98 | @event{EVT_TREE_KEY_DOWN(id, func)} | |
99 | A key has been pressed. | |
100 | @event{EVT_TREE_ITEM_GETTOOLTIP(id, func)} | |
101 | The opportunity to set the item tooltip is being given to the application (call wxTreeEvent::SetToolTip). Windows only. | |
102 | @event{EVT_TREE_ITEM_MENU(id, func)} | |
103 | The context menu for the selected item has been requested, either by a right click or by using the menu key. | |
104 | @event{EVT_TREE_STATE_IMAGE_CLICK(id, func)} | |
105 | The state image has been clicked. Windows only. | |
106 | @endEventTable | |
107 | ||
108 | ||
7977b62a | 109 | See also @ref overview_windowstyles. |
03966fcb | 110 | |
7977b62a BP |
111 | @b Win32 @b notes: |
112 | ||
113 | wxTreeCtrl class uses the standard common treeview control under Win32 | |
114 | implemented in the system library comctl32.dll. Some versions of this | |
115 | library are known to have bugs with handling the tree control colours: the | |
116 | usual symptom is that the expanded items leave black (or otherwise | |
117 | incorrectly coloured) background behind them, especially for the controls | |
118 | using non-default background colour. The recommended solution is to upgrade | |
119 | the comctl32.dll to a newer version: see | |
120 | http://www.microsoft.com/downloads/details.aspx?familyid=cb2cf3a2-8025-4e8f-8511-9b476a8d35d2 | |
121 | ||
23324ae1 FM |
122 | @library{wxcore} |
123 | @category{ctrl} | |
0c7fe6f2 | 124 | <!-- @appearance{treectrl.png} --> |
7c913512 | 125 | |
f0871806 | 126 | @see wxDataViewTreeCtrl, wxTreeEvent, wxTreeItemData, @ref overview_treectrl, wxListBox, |
7977b62a | 127 | wxListCtrl, wxImageList |
23324ae1 FM |
128 | */ |
129 | class wxTreeCtrl : public wxControl | |
130 | { | |
131 | public: | |
7977b62a BP |
132 | /** |
133 | Default Constructor. | |
134 | */ | |
135 | wxTreeCtrl(); | |
136 | ||
23324ae1 FM |
137 | /** |
138 | Constructor, creating and showing a tree control. | |
3c4f71cc | 139 | |
7c913512 | 140 | @param parent |
4cc4bfaf | 141 | Parent window. Must not be @NULL. |
7c913512 | 142 | @param id |
7977b62a | 143 | Window identifier. The value @c wxID_ANY indicates a default value. |
7c913512 | 144 | @param pos |
4cc4bfaf | 145 | Window position. |
7c913512 | 146 | @param size |
7977b62a | 147 | Window size. If wxDefaultSize is specified then the window is sized |
4cc4bfaf | 148 | appropriately. |
7c913512 | 149 | @param style |
4cc4bfaf | 150 | Window style. See wxTreeCtrl. |
7c913512 | 151 | @param validator |
4cc4bfaf | 152 | Window validator. |
7c913512 | 153 | @param name |
4cc4bfaf | 154 | Window name. |
3c4f71cc | 155 | |
4cc4bfaf | 156 | @see Create(), wxValidator |
23324ae1 | 157 | */ |
7c913512 FM |
158 | wxTreeCtrl(wxWindow* parent, wxWindowID id, |
159 | const wxPoint& pos = wxDefaultPosition, | |
160 | const wxSize& size = wxDefaultSize, | |
161 | long style = wxTR_HAS_BUTTONS, | |
162 | const wxValidator& validator = wxDefaultValidator, | |
163 | const wxString& name = "treeCtrl"); | |
03966fcb | 164 | |
23324ae1 FM |
165 | |
166 | /** | |
167 | Destructor, destroying the tree control. | |
168 | */ | |
adaaa686 | 169 | virtual ~wxTreeCtrl(); |
23324ae1 FM |
170 | |
171 | /** | |
172 | Adds the root node to the tree, returning the new item. | |
7977b62a BP |
173 | |
174 | The @a image and @a selImage parameters are an index within the normal | |
175 | image list specifying the image to use for unselected and selected | |
176 | items, respectively. If @a image -1 and @a selImage is -1, the same | |
177 | image is used for both selected and unselected items. | |
23324ae1 | 178 | */ |
adaaa686 FM |
179 | virtual wxTreeItemId AddRoot(const wxString& text, int image = -1, |
180 | int selImage = -1, | |
181 | wxTreeItemData* data = NULL); | |
23324ae1 FM |
182 | |
183 | /** | |
7977b62a BP |
184 | Appends an item to the end of the branch identified by @a parent, return |
185 | a new item id. | |
03966fcb | 186 | |
7977b62a BP |
187 | The @a image and @a selImage parameters are an index within the normal |
188 | image list specifying the image to use for unselected and selected | |
189 | items, respectively. If @a image -1 and @a selImage is -1, the same | |
190 | image is used for both selected and unselected items. | |
23324ae1 FM |
191 | */ |
192 | wxTreeItemId AppendItem(const wxTreeItemId& parent, | |
193 | const wxString& text, | |
194 | int image = -1, | |
195 | int selImage = -1, | |
4cc4bfaf | 196 | wxTreeItemData* data = NULL); |
23324ae1 FM |
197 | |
198 | /** | |
7977b62a BP |
199 | Sets the buttons image list. The button images assigned with this method |
200 | will be automatically deleted by wxTreeCtrl as appropriate (i.e. it | |
201 | takes ownership of the list). | |
202 | ||
203 | Setting or assigning the button image list enables the display of image | |
204 | buttons. Once enabled, the only way to disable the display of button | |
205 | images is to set the button image list to @NULL. | |
206 | ||
23324ae1 | 207 | This function is only available in the generic version. |
7977b62a BP |
208 | |
209 | @see SetButtonsImageList(). | |
23324ae1 FM |
210 | */ |
211 | void AssignButtonsImageList(wxImageList* imageList); | |
212 | ||
213 | /** | |
7977b62a BP |
214 | Sets the normal image list. The image list assigned with this method |
215 | will be automatically deleted by wxTreeCtrl as appropriate (i.e. it | |
216 | takes ownership of the list). | |
217 | ||
218 | @see SetImageList(). | |
23324ae1 FM |
219 | */ |
220 | void AssignImageList(wxImageList* imageList); | |
221 | ||
222 | /** | |
7977b62a BP |
223 | Sets the state image list. Image list assigned with this method will be |
224 | automatically deleted by wxTreeCtrl as appropriate (i.e. it takes | |
225 | ownership of the list). | |
226 | ||
227 | @see SetStateImageList(). | |
23324ae1 FM |
228 | */ |
229 | void AssignStateImageList(wxImageList* imageList); | |
230 | ||
231 | /** | |
232 | Collapses the given item. | |
233 | */ | |
adaaa686 | 234 | virtual void Collapse(const wxTreeItemId& item); |
23324ae1 FM |
235 | |
236 | /** | |
237 | Collapses the root item. | |
3c4f71cc | 238 | |
4cc4bfaf | 239 | @see ExpandAll() |
23324ae1 FM |
240 | */ |
241 | void CollapseAll(); | |
242 | ||
243 | /** | |
244 | Collapses this item and all of its children, recursively. | |
3c4f71cc | 245 | |
4cc4bfaf | 246 | @see ExpandAllChildren() |
23324ae1 FM |
247 | */ |
248 | void CollapseAllChildren(const wxTreeItemId& item); | |
249 | ||
250 | /** | |
251 | Collapses the given item and removes all children. | |
252 | */ | |
adaaa686 | 253 | virtual void CollapseAndReset(const wxTreeItemId& item); |
23324ae1 FM |
254 | |
255 | /** | |
7977b62a BP |
256 | Creates the tree control. See wxTreeCtrl::wxTreeCtrl() for further |
257 | details. | |
23324ae1 | 258 | */ |
7977b62a BP |
259 | bool Create(wxWindow* parent, wxWindowID id, |
260 | const wxPoint& pos = wxDefaultPosition, | |
261 | const wxSize& size = wxDefaultSize, | |
262 | long style = wxTR_HAS_BUTTONS, | |
263 | const wxValidator& validator = wxDefaultValidator, | |
264 | const wxString& name = "treeCtrl"); | |
23324ae1 FM |
265 | |
266 | /** | |
7977b62a | 267 | Deletes the specified item. A EVT_TREE_DELETE_ITEM() event will be |
23324ae1 | 268 | generated. |
7977b62a BP |
269 | |
270 | This function may cause a subsequent call to GetNextChild() to fail. | |
23324ae1 | 271 | */ |
adaaa686 | 272 | virtual void Delete(const wxTreeItemId& item); |
23324ae1 FM |
273 | |
274 | /** | |
275 | Deletes all items in the control. Note that this may not generate | |
7977b62a | 276 | EVT_TREE_DELETE_ITEM() events under some Windows versions although |
23324ae1 FM |
277 | normally such event is generated for each removed item. |
278 | */ | |
adaaa686 | 279 | virtual void DeleteAllItems(); |
23324ae1 FM |
280 | |
281 | /** | |
7977b62a BP |
282 | Deletes all children of the given item (but not the item itself). Note |
283 | that this will @b not generate any events unlike Delete() method. | |
284 | ||
285 | If you have called SetItemHasChildren(), you may need to call it again | |
286 | since DeleteChildren() does not automatically clear the setting. | |
23324ae1 | 287 | */ |
adaaa686 | 288 | virtual void DeleteChildren(const wxTreeItemId& item); |
23324ae1 FM |
289 | |
290 | /** | |
7977b62a BP |
291 | Starts editing the label of the given @a item. This function generates a |
292 | EVT_TREE_BEGIN_LABEL_EDIT() event which can be vetoed so that no text | |
293 | control will appear for in-place editing. | |
294 | ||
295 | If the user changed the label (i.e. s/he does not press ESC or leave the | |
296 | text control without changes, a EVT_TREE_END_LABEL_EDIT() event will be | |
297 | sent which can be vetoed as well. | |
3c4f71cc | 298 | |
4cc4bfaf | 299 | @see EndEditLabel(), wxTreeEvent |
23324ae1 FM |
300 | */ |
301 | void EditLabel(const wxTreeItemId& item); | |
302 | ||
303 | /** | |
7977b62a BP |
304 | Ends label editing. If @a cancelEdit is @true, the edit will be |
305 | cancelled. | |
306 | ||
307 | @note | |
308 | This function is currently supported under Windows only. | |
3c4f71cc | 309 | |
4cc4bfaf | 310 | @see EditLabel() |
23324ae1 FM |
311 | */ |
312 | void EndEditLabel(bool cancelEdit); | |
313 | ||
314 | /** | |
315 | Scrolls and/or expands items to ensure that the given item is visible. | |
316 | */ | |
adaaa686 | 317 | virtual void EnsureVisible(const wxTreeItemId& item); |
23324ae1 FM |
318 | |
319 | /** | |
320 | Expands the given item. | |
321 | */ | |
adaaa686 | 322 | virtual void Expand(const wxTreeItemId& item); |
23324ae1 FM |
323 | |
324 | /** | |
325 | Expands all items in the tree. | |
326 | */ | |
327 | void ExpandAll(); | |
328 | ||
329 | /** | |
330 | Expands the given item and all its children recursively. | |
331 | */ | |
332 | void ExpandAllChildren(const wxTreeItemId& item); | |
333 | ||
334 | /** | |
7977b62a BP |
335 | Retrieves the rectangle bounding the @a item. If @a textOnly is @true, |
336 | only the rectangle around the item's label will be returned, otherwise | |
337 | the item's image is also taken into account. | |
338 | ||
339 | The return value is @true if the rectangle was successfully retrieved or | |
340 | @c @false if it was not (in this case @a rect is not changed) -- for | |
341 | example, if the item is currently invisible. | |
342 | ||
343 | Notice that the rectangle coordinates are logical, not physical ones. | |
344 | So, for example, the x coordinate may be negative if the tree has a | |
345 | horizontal scrollbar and its position is not 0. | |
346 | ||
347 | @beginWxPythonOnly | |
348 | The wxPython version of this method requires only the @a item and @a | |
349 | textOnly parameters. The return value is either a wxRect object or @c | |
350 | None. | |
351 | @endWxPythonOnly | |
23324ae1 FM |
352 | */ |
353 | bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect, | |
328f5751 | 354 | bool textOnly = false) const; |
23324ae1 FM |
355 | |
356 | /** | |
7977b62a BP |
357 | Returns the buttons image list (from which application-defined button |
358 | images are taken). | |
359 | ||
23324ae1 FM |
360 | This function is only available in the generic version. |
361 | */ | |
328f5751 | 362 | wxImageList* GetButtonsImageList() const; |
23324ae1 FM |
363 | |
364 | /** | |
4cc4bfaf | 365 | Returns the number of items in the branch. If @a recursively is @true, |
7977b62a BP |
366 | returns the total number of descendants, otherwise only one level of |
367 | children is counted. | |
23324ae1 FM |
368 | */ |
369 | unsigned int GetChildrenCount(const wxTreeItemId& item, | |
328f5751 | 370 | bool recursively = true) const; |
23324ae1 FM |
371 | |
372 | /** | |
373 | Returns the number of items in the control. | |
374 | */ | |
adaaa686 | 375 | virtual unsigned int GetCount() const; |
23324ae1 FM |
376 | |
377 | /** | |
7977b62a BP |
378 | Returns the edit control being currently used to edit a label. Returns |
379 | @NULL if no label is being edited. | |
380 | ||
381 | @note This is currently only implemented for wxMSW. | |
23324ae1 | 382 | */ |
adaaa686 | 383 | virtual wxTextCtrl* GetEditControl() const; |
23324ae1 FM |
384 | |
385 | /** | |
386 | Returns the first child; call GetNextChild() for the next child. | |
7977b62a | 387 | |
23324ae1 | 388 | For this enumeration function you must pass in a 'cookie' parameter |
7977b62a BP |
389 | which is opaque for the application but is necessary for the library to |
390 | make these functions reentrant (i.e. allow more than one enumeration on | |
391 | one and the same object simultaneously). The cookie passed to | |
392 | GetFirstChild() and GetNextChild() should be the same variable. | |
393 | ||
394 | Returns an invalid tree item (i.e. wxTreeItemId::IsOk() returns @false) | |
395 | if there are no further children. | |
396 | ||
397 | @beginWxPythonOnly | |
398 | In wxPython the returned wxTreeItemId and the new cookie value are both | |
399 | returned as a tuple containing the two values. | |
400 | @endWxPythonOnly | |
3c4f71cc | 401 | |
4cc4bfaf | 402 | @see GetNextChild(), GetNextSibling() |
23324ae1 FM |
403 | */ |
404 | wxTreeItemId GetFirstChild(const wxTreeItemId& item, | |
328f5751 | 405 | wxTreeItemIdValue& cookie) const; |
23324ae1 FM |
406 | |
407 | /** | |
408 | Returns the first visible item. | |
409 | */ | |
adaaa686 | 410 | virtual wxTreeItemId GetFirstVisibleItem() const; |
23324ae1 FM |
411 | |
412 | /** | |
413 | Returns the normal image list. | |
414 | */ | |
328f5751 | 415 | wxImageList* GetImageList() const; |
23324ae1 FM |
416 | |
417 | /** | |
418 | Returns the current tree control indentation. | |
419 | */ | |
328f5751 | 420 | int GetIndent() const; |
23324ae1 FM |
421 | |
422 | /** | |
423 | Returns the background colour of the item. | |
424 | */ | |
adaaa686 | 425 | virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const; |
23324ae1 | 426 | |
23324ae1 | 427 | /** |
7977b62a | 428 | Returns the tree item data associated with the item. |
23324ae1 | 429 | |
483724a1 | 430 | @see wxTreeItemData |
23324ae1 | 431 | |
483724a1 FM |
432 | @beginWxPythonOnly |
433 | wxPython provides the following shortcut method: | |
434 | @li GetPyData(item): Returns the Python Object associated with the | |
435 | wxTreeItemData for the given item Id. | |
436 | @endWxPythonOnly | |
437 | */ | |
adaaa686 | 438 | virtual wxTreeItemData* GetItemData(const wxTreeItemId& item) const; |
7977b62a BP |
439 | |
440 | /** | |
441 | Returns the font of the item label. | |
442 | */ | |
adaaa686 | 443 | virtual wxFont GetItemFont(const wxTreeItemId& item) const; |
23324ae1 FM |
444 | |
445 | /** | |
4cc4bfaf | 446 | Gets the specified item image. The value of @a which may be: |
7977b62a BP |
447 | - ::wxTreeItemIcon_Normal: to get the normal item image. |
448 | - ::wxTreeItemIcon_Selected: to get the selected item image (i.e. the | |
449 | image which is shown when the item is currently selected). | |
450 | - ::wxTreeItemIcon_Expanded: to get the expanded image (this only makes | |
451 | sense for items which have children - then this image is shown when | |
452 | the item is expanded and the normal image is shown when it is | |
453 | collapsed). | |
454 | - ::wxTreeItemIcon_SelectedExpanded: to get the selected expanded image | |
455 | (which is shown when an expanded item is currently selected). | |
23324ae1 FM |
456 | */ |
457 | int GetItemImage(const wxTreeItemId& item, | |
328f5751 | 458 | wxTreeItemIcon which = wxTreeItemIcon_Normal) const; |
23324ae1 FM |
459 | |
460 | /** | |
461 | Returns the item's parent. | |
462 | */ | |
adaaa686 | 463 | virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const; |
23324ae1 FM |
464 | |
465 | /** | |
7977b62a BP |
466 | Gets the selected item image (this function is obsolete, use @ref |
467 | GetItemImage() "GetItemImage"( @a item, ::wxTreeItemIcon_Selected) | |
468 | instead). | |
23324ae1 | 469 | */ |
328f5751 | 470 | int GetItemSelectedImage(const wxTreeItemId& item) const; |
23324ae1 | 471 | |
03966fcb RR |
472 | /** |
473 | Gets the specified item state. | |
474 | */ | |
475 | int GetItemState(const wxTreeItemId& item) const; | |
476 | ||
23324ae1 FM |
477 | /** |
478 | Returns the item label. | |
479 | */ | |
adaaa686 | 480 | virtual wxString GetItemText(const wxTreeItemId& item) const; |
23324ae1 FM |
481 | |
482 | /** | |
483 | Returns the colour of the item label. | |
484 | */ | |
adaaa686 | 485 | virtual wxColour GetItemTextColour(const wxTreeItemId& item) const; |
23324ae1 FM |
486 | |
487 | /** | |
7977b62a BP |
488 | Returns the last child of the item (or an invalid tree item if this item |
489 | has no children). | |
3c4f71cc | 490 | |
7977b62a | 491 | @see GetFirstChild(), GetNextSibling(), GetLastChild() |
23324ae1 | 492 | */ |
adaaa686 | 493 | virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const; |
23324ae1 FM |
494 | |
495 | /** | |
7977b62a BP |
496 | Returns the next child; call GetFirstChild() for the first child. For |
497 | this enumeration function you must pass in a 'cookie' parameter which is | |
498 | opaque for the application but is necessary for the library to make | |
499 | these functions reentrant (i.e. allow more than one enumeration on one | |
500 | and the same object simultaneously). The cookie passed to | |
501 | GetFirstChild() and GetNextChild() should be the same. | |
502 | ||
23324ae1 | 503 | Returns an invalid tree item if there are no further children. |
3c4f71cc | 504 | |
7977b62a BP |
505 | @beginWxPythonOnly |
506 | In wxPython the returned wxTreeItemId and the new cookie value are both | |
507 | returned as a tuple containing the two values. | |
508 | @endWxPythonOnly | |
509 | ||
4cc4bfaf | 510 | @see GetFirstChild() |
23324ae1 FM |
511 | */ |
512 | wxTreeItemId GetNextChild(const wxTreeItemId& item, | |
328f5751 | 513 | wxTreeItemIdValue& cookie) const; |
23324ae1 FM |
514 | |
515 | /** | |
7977b62a BP |
516 | Returns the next sibling of the specified item; call GetPrevSibling() |
517 | for the previous sibling. | |
518 | ||
23324ae1 | 519 | Returns an invalid tree item if there are no further siblings. |
3c4f71cc | 520 | |
4cc4bfaf | 521 | @see GetPrevSibling() |
23324ae1 | 522 | */ |
adaaa686 | 523 | virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const; |
23324ae1 FM |
524 | |
525 | /** | |
7977b62a BP |
526 | Returns the next visible item or an invalid item if this item is the |
527 | last visible one. | |
528 | ||
529 | @note The @a item itself must be visible. | |
23324ae1 | 530 | */ |
adaaa686 | 531 | virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const; |
23324ae1 FM |
532 | |
533 | /** | |
7977b62a BP |
534 | Returns the previous sibling of the specified item; call |
535 | GetNextSibling() for the next sibling. | |
536 | ||
23324ae1 | 537 | Returns an invalid tree item if there are no further children. |
3c4f71cc | 538 | |
4cc4bfaf | 539 | @see GetNextSibling() |
23324ae1 | 540 | */ |
adaaa686 | 541 | virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const; |
23324ae1 FM |
542 | |
543 | /** | |
7977b62a BP |
544 | Returns the previous visible item or an invalid item if this item is the |
545 | first visible one. | |
546 | ||
547 | @note The @a item itself must be visible. | |
23324ae1 | 548 | */ |
adaaa686 | 549 | virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const; |
23324ae1 FM |
550 | |
551 | /** | |
7977b62a BP |
552 | Returns @true if the control will use a quick calculation for the best |
553 | size, looking only at the first and last items. The default is @false. | |
3c4f71cc | 554 | |
4cc4bfaf | 555 | @see SetQuickBestSize() |
23324ae1 | 556 | */ |
328f5751 | 557 | bool GetQuickBestSize() const; |
23324ae1 FM |
558 | |
559 | /** | |
560 | Returns the root item for the tree control. | |
561 | */ | |
adaaa686 | 562 | virtual wxTreeItemId GetRootItem() const; |
23324ae1 FM |
563 | |
564 | /** | |
7977b62a BP |
565 | Returns the selection, or an invalid item if there is no selection. This |
566 | function only works with the controls without @c wxTR_MULTIPLE style, | |
567 | use GetSelections() for the controls which do have this style. | |
23324ae1 | 568 | */ |
adaaa686 | 569 | virtual wxTreeItemId GetSelection() const; |
23324ae1 FM |
570 | |
571 | /** | |
7977b62a BP |
572 | Fills the array of tree items passed in with the currently selected |
573 | items. This function can be called only if the control has the @c | |
574 | wxTR_MULTIPLE style. | |
575 | ||
23324ae1 | 576 | Returns the number of selected items. |
03966fcb | 577 | |
7977b62a BP |
578 | @beginWxPythonOnly |
579 | The wxPython version of this method accepts no parameters and returns a | |
580 | Python list of @ref wxTreeItemId "wxTreeItemId"s. | |
581 | @endWxPythonOnly | |
23324ae1 | 582 | */ |
328f5751 | 583 | unsigned int GetSelections(wxArrayTreeItemIds& selection) const; |
23324ae1 FM |
584 | |
585 | /** | |
7977b62a BP |
586 | Returns the state image list (from which application-defined state |
587 | images are taken). | |
23324ae1 | 588 | */ |
328f5751 | 589 | wxImageList* GetStateImageList() const; |
23324ae1 FM |
590 | |
591 | /** | |
7977b62a BP |
592 | Calculates which (if any) item is under the given @a point, returning |
593 | the tree item id at this point plus extra information @a flags. @a flags | |
594 | is a bitlist of the following: | |
595 | ||
596 | - @c wxTREE_HITTEST_ABOVE: Above the client area. | |
597 | - @c wxTREE_HITTEST_BELOW: Below the client area. | |
598 | - @c wxTREE_HITTEST_NOWHERE: In the client area but below the last item. | |
599 | - @c wxTREE_HITTEST_ONITEMBUTTON: On the button associated with an item. | |
600 | - @c wxTREE_HITTEST_ONITEMICON: On the bitmap associated with an item. | |
601 | - @c wxTREE_HITTEST_ONITEMINDENT: In the indentation associated with an | |
602 | item. | |
603 | - @c wxTREE_HITTEST_ONITEMLABEL: On the label (string) associated with | |
604 | an item. | |
605 | - @c wxTREE_HITTEST_ONITEMRIGHT: In the area to the right of an item. | |
606 | - @c wxTREE_HITTEST_ONITEMSTATEICON: On the state icon for a tree view | |
607 | item that is in a user-defined state. | |
608 | - @c wxTREE_HITTEST_TOLEFT: To the right of the client area. | |
609 | - @c wxTREE_HITTEST_TORIGHT: To the left of the client area. | |
03966fcb | 610 | |
7977b62a BP |
611 | @beginWxPythonOnly |
612 | In wxPython both the wxTreeItemId and the flags are returned as a tuple. | |
613 | @endWxPythonOnly | |
23324ae1 | 614 | */ |
328f5751 | 615 | wxTreeItemId HitTest(const wxPoint& point, int& flags) const; |
23324ae1 | 616 | |
7977b62a | 617 | |
23324ae1 | 618 | /** |
7977b62a BP |
619 | Inserts an item after a given one (@a previous). |
620 | ||
621 | The @a image and @a selImage parameters are an index within the normal | |
622 | image list specifying the image to use for unselected and selected | |
623 | items, respectively. If @a image -1 and @a selImage is -1, the same | |
624 | image is used for both selected and unselected items. | |
23324ae1 FM |
625 | */ |
626 | wxTreeItemId InsertItem(const wxTreeItemId& parent, | |
627 | const wxTreeItemId& previous, | |
628 | const wxString& text, | |
629 | int image = -1, | |
630 | int selImage = -1, | |
4cc4bfaf | 631 | wxTreeItemData* data = NULL); |
7977b62a BP |
632 | |
633 | /** | |
634 | Inserts an item before one identified | |
635 | by its position (@a before). @a before must be less than the number of | |
636 | children. | |
637 | ||
638 | The @a image and @a selImage parameters are an index within the normal | |
639 | image list specifying the image to use for unselected and selected | |
640 | items, respectively. If @a image -1 and @a selImage is -1, the same | |
641 | image is used for both selected and unselected items. | |
642 | ||
643 | @beginWxPythonOnly | |
644 | In wxPython, this form of this method is called @c InsertItemBefore(). | |
645 | @endWxPythonOnly | |
646 | */ | |
7c913512 FM |
647 | wxTreeItemId InsertItem(const wxTreeItemId& parent, |
648 | size_t before, | |
649 | const wxString& text, | |
650 | int image = -1, | |
651 | int selImage = -1, | |
4cc4bfaf | 652 | wxTreeItemData* data = NULL); |
23324ae1 FM |
653 | |
654 | /** | |
655 | Returns @true if the given item is in bold state. | |
7977b62a BP |
656 | |
657 | @see SetItemBold() | |
23324ae1 | 658 | */ |
adaaa686 | 659 | virtual bool IsBold(const wxTreeItemId& item) const; |
23324ae1 FM |
660 | |
661 | /** | |
7977b62a BP |
662 | Returns @true if the control is empty (i.e. has no items, even no root |
663 | one). | |
23324ae1 | 664 | */ |
328f5751 | 665 | bool IsEmpty() const; |
23324ae1 FM |
666 | |
667 | /** | |
7977b62a BP |
668 | Returns @true if the item is expanded (only makes sense if it has |
669 | children). | |
23324ae1 | 670 | */ |
adaaa686 | 671 | virtual bool IsExpanded(const wxTreeItemId& item) const; |
23324ae1 FM |
672 | |
673 | /** | |
674 | Returns @true if the item is selected. | |
675 | */ | |
adaaa686 | 676 | virtual bool IsSelected(const wxTreeItemId& item) const; |
23324ae1 FM |
677 | |
678 | /** | |
679 | Returns @true if the item is visible on the screen. | |
680 | */ | |
adaaa686 | 681 | virtual bool IsVisible(const wxTreeItemId& item) const; |
23324ae1 FM |
682 | |
683 | /** | |
684 | Returns @true if the item has children. | |
685 | */ | |
adaaa686 | 686 | virtual bool ItemHasChildren(const wxTreeItemId& item) const; |
23324ae1 FM |
687 | |
688 | /** | |
7977b62a BP |
689 | Override this function in the derived class to change the sort order of |
690 | the items in the tree control. The function should return a negative, | |
691 | zero or positive value if the first item is less than, equal to or | |
692 | greater than the second one. | |
693 | ||
694 | Please note that you @b must use wxRTTI macros DECLARE_DYNAMIC_CLASS() | |
695 | and IMPLEMENT_DYNAMIC_CLASS() if you override this function because | |
696 | otherwise the base class considers that it is not overridden and uses | |
697 | the default comparison, i.e. sorts the items alphabetically, which | |
23324ae1 | 698 | allows it optimize away the calls to the virtual function completely. |
7977b62a BP |
699 | |
700 | @see SortChildren() | |
23324ae1 FM |
701 | */ |
702 | int OnCompareItems(const wxTreeItemId& item1, | |
703 | const wxTreeItemId& item2); | |
704 | ||
705 | /** | |
7977b62a BP |
706 | Appends an item as the first child of @a parent, return a new item id. |
707 | ||
708 | The @a image and @a selImage parameters are an index within the normal | |
709 | image list specifying the image to use for unselected and selected | |
710 | items, respectively. If @a image -1 and @a selImage is -1, the same | |
711 | image is used for both selected and unselected items. | |
23324ae1 FM |
712 | */ |
713 | wxTreeItemId PrependItem(const wxTreeItemId& parent, | |
714 | const wxString& text, | |
715 | int image = -1, | |
716 | int selImage = -1, | |
4cc4bfaf | 717 | wxTreeItemData* data = NULL); |
23324ae1 FM |
718 | |
719 | /** | |
720 | Scrolls the specified item into view. | |
721 | */ | |
adaaa686 | 722 | virtual void ScrollTo(const wxTreeItemId& item); |
23324ae1 FM |
723 | |
724 | /** | |
7977b62a BP |
725 | Selects the given item. In multiple selection controls, can be also used |
726 | to deselect a currently selected item if the value of @a select is | |
727 | @false. | |
23324ae1 | 728 | */ |
adaaa686 | 729 | virtual void SelectItem(const wxTreeItemId& item, bool select = true); |
23324ae1 FM |
730 | |
731 | /** | |
7977b62a BP |
732 | Sets the buttons image list (from which application-defined button |
733 | images are taken). | |
734 | ||
735 | The button images assigned with this method will @b not be deleted by | |
736 | @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you must delete it yourself. | |
737 | Setting or assigning the button image list enables the display of image | |
738 | buttons. Once enabled, the only way to disable the display of button | |
739 | images is to set the button image list to @NULL. | |
740 | ||
741 | @note This function is only available in the generic version. | |
742 | ||
743 | @see AssignButtonsImageList(). | |
23324ae1 FM |
744 | */ |
745 | void SetButtonsImageList(wxImageList* imageList); | |
746 | ||
747 | /** | |
7977b62a BP |
748 | Sets the normal image list. The image list assigned with this method |
749 | will @b not be deleted by @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you | |
750 | must delete it yourself. | |
751 | ||
752 | @see AssignImageList(). | |
23324ae1 | 753 | */ |
adaaa686 | 754 | virtual void SetImageList(wxImageList* imageList); |
23324ae1 FM |
755 | |
756 | /** | |
757 | Sets the indentation for the tree control. | |
758 | */ | |
759 | void SetIndent(int indent); | |
760 | ||
761 | /** | |
762 | Sets the colour of the item's background. | |
763 | */ | |
764 | void SetItemBackgroundColour(const wxTreeItemId& item, | |
765 | const wxColour& col); | |
766 | ||
767 | /** | |
7977b62a BP |
768 | Makes item appear in bold font if @a bold parameter is @true or resets |
769 | it to the normal state. | |
770 | ||
771 | @see IsBold() | |
23324ae1 | 772 | */ |
adaaa686 | 773 | virtual void SetItemBold(const wxTreeItemId& item, bool bold = true); |
23324ae1 | 774 | |
7977b62a BP |
775 | /** |
776 | Sets the item client data. | |
777 | ||
778 | @beginWxPythonOnly | |
779 | - @b SetPyData( @a item, @c obj): Associate the given Python Object with | |
780 | the wxTreeItemData for the given item Id. | |
781 | @endWxPythonOnly | |
782 | ||
783 | */ | |
adaaa686 | 784 | virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData* data); |
7977b62a BP |
785 | |
786 | ||
23324ae1 FM |
787 | /** |
788 | Gives the item the visual feedback for Drag'n'Drop actions, which is | |
789 | useful if something is dragged from the outside onto the tree control | |
790 | (as opposed to a DnD operation within the tree control, which already | |
791 | is implemented internally). | |
792 | */ | |
7c913512 | 793 | void SetItemDropHighlight(const wxTreeItemId& item, |
4cc4bfaf | 794 | bool highlight = true); |
23324ae1 FM |
795 | |
796 | /** | |
7977b62a BP |
797 | Sets the item's font. All items in the tree should have the same height |
798 | to avoid text clipping, so the fonts height should be the same for all | |
799 | of them, although font attributes may vary. | |
3c4f71cc | 800 | |
4cc4bfaf | 801 | @see SetItemBold() |
23324ae1 | 802 | */ |
adaaa686 | 803 | virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font); |
23324ae1 FM |
804 | |
805 | /** | |
806 | Force appearance of the button next to the item. This is useful to | |
807 | allow the user to expand the items which don't have any children now, | |
808 | but instead adding them only when needed, thus minimizing memory | |
809 | usage and loading time. | |
810 | */ | |
811 | void SetItemHasChildren(const wxTreeItemId& item, | |
4cc4bfaf | 812 | bool hasChildren = true); |
23324ae1 FM |
813 | |
814 | /** | |
7977b62a BP |
815 | Sets the specified item's image. See GetItemImage() for the description |
816 | of the @a which parameter. | |
23324ae1 FM |
817 | */ |
818 | void SetItemImage(const wxTreeItemId& item, int image, | |
819 | wxTreeItemIcon which = wxTreeItemIcon_Normal); | |
820 | ||
821 | /** | |
7977b62a BP |
822 | Sets the selected item image (this function is obsolete, use @ref |
823 | SetItemImage() "SetItemImage"( @a item, ::wxTreeItemIcon_Selected ) | |
824 | instead). | |
23324ae1 FM |
825 | */ |
826 | void SetItemSelectedImage(const wxTreeItemId& item, int selImage); | |
827 | ||
03966fcb RR |
828 | /** |
829 | Sets the specified item state. The value of @a state may be: | |
809ca837 RR |
830 | - @c wxTREE_ITEMSTATE_NONE: to disable the item state (the state image will |
831 | be not displayed). | |
832 | - @c wxTREE_ITEMSTATE_NEXT: to set the next item state. | |
833 | - @c wxTREE_ITEMSTATE_PREV: to set the previous item state. | |
03966fcb RR |
834 | */ |
835 | void SetItemState(const wxTreeItemId& item, int state); | |
836 | ||
23324ae1 FM |
837 | /** |
838 | Sets the item label. | |
839 | */ | |
adaaa686 | 840 | virtual void SetItemText(const wxTreeItemId& item, const wxString& text); |
23324ae1 FM |
841 | |
842 | /** | |
843 | Sets the colour of the item's text. | |
844 | */ | |
845 | void SetItemTextColour(const wxTreeItemId& item, | |
846 | const wxColour& col); | |
847 | ||
848 | /** | |
7977b62a BP |
849 | If @true is passed, specifies that the control will use a quick |
850 | calculation for the best size, looking only at the first and last items. | |
851 | Otherwise, it will look at all items. The default is @false. | |
3c4f71cc | 852 | |
4cc4bfaf | 853 | @see GetQuickBestSize() |
23324ae1 FM |
854 | */ |
855 | void SetQuickBestSize(bool quickBestSize); | |
856 | ||
857 | /** | |
7977b62a BP |
858 | Sets the state image list (from which application-defined state images |
859 | are taken). Image list assigned with this method will @b not be deleted | |
860 | by @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you must delete it | |
861 | yourself. | |
862 | ||
863 | @see AssignStateImageList(). | |
23324ae1 | 864 | */ |
adaaa686 | 865 | virtual void SetStateImageList(wxImageList* imageList); |
23324ae1 FM |
866 | |
867 | /** | |
7977b62a BP |
868 | Sets the mode flags associated with the display of the tree control. The |
869 | new mode takes effect immediately. | |
870 | ||
871 | @note Generic only; MSW ignores changes. | |
23324ae1 FM |
872 | */ |
873 | void SetWindowStyle(long styles); | |
874 | ||
875 | /** | |
7977b62a BP |
876 | Sorts the children of the given item using OnCompareItems(). |
877 | You should override that method to change the sort order (the default is | |
878 | ascending case-sensitive alphabetical order). | |
3c4f71cc | 879 | |
4cc4bfaf | 880 | @see wxTreeItemData, OnCompareItems() |
23324ae1 | 881 | */ |
adaaa686 | 882 | virtual void SortChildren(const wxTreeItemId& item); |
23324ae1 FM |
883 | |
884 | /** | |
885 | Toggles the given item between collapsed and expanded states. | |
886 | */ | |
adaaa686 | 887 | virtual void Toggle(const wxTreeItemId& item); |
23324ae1 FM |
888 | |
889 | /** | |
890 | Toggles the given item between selected and unselected states. For | |
891 | multiselection controls only. | |
892 | */ | |
893 | void ToggleItemSelection(const wxTreeItemId& item); | |
894 | ||
895 | /** | |
896 | Removes the selection from the currently selected item (if any). | |
897 | */ | |
adaaa686 | 898 | virtual void Unselect(); |
23324ae1 FM |
899 | |
900 | /** | |
7977b62a BP |
901 | This function either behaves the same as Unselect() if the control |
902 | doesn't have @c wxTR_MULTIPLE style, or removes the selection from all | |
903 | items if it does have this style. | |
23324ae1 | 904 | */ |
adaaa686 | 905 | virtual void UnselectAll(); |
23324ae1 FM |
906 | |
907 | /** | |
908 | Unselects the given item. This works in multiselection controls only. | |
909 | */ | |
910 | void UnselectItem(const wxTreeItemId& item); | |
911 | }; | |
912 | ||
913 | ||
e54c96f1 | 914 | |
23324ae1 FM |
915 | /** |
916 | @class wxTreeEvent | |
7c913512 | 917 | |
7977b62a BP |
918 | A tree event holds information about events associated with wxTreeCtrl |
919 | objects. | |
920 | ||
921 | To process input from a tree control, use these event handler macros to | |
922 | direct input to member functions that take a wxTreeEvent argument. | |
923 | ||
924 | @beginEventTable{wxTreeEvent} | |
925 | @event{EVT_TREE_BEGIN_DRAG(id, func)} | |
926 | Begin dragging with the left mouse button. | |
927 | @event{EVT_TREE_BEGIN_RDRAG(id, func)} | |
928 | Begin dragging with the right mouse button. | |
929 | @event{EVT_TREE_END_DRAG(id, func)} | |
930 | End dragging with the left or right mouse button. | |
931 | @event{EVT_TREE_BEGIN_LABEL_EDIT(id, func)} | |
932 | Begin editing a label. This can be prevented by calling Veto(). | |
933 | @event{EVT_TREE_END_LABEL_EDIT(id, func)} | |
934 | Finish editing a label. This can be prevented by calling Veto(). | |
935 | @event{EVT_TREE_DELETE_ITEM(id, func)} | |
936 | Delete an item. | |
937 | @event{EVT_TREE_GET_INFO(id, func)} | |
938 | Request information from the application. | |
939 | @event{EVT_TREE_SET_INFO(id, func)} | |
940 | Information is being supplied. | |
941 | @event{EVT_TREE_ITEM_ACTIVATED(id, func)} | |
942 | The item has been activated, i.e. chosen by double clicking it with | |
943 | mouse or from keyboard. | |
944 | @event{EVT_TREE_ITEM_COLLAPSED(id, func)} | |
945 | The item has been collapsed. | |
946 | @event{EVT_TREE_ITEM_COLLAPSING(id, func)} | |
947 | The item is being collapsed. This can be prevented by calling Veto(). | |
948 | @event{EVT_TREE_ITEM_EXPANDED(id, func)} | |
949 | The item has been expanded. | |
950 | @event{EVT_TREE_ITEM_EXPANDING(id, func)} | |
951 | The item is being expanded. This can be prevented by calling Veto(). | |
952 | @event{EVT_TREE_ITEM_RIGHT_CLICK(id, func)} | |
953 | The user has clicked the item with the right mouse button. | |
954 | @event{EVT_TREE_ITEM_MIDDLE_CLICK(id, func)} | |
955 | The user has clicked the item with the middle mouse button. | |
956 | @event{EVT_TREE_SEL_CHANGED(id, func)} | |
957 | Selection has changed. | |
958 | @event{EVT_TREE_SEL_CHANGING(id, func)} | |
959 | Selection is changing. This can be prevented by calling Veto(). | |
960 | @event{EVT_TREE_KEY_DOWN(id, func)} | |
961 | A key has been pressed. | |
962 | @event{EVT_TREE_ITEM_GETTOOLTIP(id, func)} | |
963 | The opportunity to set the item tooltip is being given to the | |
964 | application (call SetToolTip()). Windows only. | |
965 | @event{EVT_TREE_ITEM_MENU(id, func)} | |
966 | The context menu for the selected item has been requested, either by a | |
967 | right click or by using the menu key. | |
968 | @event{EVT_TREE_STATE_IMAGE_CLICK(id, func)} | |
809ca837 | 969 | The state image has been clicked. |
7977b62a | 970 | @endEventTable |
7c913512 | 971 | |
23324ae1 FM |
972 | @library{wxbase} |
973 | @category{events} | |
7c913512 | 974 | |
e54c96f1 | 975 | @see wxTreeCtrl |
23324ae1 FM |
976 | */ |
977 | class wxTreeEvent : public wxNotifyEvent | |
978 | { | |
979 | public: | |
980 | /** | |
23324ae1 FM |
981 | Constructor, used by wxWidgets itself only. |
982 | */ | |
4cc4bfaf | 983 | wxTreeEvent(wxEventType commandType, wxTreeCtrl* tree); |
23324ae1 FM |
984 | |
985 | /** | |
986 | Returns the item (valid for all events). | |
987 | */ | |
328f5751 | 988 | wxTreeItemId GetItem() const; |
23324ae1 FM |
989 | |
990 | /** | |
7977b62a BP |
991 | Returns the key code if the event is a key event. Use GetKeyEvent() to |
992 | get the values of the modifier keys for this event (i.e. Shift or Ctrl). | |
23324ae1 | 993 | */ |
328f5751 | 994 | int GetKeyCode() const; |
23324ae1 FM |
995 | |
996 | /** | |
7977b62a | 997 | Returns the key event for EVT_TREE_KEY_DOWN() events. |
23324ae1 | 998 | */ |
328f5751 | 999 | const wxKeyEvent GetKeyEvent() const; |
23324ae1 FM |
1000 | |
1001 | /** | |
1002 | Returns the label if the event is a begin or end edit label event. | |
1003 | */ | |
328f5751 | 1004 | const wxString GetLabel() const; |
23324ae1 FM |
1005 | |
1006 | /** | |
7977b62a BP |
1007 | Returns the old item index (valid for EVT_TREE_ITEM_CHANGING() and |
1008 | EVT_TREE_ITEM_CHANGED() events). | |
23324ae1 | 1009 | */ |
328f5751 | 1010 | wxTreeItemId GetOldItem() const; |
23324ae1 FM |
1011 | |
1012 | /** | |
1013 | Returns the position of the mouse pointer if the event is a drag or | |
1014 | menu-context event. | |
7977b62a BP |
1015 | |
1016 | In both cases the position is in client coordinates - i.e. relative to | |
1017 | the wxTreeCtrl window (so that you can pass it directly to e.g. | |
1018 | wxWindow::PopupMenu()). | |
23324ae1 | 1019 | */ |
328f5751 | 1020 | wxPoint GetPoint() const; |
23324ae1 FM |
1021 | |
1022 | /** | |
7977b62a BP |
1023 | Returns @true if the label edit was cancelled. This should be called |
1024 | from within an EVT_TREE_END_LABEL_EDIT() handler. | |
23324ae1 | 1025 | */ |
328f5751 | 1026 | bool IsEditCancelled() const; |
23324ae1 FM |
1027 | |
1028 | /** | |
7977b62a BP |
1029 | Set the tooltip for the item (valid for EVT_TREE_ITEM_GETTOOLTIP() |
1030 | events). Windows only. | |
23324ae1 FM |
1031 | */ |
1032 | void SetToolTip(const wxString& tooltip); | |
1033 | }; |