A tree control presents information as a hierarchy, with items that may be 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.
+which may be tested for validity by calling \helpref{wxTreeItemId::IsOk}{wxtreeitemidisok}.
To intercept events from a tree control, use the event table macros described in \helpref{wxTreeEvent}{wxtreeevent}.
<wx/treectrl.h>
+\wxheading{Library}
+
+\helpref{wxCore}{librarieslist}
+
\wxheading{Window styles}
\twocolwidtha{5cm}
\twocolitem{\windowstyle{wxTR\_MULTIPLE}}{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.}
-\twocolitem{\windowstyle{wxTR\_EXTENDED}}{Use this style
-to allow disjoint items to be selected. (Only partially implemented; may not work in all cases.)}
\twocolitem{\windowstyle{wxTR\_DEFAULT\_STYLE}}{The set of flags that are
closest to the defaults for the native control for a particular toolkit.}
\end{twocollist}
\func{}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
-\param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}}
+\param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``treeCtrl"}}
Constructor, creating and showing a tree control.
\func{void}{\destruct{wxTreeCtrl}}{\void}
-Destructor, destroying the list control.
+Destructor, destroying the tree control.
\membersection{wxTreeCtrl::AddRoot}\label{wxtreectrladdroot}
Collapses the given item.
+\membersection{wxTreeCtrl::CollapseAll}\label{wxtreectrlcollapseall}
+
+\func{void}{CollapseAll}{\void}
+
+Collapses the root item.
+
+\wxheading{See also}
+
+\helpref{ExpandAll}{wxtreectrlexpandall}
+
+
+\membersection{wxTreeCtrl::CollapseAllChildren}\label{wxtreectrlcollapseallchildren}
+
+\func{void}{CollapseAllChildren}{\param{const wxTreeItemId\&}{ item}}
+
+Collapses this item and all of its children, recursively.
+
+\wxheading{See also}
+
+\helpref{ExpandAllChildren}{wxtreectrlexpandallchildren}
+
+
\membersection{wxTreeCtrl::CollapseAndReset}\label{wxtreectrlcollapseandreset}
\func{void}{CollapseAndReset}{\param{const wxTreeItemId\&}{ item}}
\func{bool}{wxTreeCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
-\param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}}
+\param{long}{ style = wxTR\_HAS\_BUTTONS}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``treeCtrl"}}
Creates the tree control. See \helpref{wxTreeCtrl::wxTreeCtrl}{wxtreectrlconstr} for further details.
Expands the given item.
+\membersection{wxTreeCtrl::ExpandAll}\label{wxtreectrlexpandall}
+
+\func{void}{ExpandAll}{\void}
+
+Expands all items in the tree.
+
+
+\membersection{wxTreeCtrl::ExpandAllChildren}\label{wxtreectrlexpandallchildren}
+
+\func{void}{ExpandAllChildren}{\param{const wxTreeItemId\&}{ item}}
+
+Expands the given item and all its children recursively.
+
+
\membersection{wxTreeCtrl::GetBoundingRect}\label{wxtreectrlgetitemrect}
\constfunc{bool}{GetBoundingRect}{\param{const wxTreeItemId\&}{ item}, \param{wxRect\& }{rect}, \param{bool }{textOnly = {\tt false}}}
item's image is also taken into account.
The return value is {\tt true} if the rectangle was successfully retrieved or {\tt false}
-if it was not (in this case {\it rect} is not changed) - for example, if the
+if it was not (in this case {\it 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$.
+
\pythonnote{The wxPython version of this method requires only the
{\tt item} and {\tt textOnly} parameters. The return value is either a
{\tt wxRect} object or {\tt None}.}
\membersection{wxTreeCtrl::GetChildrenCount}\label{wxtreectrlgetchildrencount}
-\constfunc{size\_t}{GetChildrenCount}{\param{const wxTreeItemId\&}{ item}, \param{bool}{ recursively = {\tt true}}}
+\constfunc{unsigned int}{GetChildrenCount}{\param{const wxTreeItemId\&}{ item}, \param{bool}{ recursively = {\tt true}}}
Returns the number of items in the branch. If {\it recursively} is {\tt true}, returns the total number
of descendants, otherwise only one level of children is counted.
\membersection{wxTreeCtrl::GetCount}\label{wxtreectrlgetcount}
-\constfunc{size\_t}{GetCount}{\void}
+\constfunc{unsigned int}{GetCount}{\void}
Returns the number of items in the control.
Returns the item's parent.
-\membersection{wxTreeCtrl::GetParent}\label{wxtreectrlgetparent}
-
-\constfunc{wxTreeItemId}{GetParent}{\param{const wxTreeItemId\&}{ item}}
-
-{\bf NOTE:} This function is deprecated and will only work if {\tt WXWIN\_COMPATIBILITY\_2\_2}
-is defined. Use \helpref{wxTreeCtrl::GetItemParent}{wxtreectrlgetitemparent} instead.
-
-Returns the item's parent.
-
-\pythonnote{This method is named {\tt GetItemParent} to avoid a name
-clash with wxWindow::GetParent.}
-
-
\membersection{wxTreeCtrl::GetPrevSibling}\label{wxtreectrlgetprevsibling}
\constfunc{wxTreeItemId}{GetPrevSibling}{\param{const wxTreeItemId\&}{ item}}
Returns the previous visible item.
+\membersection{wxTreeCtrl::GetQuickBestSize}\label{wxtreectrlgetquickbestsize}
+
+\constfunc{bool}{GetQuickBestSize}{\void}
+
+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.
+
+\wxheading{See also}
+
+\helpref{wxTreeCtrl::SetQuickBestSize}{wxtreectrlsetquickbestsize}
+
+
\membersection{wxTreeCtrl::GetRootItem}\label{wxtreectrlgetrootitem}
\constfunc{wxTreeItemId}{GetRootItem}{\void}
\membersection{wxTreeCtrl::GetSelections}\label{wxtreectrlgetselections}
-\constfunc{size\_t}{GetSelections}{\param{wxArrayTreeItemIds\& }{selection}}
+\constfunc{unsigned int}{GetSelections}{\param{wxArrayTreeItemIds\& }{selection}}
Fills the array of tree items passed in with the currently selected items. This
function can be called only if the control has the wxTR\_MULTIPLE style.
\membersection{wxTreeCtrl::HitTest}\label{wxtreectrlhittest}
-\func{wxTreeItemId}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}}
+\constfunc{wxTreeItemId}{HitTest}{\param{const wxPoint\& }{point}, \param{int\& }{flags}}
Calculates which (if any) item is under the given point, returning the tree item
id at this point plus extra information {\it flags}. {\it flags} is a bitlist of the following:
See also: \helpref{SetItemBold}{wxtreectrlsetitembold}
+\membersection{wxTreeCtrl::IsEmpty}\label{wxtreectrlisempty}
+
+\constfunc{bool}{IsEmpty}{}
+
+Returns \true if the control is empty (i.e. has no items, even no root one).
+
+
\membersection{wxTreeCtrl::IsExpanded}\label{wxtreectrlisexpanded}
\constfunc{bool}{IsExpanded}{\param{const wxTreeItemId\&}{ item}}
positive value if the first item is less than, equal to or greater than the
second one.
-The base class version compares items alphabetically.
+Please note that you \textbf{must} use wxRTTI macros
+\helpref{DECLARE\_DYNAMIC\_CLASS}{declaredynamicclass} and
+\helpref{IMPLEMENT\_DYNAMIC\_CLASS}{implementdynamicclass} if you override this
+function because otherwise the base class considers that it is not overridden
+and uses the default comparison, i.e. sorts the items alphabetically, which
+allows it optimize away the calls to the virtual function completely.
See also: \helpref{SortChildren}{wxtreectrlsortchildren}
\membersection{wxTreeCtrl::SelectItem}\label{wxtreectrlselectitem}
-\func{bool}{SelectItem}{\param{const wxTreeItemId\&}{ item}, \param{bool }{select = \true}}
+\func{void}{SelectItem}{\param{const wxTreeItemId\&}{ item}, \param{bool }{select = \true}}
Selects the given item. In multiple selection controls, can be also used to
deselect a currently selected item if the value of \arg{select} is false.
Sets the colour of the item's text.
+\membersection{wxTreeCtrl::SetQuickBestSize}\label{wxtreectrlsetquickbestsize}
+
+\func{void}{SetQuickBestSize}{\param{bool}{ quickBestSize}}
+
+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.
+
+\wxheading{See also}
+
+\helpref{wxTreeCtrl::GetQuickBestSize}{wxtreectrlgetquickbestsize}
+
+
\membersection{wxTreeCtrl::SetStateImageList}\label{wxtreectrlsetstateimagelist}
\func{void}{SetStateImageList}{\param{wxImageList*}{ imageList}}
\func{void}{UnselectItem}{\param{const wxTreeItemId\& }{item}}
Unselects the given item. This works in multiselection controls only.
+
+
+
+
+
+%% the wxTreeItemId opaque class
+
+
+\section{\class{wxTreeItemId}}\label{wxtreeitemid}
+
+An opaque reference to a tree item.
+
+
+\wxheading{Derived from}
+
+None
+
+\wxheading{Include files}
+
+<wx/treebase.h>
+
+\wxheading{Library}
+
+\helpref{wxCore}{librarieslist}
+
+\wxheading{See also}
+
+\helpref{wxTreeCtrl}{wxtreectrl}, \helpref{wxTreeItemData}{wxtreeitemdata},\\
+\helpref{wxTreeCtrl overview}{wxtreectrloverview}
+
+
+\latexignore{\rtfignore{\wxheading{Members}}}
+
+\membersection{wxTreeItemId::wxTreeItemId}\label{wxtreeitemidconstr}
+
+\func{}{wxTreeItemId}{\void}
+
+Default constructor. wxTreemItemIds are not meant to be constructed explicitly by
+the user; they are returned by the \helpref{wxTreeCtrl}{wxtreectrl} functions instead.
+
+
+\membersection{wxTreeItemId::IsOk}\label{wxtreeitemidisok}
+
+\constfunc{bool}{IsOk}{}
+
+Returns \true if this instance is referencing a valid tree item.
+
+
+\membersection{Operators}\label{wxtreeitemidoperators}
+
+\constfunc{void}{operator $!$}{}
+
+Synonim for \helpref{IsOk}{wxtreeitemidisok}
+
+
+\constfunc{bool}{operator $==$}{\param{const wxTreeItemId\& }{item}}
+
+\constfunc{bool}{operator $!=$}{\param{const wxTreeItemId\& }{item}}
+
+Operators for comparison between \helpref{wxTreeItemId}{wxtreeitemid} objects.
+