wxTreeMultiCtrl Class Reference
[wxTreeMultiCtrl Classes]

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

#include <wxTreeMultiCtrl.h>

Collaboration diagram for wxTreeMultiCtrl:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 wxTreeMultiCtrl ()
 wxTreeMultiCtrl (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSIMPLE_BORDER, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxT("wxTreeMultiCtrl"))
virtual ~wxTreeMultiCtrl ()
bool Create (wxWindow *parent, wxWindowID id=-1, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSIMPLE_BORDER, const wxValidator &validator=wxDefaultValidator, const wxString &name=wxT("wxTreeMultiCtrl"))
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=NULL, const wxString &name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfo(0x000000001, 8, 0), int flags=0)
wxTreeMultiItem InsertWindow (wxTreeMultiItem const &ParentItem, size_t Position, wxWindow *window=NULL, wxString const &Name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfo(0x000000001, 8, 0), int flags=0)
wxTreeMultiItem PrependWindow (wxTreeMultiItem const &ParentItem, wxWindow *window=NULL, const wxString &name=wxEmptyString, wxTreeMultiWindowInfo const &info=wxTreeMultiWindowInfo(0x000000001, 8, 0), 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)

Private Member Functions

void DoFold (TreeMultiItemBase *item, bool expand, bool recursive)
void RedrawFromNode (TreeMultiItemNode *n)
void RedrawFromParentNode (TreeMultiItemBase *b)
void DrawCheckbox (TreeMultiItemBase *b, wxDC &dc, bool convertScrolled=false)
void RecalculateNodePositions ()
int CalculateNodeDimensions (TreeMultiItemBase *b, int currentY, int level)
void DrawNode (TreeMultiItemBase *b, wxDC &dc)
void SetWindowBackgroundColour (wxWindow *wnd, const wxColour &col, int flags)
void ShowTreeMultiWindow (TreeMultiItemWindow *window, bool show=true)
void UpdateAllWindowVisibility ()
void UpdateTreeMultiWindowVisibility (TreeMultiItemBase *b, bool show)
void RecalculateVirtualSize ()
virtual void AdjustScrollbars (int x, int y)
void RecalculateVirtualSizeFromNode (const TreeMultiItemNode *node, int &x, int &y)
TreeMultiItemBaseFindNodeByPoint (TreeMultiItemBase *b, wxPoint const &pt, int &area)
wxTreeMultiItem FindWindowNode (wxWindow *wnd, TreeMultiItemNode *n=0)
TreeMultiItemWindowFindNextVisibleWindowItem (TreeMultiItemBase *b, int index=-1)
void AdjustIconsDeltaY ()
void CalculateNodeSpanning (TreeMultiItemBase *b)
void Init ()
void OnPaint (wxPaintEvent &event)
void OnMouseClick (wxMouseEvent &event)
void OnRightMouseClick (wxMouseEvent &Event)
void OnKey (wxKeyEvent &event)
void OnSize (wxSizeEvent &event)
void RecalculateSpanSizes ()
Private add and delete methods
wxTreeMultiItem InsertNode (TreeMultiItemNode *ParentPtr, size_t Position, wxString const &Caption, wxString const &Name)
wxTreeMultiItem InsertWindow (TreeMultiItemNode *ParentPtr, size_t Position, wxWindow *WindowPtr, wxString const &Name, wxTreeMultiWindowInfo const &Info, int Flags)

Private Attributes

TreeMultiItemRoot _root
long _style
wxBitmap * _expandBmp
wxBitmap * _collBmp
int _iconDeltaY
int _checkDeltaY
int _captionHeight
int _gutterWidth
int _iconWidth
int _iconHeight
int _maxHeight
int _spacingY
bool _create_called
wxBrush * m_HilightBrush
wxFont _captionFont
wxArrayTreeMultiItem m_SelectedItems


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
    wxTreeMultiWindowInfo wndinfo;

    // 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);

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

Definition at line 532 of file wxTreeMultiCtrl.h.


Constructor & Destructor Documentation

wxTreeMultiCtrl::wxTreeMultiCtrl (  )  [inline]

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

Definition at line 720 of file wxTreeMultiCtrl.h.

References Init().

00721         : _create_called(false)
00722     {
00723 
00724         Init();
00725     }

Here is the call graph for this function:

wxTreeMultiCtrl::wxTreeMultiCtrl ( wxWindow *  parent,
wxWindowID  id = -1,
const wxPoint &  pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxSIMPLE_BORDER,
const wxValidator &  validator = wxDefaultValidator,
const wxString &  name = wxT("wxTreeMultiCtrl") 
) [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

Definition at line 731 of file wxTreeMultiCtrl.h.

References Create().

00737         : _style(style | wxTAB_TRAVERSAL)
00738         , _create_called(false)
00739     {
00740         Create(parent, id, pos, size, style, validator, name);
00741     }

Here is the call graph for this function:

virtual wxTreeMultiCtrl::~wxTreeMultiCtrl (  )  [virtual]

Destructor


Member Function Documentation

void wxTreeMultiCtrl::DoFold ( TreeMultiItemBase item,
bool  expand,
bool  recursive 
) [private]

Does the actual collapsing / expanding. So that Expand and Collapse aren't using the same code twice

void wxTreeMultiCtrl::RedrawFromNode ( TreeMultiItemNode n  )  [private]

Redraws and recalculates the nodes from the current node. It will also clear all 'dirty' flags when they are recalculated

Referenced by SetSpacingY().

Here is the caller graph for this function:

void wxTreeMultiCtrl::RedrawFromParentNode ( TreeMultiItemBase b  )  [private]

Redraws from parent node of this node

void wxTreeMultiCtrl::DrawCheckbox ( TreeMultiItemBase b,
wxDC &  dc,
bool  convertScrolled = false 
) [private]

Draws checkbox belonging to this node, in the given state

void wxTreeMultiCtrl::RecalculateNodePositions (  )  [private]

Recalculate the space needed based on every node. It goes as follows.

  • A foldable node (TreeMultiItemNode) is as high as the 'Jg' y-size. This type only has a caption plus a picture which explains the state ([+] or [-]), the width will be the caption length
  • A window node will be as high as the y size of the window. The X size is the total length of the window.
  • For every child node an indent will be added to the x size.

Only visible nodes will be recalculated. Non visible (collapsed) children will be skipped

int wxTreeMultiCtrl::CalculateNodeDimensions ( TreeMultiItemBase b,
int  currentY,
int  level 
) [private]

Recurses into the whole tree and provides every node with the proper x and y values. All non visible items are skipped (so when it encounters a collapsed node, it's children are not calculated). Returns the last Y

void wxTreeMultiCtrl::DrawNode ( TreeMultiItemBase b,
wxDC &  dc 
) [private]

void wxTreeMultiCtrl::SetWindowBackgroundColour ( wxWindow *  wnd,
const wxColour &  col,
int  flags 
) [private]

Sets background colour of all the windows and subwindows in this wxWindow. This is very handy for wxPanel derived classes which need to be made equal to the background colour of the wxTreeMultiCtrl

void wxTreeMultiCtrl::ShowTreeMultiWindow ( TreeMultiItemWindow window,
bool  show = true 
) [private]

Shows or hides the assigned window (if there is any)

void wxTreeMultiCtrl::UpdateAllWindowVisibility (  )  [private]

Goes down the tree, and if a window is not visible (thus all it's children aren't too) it will hide the window so it is not shown on the control

void wxTreeMultiCtrl::UpdateTreeMultiWindowVisibility ( TreeMultiItemBase b,
bool  show 
) [private]

Hides tree multi window. It this is a TreeMultiItemNode, hide all subwindows as well.

void wxTreeMultiCtrl::RecalculateVirtualSize (  )  [private]

Recalculates totally needed virtual size of the wxTreeMultiCtrl. It will scan for the largest window, with the biggest size, and report that back

virtual void wxTreeMultiCtrl::AdjustScrollbars ( int  x,
int  y 
) [private, virtual]

void wxTreeMultiCtrl::RecalculateVirtualSizeFromNode ( const TreeMultiItemNode node,
int &  x,
int &  y 
) [private]

Recalculates and accumulates largest x and y

TreeMultiItemBase* wxTreeMultiCtrl::FindNodeByPoint ( TreeMultiItemBase b,
wxPoint const &  pt,
int &  area 
) [private]

Scans for TreeMultiItemBase node that contains x,y and in area returns a hittest constant to indicate what matched

wxTreeMultiItem wxTreeMultiCtrl::FindWindowNode ( wxWindow *  wnd,
TreeMultiItemNode n = 0 
) [private]

Scans for TreeMultiItemWindow that holds the wxWindow pointer. Does not scan in panels or does a deep search. Reason, this function is used to advance to next TreeMultiItemWindow for focus on this wxScrolledWindow. If a sub window is found, it will skip other windows on that same level

TreeMultiItemWindow* wxTreeMultiCtrl::FindNextVisibleWindowItem ( TreeMultiItemBase b,
int  index = -1 
) [private]

Finds next visible window item in chain. If not found use FindFirstVisibleItem to start from the beginning

void wxTreeMultiCtrl::AdjustIconsDeltaY (  )  [private]

Adjust the centering of the bitmap icons (collapse / expand) when the caption font changes. They need to be centered in the middle of the font, so a bit of deltaY adjustment is needed

void wxTreeMultiCtrl::CalculateNodeSpanning ( TreeMultiItemBase b  )  [private]

Calculate the spanning of the individual nodes

wxTreeMultiItem wxTreeMultiCtrl::InsertNode ( TreeMultiItemNode ParentPtr,
size_t  Position,
wxString const &  Caption,
wxString const &  Name 
) [private]

Inserts a node into the parent's node at the specified position. As this is a private method error checking is limited. Therefore, it has to be guaranteed that this method is only called with a valid parent node pointer. The position is zero based. In case the position is equal or larger than the current number of parent's elements the new node is appended. The newly inserted node is being returned.

wxTreeMultiItem wxTreeMultiCtrl::InsertWindow ( TreeMultiItemNode ParentPtr,
size_t  Position,
wxWindow *  WindowPtr,
wxString const &  Name,
wxTreeMultiWindowInfo const &  Info,
int  Flags 
) [private]

Inserts a window into the parent's node at the specified position. As this is a private method error checking is limited. Therefore, it has to be guaranteed that this method is only called with a valid parent node and window pointer. The position is zero based. In case the position is equal or larger than the current number of parent's elements the new node is appended. The newly inserted window is being returned.

void wxTreeMultiCtrl::Init (  )  [private]

Referenced by wxTreeMultiCtrl().

Here is the caller graph for this function:

void wxTreeMultiCtrl::OnPaint ( wxPaintEvent &  event  )  [private]

void wxTreeMultiCtrl::OnMouseClick ( wxMouseEvent &  event  )  [private]

void wxTreeMultiCtrl::OnRightMouseClick ( wxMouseEvent &  Event  )  [private]

void wxTreeMultiCtrl::OnKey ( wxKeyEvent &  event  )  [private]

void wxTreeMultiCtrl::OnSize ( wxSizeEvent &  event  )  [private]

void wxTreeMultiCtrl::RecalculateSpanSizes (  )  [private]

Recalculates the spanning controls

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

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()

Referenced by wxTreeMultiCtrl().

Here is the caller graph for this function:

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.

wxTreeMultiItem wxTreeMultiCtrl::AppendWindow ( const wxTreeMultiItem ParentItem,
wxWindow *  window = NULL,
const wxString &  name = wxEmptyString,
wxTreeMultiWindowInfo const &  info = wxTreeMultiWindowInfo(0x000000001, 8, 0),
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

wxTreeMultiItem wxTreeMultiCtrl::InsertWindow ( wxTreeMultiItem const &  ParentItem,
size_t  Position,
wxWindow *  window = NULL,
wxString const &  Name = wxEmptyString,
wxTreeMultiWindowInfo const &  info = wxTreeMultiWindowInfo(0x000000001, 8, 0),
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.

wxTreeMultiItem wxTreeMultiCtrl::PrependWindow ( wxTreeMultiItem const &  ParentItem,
wxWindow *  window = NULL,
const wxString &  name = wxEmptyString,
wxTreeMultiWindowInfo const &  info = wxTreeMultiWindowInfo(0x000000001, 8, 0),
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.

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

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.

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.

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

void wxTreeMultiCtrl::DeleteAllItems ( void   )  [inline]

Deletes all the items from the wxTreeMultiCtrl.

Definition at line 821 of file wxTreeMultiCtrl.h.

References _root, TreeMultiItemNode::Clear(), and m_SelectedItems.

00822     {
00823       this->_root.Clear();
00824       this->m_SelectedItems.Clear();
00825       Refresh();
00826     };

Here is the call graph for this function:

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.

void wxTreeMultiCtrl::ExpandNodes ( bool  recursive = false  ) 

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

void wxTreeMultiCtrl::CollapseNodes ( bool  recursive = false  ) 

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

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

Expands given node, and with recursive, also the subnodes

Referenced by Fold().

Here is the caller graph for this function:

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

Referenced by Fold().

Here is the caller graph for this function:

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.

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

Definition at line 859 of file wxTreeMultiCtrl.h.

References Collapse(), and Expand().

00859                                                                {
00860         if(expand)
00861             Expand(item, false);
00862         else
00863             Collapse(item, false);
00864     };

Here is the call graph for this function:

size_t wxTreeMultiCtrl::GetSelectedItemCount ( void   )  const [inline]

Returns the number of selected items.

Definition at line 876 of file wxTreeMultiCtrl.h.

References m_SelectedItems.

00876 {return this->m_SelectedItems.GetCount();}

wxTreeMultiItem wxTreeMultiCtrl::GetFirstSelectedItem ( void   )  const

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

wxTreeMultiItem wxTreeMultiCtrl::GetLastSelectedItem ( void   )  const

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

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.

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.

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.

void wxTreeMultiCtrl::UnselectAll ( void   ) 

Unselect all selected items.

void wxTreeMultiCtrl::Unselect ( wxTreeMultiItem const &  Item  ) 

Unselect specified item

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.

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

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.

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

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.

Referenced by FindItem().

Here is the caller graph for this function:

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

Definition at line 964 of file wxTreeMultiCtrl.h.

References _root, and FindItem().

00964                                                                             {
00965         return FindItem(wxTreeMultiItem(&_root), name, ignoreCase, false);
00966     };

Here is the call graph for this function:

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.

Definition at line 972 of file wxTreeMultiCtrl.h.

References wxTreeMultiItem::GetItem(), TreeMultiItemNode::GetNodeCount(), and wxTreeMultiItem::IsNodeItem().

00972                                                       {
00973         if(item.IsNodeItem())
00974         {
00975             TreeMultiItemNode *n = (TreeMultiItemNode *)item.GetItem();
00976             return n->GetNodeCount();
00977         }
00978 
00979         return -1;
00980     };

Here is the call graph for this function:

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

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

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

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

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

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.

Definition at line 1038 of file wxTreeMultiCtrl.h.

References wxTreeMultiItem::GetItem(), and wxTreeMultiItem::IsWindowItem().

01038                                                      {
01039         if(item.IsWindowItem())
01040             return ((TreeMultiItemWindow *)item.GetItem())->GetWindow();
01041         return 0;
01042     };

Here is the call graph for this function:

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.

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.

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.

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

Definition at line 1105 of file wxTreeMultiCtrl.h.

References _spacingY, and RedrawFromNode().

01105                                    {
01106         if(spacingY >= 0)
01107         {
01108             _spacingY = spacingY;
01109             RedrawFromNode(0);
01110         }
01111     };

Here is the call graph for this function:

int wxTreeMultiCtrl::GetSpacingY (  )  const [inline]

Gets the Y spacing of the wxTreeMultiCtrl.

Definition at line 1115 of file wxTreeMultiCtrl.h.

References _spacingY.

01115                             {
01116         return _spacingY;
01117     };

wxTreeMultiItem wxTreeMultiCtrl::GetFirstRoot ( void   )  const [inline]

Returns the first root.

Definition at line 1147 of file wxTreeMultiCtrl.h.

References _root, and TreeMultiItemNode::First().

01147 {return wxTreeMultiItem(this->_root.First());}

Here is the call graph for this function:

wxTreeMultiItem wxTreeMultiCtrl::GetLastRoot ( void   )  const [inline]

Returns the last root.

Definition at line 1150 of file wxTreeMultiCtrl.h.

References _root, and TreeMultiItemNode::Last().

01150 {return wxTreeMultiItem(this->_root.Last());}

Here is the call graph for this function:

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

Returns the items parent.

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

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

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.

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

Returns the next sibling of the passed item.

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

Returns the previous sibling of the passed item.

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.

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.

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()

Definition at line 1200 of file wxTreeMultiCtrl.h.

References _captionFont.

01200                                          {
01201         return _captionFont;
01202     };

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.

void wxTreeMultiCtrl::OnDraw ( wxDC &  dc  ) 


Member Data Documentation

Todo:
When tab is pressed, the focus can get out of sight. This should be resolved by catching the TAB, see what window is focussed, and scroll the window so it's visible

Definition at line 539 of file wxTreeMultiCtrl.h.

Referenced by DeleteAllItems(), FindItem(), GetFirstRoot(), and GetLastRoot().

long wxTreeMultiCtrl::_style [private]

Definition at line 541 of file wxTreeMultiCtrl.h.

wxBitmap* wxTreeMultiCtrl::_expandBmp [private]

Definition at line 542 of file wxTreeMultiCtrl.h.

wxBitmap * wxTreeMultiCtrl::_collBmp [private]

Definition at line 542 of file wxTreeMultiCtrl.h.

Delta Y for bitmap, to center it on the caption

Definition at line 545 of file wxTreeMultiCtrl.h.

Definition at line 545 of file wxTreeMultiCtrl.h.

Definition at line 548 of file wxTreeMultiCtrl.h.

The gutter spacing in front and back of the image. This determines the amount of spacing in front of each item

Definition at line 552 of file wxTreeMultiCtrl.h.

The image width of the [+] / [-] icon. This is also calculated in the gutter

Definition at line 555 of file wxTreeMultiCtrl.h.

The image height of the [+] / [-] icon. This is calculated as minimal size and to allign

Definition at line 558 of file wxTreeMultiCtrl.h.

Max height. This is either the [+] bitmap or the checkbox

Definition at line 561 of file wxTreeMultiCtrl.h.

Extra Y spacing between the items.

Definition at line 565 of file wxTreeMultiCtrl.h.

Referenced by GetSpacingY(), and SetSpacingY().

Two step create prevention. Something with GetWindowSize freaks out when not actually created

Definition at line 568 of file wxTreeMultiCtrl.h.

wxBrush* wxTreeMultiCtrl::m_HilightBrush [private]

brush for highlighting nodes

Definition at line 581 of file wxTreeMultiCtrl.h.

This captionFont is made equal to the font of the wxScrolledWindow. As extra the bold face is set on it when this is wanted by the user (see flags)

Definition at line 585 of file wxTreeMultiCtrl.h.

Referenced by GetCaptionFont().

wxArrayTreeMultiItem wxTreeMultiCtrl::m_SelectedItems [private]

list of selected items

Definition at line 588 of file wxTreeMultiCtrl.h.

Referenced by DeleteAllItems(), and GetSelectedItemCount().


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

Generated on Wed Nov 12 11:38:17 2008 for BBTK by  doxygen 1.5.6