2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: treectrl.h
|
2008-03-10 11:24:38 -04:00
|
|
|
// Purpose: interface of wxTreeItemData
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxTreeCtrl
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
A tree control presents information as a hierarchy, with items that may be
|
2008-05-20 03:48:30 -04:00
|
|
|
expanded to show further items. Items in a tree control are referenced by
|
|
|
|
wxTreeItemId handles, which may be tested for validity by calling
|
|
|
|
wxTreeItemId::IsOk().
|
2008-06-16 13:50:40 -04:00
|
|
|
|
2011-04-03 16:31:32 -04:00
|
|
|
A similar control with a fully native implementation for GTK+ and OS X
|
2008-05-24 15:49:55 -04:00
|
|
|
as well is wxDataViewTreeCtrl.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
To intercept events from a tree control, use the event table macros
|
|
|
|
described in wxTreeEvent.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@beginStyleTable
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_EDIT_LABELS}
|
2008-05-20 03:48:30 -04:00
|
|
|
Use this style if you wish the user to be able to edit labels in the
|
|
|
|
tree control.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_NO_BUTTONS}
|
2008-05-20 03:48:30 -04:00
|
|
|
For convenience to document that no buttons are to be drawn.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_HAS_BUTTONS}
|
2008-05-20 03:48:30 -04:00
|
|
|
Use this style to show + and - buttons to the left of parent items.
|
2011-02-05 20:00:48 -05:00
|
|
|
@style{wxTR_TWIST_BUTTONS}
|
|
|
|
Selects alternative style of @c +/@c - buttons and shows rotating
|
|
|
|
("twisting") arrows instead. Currently this style is only implemented
|
|
|
|
under Microsoft Windows Vista and later Windows versions and is ignored
|
2015-09-17 08:46:27 -04:00
|
|
|
under the other platforms as enabling it is equivalent to using
|
|
|
|
wxSystemThemedControl::EnableSystemTheme().
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_NO_LINES}
|
2008-05-20 03:48:30 -04:00
|
|
|
Use this style to hide vertical level connectors.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_FULL_ROW_HIGHLIGHT}
|
2008-05-20 03:48:30 -04:00
|
|
|
Use this style to have the background colour and the selection highlight
|
|
|
|
extend over the entire horizontal row of the tree control window. (This
|
|
|
|
flag is ignored under Windows unless you specify @c wxTR_NO_LINES as
|
|
|
|
well.)
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_LINES_AT_ROOT}
|
2018-08-25 16:33:57 -04:00
|
|
|
Use this style to show lines leading to the root nodes (unless no
|
|
|
|
@c wxTR_NO_LINES is also used, in which case no lines are shown). Note
|
|
|
|
that in the MSW version, if this style is omitted, not only the lines,
|
|
|
|
but also the button used for expanding the root item is not shown,
|
|
|
|
which can be unexpected, so it is recommended to always use it.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_HIDE_ROOT}
|
2008-05-20 03:48:30 -04:00
|
|
|
Use this style to suppress the display of the root node, effectively
|
|
|
|
causing the first-level nodes to appear as a series of root nodes.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_ROW_LINES}
|
2008-05-20 03:48:30 -04:00
|
|
|
Use this style to draw a contrasting border between displayed rows.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_HAS_VARIABLE_ROW_HEIGHT}
|
2008-05-20 03:48:30 -04:00
|
|
|
Use this style to cause row heights to be just big enough to fit the
|
|
|
|
content. If not set, all rows use the largest row height. The default is
|
|
|
|
that this flag is unset. Generic only.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_SINGLE}
|
2008-05-20 03:48:30 -04:00
|
|
|
For convenience to document that only one item may be selected at a
|
|
|
|
time. Selecting another item causes the current selection, if any, to be
|
|
|
|
deselected. This is the default.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_MULTIPLE}
|
2008-05-20 03:48:30 -04:00
|
|
|
Use this style to allow a range of items to be selected. If a second
|
|
|
|
range is selected, the current range, if any, is deselected.
|
2008-04-06 10:43:04 -04:00
|
|
|
@style{wxTR_DEFAULT_STYLE}
|
2008-05-20 03:48:30 -04:00
|
|
|
The set of flags that are closest to the defaults for the native control
|
|
|
|
for a particular toolkit.
|
2008-03-08 08:52:38 -05:00
|
|
|
@endStyleTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2009-02-18 12:58:51 -05:00
|
|
|
@beginEventEmissionTable{wxTreeEvent}
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_BEGIN_DRAG(id, func)}
|
|
|
|
Begin dragging with the left mouse button.
|
2008-11-23 14:30:25 -05:00
|
|
|
If you want to enable left-dragging you need to intercept this event
|
2011-03-22 10:17:38 -04:00
|
|
|
and explicitly call wxTreeEvent::Allow(), as it's vetoed by default.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_BEGIN_DRAG event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_BEGIN_RDRAG(id, func)}
|
|
|
|
Begin dragging with the right mouse button.
|
2008-11-23 14:30:25 -05:00
|
|
|
If you want to enable right-dragging you need to intercept this event
|
2011-03-22 10:17:38 -04:00
|
|
|
and explicitly call wxTreeEvent::Allow(), as it's vetoed by default.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_BEGIN_RDRAG event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_END_DRAG(id, func)}
|
|
|
|
End dragging with the left or right mouse button.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_END_DRAG event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_BEGIN_LABEL_EDIT(id, func)}
|
|
|
|
Begin editing a label. This can be prevented by calling Veto().
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_BEGIN_LABEL_EDIT event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_END_LABEL_EDIT(id, func)}
|
|
|
|
Finish editing a label. This can be prevented by calling Veto().
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_END_LABEL_EDIT event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_DELETE_ITEM(id, func)}
|
|
|
|
An item was deleted.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_DELETE_ITEM event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_GET_INFO(id, func)}
|
|
|
|
Request information from the application.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_GET_INFO event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_SET_INFO(id, func)}
|
|
|
|
Information is being supplied.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_SET_INFO event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_ACTIVATED(id, func)}
|
2008-11-22 06:56:05 -05:00
|
|
|
The item has been activated, i.e. chosen by double clicking it with
|
|
|
|
mouse or from keyboard.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_ACTIVATED event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_COLLAPSED(id, func)}
|
|
|
|
The item has been collapsed.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_COLLAPSED event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_COLLAPSING(id, func)}
|
|
|
|
The item is being collapsed. This can be prevented by calling Veto().
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_COLLAPSING event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_EXPANDED(id, func)}
|
|
|
|
The item has been expanded.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_EXPANDED event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_EXPANDING(id, func)}
|
|
|
|
The item is being expanded. This can be prevented by calling Veto().
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_EXPANDING event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_RIGHT_CLICK(id, func)}
|
|
|
|
The user has clicked the item with the right mouse button.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_RIGHT_CLICK event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_MIDDLE_CLICK(id, func)}
|
2010-08-22 18:16:05 -04:00
|
|
|
The user has clicked the item with the middle mouse button. This is
|
|
|
|
only supported by the generic control.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_MIDDLE_CLICK event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_SEL_CHANGED(id, func)}
|
|
|
|
Selection has changed.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_SEL_CHANGED event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_SEL_CHANGING(id, func)}
|
|
|
|
Selection is changing. This can be prevented by calling Veto().
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_SEL_CHANGING event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_KEY_DOWN(id, func)}
|
|
|
|
A key has been pressed.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_KEY_DOWN event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_GETTOOLTIP(id, func)}
|
2008-11-22 06:56:05 -05:00
|
|
|
The opportunity to set the item tooltip is being given to the application
|
|
|
|
(call wxTreeEvent::SetToolTip). Windows only.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_GETTOOLTIP event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_ITEM_MENU(id, func)}
|
2008-11-22 06:56:05 -05:00
|
|
|
The context menu for the selected item has been requested, either by a
|
2018-03-06 13:51:31 -05:00
|
|
|
right click or by using the menu key. Notice that these events always
|
|
|
|
carry a valid tree item and so are not generated when (right)
|
|
|
|
clicking outside of the items area. If you need to handle such
|
|
|
|
events, consider using @c wxEVT_CONTEXT_MENU instead.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_ITEM_MENU event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@event{EVT_TREE_STATE_IMAGE_CLICK(id, func)}
|
2013-04-19 06:47:16 -04:00
|
|
|
The state image has been clicked.
|
2013-04-25 06:11:03 -04:00
|
|
|
Processes a @c wxEVT_TREE_STATE_IMAGE_CLICK event type.
|
2008-09-01 15:45:06 -04:00
|
|
|
@endEventTable
|
|
|
|
|
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
See also @ref overview_windowstyles.
|
2008-06-16 13:50:40 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
@b Win32 @b notes:
|
|
|
|
|
|
|
|
wxTreeCtrl class uses the standard common treeview control under Win32
|
|
|
|
implemented in the system library comctl32.dll. Some versions of this
|
|
|
|
library are known to have bugs with handling the tree control colours: the
|
|
|
|
usual symptom is that the expanded items leave black (or otherwise
|
|
|
|
incorrectly coloured) background behind them, especially for the controls
|
|
|
|
using non-default background colour. The recommended solution is to upgrade
|
|
|
|
the comctl32.dll to a newer version: see
|
|
|
|
http://www.microsoft.com/downloads/details.aspx?familyid=cb2cf3a2-8025-4e8f-8511-9b476a8d35d2
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxcore}
|
|
|
|
@category{ctrl}
|
2012-11-03 14:32:50 -04:00
|
|
|
@appearance{treectrl}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-11-22 06:56:05 -05:00
|
|
|
@see wxDataViewTreeCtrl, wxTreeEvent, wxTreeItemData, @ref overview_treectrl,
|
|
|
|
wxListBox, wxListCtrl, wxImageList
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxTreeCtrl : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
2008-05-20 03:48:30 -04:00
|
|
|
/**
|
|
|
|
Default Constructor.
|
|
|
|
*/
|
|
|
|
wxTreeCtrl();
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Constructor, creating and showing a tree control.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-08 09:43:31 -05:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
Parent window. Must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-05-20 03:48:30 -04:00
|
|
|
Window identifier. The value @c wxID_ANY indicates a default value.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Window position.
|
2009-04-21 07:21:36 -04:00
|
|
|
If ::wxDefaultPosition is specified then a default position is chosen.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2019-01-30 11:28:08 -05:00
|
|
|
Window size.
|
2009-04-21 07:21:36 -04:00
|
|
|
If ::wxDefaultSize is specified then the window is sized appropriately.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
Window style. See wxTreeCtrl.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param validator
|
2008-03-09 08:33:59 -04:00
|
|
|
Window validator.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see Create(), wxValidator
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
wxTreeCtrl(wxWindow* parent, wxWindowID id = wxID_ANY,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2008-10-28 10:29:36 -04:00
|
|
|
long style = wxTR_DEFAULT_STYLE,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-10-28 10:29:36 -04:00
|
|
|
const wxString& name = wxTreeCtrlNameStr);
|
2008-06-16 13:50:40 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Destructor, destroying the tree control.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual ~wxTreeCtrl();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Adds the root node to the tree, returning the new item.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
The @a image and @a selImage parameters are an index within the normal
|
|
|
|
image list specifying the image to use for unselected and selected
|
2016-12-04 19:30:53 -05:00
|
|
|
items, respectively. If @a image > -1 and @a selImage is -1, the same
|
2008-05-20 03:48:30 -04:00
|
|
|
image is used for both selected and unselected items.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId AddRoot(const wxString& text, int image = -1,
|
|
|
|
int selImage = -1,
|
|
|
|
wxTreeItemData* data = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Appends an item to the end of the branch identified by @a parent, return
|
|
|
|
a new item id.
|
2008-06-16 13:50:40 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
The @a image and @a selImage parameters are an index within the normal
|
|
|
|
image list specifying the image to use for unselected and selected
|
2014-07-04 08:22:57 -04:00
|
|
|
items, respectively. If @a image > -1 and @a selImage is -1, the same
|
2008-05-20 03:48:30 -04:00
|
|
|
image is used for both selected and unselected items.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxTreeItemId AppendItem(const wxTreeItemId& parent,
|
|
|
|
const wxString& text,
|
|
|
|
int image = -1,
|
|
|
|
int selImage = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxTreeItemData* data = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the buttons image list. The button images assigned with this method
|
|
|
|
will be automatically deleted by wxTreeCtrl as appropriate (i.e. it
|
|
|
|
takes ownership of the list).
|
|
|
|
|
|
|
|
Setting or assigning the button image list enables the display of image
|
|
|
|
buttons. Once enabled, the only way to disable the display of button
|
|
|
|
images is to set the button image list to @NULL.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function is only available in the generic version.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
@see SetButtonsImageList().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void AssignButtonsImageList(wxImageList* imageList);
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the normal image list. The image list assigned with this method
|
|
|
|
will be automatically deleted by wxTreeCtrl as appropriate (i.e. it
|
|
|
|
takes ownership of the list).
|
|
|
|
|
|
|
|
@see SetImageList().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void AssignImageList(wxImageList* imageList);
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the state image list. Image list assigned with this method will be
|
|
|
|
automatically deleted by wxTreeCtrl as appropriate (i.e. it takes
|
|
|
|
ownership of the list).
|
|
|
|
|
|
|
|
@see SetStateImageList().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void AssignStateImageList(wxImageList* imageList);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Collapses the given item.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Collapse(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Collapses the root item.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see ExpandAll()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void CollapseAll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Collapses this item and all of its children, recursively.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see ExpandAllChildren()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void CollapseAllChildren(const wxTreeItemId& item);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Collapses the given item and removes all children.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void CollapseAndReset(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-28 10:29:36 -04:00
|
|
|
Creates the tree control.
|
|
|
|
See wxTreeCtrl::wxTreeCtrl() for further details.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
2008-05-20 03:48:30 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2008-10-28 10:29:36 -04:00
|
|
|
long style = wxTR_DEFAULT_STYLE,
|
2008-05-20 03:48:30 -04:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-10-28 10:29:36 -04:00
|
|
|
const wxString& name = wxTreeCtrlNameStr);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-11-22 06:56:05 -05:00
|
|
|
Deletes the specified item. A @c EVT_TREE_DELETE_ITEM event will be
|
2008-03-08 08:52:38 -05:00
|
|
|
generated.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
This function may cause a subsequent call to GetNextChild() to fail.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Delete(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2018-08-14 11:50:28 -04:00
|
|
|
Deletes all items in the control.
|
|
|
|
|
|
|
|
This function generates @c wxEVT_TREE_DELETE_ITEM events for each item
|
|
|
|
being deleted, including the root one if it is shown, i.e. unless
|
|
|
|
wxTR_HIDE_ROOT style is used.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void DeleteAllItems();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2018-08-14 11:24:08 -04:00
|
|
|
Deletes all children of the given item (but not the item itself).
|
|
|
|
|
|
|
|
A @c wxEVT_TREE_DELETE_ITEM event will be generated for every item
|
|
|
|
being deleted.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
If you have called SetItemHasChildren(), you may need to call it again
|
|
|
|
since DeleteChildren() does not automatically clear the setting.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void DeleteChildren(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Starts editing the label of the given @a item. This function generates a
|
2008-11-22 06:56:05 -05:00
|
|
|
@c EVT_TREE_BEGIN_LABEL_EDIT event which can be vetoed so that no text
|
2008-05-20 03:48:30 -04:00
|
|
|
control will appear for in-place editing.
|
|
|
|
|
|
|
|
If the user changed the label (i.e. s/he does not press ESC or leave the
|
2008-11-22 06:56:05 -05:00
|
|
|
text control without changes, a @c EVT_TREE_END_LABEL_EDIT event will be
|
2008-05-20 03:48:30 -04:00
|
|
|
sent which can be vetoed as well.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see EndEditLabel(), wxTreeEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
virtual wxTextCtrl *EditLabel(const wxTreeItemId& item,
|
2010-06-09 09:55:48 -04:00
|
|
|
wxClassInfo* textCtrlClass = wxCLASSINFO(wxTextCtrl));
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2012-10-07 18:42:02 -04:00
|
|
|
/**
|
|
|
|
Enable or disable a beep if there is no match for the currently
|
|
|
|
entered text when searching for the item from keyboard.
|
|
|
|
|
|
|
|
The default is to not beep in this case except in wxMSW where the
|
|
|
|
beep is always generated by the native control and cannot be disabled,
|
|
|
|
i.e. calls to this function do nothing there.
|
|
|
|
|
|
|
|
@since 2.9.5
|
|
|
|
*/
|
|
|
|
void EnableBellOnNoMatch(bool on = true);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Ends label editing. If @a cancelEdit is @true, the edit will be
|
|
|
|
cancelled.
|
|
|
|
|
|
|
|
@note
|
|
|
|
This function is currently supported under Windows only.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see EditLabel()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
virtual void EndEditLabel(const wxTreeItemId& item, bool discardChanges = false);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Scrolls and/or expands items to ensure that the given item is visible.
|
2019-08-23 11:23:22 -04:00
|
|
|
|
|
|
|
This method can be used, and will work, even while the window is frozen
|
|
|
|
(see wxWindow::Freeze()).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void EnsureVisible(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Expands the given item.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Expand(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Expands all items in the tree.
|
|
|
|
*/
|
|
|
|
void ExpandAll();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Expands the given item and all its children recursively.
|
|
|
|
*/
|
|
|
|
void ExpandAllChildren(const wxTreeItemId& item);
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Retrieves the rectangle bounding the @a item. If @a textOnly is @true,
|
|
|
|
only the rectangle around the item's label will be returned, otherwise
|
|
|
|
the item's image is also taken into account.
|
|
|
|
|
|
|
|
The return value is @true if the rectangle was successfully retrieved or
|
|
|
|
@c @false if it was not (in this case @a rect is not changed) -- for
|
|
|
|
example, if the item is currently invisible.
|
|
|
|
|
|
|
|
Notice that the rectangle coordinates are logical, not physical ones.
|
|
|
|
So, for example, the x coordinate may be negative if the tree has a
|
|
|
|
horizontal scrollbar and its position is not 0.
|
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method only takes the @a item and
|
|
|
|
@a textOnly parameters and returns a @c Wx::Rect (or @c undef).
|
|
|
|
@endWxPerlOnly
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual bool GetBoundingRect(const wxTreeItemId& item, wxRect& rect,
|
|
|
|
bool textOnly = false) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the buttons image list (from which application-defined button
|
|
|
|
images are taken).
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
This function is only available in the generic version.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxImageList* GetButtonsImageList() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Returns the number of items in the branch. If @a recursively is @true,
|
2008-05-20 03:48:30 -04:00
|
|
|
returns the total number of descendants, otherwise only one level of
|
|
|
|
children is counted.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
virtual size_t GetChildrenCount(const wxTreeItemId& item,
|
|
|
|
bool recursively = true) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the number of items in the control.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual unsigned int GetCount() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the edit control being currently used to edit a label. Returns
|
|
|
|
@NULL if no label is being edited.
|
|
|
|
|
|
|
|
@note This is currently only implemented for wxMSW.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTextCtrl* GetEditControl() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the first child; call GetNextChild() for the next child.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
For this enumeration function you must pass in a 'cookie' parameter
|
2008-05-20 03:48:30 -04:00
|
|
|
which is opaque for the application but is necessary for the library to
|
|
|
|
make these functions reentrant (i.e. allow more than one enumeration on
|
|
|
|
one and the same object simultaneously). The cookie passed to
|
|
|
|
GetFirstChild() and GetNextChild() should be the same variable.
|
|
|
|
|
|
|
|
Returns an invalid tree item (i.e. wxTreeItemId::IsOk() returns @false)
|
|
|
|
if there are no further children.
|
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method only takes the @a item parameter, and
|
|
|
|
returns a 2-element list (item, cookie).
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetNextChild(), GetNextSibling()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual wxTreeItemId GetFirstChild(const wxTreeItemId& item,
|
|
|
|
wxTreeItemIdValue& cookie) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the first visible item.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetFirstVisibleItem() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-06-19 19:34:51 -04:00
|
|
|
/**
|
|
|
|
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.
|
2019-01-30 11:28:08 -05:00
|
|
|
|
2009-06-19 19:34:51 -04:00
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
virtual wxTreeItemId GetFocusedItem() const;
|
|
|
|
|
2010-05-02 08:01:30 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Clears the currently focused item
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
virtual void ClearFocusedItem();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the currently focused item.
|
|
|
|
|
|
|
|
@param item
|
|
|
|
The item to make the current one. It must be valid.
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
virtual void SetFocusedItem(const wxTreeItemId& item);
|
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Returns the normal image list.
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxImageList* GetImageList() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the current tree control indentation.
|
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
virtual unsigned int GetIndent() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the background colour of the item.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxColour GetItemBackgroundColour(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the tree item data associated with the item.
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-03-20 14:10:49 -04:00
|
|
|
@see wxTreeItemData
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
wxPerl provides the following shortcut method:
|
|
|
|
- GetPlData(item): returns the Perl data
|
|
|
|
associated with the Wx::TreeItemData. It is just the same as
|
|
|
|
tree->GetItemData(item)->GetData().
|
|
|
|
@endWxPerlOnly
|
2008-03-20 14:10:49 -04:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemData* GetItemData(const wxTreeItemId& item) const;
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the font of the item label.
|
2013-08-06 12:59:49 -04:00
|
|
|
|
|
|
|
If the font hadn't been explicitly set for the specified @a item with
|
|
|
|
SetItemFont(), returns an invalid ::wxNullFont font. GetFont() can be
|
|
|
|
used to retrieve the global tree control font used for the items
|
|
|
|
without any specific font.
|
2008-05-20 03:48:30 -04:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxFont GetItemFont(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-03-09 08:33:59 -04:00
|
|
|
Gets the specified item image. The value of @a which may be:
|
2008-05-20 03:48:30 -04:00
|
|
|
- ::wxTreeItemIcon_Normal: to get the normal item image.
|
|
|
|
- ::wxTreeItemIcon_Selected: to get the selected item image (i.e. the
|
|
|
|
image which is shown when the item is currently selected).
|
|
|
|
- ::wxTreeItemIcon_Expanded: to get the expanded image (this only makes
|
|
|
|
sense for items which have children - then this image is shown when
|
|
|
|
the item is expanded and the normal image is shown when it is
|
|
|
|
collapsed).
|
|
|
|
- ::wxTreeItemIcon_SelectedExpanded: to get the selected expanded image
|
|
|
|
(which is shown when an expanded item is currently selected).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual int GetItemImage(const wxTreeItemId& item,
|
|
|
|
wxTreeItemIcon which = wxTreeItemIcon_Normal) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the item's parent.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetItemParent(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-06-16 13:50:40 -04:00
|
|
|
/**
|
|
|
|
Gets the specified item state.
|
|
|
|
*/
|
|
|
|
int GetItemState(const wxTreeItemId& item) const;
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Returns the item label.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxString GetItemText(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the colour of the item label.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxColour GetItemTextColour(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the last child of the item (or an invalid tree item if this item
|
|
|
|
has no children).
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
@see GetFirstChild(), GetNextSibling(), GetLastChild()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetLastChild(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the next child; call GetFirstChild() for the first child. For
|
|
|
|
this enumeration function you must pass in a 'cookie' parameter which is
|
|
|
|
opaque for the application but is necessary for the library to make
|
|
|
|
these functions reentrant (i.e. allow more than one enumeration on one
|
|
|
|
and the same object simultaneously). The cookie passed to
|
|
|
|
GetFirstChild() and GetNextChild() should be the same.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Returns an invalid tree item if there are no further children.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method returns a 2-element list
|
|
|
|
(item, cookie) instead of modifying its parameters.
|
|
|
|
@endWxPerlOnly
|
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetFirstChild()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual wxTreeItemId GetNextChild(const wxTreeItemId& item,
|
|
|
|
wxTreeItemIdValue& cookie) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the next sibling of the specified item; call GetPrevSibling()
|
|
|
|
for the previous sibling.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Returns an invalid tree item if there are no further siblings.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetPrevSibling()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetNextSibling(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the next visible item or an invalid item if this item is the
|
|
|
|
last visible one.
|
|
|
|
|
|
|
|
@note The @a item itself must be visible.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetNextVisible(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the previous sibling of the specified item; call
|
|
|
|
GetNextSibling() for the next sibling.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Returns an invalid tree item if there are no further children.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetNextSibling()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetPrevSibling(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the previous visible item or an invalid item if this item is the
|
|
|
|
first visible one.
|
|
|
|
|
|
|
|
@note The @a item itself must be visible.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetPrevVisible(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns @true if the control will use a quick calculation for the best
|
|
|
|
size, looking only at the first and last items. The default is @false.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetQuickBestSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool GetQuickBestSize() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the root item for the tree control.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetRootItem() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the selection, or an invalid item if there is no selection. This
|
|
|
|
function only works with the controls without @c wxTR_MULTIPLE style,
|
2019-01-30 11:28:08 -05:00
|
|
|
use GetSelections() for the controls which do have this style
|
2009-06-19 19:34:51 -04:00
|
|
|
or, if a single item is wanted, use GetFocusedItem().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual wxTreeItemId GetSelection() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Fills the array of tree items passed in with the currently selected
|
|
|
|
items. This function can be called only if the control has the @c
|
|
|
|
wxTR_MULTIPLE style.
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Returns the number of selected items.
|
2008-06-16 13:50:40 -04:00
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method takes no parameters and returns a list of
|
|
|
|
@c Wx::TreeItemId.
|
|
|
|
@endWxPerlOnly
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
virtual size_t GetSelections(wxArrayTreeItemIds& selection) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the state image list (from which application-defined state
|
|
|
|
images are taken).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxImageList* GetStateImageList() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Calculates which (if any) item is under the given @a point, returning
|
|
|
|
the tree item id at this point plus extra information @a flags. @a flags
|
|
|
|
is a bitlist of the following:
|
|
|
|
|
|
|
|
- @c wxTREE_HITTEST_ABOVE: Above the client area.
|
|
|
|
- @c wxTREE_HITTEST_BELOW: Below the client area.
|
|
|
|
- @c wxTREE_HITTEST_NOWHERE: In the client area but below the last item.
|
|
|
|
- @c wxTREE_HITTEST_ONITEMBUTTON: On the button associated with an item.
|
|
|
|
- @c wxTREE_HITTEST_ONITEMICON: On the bitmap associated with an item.
|
2008-11-22 06:56:05 -05:00
|
|
|
- @c wxTREE_HITTEST_ONITEMINDENT: In the indentation associated with an item.
|
|
|
|
- @c wxTREE_HITTEST_ONITEMLABEL: On the label (string) associated with an item.
|
2008-05-20 03:48:30 -04:00
|
|
|
- @c wxTREE_HITTEST_ONITEMRIGHT: In the area to the right of an item.
|
|
|
|
- @c wxTREE_HITTEST_ONITEMSTATEICON: On the state icon for a tree view
|
2008-11-22 06:56:05 -05:00
|
|
|
item that is in a user-defined state.
|
2008-05-20 03:48:30 -04:00
|
|
|
- @c wxTREE_HITTEST_TOLEFT: To the right of the client area.
|
|
|
|
- @c wxTREE_HITTEST_TORIGHT: To the left of the client area.
|
2008-06-16 13:50:40 -04:00
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
In wxPerl this method only takes the @a point parameter
|
|
|
|
and returns a 2-element list (item, flags).
|
|
|
|
@endWxPerlOnly
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxTreeItemId HitTest(const wxPoint& point, int& flags) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Inserts an item after a given one (@a previous).
|
|
|
|
|
|
|
|
The @a image and @a selImage parameters are an index within the normal
|
|
|
|
image list specifying the image to use for unselected and selected
|
2016-12-04 19:30:53 -05:00
|
|
|
items, respectively. If @a image > -1 and @a selImage is -1, the same
|
2008-05-20 03:48:30 -04:00
|
|
|
image is used for both selected and unselected items.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxTreeItemId InsertItem(const wxTreeItemId& parent,
|
|
|
|
const wxTreeItemId& previous,
|
|
|
|
const wxString& text,
|
|
|
|
int image = -1,
|
|
|
|
int selImage = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxTreeItemData* data = NULL);
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
Inserts an item before one identified
|
2012-09-13 13:12:19 -04:00
|
|
|
by its position (@a pos). @a pos must be less than or equal to
|
|
|
|
the number of children.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
The @a image and @a selImage parameters are an index within the normal
|
|
|
|
image list specifying the image to use for unselected and selected
|
2016-12-04 19:30:53 -05:00
|
|
|
items, respectively. If @a image > -1 and @a selImage is -1, the same
|
2008-05-20 03:48:30 -04:00
|
|
|
image is used for both selected and unselected items.
|
|
|
|
*/
|
2008-03-08 09:43:31 -05:00
|
|
|
wxTreeItemId InsertItem(const wxTreeItemId& parent,
|
2012-09-13 13:12:19 -04:00
|
|
|
size_t pos,
|
2008-03-08 09:43:31 -05:00
|
|
|
const wxString& text,
|
|
|
|
int image = -1,
|
|
|
|
int selImage = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxTreeItemData* data = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the given item is in bold state.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
@see SetItemBold()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsBold(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2012-11-30 19:14:07 -05:00
|
|
|
Returns @true if the control is empty (i.e.\ has no items, even no root
|
2008-05-20 03:48:30 -04:00
|
|
|
one).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsEmpty() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns @true if the item is expanded (only makes sense if it has
|
|
|
|
children).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsExpanded(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the item is selected.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsSelected(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the item is visible on the screen.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool IsVisible(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns @true if the item has children.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual bool ItemHasChildren(const wxTreeItemId& item) const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Override this function in the derived class to change the sort order of
|
|
|
|
the items in the tree control. The function should return a negative,
|
|
|
|
zero or positive value if the first item is less than, equal to or
|
|
|
|
greater than the second one.
|
|
|
|
|
2010-06-09 09:55:48 -04:00
|
|
|
Please note that you @b must use wxRTTI macros wxDECLARE_DYNAMIC_CLASS()
|
|
|
|
and wxIMPLEMENT_DYNAMIC_CLASS() if you override this function because
|
2008-05-20 03:48:30 -04:00
|
|
|
otherwise the base class considers that it is not overridden and uses
|
|
|
|
the default comparison, i.e. sorts the items alphabetically, which
|
2008-03-08 08:52:38 -05:00
|
|
|
allows it optimize away the calls to the virtual function completely.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
@see SortChildren()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual int OnCompareItems(const wxTreeItemId& item1,
|
|
|
|
const wxTreeItemId& item2);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Appends an item as the first child of @a parent, return a new item id.
|
|
|
|
|
|
|
|
The @a image and @a selImage parameters are an index within the normal
|
|
|
|
image list specifying the image to use for unselected and selected
|
2016-12-04 19:30:53 -05:00
|
|
|
items, respectively. If @a image > -1 and @a selImage is -1, the same
|
2008-05-20 03:48:30 -04:00
|
|
|
image is used for both selected and unselected items.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
wxTreeItemId PrependItem(const wxTreeItemId& parent,
|
|
|
|
const wxString& text,
|
|
|
|
int image = -1,
|
|
|
|
int selImage = -1,
|
2008-03-09 08:33:59 -04:00
|
|
|
wxTreeItemData* data = NULL);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Scrolls the specified item into view.
|
2019-08-23 11:23:22 -04:00
|
|
|
|
|
|
|
Note that this method doesn't work while the window is frozen (See
|
|
|
|
wxWindow::Freeze()), at least under MSW.
|
|
|
|
|
|
|
|
@see EnsureVisible()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void ScrollTo(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2011-04-23 07:17:43 -04:00
|
|
|
Selects the given item.
|
|
|
|
|
|
|
|
In multiple selection controls, can be also used to deselect a
|
|
|
|
currently selected item if the value of @a select is @false.
|
|
|
|
|
|
|
|
Notice that calling this method will generate
|
2013-04-25 06:11:03 -04:00
|
|
|
@c wxEVT_TREE_SEL_CHANGING and @c wxEVT_TREE_SEL_CHANGED
|
2011-04-23 07:17:43 -04:00
|
|
|
events and that the change could be vetoed by the former event handler.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SelectItem(const wxTreeItemId& item, bool select = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the buttons image list (from which application-defined button
|
|
|
|
images are taken).
|
|
|
|
|
|
|
|
The button images assigned with this method will @b not be deleted by
|
|
|
|
@ref wxTreeCtrl "wxTreeCtrl"'s destructor, you must delete it yourself.
|
|
|
|
Setting or assigning the button image list enables the display of image
|
|
|
|
buttons. Once enabled, the only way to disable the display of button
|
|
|
|
images is to set the button image list to @NULL.
|
|
|
|
|
|
|
|
@note This function is only available in the generic version.
|
|
|
|
|
|
|
|
@see AssignButtonsImageList().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetButtonsImageList(wxImageList* imageList);
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the normal image list. The image list assigned with this method
|
|
|
|
will @b not be deleted by @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you
|
|
|
|
must delete it yourself.
|
|
|
|
|
|
|
|
@see AssignImageList().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetImageList(wxImageList* imageList);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the indentation for the tree control.
|
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
virtual void SetIndent(unsigned int indent);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the colour of the item's background.
|
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual void SetItemBackgroundColour(const wxTreeItemId& item,
|
|
|
|
const wxColour& col);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Makes item appear in bold font if @a bold parameter is @true or resets
|
|
|
|
it to the normal state.
|
|
|
|
|
|
|
|
@see IsBold()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetItemBold(const wxTreeItemId& item, bool bold = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
/**
|
|
|
|
Sets the item client data.
|
|
|
|
|
2009-04-05 09:07:24 -04:00
|
|
|
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.
|
|
|
|
|
2009-10-18 13:47:01 -04:00
|
|
|
@beginWxPerlOnly
|
|
|
|
wxPerl provides the following shortcut method:
|
|
|
|
- SetPlData(item, data): sets the Perl data
|
|
|
|
associated with the @c Wx::TreeItemData. It is just the same as
|
|
|
|
tree->GetItemData(item)->SetData(data).
|
|
|
|
@endWxPerlOnly
|
2008-05-20 03:48:30 -04:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetItemData(const wxTreeItemId& item, wxTreeItemData* data);
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Gives the item the visual feedback for Drag'n'Drop actions, which is
|
|
|
|
useful if something is dragged from the outside onto the tree control
|
|
|
|
(as opposed to a DnD operation within the tree control, which already
|
|
|
|
is implemented internally).
|
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual void SetItemDropHighlight(const wxTreeItemId& item,
|
|
|
|
bool highlight = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the item's font. All items in the tree should have the same height
|
|
|
|
to avoid text clipping, so the fonts height should be the same for all
|
|
|
|
of them, although font attributes may vary.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see SetItemBold()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetItemFont(const wxTreeItemId& item, const wxFont& font);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Force appearance of the button next to the item. This is useful to
|
|
|
|
allow the user to expand the items which don't have any children now,
|
|
|
|
but instead adding them only when needed, thus minimizing memory
|
|
|
|
usage and loading time.
|
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual void SetItemHasChildren(const wxTreeItemId& item,
|
|
|
|
bool hasChildren = true);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the specified item's image. See GetItemImage() for the description
|
|
|
|
of the @a which parameter.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual void SetItemImage(const wxTreeItemId& item, int image,
|
|
|
|
wxTreeItemIcon which = wxTreeItemIcon_Normal);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-06-16 13:50:40 -04:00
|
|
|
/**
|
2018-06-21 21:19:03 -04:00
|
|
|
Sets the specified item state. The value of @a state may be an index
|
|
|
|
into the state image list, or one of the special values:
|
2008-06-22 10:39:04 -04:00
|
|
|
- @c wxTREE_ITEMSTATE_NONE: to disable the item state (the state image will
|
|
|
|
be not displayed).
|
|
|
|
- @c wxTREE_ITEMSTATE_NEXT: to set the next item state.
|
|
|
|
- @c wxTREE_ITEMSTATE_PREV: to set the previous item state.
|
2008-06-16 13:50:40 -04:00
|
|
|
*/
|
|
|
|
void SetItemState(const wxTreeItemId& item, int state);
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
Sets the item label.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetItemText(const wxTreeItemId& item, const wxString& text);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the colour of the item's text.
|
|
|
|
*/
|
2008-10-27 17:26:54 -04:00
|
|
|
virtual void SetItemTextColour(const wxTreeItemId& item,
|
|
|
|
const wxColour& col);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
If @true is passed, specifies that the control will use a quick
|
|
|
|
calculation for the best size, looking only at the first and last items.
|
|
|
|
Otherwise, it will look at all items. The default is @false.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see GetQuickBestSize()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetQuickBestSize(bool quickBestSize);
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the state image list (from which application-defined state images
|
|
|
|
are taken). Image list assigned with this method will @b not be deleted
|
|
|
|
by @ref wxTreeCtrl "wxTreeCtrl"'s destructor, you must delete it
|
|
|
|
yourself.
|
|
|
|
|
|
|
|
@see AssignStateImageList().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SetStateImageList(wxImageList* imageList);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sets the mode flags associated with the display of the tree control. The
|
|
|
|
new mode takes effect immediately.
|
|
|
|
|
|
|
|
@note Generic only; MSW ignores changes.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetWindowStyle(long styles);
|
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Sorts the children of the given item using OnCompareItems().
|
|
|
|
You should override that method to change the sort order (the default is
|
|
|
|
ascending case-sensitive alphabetical order).
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-03-09 08:33:59 -04:00
|
|
|
@see wxTreeItemData, OnCompareItems()
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void SortChildren(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Toggles the given item between collapsed and expanded states.
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Toggle(const wxTreeItemId& item);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Toggles the given item between selected and unselected states. For
|
|
|
|
multiselection controls only.
|
|
|
|
*/
|
|
|
|
void ToggleItemSelection(const wxTreeItemId& item);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Removes the selection from the currently selected item (if any).
|
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void Unselect();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
This function either behaves the same as Unselect() if the control
|
|
|
|
doesn't have @c wxTR_MULTIPLE style, or removes the selection from all
|
|
|
|
items if it does have this style.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-27 07:21:10 -04:00
|
|
|
virtual void UnselectAll();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Unselects the given item. This works in multiselection controls only.
|
|
|
|
*/
|
|
|
|
void UnselectItem(const wxTreeItemId& item);
|
2010-01-26 07:43:39 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Select all the immediate children of the given parent.
|
|
|
|
|
|
|
|
This function can be used with multiselection controls only.
|
|
|
|
|
|
|
|
@since 2.9.1
|
|
|
|
*/
|
|
|
|
virtual void SelectChildren(const wxTreeItemId& parent);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxTreeEvent
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-05-20 03:48:30 -04:00
|
|
|
A tree event holds information about events associated with wxTreeCtrl
|
|
|
|
objects.
|
|
|
|
|
|
|
|
To process input from a tree control, use these event handler macros to
|
|
|
|
direct input to member functions that take a wxTreeEvent argument.
|
|
|
|
|
|
|
|
@beginEventTable{wxTreeEvent}
|
|
|
|
@event{EVT_TREE_BEGIN_DRAG(id, func)}
|
2009-04-07 07:04:52 -04:00
|
|
|
Begin dragging with the left mouse button. If you want to enable
|
2011-03-22 10:17:38 -04:00
|
|
|
left-dragging you need to intercept this event and explicitly call
|
2009-04-07 07:04:52 -04:00
|
|
|
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.
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TREE_BEGIN_RDRAG(id, func)}
|
2009-04-07 07:04:52 -04:00
|
|
|
Begin dragging with the right mouse button. If you want to enable
|
2011-03-22 10:17:38 -04:00
|
|
|
right-dragging you need to intercept this event and explicitly call
|
2009-04-07 07:04:52 -04:00
|
|
|
wxTreeEvent::Allow(), as it's vetoed by default.
|
2008-05-20 03:48:30 -04:00
|
|
|
@event{EVT_TREE_END_DRAG(id, func)}
|
|
|
|
End dragging with the left or right mouse button.
|
|
|
|
@event{EVT_TREE_BEGIN_LABEL_EDIT(id, func)}
|
|
|
|
Begin editing a label. This can be prevented by calling Veto().
|
|
|
|
@event{EVT_TREE_END_LABEL_EDIT(id, func)}
|
|
|
|
Finish editing a label. This can be prevented by calling Veto().
|
|
|
|
@event{EVT_TREE_DELETE_ITEM(id, func)}
|
|
|
|
Delete an item.
|
|
|
|
@event{EVT_TREE_GET_INFO(id, func)}
|
|
|
|
Request information from the application.
|
|
|
|
@event{EVT_TREE_SET_INFO(id, func)}
|
|
|
|
Information is being supplied.
|
|
|
|
@event{EVT_TREE_ITEM_ACTIVATED(id, func)}
|
|
|
|
The item has been activated, i.e. chosen by double clicking it with
|
|
|
|
mouse or from keyboard.
|
|
|
|
@event{EVT_TREE_ITEM_COLLAPSED(id, func)}
|
|
|
|
The item has been collapsed.
|
|
|
|
@event{EVT_TREE_ITEM_COLLAPSING(id, func)}
|
|
|
|
The item is being collapsed. This can be prevented by calling Veto().
|
|
|
|
@event{EVT_TREE_ITEM_EXPANDED(id, func)}
|
|
|
|
The item has been expanded.
|
|
|
|
@event{EVT_TREE_ITEM_EXPANDING(id, func)}
|
|
|
|
The item is being expanded. This can be prevented by calling Veto().
|
|
|
|
@event{EVT_TREE_ITEM_RIGHT_CLICK(id, func)}
|
|
|
|
The user has clicked the item with the right mouse button.
|
|
|
|
@event{EVT_TREE_ITEM_MIDDLE_CLICK(id, func)}
|
|
|
|
The user has clicked the item with the middle mouse button.
|
|
|
|
@event{EVT_TREE_SEL_CHANGED(id, func)}
|
|
|
|
Selection has changed.
|
|
|
|
@event{EVT_TREE_SEL_CHANGING(id, func)}
|
|
|
|
Selection is changing. This can be prevented by calling Veto().
|
|
|
|
@event{EVT_TREE_KEY_DOWN(id, func)}
|
|
|
|
A key has been pressed.
|
|
|
|
@event{EVT_TREE_ITEM_GETTOOLTIP(id, func)}
|
|
|
|
The opportunity to set the item tooltip is being given to the
|
|
|
|
application (call SetToolTip()). Windows only.
|
|
|
|
@event{EVT_TREE_ITEM_MENU(id, func)}
|
|
|
|
The context menu for the selected item has been requested, either by a
|
|
|
|
right click or by using the menu key.
|
|
|
|
@event{EVT_TREE_STATE_IMAGE_CLICK(id, func)}
|
2008-06-22 10:39:04 -04:00
|
|
|
The state image has been clicked.
|
2008-05-20 03:48:30 -04:00
|
|
|
@endEventTable
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2012-10-14 21:17:21 -04:00
|
|
|
@library{wxcore}
|
2008-03-08 08:52:38 -05:00
|
|
|
@category{events}
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
@see wxTreeCtrl
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxTreeEvent : public wxNotifyEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
Constructor, used by wxWidgets itself only.
|
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
wxTreeEvent(wxEventType commandType, wxTreeCtrl* tree,
|
|
|
|
const wxTreeItemId& item = wxTreeItemId());
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the item (valid for all events).
|
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxTreeItemId GetItem() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns the key code if the event is a key event. Use GetKeyEvent() to
|
|
|
|
get the values of the modifier keys for this event (i.e. Shift or Ctrl).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
int GetKeyCode() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-11-22 06:56:05 -05:00
|
|
|
Returns the key event for @c EVT_TREE_KEY_DOWN events.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
const wxKeyEvent& GetKeyEvent() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the label if the event is a begin or end edit label event.
|
|
|
|
*/
|
2008-10-28 10:29:36 -04:00
|
|
|
const wxString& GetLabel() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2015-02-10 18:14:39 -05:00
|
|
|
Returns the old item index (valid for @c EVT_TREE_SEL_CHANGING and
|
|
|
|
@c EVT_TREE_SEL_CHANGED events).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxTreeItemId GetOldItem() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Returns the position of the mouse pointer if the event is a drag or
|
|
|
|
menu-context event.
|
2008-05-20 03:48:30 -04:00
|
|
|
|
|
|
|
In both cases the position is in client coordinates - i.e. relative to
|
|
|
|
the wxTreeCtrl window (so that you can pass it directly to e.g.
|
|
|
|
wxWindow::PopupMenu()).
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
wxPoint GetPoint() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-05-20 03:48:30 -04:00
|
|
|
Returns @true if the label edit was cancelled. This should be called
|
2008-11-22 06:56:05 -05:00
|
|
|
from within an @c EVT_TREE_END_LABEL_EDIT handler.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-03-09 12:24:26 -04:00
|
|
|
bool IsEditCancelled() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-11-22 06:56:05 -05:00
|
|
|
Set the tooltip for the item (valid for @c EVT_TREE_ITEM_GETTOOLTIP
|
2008-05-20 03:48:30 -04:00
|
|
|
events). Windows only.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
void SetToolTip(const wxString& tooltip);
|
|
|
|
};
|
2012-03-29 13:14:52 -04:00
|
|
|
|
|
|
|
|
2013-04-25 06:11:03 -04:00
|
|
|
wxEventType wxEVT_TREE_BEGIN_DRAG;
|
|
|
|
wxEventType wxEVT_TREE_BEGIN_RDRAG;
|
|
|
|
wxEventType wxEVT_TREE_BEGIN_LABEL_EDIT;
|
|
|
|
wxEventType wxEVT_TREE_END_LABEL_EDIT;
|
|
|
|
wxEventType wxEVT_TREE_DELETE_ITEM;
|
|
|
|
wxEventType wxEVT_TREE_GET_INFO;
|
|
|
|
wxEventType wxEVT_TREE_SET_INFO;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_EXPANDED;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_EXPANDING;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_COLLAPSED;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_COLLAPSING;
|
|
|
|
wxEventType wxEVT_TREE_SEL_CHANGED;
|
|
|
|
wxEventType wxEVT_TREE_SEL_CHANGING;
|
|
|
|
wxEventType wxEVT_TREE_KEY_DOWN;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_ACTIVATED;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_RIGHT_CLICK;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_MIDDLE_CLICK;
|
|
|
|
wxEventType wxEVT_TREE_END_DRAG;
|
|
|
|
wxEventType wxEVT_TREE_STATE_IMAGE_CLICK;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_GETTOOLTIP;
|
|
|
|
wxEventType wxEVT_TREE_ITEM_MENU;
|
2012-03-29 13:14:52 -04:00
|
|
|
|