Window identifier. The value @c wxID_ANY indicates a default value.
@param pos
Window position.
+ If ::wxDefaultPosition is specified then a default position is chosen.
@param size
- Window size. If wxDefaultSize is specified then the window is sized
- appropriately.
+ Window size.
+ If ::wxDefaultSize is specified then the window is sized appropriately.
@param style
Window style. See wxTreeCtrl.
@param validator
*/
virtual wxTreeItemId GetFirstVisibleItem() const;
+ /**
+ Returns the item last clicked or otherwise selected.
+ Unlike GetSelection(), it can be used whether or not
+ the control has the @c wxTR_MULTIPLE style.
+
+ @since 2.9.1
+ */
+ virtual wxTreeItemId GetFocusedItem() const;
+
/**
Returns the normal image list.
*/
/**
Returns the selection, or an invalid item if there is no selection. This
function only works with the controls without @c wxTR_MULTIPLE style,
- use GetSelections() for the controls which do have this style.
+ use GetSelections() for the controls which do have this style
+ or, if a single item is wanted, use GetFocusedItem().
*/
virtual wxTreeItemId GetSelection() const;
/**
Sets the item client data.
+ Notice that the client data previously associated with the @a item (if
+ any) is @em not freed by this function and so calling this function
+ multiple times for the same item will result in memory leaks unless you
+ delete the old item data pointer yourself.
+
@beginWxPythonOnly
- @b SetPyData( @a item, @c obj): Associate the given Python Object with
the wxTreeItemData for the given item Id.
@beginEventTable{wxTreeEvent}
@event{EVT_TREE_BEGIN_DRAG(id, func)}
- Begin dragging with the left mouse button.
- If you want to enable left-dragging you need to intercept this event
- and explicitely call wxTreeEvent::Allow(), as it's vetoed by default.
+ Begin dragging with the left mouse button. If you want to enable
+ left-dragging you need to intercept this event and explicitely call
+ wxTreeEvent::Allow(), as it's vetoed by default. Also notice that the
+ control must have an associated image list (see SetImageList()) to
+ drag its items under MSW.
@event{EVT_TREE_BEGIN_RDRAG(id, func)}
- Begin dragging with the right mouse button.
- If you want to enable right-dragging you need to intercept this event
- and explicitely call wxTreeEvent::Allow(), as it's vetoed by default.
+ Begin dragging with the right mouse button. If you want to enable
+ right-dragging you need to intercept this event and explicitely call
+ wxTreeEvent::Allow(), as it's vetoed by default.
@event{EVT_TREE_END_DRAG(id, func)}
End dragging with the left or right mouse button.
@event{EVT_TREE_BEGIN_LABEL_EDIT(id, func)}