ToolMap
Loading...
Searching...
No Matches
wxTreeMultiCtrl Class Reference

This is the visual control, which will contain all the logic for the tree mechanism. More...

#include <wxTreeMultiCtrl.h>

Inheritance diagram for wxTreeMultiCtrl:
tmAAttribTree tmSelectionInfoCtrl

Public Member Functions

 wxTreeMultiCtrl ()
 
 wxTreeMultiCtrl (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTMC_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxTreeMultiCtrlNameStr)
 
virtual ~wxTreeMultiCtrl ()
 
bool Create (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTMC_DEFAULT_STYLE, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxTreeMultiCtrlNameStr)
 
wxTreeMultiItem HitTest (wxPoint const &pt, int &flags)
 
int GetChildrenCount (const wxTreeMultiItem &item)
 
wxTreeMultiItem GetFocus ()
 
void OnDraw (wxDC &dc)
 
Add and delete methods

To add and delete node items like a Root item, Window item or Node item. This allows the user to manipulate the tree, and build it up.

wxTreeMultiItem AddRoot (const wxString &caption, const wxString &name=wxEmptyString)
 
wxTreeMultiItem AppendWindow (const wxTreeMultiItem &ParentItem, wxWindow *window=nullptr, const wxString &name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfoDefault, int flags=0)
 
wxTreeMultiItem InsertWindow (wxTreeMultiItem const &ParentItem, size_t Position, wxWindow *window=nullptr, wxString const &Name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfoDefault, int flags=0)
 
wxTreeMultiItem PrependWindow (wxTreeMultiItem const &ParentItem, wxWindow *window=nullptr, const wxString &name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfoDefault, int flags=0)
 
wxTreeMultiItem AppendNode (wxTreeMultiItem const &ParentItem, const wxString &caption=wxEmptyString, const wxString &name=wxEmptyString)
 
wxTreeMultiItem InsertNode (wxTreeMultiItem const &ParentItem, size_t Position, wxString const &caption, wxString const &name)
 
wxTreeMultiItem PrependNode (wxTreeMultiItem const &ParentItem, wxString const &caption=wxEmptyString, wxString const &name=wxEmptyString)
 
bool Delete (wxTreeMultiItem &item)
 
void DeleteAllItems (void)
 
void DeleteChildren (const wxTreeMultiItem &item)
 
Expand and collapse methods

These methods are all for items of type Node.

void ExpandNodes (bool recursive=false)
 
void CollapseNodes (bool recursive=false)
 
void Expand (const wxTreeMultiItem &item, bool recursive)
 
void Collapse (const wxTreeMultiItem &item, bool recursive)
 
void CollapseAndReset (const wxTreeMultiItem &item)
 
void Fold (const wxTreeMultiItem &item, bool expand=true)
 
Selection manipulation

These methods allow you to select, unselect or test wxTreeMultiItems on selection. Currently only items of type Node can be manipulated.

size_t GetSelectedItemCount (void) const
 
wxTreeMultiItem GetFirstSelectedItem (void) const
 
wxTreeMultiItem GetLastSelectedItem (void) const
 
wxTreeMultiItem GetSelectedItem (size_t Index) const
 
size_t GetSelectedItemIndex (wxTreeMultiItem const &Item) const
 
void SelectItem (wxTreeMultiItem const &Item, bool UnselectOthers=true, bool ExpandSelection=false)
 
void UnselectAll (void)
 
void Unselect (wxTreeMultiItem const &Item)
 
Visibility manipulation

These methods allow you to manipulate a certain wxTreeMultiItem to temporarily exclude or to include the node from drawing. Whenever it is excluded, all operations can still be performed, however the node may not be visible.

void Exclude (const wxTreeMultiItem &item)
 
void Include (const wxTreeMultiItem &item)
 
wxTreeMultiItem GetExcludedParent (const wxTreeMultiItem &item)
 
Find methods

These methods are used for finding a node in the wxTreeMultiCtrl.

wxTreeMultiItem FindItem (const wxTreeMultiItem &item, const wxString &name, bool ignoreCase=false, bool skipFirst=false)
 
wxTreeMultiItem FindItem (const wxString &name, bool ignoreCase=false)
 
Smart window Get/Set methods

These methods are used for quickly getting or setting primitive values, like boolean, string, or selections into primitive wxWindow controls like a wxRadioButton, wxCheckBox, wxTextCtrl, etc. The methods allow you to quickly set e.g. a boolean value by using the wxWindow ID of the control. A type check is performed before the value is actually set with the appropiate method for it. If it fails, an assertion will follow in debug mode. If you want to get values back similar get methods are present to return values. This allows the user to quickly retrieve or set values by ID, without the fuss of remembering the pointer or node ID of the wxTreeMultiCtrl.

bool GetBooleanValue (int wndId)
 
wxString GetTextValue (int wndId)
 
void SetBooleanValue (int wndId, bool value=true)
 
void SetTextValue (int wndId, const wxString &value=wxEmptyString)
 
wxWindow * GetWindow (const wxTreeMultiItem &item)
 
void SetSelectionValue (int wndId, int sel)
 
int GetSelectionValue (int wndId)
 
void GetSelectionValues (int wndId, wxArrayInt &sels)
 
Extended visibility and manipulation methods

These methods alter the wxTreeMultiCtrl appearance, or add more functionality like checkboxes before each node.

void SetSpacingY (int spacingY)
 
int GetSpacingY () const
 
Iteration methods

Allows the user to iterate through a wxTreeMultiCtrl node, and get all the children or siblings. To start an iteration from the lowest level the functions GetFirstRoot and GetLastRoot are provided.

wxTreeMultiItem GetFirstRoot (void) const
 
wxTreeMultiItem GetLastRoot (void) const
 
wxTreeMultiItem GetParent (wxTreeMultiItem const &item) const
 
wxTreeMultiItem GetFirstChild (const wxTreeMultiItem &item, int &cookie) const
 
wxTreeMultiItem GetNextChild (const wxTreeMultiItem &item, int &cookie) const
 
wxTreeMultiItem GetLastChild (const wxTreeMultiItem &item) const
 
wxTreeMultiItem GetNextSibling (wxTreeMultiItem const &item) const
 
wxTreeMultiItem GetPrevSibling (wxTreeMultiItem const &item) const
 
wxTreeMultiItem GetNext (wxTreeMultiItem const &item) const
 
wxTreeMultiItem GetPrevious (wxTreeMultiItem const &item) const
 
Get and set methods

These methods allow you to set or get certain properties of the wxTreeMultiCtrl.

const wxFont & GetCaptionFont () const
 
void SetCaptionFont (const wxFont &font)
 
void SetCaption (wxTreeMultiItem const &item, const wxString &caption)
 

Detailed Description

This is the visual control, which will contain all the logic for the tree mechanism.

The wxTreeMultiCtrl is the container class which can be filled in to get the tree shaped structure in which the controls are displayed. The user can add / delete new nodes at runtime, expand or collapse nodes, perform get or set actions on the controls inside, and iterate over the items.

A typical usage of the wxTreeCtrl is;

wxTreeMultiCtrl *tmc = new wxTreeMultiCtrl(this, -1);
// add root
wxTreeMultiItem item = tmc->AddRoot("This is the first root");
// create a wxTreeMultiWindowInfo object for indenting etc
// add subitem to root
tmc->AppendWindow(item, new wxButton(tmc, -1, "Press this"), "", wndinfo);
// indent a few
wndinfo.Indent(4);
// add a new one
tmc->AddWindow(item, new wxCheckBox(tmc, ID_MYCHECK, "Check this!"), "", wndinfo);
// now check the value of the checkbox
tmc->SetBooleanValue(ID_MYCHECK, true);
This is the visual control, which will contain all the logic for the tree mechanism.
Definition wxTreeMultiCtrl.h:541
wxTreeMultiCtrl()
Definition wxTreeMultiCtrl.h:735
wxTreeMultiItem AddRoot(const wxString &caption, const wxString &name=wxEmptyString)
Definition wxTreeMultiCtrl.cpp:185
wxTreeMultiItem AppendWindow(const wxTreeMultiItem &ParentItem, wxWindow *window=nullptr, const wxString &name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfoDefault, int flags=0)
Definition wxTreeMultiCtrl.cpp:192
void SetBooleanValue(int wndId, bool value=true)
Definition wxTreeMultiCtrl.cpp:1439
An intermediate class which is used to return as 'item' value for the wxTreeMultiCtrl....
Definition wxTreeMultiCtrl.h:173
This class contains information for every Window node to be added.
Definition wxTreeMultiCtrl.h:357
int Indent(int num=1)
Definition wxTreeMultiCtrl.h:404

IMPORTANT: Every control added to the wxTreeMultiCtrl has to be child of the wxTreeMultiCtrl.

Constructor & Destructor Documentation

◆ wxTreeMultiCtrl() [1/2]

wxTreeMultiCtrl::wxTreeMultiCtrl ( )
inline

Two step constructor. Call Create when this constructor is called to build up the wxTreeMultiCtrl

◆ wxTreeMultiCtrl() [2/2]

wxTreeMultiCtrl::wxTreeMultiCtrl ( wxWindow *  parent,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxTMC_DEFAULT_STYLE,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxTreeMultiCtrlNameStr 
)
inline

The default constructor. The style wxTAB_TRAVERSAL is enforced to make sure that the focus handling is being done correctly. The styles to be used are styles valid for the wxWindow and wxScrolledWindow

◆ ~wxTreeMultiCtrl()

wxTreeMultiCtrl::~wxTreeMultiCtrl ( )
virtual

Destructor

Member Function Documentation

◆ AddRoot()

wxTreeMultiItem wxTreeMultiCtrl::AddRoot ( const wxString &  caption,
const wxString &  name = wxEmptyString 
)

Adds a root node to the wxTreeMultiItem. There can be many root nodes. Use this wxTreeMultiNode pointer to add more subnodes to it.

◆ AppendNode()

wxTreeMultiItem wxTreeMultiCtrl::AppendNode ( wxTreeMultiItem const &  ParentItem,
const wxString &  caption = wxEmptyString,
const wxString &  name = wxEmptyString 
)

Adds a node to the tree control. Use this wxTreeMultiItem method to add a recursive subnode class as the last element of the parent's wxTreeMultiItem. The parent wxTreeMultiItem must point to a Node class. If this is not the case an empty wxTreeMultiItem is returned. A node can contain multiple nodes or window classes

◆ AppendWindow()

wxTreeMultiItem wxTreeMultiCtrl::AppendWindow ( const wxTreeMultiItem ParentItem,
wxWindow *  window = nullptr,
const wxString &  name = wxEmptyString,
wxTreeMultiWindowInfo const &  info = wxTreeMultiWindowInfoDefault,
int  flags = 0 
)

Adds a window to the tree control. Use this wxTreeMultiItem method to add a window class to the current wxTreeMultiItem. The wxTreeMultiItem must point to a Node class. If this is not the case an empty wxTreeMultiItem is returned. The mask is used to override the mask settings of the wxTreeMultiWindowInfo class. This can be handy to set or clear extra flags only needed for certain situations

◆ Collapse()

void wxTreeMultiCtrl::Collapse ( const wxTreeMultiItem item,
bool  recursive 
)

Collapses given node, and with recursive, also the subnodes. If this item is not a node, but a window. the parent is resolved and that node is collapsed

◆ CollapseAndReset()

void wxTreeMultiCtrl::CollapseAndReset ( const wxTreeMultiItem item)

Collapses this node and removes all children from it. This is only applicable on wxTreeMultiItems which are of type Node / Root.

◆ CollapseNodes()

void wxTreeMultiCtrl::CollapseNodes ( bool  recursive = false)

Collapses all nodes and subnodes. Recursive = true means all subnodes are also expanded.

◆ Create()

bool wxTreeMultiCtrl::Create ( wxWindow *  parent,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxTMC_DEFAULT_STYLE,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxTreeMultiCtrlNameStr 
)

Two step creation. Whenever the control is created without any parameters, use Create to actually create it. Don't access the control's public methods before this is called

See also
wxTreeMultiCtrl()

◆ Delete()

bool wxTreeMultiCtrl::Delete ( wxTreeMultiItem item)

Delete item from the tree control. Whenever it is present, delete it. If not, return false. After deletion the wxTreeMultiItem is 0, thus IsOk will return false

◆ DeleteAllItems()

void wxTreeMultiCtrl::DeleteAllItems ( void  )
inline

Deletes all the items from the wxTreeMultiCtrl.

◆ DeleteChildren()

void wxTreeMultiCtrl::DeleteChildren ( const wxTreeMultiItem item)

Deletes all children of the current node. The wxTreeMultiItem needs to be of type Node to do this. Call GetParentNode to get the parent wxTreeMultiItem which is always a node.

◆ Exclude()

void wxTreeMultiCtrl::Exclude ( const wxTreeMultiItem item)

Excludes this node from drawing. When excluded, the node will dissapear from the control but is still physically present in the tree itself. If this node is a composite node with children, they will all be hidden from the control.

◆ Expand()

void wxTreeMultiCtrl::Expand ( const wxTreeMultiItem item,
bool  recursive 
)

Expands given node, and with recursive, also the subnodes

◆ ExpandNodes()

void wxTreeMultiCtrl::ExpandNodes ( bool  recursive = false)

Expand all nodes and subnodes. Recursive = true means all subnodes are also expanded.

◆ FindItem() [1/2]

wxTreeMultiItem wxTreeMultiCtrl::FindItem ( const wxString &  name,
bool  ignoreCase = false 
)
inline

Searches all nodes for the given name and returns the one found. This is a specialised method for FindItem

◆ FindItem() [2/2]

wxTreeMultiItem wxTreeMultiCtrl::FindItem ( const wxTreeMultiItem item,
const wxString &  name,
bool  ignoreCase = false,
bool  skipFirst = false 
)

Searches for the given name from the given level and lower. It will return a wxTreeMultiItem which needs to be checked with IsOk() to see if it is a correct item. IsRootItem, IsNodeItem and IsWindowItem can be used to determine the type of item. If the search returned an item which doesn't satisfy the query, you can restart the search from here, with skip = true to skip the passed item.

◆ Fold()

void wxTreeMultiCtrl::Fold ( const wxTreeMultiItem item,
bool  expand = true 
)
inline

Folds the given node. The same as Expand and Collapse, but the state can be given through a parameter

◆ GetBooleanValue()

bool wxTreeMultiCtrl::GetBooleanValue ( int  wndId)

This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with AppendWindow). When it is found, it is type casted towards a wxCheckBox and wxRadioButton. Whenever it finds a proper type it will return true or false. Whenever no proper type is found, it will return with false. In debug mode it will cause an assertion failure as well, to notify the developer something is wrong.

See also
SetBooleanValue
Todo:
For custom controls we should put something in wxMultiTreeItemData class which can be overridden to retrieve the boolean value. It will also be passed the pointer to the window, so the derived class can figure out how to get a boolean value.

◆ GetCaptionFont()

const wxFont & wxTreeMultiCtrl::GetCaptionFont ( ) const
inline

Get the currently used font for the caption headers in the wxTreeMultiCtrl. If you want to alter this font, simply obtain it and copy it to a local font. After that, set this font back using SetCaptionFont()

◆ GetChildrenCount()

int wxTreeMultiCtrl::GetChildrenCount ( const wxTreeMultiItem item)
inline

Returns the number of children in this node. If this node is not of type Node, count returns -1.

◆ GetExcludedParent()

wxTreeMultiItem wxTreeMultiCtrl::GetExcludedParent ( const wxTreeMultiItem item)

Returns the parent that is responsible for excluding this node. If there is no excluded node as parent, the wxTreeMultiItem is zero.

◆ GetFirstChild()

wxTreeMultiItem wxTreeMultiCtrl::GetFirstChild ( const wxTreeMultiItem item,
int &  cookie 
) const

Returns the first child of this node. The type of wxTreeMultiItem needs to be of Node. Whenever not succesful, the item returned is not ok (IsOk = false). Upon success, a valid child is returned. The cookie variable doesn't need to be initialized

◆ GetFirstRoot()

wxTreeMultiItem wxTreeMultiCtrl::GetFirstRoot ( void  ) const
inline

Returns the first root.

◆ GetFirstSelectedItem()

wxTreeMultiItem wxTreeMultiCtrl::GetFirstSelectedItem ( void  ) const

Returns the first selected item. If there is no selected item an invalid tree multi item is returned.

◆ GetFocus()

wxTreeMultiItem wxTreeMultiCtrl::GetFocus ( )

This method finds the current focused window, and returns the wxTreeMultiItem that has this window as pointer. If the wxTreeMultiItem is not ok, the focused window is on a sub-panel, or not on this control. If the focus is on a sub-panel, this panel will handle the focusing. If you are still interested in this window, try wxWindow::FindFocus which will always return with a pointer if a wxWindow has focus

◆ GetLastChild()

wxTreeMultiItem wxTreeMultiCtrl::GetLastChild ( const wxTreeMultiItem item) const

Returns the last child of this node. The type of 'item' needs to be of Node. Whenever not succesful, the item returned is not ok (IsOk = false). Upon success, a valid last child is returned.

◆ GetLastRoot()

wxTreeMultiItem wxTreeMultiCtrl::GetLastRoot ( void  ) const
inline

Returns the last root.

◆ GetLastSelectedItem()

wxTreeMultiItem wxTreeMultiCtrl::GetLastSelectedItem ( void  ) const

Returns the last selected item. If there is no selected item an invalid tree multi item is returned.

◆ GetNext()

wxTreeMultiItem wxTreeMultiCtrl::GetNext ( wxTreeMultiItem const &  item) const

Returns the next item. "Next" is defined by the following order:

  • in case the current item has a child it is the first child of the current item;
  • in case the current item has a next sibling as the next sibling;
  • as the parent's (or one of its ancestor's) next sibling.

◆ GetNextChild()

wxTreeMultiItem wxTreeMultiCtrl::GetNextChild ( const wxTreeMultiItem item,
int &  cookie 
) const

Returns the next child in the iteration on the level of 'item'. Make sure you called GetFirstChild first before calling this one

◆ GetNextSibling()

wxTreeMultiItem wxTreeMultiCtrl::GetNextSibling ( wxTreeMultiItem const &  item) const

Returns the next sibling of the passed item.

◆ GetParent()

wxTreeMultiItem wxTreeMultiCtrl::GetParent ( wxTreeMultiItem const &  item) const

Returns the items parent.

◆ GetPrevious()

wxTreeMultiItem wxTreeMultiCtrl::GetPrevious ( wxTreeMultiItem const &  item) const

Returns the previous item. "Previous" is defined by the following order:

  • in case the current item has a child it is the last child of the current item;
  • in case the current item has a previous sibling it is the previous sibling;
  • as the parent's (or one of its ancestor's) previous sibling.

◆ GetPrevSibling()

wxTreeMultiItem wxTreeMultiCtrl::GetPrevSibling ( wxTreeMultiItem const &  item) const

Returns the previous sibling of the passed item.

◆ GetSelectedItem()

wxTreeMultiItem wxTreeMultiCtrl::GetSelectedItem ( size_t  Index) const

Returns a selected item with the specified index. If there is no selected item with the passed index an invalide tree multi item is returned.

◆ GetSelectedItemCount()

size_t wxTreeMultiCtrl::GetSelectedItemCount ( void  ) const
inline

Returns the number of selected items.

◆ GetSelectedItemIndex()

size_t wxTreeMultiCtrl::GetSelectedItemIndex ( wxTreeMultiItem const &  Item) const

Returns the index of the selected item. In case the item is not selected "GetSelectedItemCount()" - which is an invalid index - is returned.

◆ GetSelectionValue()

int wxTreeMultiCtrl::GetSelectionValue ( int  wndId)

This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with AppendWindow). When it is found, it is type casted towards a wxListBox, wxChoice, wxComboBox. If the control is not found or of the wrong type, an asserion failure (in debug mode) follows. In release mode -1 is returned. If it is found the selection index is returned.

Todo:
For custom controls we should put something in wxMultiTreeItemData class which can be overridden to retrieve the boolean value. It will also be passed the pointer to the window, so the derived class can figure out how to get a boolean value.

◆ GetSelectionValues()

void wxTreeMultiCtrl::GetSelectionValues ( int  wndId,
wxArrayInt &  sels 
)

This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with AppendWindow). When it is found, it is type casted towards a wxListBox. If the control is not found or of the wrong type, an asserion failure (in debug mode) follows. In release mode an empty wxArrayInt is returned. If it is found the selections are stored in the wxArrayInt. This is only valid for wxListBox classes with multiple selection flag set.

Todo:
For custom controls we should put something in wxMultiTreeItemData class which can be overridden to retrieve the boolean value. It will also be passed the pointer to the window, so the derived class can figure out how to get a boolean value.

◆ GetSpacingY()

int wxTreeMultiCtrl::GetSpacingY ( ) const
inline

Gets the Y spacing of the wxTreeMultiCtrl.

◆ GetTextValue()

wxString wxTreeMultiCtrl::GetTextValue ( int  wndId)

This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with AppendWindow). When it is found, it is type casted towards a wxTextCtrl, wxChoice and wxComboBox. Whenever it finds a proper type it will return the (selected) text in the control. Whenever no proper type is found, it will return with an empty string. In debug mode it will cause an exception error as well if the cast fails, to notify the developer something is wrong.

See also
SetTextValue
Todo:
For custom controls we should put something in wxMultiTreeItemData class which can be overridden to retrieve the boolean value. It will also be passed the pointer to the window, so the derived class can figure out how to get a boolean value.

◆ GetWindow()

wxWindow * wxTreeMultiCtrl::GetWindow ( const wxTreeMultiItem item)
inline

Retrieves the wxWindow * associated with the wxTreeMultiItem. This only works for Window typed wxTreeMultiItem classes. If this type does not match or no window is associated, 0 is returned.

◆ HitTest()

wxTreeMultiItem wxTreeMultiCtrl::HitTest ( wxPoint const &  pt,
int &  flags 
)

Checks if the point is under one of the given areas. The returned areas can be

  • wxTMC_HITTEST_GUTTER If the front part of the item is clicked (where the node is)
  • wxTMC_HITTEST_WINDOW If located in the window area
  • wxTMC_HITTEST_CAPTION If located on the caption of the MultiTreeItemNode

Returned is the item which is located under the mouse, or none (IsOk = false) if no item under the mouse

◆ Include()

void wxTreeMultiCtrl::Include ( const wxTreeMultiItem item)

Includes an excluded node. If the node was already present on the drawing, nothing happens. If the node is included after exclusion it will become visible. If the parent node is still excluded or collapsed (not visible) this will not show, until the parent node shows

◆ InsertNode()

wxTreeMultiItem wxTreeMultiCtrl::InsertNode ( wxTreeMultiItem const &  ParentItem,
size_t  Position,
wxString const &  caption,
wxString const &  name 
)

Adds a node to the tree control. Use this method to add a recursive subnode class at the specified position of the parent's wxTreeMultiItem. In case the position is smaller than the current number of nodes all elements are shifted upwards, otherwise the new node is appended to the parent's wxTreeMultiItem. The parent wxTreeMultiItem must point to a Node class. If this is not the case an empty wxTreeMultiItem is returned. A node can contain multiple nodes or window classes.

◆ InsertWindow()

wxTreeMultiItem wxTreeMultiCtrl::InsertWindow ( wxTreeMultiItem const &  ParentItem,
size_t  Position,
wxWindow *  window = nullptr,
wxString const &  Name = wxEmptyString,
wxTreeMultiWindowInfo const &  info = wxTreeMultiWindowInfoDefault,
int  flags = 0 
)

Adds a window to the tree control. Use this method to add a window class at the specified position of the parent's wxTreeMultiItem. In case the position is smaller than the current number of children all elements are shifted upwards, otherwise the new window is appended to the parent's wxTreeMultiItem. The parent wxTreeMultiItem must point to a Node class. If this is not the case an empty wxTreeMultiItem is returned.

◆ PrependNode()

wxTreeMultiItem wxTreeMultiCtrl::PrependNode ( wxTreeMultiItem const &  ParentItem,
wxString const &  caption = wxEmptyString,
wxString const &  name = wxEmptyString 
)

Adds a node to the tree control. Use this method to add a recursive subnode class as the first element of the parent's wxTreeMultiItem. The parent wxTreeMultiItem must point to a Node class. If this is not the case an empty wxTreeMultiItem is returned. A node can contain multiple nodes or window classes.

◆ PrependWindow()

wxTreeMultiItem wxTreeMultiCtrl::PrependWindow ( wxTreeMultiItem const &  ParentItem,
wxWindow *  window = nullptr,
const wxString &  name = wxEmptyString,
wxTreeMultiWindowInfo const &  info = wxTreeMultiWindowInfoDefault,
int  flags = 0 
)

Adds a window to the tree control. Use this method to add a window class as the first element of the parent's wxTreeMultiItem. The parent wxTreeMultiItem must point to a Node class. If this is not the case an empty wxTreeMultiItem is returned.

◆ SelectItem()

void wxTreeMultiCtrl::SelectItem ( wxTreeMultiItem const &  Item,
bool  UnselectOthers = true,
bool  ExpandSelection = false 
)

Selects the specified item AND in case

  • UnselectOthers is set all other selected items are going to be unselected;
  • ExpandSelection is set all items between the last selected item and the passed item are selected, too (in case there this is the first selection all items between the first root and the passed item are selected). If the passed item is already selected the other parameters are ignored. Please not that currently only nodes can be selected, therefore, if any other item is passed nothing will happen.

◆ SetBooleanValue()

void wxTreeMultiCtrl::SetBooleanValue ( int  wndId,
bool  value = true 
)

This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with AppendWindow). When it is found, it is type casted towards a wxCheckBox and wxRadioButton. Whenever it finds a proper type it set the control's value to the given boolean parameter. Nothing happens when no proper type is found, however debug mode it will cause an assertion failure.

See also
GetBooleanValue
Todo:
For custom controls we should put something in wxMultiTreeItemData class which can be overridden to retrieve the boolean value. It will also be passed the pointer to the window, so the derived class can figure out how to get a boolean value.

◆ SetCaption()

void wxTreeMultiCtrl::SetCaption ( wxTreeMultiItem const &  item,
const wxString &  caption 
)

Sets the caption for a node referred to by item. This triggers a redraw from the current node.

◆ SetCaptionFont()

void wxTreeMultiCtrl::SetCaptionFont ( const wxFont &  font)

Sets the font to be used for the text caption headers. This triggers a complete redraw because x,y sizes can differ, and ofcourse all nodes need to be updated. You can call this method at any time not only at the beginning.

◆ SetSelectionValue()

void wxTreeMultiCtrl::SetSelectionValue ( int  wndId,
int  sel 
)

This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with AppendWindow). When it is found, it is type casted towards a wxListBox, wxChoice, wxComboBox. If the control is not found or of the wrong type, an asserion failure (in debug mode) follows. If it is found the selection is set in the control.

Todo:
For custom controls we should put something in wxMultiTreeItemData class which can be overridden to retrieve the boolean value. It will also be passed the pointer to the window, so the derived class can figure out how to get a boolean value.

◆ SetSpacingY()

void wxTreeMultiCtrl::SetSpacingY ( int  spacingY)
inline

Sets the Y spacing of the wxTreeMultiCtrl to a new size. This can be used to give the controls some more spacing in between

◆ SetTextValue()

void wxTreeMultiCtrl::SetTextValue ( int  wndId,
const wxString &  value = wxEmptyString 
)

This function calls FindWindow on the wxTreeMultiCtrl to find the window with the given ID (which is added with AppendWindow). When it is found, it is type casted towards a wxTextCtrl. If the control is not found or of the wrong type, an asserion failure (in debug mode) follows.
NOTE: this method does not typecast to wxChoice or wxComboBox and the likes. If a selection in one of those needs to be set, use the SetSelectionValue / GetSelectionValue combination.

See also
GetTextValue, GetSelectionValue, SetSelectionValue
Todo:
For custom controls we should put something in wxMultiTreeItemData class which can be overridden to retrieve the boolean value. It will also be passed the pointer to the window, so the derived class can figure out how to get a boolean value.

◆ Unselect()

void wxTreeMultiCtrl::Unselect ( wxTreeMultiItem const &  Item)

Unselect specified item

◆ UnselectAll()

void wxTreeMultiCtrl::UnselectAll ( void  )

Unselect all selected items.


The documentation for this class was generated from the following files: