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