]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/treectrl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTreeItemData
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
13 A tree control presents information as a hierarchy, with items that may be
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
18 A similar control with a fully native implemtation for GTK+ and OS X
19 as well is wxDataViewTreeCtrl.
21 To intercept events from a tree control, use the event table macros
22 described in wxTreeEvent.
25 @style{wxTR_EDIT_LABELS}
26 Use this style if you wish the user to be able to edit labels in the
28 @style{wxTR_NO_BUTTONS}
29 For convenience to document that no buttons are to be drawn.
30 @style{wxTR_HAS_BUTTONS}
31 Use this style to show + and - buttons to the left of parent items.
33 Use this style to hide vertical level connectors.
34 @style{wxTR_FULL_ROW_HIGHLIGHT}
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
39 @style{wxTR_LINES_AT_ROOT}
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.
42 @style{wxTR_HIDE_ROOT}
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.
45 @style{wxTR_ROW_LINES}
46 Use this style to draw a contrasting border between displayed rows.
47 @style{wxTR_HAS_VARIABLE_ROW_HEIGHT}
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.
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.
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.
58 @style{wxTR_DEFAULT_STYLE}
59 The set of flags that are closest to the defaults for the native control
60 for a particular toolkit.
63 See also @ref overview_windowstyles.
67 wxTreeCtrl class uses the standard common treeview control under Win32
68 implemented in the system library comctl32.dll. Some versions of this
69 library are known to have bugs with handling the tree control colours: the
70 usual symptom is that the expanded items leave black (or otherwise
71 incorrectly coloured) background behind them, especially for the controls
72 using non-default background colour. The recommended solution is to upgrade
73 the comctl32.dll to a newer version: see
74 http://www.microsoft.com/downloads/details.aspx?familyid=cb2cf3a2-8025-4e8f-8511-9b476a8d35d2
78 <!-- @appearance{treectrl.png} -->
80 @see wxDataViewTreeCtrl, wxTreeEvent, wxTreeItemData, @ref overview_treectrl, wxListBox,
81 wxListCtrl, wxImageList
83 class wxTreeCtrl
: public wxControl
92 Constructor, creating and showing a tree control.
95 Parent window. Must not be @NULL.
97 Window identifier. The value @c wxID_ANY indicates a default value.
101 Window size. If wxDefaultSize is specified then the window is sized
104 Window style. See wxTreeCtrl.
110 @see Create(), wxValidator
112 wxTreeCtrl(wxWindow
* parent
, wxWindowID id
,
113 const wxPoint
& pos
= wxDefaultPosition
,
114 const wxSize
& size
= wxDefaultSize
,
115 long style
= wxTR_HAS_BUTTONS
,
116 const wxValidator
& validator
= wxDefaultValidator
,
117 const wxString
& name
= "treeCtrl");
121 Destructor, destroying the tree control.
126 Adds the root node to the tree, returning the new item.
128 The @a image and @a selImage parameters are an index within the normal
129 image list specifying the image to use for unselected and selected
130 items, respectively. If @a image -1 and @a selImage is -1, the same
131 image is used for both selected and unselected items.
133 wxTreeItemId
AddRoot(const wxString
& text
, int image
= -1,
135 wxTreeItemData
* data
= NULL
);
138 Appends an item to the end of the branch identified by @a parent, return
141 The @a image and @a selImage parameters are an index within the normal
142 image list specifying the image to use for unselected and selected
143 items, respectively. If @a image -1 and @a selImage is -1, the same
144 image is used for both selected and unselected items.
146 wxTreeItemId
AppendItem(const wxTreeItemId
& parent
,
147 const wxString
& text
,
150 wxTreeItemData
* data
= NULL
);
153 Sets the buttons image list. The button images assigned with this method
154 will be automatically deleted by wxTreeCtrl as appropriate (i.e. it
155 takes ownership of the list).
157 Setting or assigning the button image list enables the display of image
158 buttons. Once enabled, the only way to disable the display of button
159 images is to set the button image list to @NULL.
161 This function is only available in the generic version.
163 @see SetButtonsImageList().
165 void AssignButtonsImageList(wxImageList
* imageList
);
168 Sets the normal image list. The image list assigned with this method
169 will be automatically deleted by wxTreeCtrl as appropriate (i.e. it
170 takes ownership of the list).
174 void AssignImageList(wxImageList
* imageList
);
177 Sets the state image list. Image list assigned with this method will be
178 automatically deleted by wxTreeCtrl as appropriate (i.e. it takes
179 ownership of the list).
181 @see SetStateImageList().
183 void AssignStateImageList(wxImageList
* imageList
);
186 Collapses the given item.
188 void Collapse(const wxTreeItemId
& item
);
191 Collapses the root item.
198 Collapses this item and all of its children, recursively.
200 @see ExpandAllChildren()
202 void CollapseAllChildren(const wxTreeItemId
& item
);
205 Collapses the given item and removes all children.
207 void CollapseAndReset(const wxTreeItemId
& item
);
210 Creates the tree control. See wxTreeCtrl::wxTreeCtrl() for further
213 bool Create(wxWindow
* parent
, wxWindowID id
,
214 const wxPoint
& pos
= wxDefaultPosition
,
215 const wxSize
& size
= wxDefaultSize
,
216 long style
= wxTR_HAS_BUTTONS
,
217 const wxValidator
& validator
= wxDefaultValidator
,
218 const wxString
& name
= "treeCtrl");
221 Deletes the specified item. A EVT_TREE_DELETE_ITEM() event will be
224 This function may cause a subsequent call to GetNextChild() to fail.
226 void Delete(const wxTreeItemId
& item
);
229 Deletes all items in the control. Note that this may not generate
230 EVT_TREE_DELETE_ITEM() events under some Windows versions although
231 normally such event is generated for each removed item.
233 void DeleteAllItems();
236 Deletes all children of the given item (but not the item itself). Note
237 that this will @b not generate any events unlike Delete() method.
239 If you have called SetItemHasChildren(), you may need to call it again
240 since DeleteChildren() does not automatically clear the setting.
242 void DeleteChildren(const wxTreeItemId
& item
);
245 Starts editing the label of the given @a item. This function generates a
246 EVT_TREE_BEGIN_LABEL_EDIT() event which can be vetoed so that no text
247 control will appear for in-place editing.
249 If the user changed the label (i.e. s/he does not press ESC or leave the
250 text control without changes, a EVT_TREE_END_LABEL_EDIT() event will be
251 sent which can be vetoed as well.
253 @see EndEditLabel(), wxTreeEvent
255 void EditLabel(const wxTreeItemId
& item
);
258 Ends label editing. If @a cancelEdit is @true, the edit will be
262 This function is currently supported under Windows only.
266 void EndEditLabel(bool cancelEdit
);
269 Scrolls and/or expands items to ensure that the given item is visible.
271 void EnsureVisible(const wxTreeItemId
& item
);
274 Expands the given item.
276 void Expand(const wxTreeItemId
& item
);
279 Expands all items in the tree.
284 Expands the given item and all its children recursively.
286 void ExpandAllChildren(const wxTreeItemId
& item
);
289 Retrieves the rectangle bounding the @a item. If @a textOnly is @true,
290 only the rectangle around the item's label will be returned, otherwise
291 the item's image is also taken into account.
293 The return value is @true if the rectangle was successfully retrieved or
294 @c @false if it was not (in this case @a rect is not changed) -- for
295 example, if the item is currently invisible.
297 Notice that the rectangle coordinates are logical, not physical ones.
298 So, for example, the x coordinate may be negative if the tree has a
299 horizontal scrollbar and its position is not 0.
302 The wxPython version of this method requires only the @a item and @a
303 textOnly parameters. The return value is either a wxRect object or @c
307 bool GetBoundingRect(const wxTreeItemId
& item
, wxRect
& rect
,
308 bool textOnly
= false) const;
311 Returns the buttons image list (from which application-defined button
314 This function is only available in the generic version.
316 wxImageList
* GetButtonsImageList() const;
319 Returns the number of items in the branch. If @a recursively is @true,
320 returns the total number of descendants, otherwise only one level of
323 unsigned int GetChildrenCount(const wxTreeItemId
& item
,
324 bool recursively
= true) const;
327 Returns the number of items in the control.
329 unsigned int GetCount() const;
332 Returns the edit control being currently used to edit a label. Returns
333 @NULL if no label is being edited.
335 @note This is currently only implemented for wxMSW.
337 wxTextCtrl
* GetEditControl() const;
340 Returns the first child; call GetNextChild() for the next child.
342 For this enumeration function you must pass in a 'cookie' parameter
343 which is opaque for the application but is necessary for the library to
344 make these functions reentrant (i.e. allow more than one enumeration on
345 one and the same object simultaneously). The cookie passed to
346 GetFirstChild() and GetNextChild() should be the same variable.
348 Returns an invalid tree item (i.e. wxTreeItemId::IsOk() returns @false)
349 if there are no further children.
352 In wxPython the returned wxTreeItemId and the new cookie value are both
353 returned as a tuple containing the two values.
356 @see GetNextChild(), GetNextSibling()
358 wxTreeItemId
GetFirstChild(const wxTreeItemId
& item
,
359 wxTreeItemIdValue
& cookie
) const;
362 Returns the first visible item.
364 wxTreeItemId
GetFirstVisibleItem() const;
367 Returns the normal image list.
369 wxImageList
* GetImageList() const;
372 Returns the current tree control indentation.
374 int GetIndent() const;
377 Returns the background colour of the item.
379 wxColour
GetItemBackgroundColour(const wxTreeItemId
& item
) const;
382 Returns the tree item data associated with the item.
387 wxPython provides the following shortcut method:
388 @li GetPyData(item): Returns the Python Object associated with the
389 wxTreeItemData for the given item Id.
392 wxTreeItemData
* GetItemData(const wxTreeItemId
& item
) const;
395 Returns the font of the item label.
397 wxFont
GetItemFont(const wxTreeItemId
& item
) const;
400 Gets the specified item image. The value of @a which may be:
401 - ::wxTreeItemIcon_Normal: to get the normal item image.
402 - ::wxTreeItemIcon_Selected: to get the selected item image (i.e. the
403 image which is shown when the item is currently selected).
404 - ::wxTreeItemIcon_Expanded: to get the expanded image (this only makes
405 sense for items which have children - then this image is shown when
406 the item is expanded and the normal image is shown when it is
408 - ::wxTreeItemIcon_SelectedExpanded: to get the selected expanded image
409 (which is shown when an expanded item is currently selected).
411 int GetItemImage(const wxTreeItemId
& item
,
412 wxTreeItemIcon which
= wxTreeItemIcon_Normal
) const;
415 Returns the item's parent.
417 wxTreeItemId
GetItemParent(const wxTreeItemId
& item
) const;
420 Gets the selected item image (this function is obsolete, use @ref
421 GetItemImage() "GetItemImage"( @a item, ::wxTreeItemIcon_Selected)
424 int GetItemSelectedImage(const wxTreeItemId
& item
) const;
427 Gets the specified item state.
429 int GetItemState(const wxTreeItemId
& item
) const;
432 Returns the item label.
434 wxString
GetItemText(const wxTreeItemId
& item
) const;
437 Returns the colour of the item label.
439 wxColour
GetItemTextColour(const wxTreeItemId
& item
) const;
442 Returns the last child of the item (or an invalid tree item if this item
445 @see GetFirstChild(), GetNextSibling(), GetLastChild()
447 wxTreeItemId
GetLastChild(const wxTreeItemId
& item
) const;
450 Returns the next child; call GetFirstChild() for the first child. For
451 this enumeration function you must pass in a 'cookie' parameter which is
452 opaque for the application but is necessary for the library to make
453 these functions reentrant (i.e. allow more than one enumeration on one
454 and the same object simultaneously). The cookie passed to
455 GetFirstChild() and GetNextChild() should be the same.
457 Returns an invalid tree item if there are no further children.
460 In wxPython the returned wxTreeItemId and the new cookie value are both
461 returned as a tuple containing the two values.
466 wxTreeItemId
GetNextChild(const wxTreeItemId
& item
,
467 wxTreeItemIdValue
& cookie
) const;
470 Returns the next sibling of the specified item; call GetPrevSibling()
471 for the previous sibling.
473 Returns an invalid tree item if there are no further siblings.
475 @see GetPrevSibling()
477 wxTreeItemId
GetNextSibling(const wxTreeItemId
& item
) const;
480 Returns the next visible item or an invalid item if this item is the
483 @note The @a item itself must be visible.
485 wxTreeItemId
GetNextVisible(const wxTreeItemId
& item
) const;
488 Returns the previous sibling of the specified item; call
489 GetNextSibling() for the next sibling.
491 Returns an invalid tree item if there are no further children.
493 @see GetNextSibling()
495 wxTreeItemId
GetPrevSibling(const wxTreeItemId
& item
) const;
498 Returns the previous visible item or an invalid item if this item is the
501 @note The @a item itself must be visible.
503 wxTreeItemId
GetPrevVisible(const wxTreeItemId
& item
) const;
506 Returns @true if the control will use a quick calculation for the best
507 size, looking only at the first and last items. The default is @false.
509 @see SetQuickBestSize()
511 bool GetQuickBestSize() const;
514 Returns the root item for the tree control.
516 wxTreeItemId
GetRootItem() const;
519 Returns the selection, or an invalid item if there is no selection. This
520 function only works with the controls without @c wxTR_MULTIPLE style,
521 use GetSelections() for the controls which do have this style.
523 wxTreeItemId
GetSelection() const;
526 Fills the array of tree items passed in with the currently selected
527 items. This function can be called only if the control has the @c
530 Returns the number of selected items.
533 The wxPython version of this method accepts no parameters and returns a
534 Python list of @ref wxTreeItemId "wxTreeItemId"s.
537 unsigned int GetSelections(wxArrayTreeItemIds
& selection
) const;
540 Returns the state image list (from which application-defined state
543 wxImageList
* GetStateImageList() const;
546 Calculates which (if any) item is under the given @a point, returning
547 the tree item id at this point plus extra information @a flags. @a flags
548 is a bitlist of the following:
550 - @c wxTREE_HITTEST_ABOVE: Above the client area.
551 - @c wxTREE_HITTEST_BELOW: Below the client area.
552 - @c wxTREE_HITTEST_NOWHERE: In the client area but below the last item.
553 - @c wxTREE_HITTEST_ONITEMBUTTON: On the button associated with an item.
554 - @c wxTREE_HITTEST_ONITEMICON: On the bitmap associated with an item.
555 - @c wxTREE_HITTEST_ONITEMINDENT: In the indentation associated with an
557 - @c wxTREE_HITTEST_ONITEMLABEL: On the label (string) associated with
559 - @c wxTREE_HITTEST_ONITEMRIGHT: In the area to the right of an item.
560 - @c wxTREE_HITTEST_ONITEMSTATEICON: On the state icon for a tree view
561 item that is in a user-defined state.
562 - @c wxTREE_HITTEST_TOLEFT: To the right of the client area.
563 - @c wxTREE_HITTEST_TORIGHT: To the left of the client area.
566 In wxPython both the wxTreeItemId and the flags are returned as a tuple.
569 wxTreeItemId
HitTest(const wxPoint
& point
, int& flags
) const;
573 Inserts an item after a given one (@a previous).
575 The @a image and @a selImage parameters are an index within the normal
576 image list specifying the image to use for unselected and selected
577 items, respectively. If @a image -1 and @a selImage is -1, the same
578 image is used for both selected and unselected items.
580 wxTreeItemId
InsertItem(const wxTreeItemId
& parent
,
581 const wxTreeItemId
& previous
,
582 const wxString
& text
,
585 wxTreeItemData
* data
= NULL
);
588 Inserts an item before one identified
589 by its position (@a before). @a before must be less than the number of
592 The @a image and @a selImage parameters are an index within the normal
593 image list specifying the image to use for unselected and selected
594 items, respectively. If @a image -1 and @a selImage is -1, the same
595 image is used for both selected and unselected items.
598 In wxPython, this form of this method is called @c InsertItemBefore().
601 wxTreeItemId
InsertItem(const wxTreeItemId
& parent
,
603 const wxString
& text
,
606 wxTreeItemData
* data
= NULL
);
609 Returns @true if the given item is in bold state.
613 bool IsBold(const wxTreeItemId
& item
) const;
616 Returns @true if the control is empty (i.e. has no items, even no root
619 bool IsEmpty() const;
622 Returns @true if the item is expanded (only makes sense if it has
625 bool IsExpanded(const wxTreeItemId
& item
) const;
628 Returns @true if the item is selected.
630 bool IsSelected(const wxTreeItemId
& item
) const;
633 Returns @true if the item is visible on the screen.
635 bool IsVisible(const wxTreeItemId
& item
) const;
638 Returns @true if the item has children.
640 bool ItemHasChildren(const wxTreeItemId
& item
) const;
643 Override this function in the derived class to change the sort order of
644 the items in the tree control. The function should return a negative,
645 zero or positive value if the first item is less than, equal to or
646 greater than the second one.
648 Please note that you @b must use wxRTTI macros DECLARE_DYNAMIC_CLASS()
649 and IMPLEMENT_DYNAMIC_CLASS() if you override this function because
650 otherwise the base class considers that it is not overridden and uses
651 the default comparison, i.e. sorts the items alphabetically, which
652 allows it optimize away the calls to the virtual function completely.
656 int OnCompareItems(const wxTreeItemId
& item1
,
657 const wxTreeItemId
& item2
);
660 Appends an item as the first child of @a parent, return a new item id.
662 The @a image and @a selImage parameters are an index within the normal
663 image list specifying the image to use for unselected and selected
664 items, respectively. If @a image -1 and @a selImage is -1, the same
665 image is used for both selected and unselected items.
667 wxTreeItemId
PrependItem(const wxTreeItemId
& parent
,
668 const wxString
& text
,
671 wxTreeItemData
* data
= NULL
);
674 Scrolls the specified item into view.
676 void ScrollTo(const wxTreeItemId
& item
);
679 Selects the given item. In multiple selection controls, can be also used
680 to deselect a currently selected item if the value of @a select is
683 void SelectItem(const wxTreeItemId
& item
, bool select
= true);
686 Sets the buttons image list (from which application-defined button
689 The button images assigned with this method will @b not be deleted by
690 @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you must delete it yourself.
691 Setting or assigning the button image list enables the display of image
692 buttons. Once enabled, the only way to disable the display of button
693 images is to set the button image list to @NULL.
695 @note This function is only available in the generic version.
697 @see AssignButtonsImageList().
699 void SetButtonsImageList(wxImageList
* imageList
);
702 Sets the normal image list. The image list assigned with this method
703 will @b not be deleted by @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you
704 must delete it yourself.
706 @see AssignImageList().
708 void SetImageList(wxImageList
* imageList
);
711 Sets the indentation for the tree control.
713 void SetIndent(int indent
);
716 Sets the colour of the item's background.
718 void SetItemBackgroundColour(const wxTreeItemId
& item
,
719 const wxColour
& col
);
722 Makes item appear in bold font if @a bold parameter is @true or resets
723 it to the normal state.
727 void SetItemBold(const wxTreeItemId
& item
, bool bold
= true);
730 Sets the item client data.
733 - @b SetPyData( @a item, @c obj): Associate the given Python Object with
734 the wxTreeItemData for the given item Id.
738 void SetItemData(const wxTreeItemId
& item
, wxTreeItemData
* data
);
742 Gives the item the visual feedback for Drag'n'Drop actions, which is
743 useful if something is dragged from the outside onto the tree control
744 (as opposed to a DnD operation within the tree control, which already
745 is implemented internally).
747 void SetItemDropHighlight(const wxTreeItemId
& item
,
748 bool highlight
= true);
751 Sets the item's font. All items in the tree should have the same height
752 to avoid text clipping, so the fonts height should be the same for all
753 of them, although font attributes may vary.
757 void SetItemFont(const wxTreeItemId
& item
, const wxFont
& font
);
760 Force appearance of the button next to the item. This is useful to
761 allow the user to expand the items which don't have any children now,
762 but instead adding them only when needed, thus minimizing memory
763 usage and loading time.
765 void SetItemHasChildren(const wxTreeItemId
& item
,
766 bool hasChildren
= true);
769 Sets the specified item's image. See GetItemImage() for the description
770 of the @a which parameter.
772 void SetItemImage(const wxTreeItemId
& item
, int image
,
773 wxTreeItemIcon which
= wxTreeItemIcon_Normal
);
776 Sets the selected item image (this function is obsolete, use @ref
777 SetItemImage() "SetItemImage"( @a item, ::wxTreeItemIcon_Selected )
780 void SetItemSelectedImage(const wxTreeItemId
& item
, int selImage
);
783 Sets the specified item state. The value of @a state may be:
784 - @c wxTREE_ITEMSTATE_NONE: to disable the item state (the state image will
786 - @c wxTREE_ITEMSTATE_NEXT: to set the next item state.
787 - @c wxTREE_ITEMSTATE_PREV: to set the previous item state.
789 void SetItemState(const wxTreeItemId
& item
, int state
);
794 void SetItemText(const wxTreeItemId
& item
, const wxString
& text
);
797 Sets the colour of the item's text.
799 void SetItemTextColour(const wxTreeItemId
& item
,
800 const wxColour
& col
);
803 If @true is passed, specifies that the control will use a quick
804 calculation for the best size, looking only at the first and last items.
805 Otherwise, it will look at all items. The default is @false.
807 @see GetQuickBestSize()
809 void SetQuickBestSize(bool quickBestSize
);
812 Sets the state image list (from which application-defined state images
813 are taken). Image list assigned with this method will @b not be deleted
814 by @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you must delete it
817 @see AssignStateImageList().
819 void SetStateImageList(wxImageList
* imageList
);
822 Sets the mode flags associated with the display of the tree control. The
823 new mode takes effect immediately.
825 @note Generic only; MSW ignores changes.
827 void SetWindowStyle(long styles
);
830 Sorts the children of the given item using OnCompareItems().
831 You should override that method to change the sort order (the default is
832 ascending case-sensitive alphabetical order).
834 @see wxTreeItemData, OnCompareItems()
836 void SortChildren(const wxTreeItemId
& item
);
839 Toggles the given item between collapsed and expanded states.
841 void Toggle(const wxTreeItemId
& item
);
844 Toggles the given item between selected and unselected states. For
845 multiselection controls only.
847 void ToggleItemSelection(const wxTreeItemId
& item
);
850 Removes the selection from the currently selected item (if any).
855 This function either behaves the same as Unselect() if the control
856 doesn't have @c wxTR_MULTIPLE style, or removes the selection from all
857 items if it does have this style.
862 Unselects the given item. This works in multiselection controls only.
864 void UnselectItem(const wxTreeItemId
& item
);
872 A tree event holds information about events associated with wxTreeCtrl
875 To process input from a tree control, use these event handler macros to
876 direct input to member functions that take a wxTreeEvent argument.
878 @beginEventTable{wxTreeEvent}
879 @event{EVT_TREE_BEGIN_DRAG(id, func)}
880 Begin dragging with the left mouse button.
881 @event{EVT_TREE_BEGIN_RDRAG(id, func)}
882 Begin dragging with the right mouse button.
883 @event{EVT_TREE_END_DRAG(id, func)}
884 End dragging with the left or right mouse button.
885 @event{EVT_TREE_BEGIN_LABEL_EDIT(id, func)}
886 Begin editing a label. This can be prevented by calling Veto().
887 @event{EVT_TREE_END_LABEL_EDIT(id, func)}
888 Finish editing a label. This can be prevented by calling Veto().
889 @event{EVT_TREE_DELETE_ITEM(id, func)}
891 @event{EVT_TREE_GET_INFO(id, func)}
892 Request information from the application.
893 @event{EVT_TREE_SET_INFO(id, func)}
894 Information is being supplied.
895 @event{EVT_TREE_ITEM_ACTIVATED(id, func)}
896 The item has been activated, i.e. chosen by double clicking it with
897 mouse or from keyboard.
898 @event{EVT_TREE_ITEM_COLLAPSED(id, func)}
899 The item has been collapsed.
900 @event{EVT_TREE_ITEM_COLLAPSING(id, func)}
901 The item is being collapsed. This can be prevented by calling Veto().
902 @event{EVT_TREE_ITEM_EXPANDED(id, func)}
903 The item has been expanded.
904 @event{EVT_TREE_ITEM_EXPANDING(id, func)}
905 The item is being expanded. This can be prevented by calling Veto().
906 @event{EVT_TREE_ITEM_RIGHT_CLICK(id, func)}
907 The user has clicked the item with the right mouse button.
908 @event{EVT_TREE_ITEM_MIDDLE_CLICK(id, func)}
909 The user has clicked the item with the middle mouse button.
910 @event{EVT_TREE_SEL_CHANGED(id, func)}
911 Selection has changed.
912 @event{EVT_TREE_SEL_CHANGING(id, func)}
913 Selection is changing. This can be prevented by calling Veto().
914 @event{EVT_TREE_KEY_DOWN(id, func)}
915 A key has been pressed.
916 @event{EVT_TREE_ITEM_GETTOOLTIP(id, func)}
917 The opportunity to set the item tooltip is being given to the
918 application (call SetToolTip()). Windows only.
919 @event{EVT_TREE_ITEM_MENU(id, func)}
920 The context menu for the selected item has been requested, either by a
921 right click or by using the menu key.
922 @event{EVT_TREE_STATE_IMAGE_CLICK(id, func)}
923 The state image has been clicked.
931 class wxTreeEvent
: public wxNotifyEvent
935 Constructor, used by wxWidgets itself only.
937 wxTreeEvent(wxEventType commandType
, wxTreeCtrl
* tree
);
940 Returns the item (valid for all events).
942 wxTreeItemId
GetItem() const;
945 Returns the key code if the event is a key event. Use GetKeyEvent() to
946 get the values of the modifier keys for this event (i.e. Shift or Ctrl).
948 int GetKeyCode() const;
951 Returns the key event for EVT_TREE_KEY_DOWN() events.
953 const wxKeyEvent
GetKeyEvent() const;
956 Returns the label if the event is a begin or end edit label event.
958 const wxString
GetLabel() const;
961 Returns the old item index (valid for EVT_TREE_ITEM_CHANGING() and
962 EVT_TREE_ITEM_CHANGED() events).
964 wxTreeItemId
GetOldItem() const;
967 Returns the position of the mouse pointer if the event is a drag or
970 In both cases the position is in client coordinates - i.e. relative to
971 the wxTreeCtrl window (so that you can pass it directly to e.g.
972 wxWindow::PopupMenu()).
974 wxPoint
GetPoint() const;
977 Returns @true if the label edit was cancelled. This should be called
978 from within an EVT_TREE_END_LABEL_EDIT() handler.
980 bool IsEditCancelled() const;
983 Set the tooltip for the item (valid for EVT_TREE_ITEM_GETTOOLTIP()
984 events). Windows only.
986 void SetToolTip(const wxString
& tooltip
);