]>
git.saurik.com Git - wxWidgets.git/blob - interface/treectrl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxTreeItemData
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
14 A tree control presents information as a hierarchy, with items that may be
15 expanded to show further items. Items in a tree control are referenced by
16 wxTreeItemId handles, which may be tested for validity by calling
19 To intercept events from a tree control, use the event table macros
20 described in wxTreeEvent.
23 @style{wxTR_EDIT_LABELS}
24 Use this style if you wish the user to be able to edit labels in the
26 @style{wxTR_NO_BUTTONS}
27 For convenience to document that no buttons are to be drawn.
28 @style{wxTR_HAS_BUTTONS}
29 Use this style to show + and - buttons to the left of parent items.
31 Use this style to hide vertical level connectors.
32 @style{wxTR_FULL_ROW_HIGHLIGHT}
33 Use this style to have the background colour and the selection highlight
34 extend over the entire horizontal row of the tree control window. (This
35 flag is ignored under Windows unless you specify @c wxTR_NO_LINES as
37 @style{wxTR_LINES_AT_ROOT}
38 Use this style to show lines between root nodes. Only applicable if @c
39 wxTR_HIDE_ROOT is set and @c wxTR_NO_LINES is not set.
40 @style{wxTR_HIDE_ROOT}
41 Use this style to suppress the display of the root node, effectively
42 causing the first-level nodes to appear as a series of root nodes.
43 @style{wxTR_ROW_LINES}
44 Use this style to draw a contrasting border between displayed rows.
45 @style{wxTR_HAS_VARIABLE_ROW_HEIGHT}
46 Use this style to cause row heights to be just big enough to fit the
47 content. If not set, all rows use the largest row height. The default is
48 that this flag is unset. Generic only.
50 For convenience to document that only one item may be selected at a
51 time. Selecting another item causes the current selection, if any, to be
52 deselected. This is the default.
54 Use this style to allow a range of items to be selected. If a second
55 range is selected, the current range, if any, is deselected.
56 @style{wxTR_DEFAULT_STYLE}
57 The set of flags that are closest to the defaults for the native control
58 for a particular toolkit.
61 See also @ref overview_windowstyles.
65 wxTreeCtrl class uses the standard common treeview control under Win32
66 implemented in the system library comctl32.dll. Some versions of this
67 library are known to have bugs with handling the tree control colours: the
68 usual symptom is that the expanded items leave black (or otherwise
69 incorrectly coloured) background behind them, especially for the controls
70 using non-default background colour. The recommended solution is to upgrade
71 the comctl32.dll to a newer version: see
72 http://www.microsoft.com/downloads/details.aspx?familyid=cb2cf3a2-8025-4e8f-8511-9b476a8d35d2
76 <!-- @appearance{treectrl.png} -->
78 @see wxTreeEvent, wxTreeItemData, @ref overview_treectrl, wxListBox,
79 wxListCtrl, wxImageList
81 class wxTreeCtrl
: public wxControl
90 Constructor, creating and showing a tree control.
93 Parent window. Must not be @NULL.
95 Window identifier. The value @c wxID_ANY indicates a default value.
99 Window size. If wxDefaultSize is specified then the window is sized
102 Window style. See wxTreeCtrl.
108 @see Create(), wxValidator
110 wxTreeCtrl(wxWindow
* parent
, wxWindowID id
,
111 const wxPoint
& pos
= wxDefaultPosition
,
112 const wxSize
& size
= wxDefaultSize
,
113 long style
= wxTR_HAS_BUTTONS
,
114 const wxValidator
& validator
= wxDefaultValidator
,
115 const wxString
& name
= "treeCtrl");
119 Destructor, destroying the tree control.
124 Adds the root node to the tree, returning the new item.
126 The @a image and @a selImage parameters are an index within the normal
127 image list specifying the image to use for unselected and selected
128 items, respectively. If @a image -1 and @a selImage is -1, the same
129 image is used for both selected and unselected items.
131 wxTreeItemId
AddRoot(const wxString
& text
, int image
= -1,
133 wxTreeItemData
* data
= NULL
);
136 Appends an item to the end of the branch identified by @a parent, return
139 The @a image and @a selImage parameters are an index within the normal
140 image list specifying the image to use for unselected and selected
141 items, respectively. If @a image -1 and @a selImage is -1, the same
142 image is used for both selected and unselected items.
144 wxTreeItemId
AppendItem(const wxTreeItemId
& parent
,
145 const wxString
& text
,
148 wxTreeItemData
* data
= NULL
);
151 Sets the buttons image list. The button images assigned with this method
152 will be automatically deleted by wxTreeCtrl as appropriate (i.e. it
153 takes ownership of the list).
155 Setting or assigning the button image list enables the display of image
156 buttons. Once enabled, the only way to disable the display of button
157 images is to set the button image list to @NULL.
159 This function is only available in the generic version.
161 @see SetButtonsImageList().
163 void AssignButtonsImageList(wxImageList
* imageList
);
166 Sets the normal image list. The image list assigned with this method
167 will be automatically deleted by wxTreeCtrl as appropriate (i.e. it
168 takes ownership of the list).
172 void AssignImageList(wxImageList
* imageList
);
175 Sets the state image list. Image list assigned with this method will be
176 automatically deleted by wxTreeCtrl as appropriate (i.e. it takes
177 ownership of the list).
179 @see SetStateImageList().
181 void AssignStateImageList(wxImageList
* imageList
);
184 Collapses the given item.
186 void Collapse(const wxTreeItemId
& item
);
189 Collapses the root item.
196 Collapses this item and all of its children, recursively.
198 @see ExpandAllChildren()
200 void CollapseAllChildren(const wxTreeItemId
& item
);
203 Collapses the given item and removes all children.
205 void CollapseAndReset(const wxTreeItemId
& item
);
208 Creates the tree control. See wxTreeCtrl::wxTreeCtrl() for further
211 bool Create(wxWindow
* parent
, wxWindowID id
,
212 const wxPoint
& pos
= wxDefaultPosition
,
213 const wxSize
& size
= wxDefaultSize
,
214 long style
= wxTR_HAS_BUTTONS
,
215 const wxValidator
& validator
= wxDefaultValidator
,
216 const wxString
& name
= "treeCtrl");
219 Deletes the specified item. A EVT_TREE_DELETE_ITEM() event will be
222 This function may cause a subsequent call to GetNextChild() to fail.
224 void Delete(const wxTreeItemId
& item
);
227 Deletes all items in the control. Note that this may not generate
228 EVT_TREE_DELETE_ITEM() events under some Windows versions although
229 normally such event is generated for each removed item.
231 void DeleteAllItems();
234 Deletes all children of the given item (but not the item itself). Note
235 that this will @b not generate any events unlike Delete() method.
237 If you have called SetItemHasChildren(), you may need to call it again
238 since DeleteChildren() does not automatically clear the setting.
240 void DeleteChildren(const wxTreeItemId
& item
);
243 Starts editing the label of the given @a item. This function generates a
244 EVT_TREE_BEGIN_LABEL_EDIT() event which can be vetoed so that no text
245 control will appear for in-place editing.
247 If the user changed the label (i.e. s/he does not press ESC or leave the
248 text control without changes, a EVT_TREE_END_LABEL_EDIT() event will be
249 sent which can be vetoed as well.
251 @see EndEditLabel(), wxTreeEvent
253 void EditLabel(const wxTreeItemId
& item
);
256 Ends label editing. If @a cancelEdit is @true, the edit will be
260 This function is currently supported under Windows only.
264 void EndEditLabel(bool cancelEdit
);
267 Scrolls and/or expands items to ensure that the given item is visible.
269 void EnsureVisible(const wxTreeItemId
& item
);
272 Expands the given item.
274 void Expand(const wxTreeItemId
& item
);
277 Expands all items in the tree.
282 Expands the given item and all its children recursively.
284 void ExpandAllChildren(const wxTreeItemId
& item
);
287 Retrieves the rectangle bounding the @a item. If @a textOnly is @true,
288 only the rectangle around the item's label will be returned, otherwise
289 the item's image is also taken into account.
291 The return value is @true if the rectangle was successfully retrieved or
292 @c @false if it was not (in this case @a rect is not changed) -- for
293 example, if the item is currently invisible.
295 Notice that the rectangle coordinates are logical, not physical ones.
296 So, for example, the x coordinate may be negative if the tree has a
297 horizontal scrollbar and its position is not 0.
300 The wxPython version of this method requires only the @a item and @a
301 textOnly parameters. The return value is either a wxRect object or @c
305 bool GetBoundingRect(const wxTreeItemId
& item
, wxRect
& rect
,
306 bool textOnly
= false) const;
309 Returns the buttons image list (from which application-defined button
312 This function is only available in the generic version.
314 wxImageList
* GetButtonsImageList() const;
317 Returns the number of items in the branch. If @a recursively is @true,
318 returns the total number of descendants, otherwise only one level of
321 unsigned int GetChildrenCount(const wxTreeItemId
& item
,
322 bool recursively
= true) const;
325 Returns the number of items in the control.
327 unsigned int GetCount() const;
330 Returns the edit control being currently used to edit a label. Returns
331 @NULL if no label is being edited.
333 @note This is currently only implemented for wxMSW.
335 wxTextCtrl
* GetEditControl() const;
338 Returns the first child; call GetNextChild() for the next child.
340 For this enumeration function you must pass in a 'cookie' parameter
341 which is opaque for the application but is necessary for the library to
342 make these functions reentrant (i.e. allow more than one enumeration on
343 one and the same object simultaneously). The cookie passed to
344 GetFirstChild() and GetNextChild() should be the same variable.
346 Returns an invalid tree item (i.e. wxTreeItemId::IsOk() returns @false)
347 if there are no further children.
350 In wxPython the returned wxTreeItemId and the new cookie value are both
351 returned as a tuple containing the two values.
354 @see GetNextChild(), GetNextSibling()
356 wxTreeItemId
GetFirstChild(const wxTreeItemId
& item
,
357 wxTreeItemIdValue
& cookie
) const;
360 Returns the first visible item.
362 wxTreeItemId
GetFirstVisibleItem() const;
365 Returns the normal image list.
367 wxImageList
* GetImageList() const;
370 Returns the current tree control indentation.
372 int GetIndent() const;
375 Returns the background colour of the item.
377 wxColour
GetItemBackgroundColour(const wxTreeItemId
& item
) const;
380 Returns the tree item data associated with the item.
385 wxPython provides the following shortcut method:
386 @li GetPyData(item): Returns the Python Object associated with the
387 wxTreeItemData for the given item Id.
390 wxTreeItemData
* GetItemData(const wxTreeItemId
& item
) const;
393 Returns the font of the item label.
395 wxFont
GetItemFont(const wxTreeItemId
& item
) const;
398 Gets the specified item image. The value of @a which may be:
399 - ::wxTreeItemIcon_Normal: to get the normal item image.
400 - ::wxTreeItemIcon_Selected: to get the selected item image (i.e. the
401 image which is shown when the item is currently selected).
402 - ::wxTreeItemIcon_Expanded: to get the expanded image (this only makes
403 sense for items which have children - then this image is shown when
404 the item is expanded and the normal image is shown when it is
406 - ::wxTreeItemIcon_SelectedExpanded: to get the selected expanded image
407 (which is shown when an expanded item is currently selected).
409 int GetItemImage(const wxTreeItemId
& item
,
410 wxTreeItemIcon which
= wxTreeItemIcon_Normal
) const;
413 Returns the item's parent.
415 wxTreeItemId
GetItemParent(const wxTreeItemId
& item
) const;
418 Gets the selected item image (this function is obsolete, use @ref
419 GetItemImage() "GetItemImage"( @a item, ::wxTreeItemIcon_Selected)
422 int GetItemSelectedImage(const wxTreeItemId
& item
) const;
425 Returns the item label.
427 wxString
GetItemText(const wxTreeItemId
& item
) const;
430 Returns the colour of the item label.
432 wxColour
GetItemTextColour(const wxTreeItemId
& item
) const;
435 Returns the last child of the item (or an invalid tree item if this item
438 @see GetFirstChild(), GetNextSibling(), GetLastChild()
440 wxTreeItemId
GetLastChild(const wxTreeItemId
& item
) const;
443 Returns the next child; call GetFirstChild() for the first child. For
444 this enumeration function you must pass in a 'cookie' parameter which is
445 opaque for the application but is necessary for the library to make
446 these functions reentrant (i.e. allow more than one enumeration on one
447 and the same object simultaneously). The cookie passed to
448 GetFirstChild() and GetNextChild() should be the same.
450 Returns an invalid tree item if there are no further children.
453 In wxPython the returned wxTreeItemId and the new cookie value are both
454 returned as a tuple containing the two values.
459 wxTreeItemId
GetNextChild(const wxTreeItemId
& item
,
460 wxTreeItemIdValue
& cookie
) const;
463 Returns the next sibling of the specified item; call GetPrevSibling()
464 for the previous sibling.
466 Returns an invalid tree item if there are no further siblings.
468 @see GetPrevSibling()
470 wxTreeItemId
GetNextSibling(const wxTreeItemId
& item
) const;
473 Returns the next visible item or an invalid item if this item is the
476 @note The @a item itself must be visible.
478 wxTreeItemId
GetNextVisible(const wxTreeItemId
& item
) const;
481 Returns the previous sibling of the specified item; call
482 GetNextSibling() for the next sibling.
484 Returns an invalid tree item if there are no further children.
486 @see GetNextSibling()
488 wxTreeItemId
GetPrevSibling(const wxTreeItemId
& item
) const;
491 Returns the previous visible item or an invalid item if this item is the
494 @note The @a item itself must be visible.
496 wxTreeItemId
GetPrevVisible(const wxTreeItemId
& item
) const;
499 Returns @true if the control will use a quick calculation for the best
500 size, looking only at the first and last items. The default is @false.
502 @see SetQuickBestSize()
504 bool GetQuickBestSize() const;
507 Returns the root item for the tree control.
509 wxTreeItemId
GetRootItem() const;
512 Returns the selection, or an invalid item if there is no selection. This
513 function only works with the controls without @c wxTR_MULTIPLE style,
514 use GetSelections() for the controls which do have this style.
516 wxTreeItemId
GetSelection() const;
519 Fills the array of tree items passed in with the currently selected
520 items. This function can be called only if the control has the @c
523 Returns the number of selected items.
526 The wxPython version of this method accepts no parameters and returns a
527 Python list of @ref wxTreeItemId "wxTreeItemId"s.
530 unsigned int GetSelections(wxArrayTreeItemIds
& selection
) const;
533 Returns the state image list (from which application-defined state
536 wxImageList
* GetStateImageList() const;
539 Calculates which (if any) item is under the given @a point, returning
540 the tree item id at this point plus extra information @a flags. @a flags
541 is a bitlist of the following:
543 - @c wxTREE_HITTEST_ABOVE: Above the client area.
544 - @c wxTREE_HITTEST_BELOW: Below the client area.
545 - @c wxTREE_HITTEST_NOWHERE: In the client area but below the last item.
546 - @c wxTREE_HITTEST_ONITEMBUTTON: On the button associated with an item.
547 - @c wxTREE_HITTEST_ONITEMICON: On the bitmap associated with an item.
548 - @c wxTREE_HITTEST_ONITEMINDENT: In the indentation associated with an
550 - @c wxTREE_HITTEST_ONITEMLABEL: On the label (string) associated with
552 - @c wxTREE_HITTEST_ONITEMRIGHT: In the area to the right of an item.
553 - @c wxTREE_HITTEST_ONITEMSTATEICON: On the state icon for a tree view
554 item that is in a user-defined state.
555 - @c wxTREE_HITTEST_TOLEFT: To the right of the client area.
556 - @c wxTREE_HITTEST_TORIGHT: To the left of the client area.
559 In wxPython both the wxTreeItemId and the flags are returned as a tuple.
562 wxTreeItemId
HitTest(const wxPoint
& point
, int& flags
) const;
566 Inserts an item after a given one (@a previous).
568 The @a image and @a selImage parameters are an index within the normal
569 image list specifying the image to use for unselected and selected
570 items, respectively. If @a image -1 and @a selImage is -1, the same
571 image is used for both selected and unselected items.
573 wxTreeItemId
InsertItem(const wxTreeItemId
& parent
,
574 const wxTreeItemId
& previous
,
575 const wxString
& text
,
578 wxTreeItemData
* data
= NULL
);
581 Inserts an item before one identified
582 by its position (@a before). @a before must be less than the number of
585 The @a image and @a selImage parameters are an index within the normal
586 image list specifying the image to use for unselected and selected
587 items, respectively. If @a image -1 and @a selImage is -1, the same
588 image is used for both selected and unselected items.
591 In wxPython, this form of this method is called @c InsertItemBefore().
594 wxTreeItemId
InsertItem(const wxTreeItemId
& parent
,
596 const wxString
& text
,
599 wxTreeItemData
* data
= NULL
);
602 Returns @true if the given item is in bold state.
606 bool IsBold(const wxTreeItemId
& item
) const;
609 Returns @true if the control is empty (i.e. has no items, even no root
612 bool IsEmpty() const;
615 Returns @true if the item is expanded (only makes sense if it has
618 bool IsExpanded(const wxTreeItemId
& item
) const;
621 Returns @true if the item is selected.
623 bool IsSelected(const wxTreeItemId
& item
) const;
626 Returns @true if the item is visible on the screen.
628 bool IsVisible(const wxTreeItemId
& item
) const;
631 Returns @true if the item has children.
633 bool ItemHasChildren(const wxTreeItemId
& item
) const;
636 Override this function in the derived class to change the sort order of
637 the items in the tree control. The function should return a negative,
638 zero or positive value if the first item is less than, equal to or
639 greater than the second one.
641 Please note that you @b must use wxRTTI macros DECLARE_DYNAMIC_CLASS()
642 and IMPLEMENT_DYNAMIC_CLASS() if you override this function because
643 otherwise the base class considers that it is not overridden and uses
644 the default comparison, i.e. sorts the items alphabetically, which
645 allows it optimize away the calls to the virtual function completely.
649 int OnCompareItems(const wxTreeItemId
& item1
,
650 const wxTreeItemId
& item2
);
653 Appends an item as the first child of @a parent, return a new item id.
655 The @a image and @a selImage parameters are an index within the normal
656 image list specifying the image to use for unselected and selected
657 items, respectively. If @a image -1 and @a selImage is -1, the same
658 image is used for both selected and unselected items.
660 wxTreeItemId
PrependItem(const wxTreeItemId
& parent
,
661 const wxString
& text
,
664 wxTreeItemData
* data
= NULL
);
667 Scrolls the specified item into view.
669 void ScrollTo(const wxTreeItemId
& item
);
672 Selects the given item. In multiple selection controls, can be also used
673 to deselect a currently selected item if the value of @a select is
676 void SelectItem(const wxTreeItemId
& item
, bool select
= true);
679 Sets the buttons image list (from which application-defined button
682 The button images assigned with this method will @b not be deleted by
683 @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you must delete it yourself.
684 Setting or assigning the button image list enables the display of image
685 buttons. Once enabled, the only way to disable the display of button
686 images is to set the button image list to @NULL.
688 @note This function is only available in the generic version.
690 @see AssignButtonsImageList().
692 void SetButtonsImageList(wxImageList
* imageList
);
695 Sets the normal image list. The image list assigned with this method
696 will @b not be deleted by @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you
697 must delete it yourself.
699 @see AssignImageList().
701 void SetImageList(wxImageList
* imageList
);
704 Sets the indentation for the tree control.
706 void SetIndent(int indent
);
709 Sets the colour of the item's background.
711 void SetItemBackgroundColour(const wxTreeItemId
& item
,
712 const wxColour
& col
);
715 Makes item appear in bold font if @a bold parameter is @true or resets
716 it to the normal state.
720 void SetItemBold(const wxTreeItemId
& item
, bool bold
= true);
723 Sets the item client data.
726 - @b SetPyData( @a item, @c obj): Associate the given Python Object with
727 the wxTreeItemData for the given item Id.
731 void SetItemData(const wxTreeItemId
& item
, wxTreeItemData
* data
);
735 Gives the item the visual feedback for Drag'n'Drop actions, which is
736 useful if something is dragged from the outside onto the tree control
737 (as opposed to a DnD operation within the tree control, which already
738 is implemented internally).
740 void SetItemDropHighlight(const wxTreeItemId
& item
,
741 bool highlight
= true);
744 Sets the item's font. All items in the tree should have the same height
745 to avoid text clipping, so the fonts height should be the same for all
746 of them, although font attributes may vary.
750 void SetItemFont(const wxTreeItemId
& item
, const wxFont
& font
);
753 Force appearance of the button next to the item. This is useful to
754 allow the user to expand the items which don't have any children now,
755 but instead adding them only when needed, thus minimizing memory
756 usage and loading time.
758 void SetItemHasChildren(const wxTreeItemId
& item
,
759 bool hasChildren
= true);
762 Sets the specified item's image. See GetItemImage() for the description
763 of the @a which parameter.
765 void SetItemImage(const wxTreeItemId
& item
, int image
,
766 wxTreeItemIcon which
= wxTreeItemIcon_Normal
);
769 Sets the selected item image (this function is obsolete, use @ref
770 SetItemImage() "SetItemImage"( @a item, ::wxTreeItemIcon_Selected )
773 void SetItemSelectedImage(const wxTreeItemId
& item
, int selImage
);
778 void SetItemText(const wxTreeItemId
& item
, const wxString
& text
);
781 Sets the colour of the item's text.
783 void SetItemTextColour(const wxTreeItemId
& item
,
784 const wxColour
& col
);
787 If @true is passed, specifies that the control will use a quick
788 calculation for the best size, looking only at the first and last items.
789 Otherwise, it will look at all items. The default is @false.
791 @see GetQuickBestSize()
793 void SetQuickBestSize(bool quickBestSize
);
796 Sets the state image list (from which application-defined state images
797 are taken). Image list assigned with this method will @b not be deleted
798 by @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you must delete it
801 @see AssignStateImageList().
803 void SetStateImageList(wxImageList
* imageList
);
806 Sets the mode flags associated with the display of the tree control. The
807 new mode takes effect immediately.
809 @note Generic only; MSW ignores changes.
811 void SetWindowStyle(long styles
);
814 Sorts the children of the given item using OnCompareItems().
815 You should override that method to change the sort order (the default is
816 ascending case-sensitive alphabetical order).
818 @see wxTreeItemData, OnCompareItems()
820 void SortChildren(const wxTreeItemId
& item
);
823 Toggles the given item between collapsed and expanded states.
825 void Toggle(const wxTreeItemId
& item
);
828 Toggles the given item between selected and unselected states. For
829 multiselection controls only.
831 void ToggleItemSelection(const wxTreeItemId
& item
);
834 Removes the selection from the currently selected item (if any).
839 This function either behaves the same as Unselect() if the control
840 doesn't have @c wxTR_MULTIPLE style, or removes the selection from all
841 items if it does have this style.
846 Unselects the given item. This works in multiselection controls only.
848 void UnselectItem(const wxTreeItemId
& item
);
855 @wxheader{treectrl.h}
857 A tree event holds information about events associated with wxTreeCtrl
860 To process input from a tree control, use these event handler macros to
861 direct input to member functions that take a wxTreeEvent argument.
863 @beginEventTable{wxTreeEvent}
864 @event{EVT_TREE_BEGIN_DRAG(id, func)}
865 Begin dragging with the left mouse button.
866 @event{EVT_TREE_BEGIN_RDRAG(id, func)}
867 Begin dragging with the right mouse button.
868 @event{EVT_TREE_END_DRAG(id, func)}
869 End dragging with the left or right mouse button.
870 @event{EVT_TREE_BEGIN_LABEL_EDIT(id, func)}
871 Begin editing a label. This can be prevented by calling Veto().
872 @event{EVT_TREE_END_LABEL_EDIT(id, func)}
873 Finish editing a label. This can be prevented by calling Veto().
874 @event{EVT_TREE_DELETE_ITEM(id, func)}
876 @event{EVT_TREE_GET_INFO(id, func)}
877 Request information from the application.
878 @event{EVT_TREE_SET_INFO(id, func)}
879 Information is being supplied.
880 @event{EVT_TREE_ITEM_ACTIVATED(id, func)}
881 The item has been activated, i.e. chosen by double clicking it with
882 mouse or from keyboard.
883 @event{EVT_TREE_ITEM_COLLAPSED(id, func)}
884 The item has been collapsed.
885 @event{EVT_TREE_ITEM_COLLAPSING(id, func)}
886 The item is being collapsed. This can be prevented by calling Veto().
887 @event{EVT_TREE_ITEM_EXPANDED(id, func)}
888 The item has been expanded.
889 @event{EVT_TREE_ITEM_EXPANDING(id, func)}
890 The item is being expanded. This can be prevented by calling Veto().
891 @event{EVT_TREE_ITEM_RIGHT_CLICK(id, func)}
892 The user has clicked the item with the right mouse button.
893 @event{EVT_TREE_ITEM_MIDDLE_CLICK(id, func)}
894 The user has clicked the item with the middle mouse button.
895 @event{EVT_TREE_SEL_CHANGED(id, func)}
896 Selection has changed.
897 @event{EVT_TREE_SEL_CHANGING(id, func)}
898 Selection is changing. This can be prevented by calling Veto().
899 @event{EVT_TREE_KEY_DOWN(id, func)}
900 A key has been pressed.
901 @event{EVT_TREE_ITEM_GETTOOLTIP(id, func)}
902 The opportunity to set the item tooltip is being given to the
903 application (call SetToolTip()). Windows only.
904 @event{EVT_TREE_ITEM_MENU(id, func)}
905 The context menu for the selected item has been requested, either by a
906 right click or by using the menu key.
907 @event{EVT_TREE_STATE_IMAGE_CLICK(id, func)}
908 The state image has been clicked. Windows only.
916 class wxTreeEvent
: public wxNotifyEvent
920 Constructor, used by wxWidgets itself only.
922 wxTreeEvent(wxEventType commandType
, wxTreeCtrl
* tree
);
925 Returns the item (valid for all events).
927 wxTreeItemId
GetItem() const;
930 Returns the key code if the event is a key event. Use GetKeyEvent() to
931 get the values of the modifier keys for this event (i.e. Shift or Ctrl).
933 int GetKeyCode() const;
936 Returns the key event for EVT_TREE_KEY_DOWN() events.
938 const wxKeyEvent
GetKeyEvent() const;
941 Returns the label if the event is a begin or end edit label event.
943 const wxString
GetLabel() const;
946 Returns the old item index (valid for EVT_TREE_ITEM_CHANGING() and
947 EVT_TREE_ITEM_CHANGED() events).
949 wxTreeItemId
GetOldItem() const;
952 Returns the position of the mouse pointer if the event is a drag or
955 In both cases the position is in client coordinates - i.e. relative to
956 the wxTreeCtrl window (so that you can pass it directly to e.g.
957 wxWindow::PopupMenu()).
959 wxPoint
GetPoint() const;
962 Returns @true if the label edit was cancelled. This should be called
963 from within an EVT_TREE_END_LABEL_EDIT() handler.
965 bool IsEditCancelled() const;
968 Set the tooltip for the item (valid for EVT_TREE_ITEM_GETTOOLTIP()
969 events). Windows only.
971 void SetToolTip(const wxString
& tooltip
);