wxMenuTreeWalker Class Reference

A wxMenuWalker-derived class which uses the recursive capabilities of the tree-walker algorithm to populate a wxTreeCtrl with a structure identic to the given menubar. More...

#include <menuutils.h>

Inheritance diagram for wxMenuTreeWalker:

Inheritance graph
[legend]
Collaboration diagram for wxMenuTreeWalker:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 wxMenuTreeWalker ()
virtual ~wxMenuTreeWalker ()
void FillTreeBranch (wxMenuBar *p, wxTreeCtrl *ctrl, wxTreeItemId branch)
 Attaches the tree structure of the menubar in the given tree control using the given tree item as root.
void FillTreeCtrl (wxMenuBar *p, wxTreeCtrl *ctrl, const wxString &rootname=wxT("root"))
 Works like FillTreeBranch but this function also removes all the tree items (before starting) and then builds the root with the given label.

Protected Member Functions

void * OnMenuWalk (wxMenuBar *p, wxMenu *, void *)
 Called when a wxMenu is found in the menu bar passed to Walk(), or when a submenu is found by WalkMenuItem().
void * OnMenuItemWalk (wxMenuBar *p, wxMenuItem *, void *)
 Called when a wxMenuItem is found inside a wxMenu.
void DeleteData (void *data)
 Deletes the given 'data'.

Private Attributes

wxTreeCtrl * m_pTreeCtrl
wxTreeItemId m_root

Detailed Description

A wxMenuWalker-derived class which uses the recursive capabilities of the tree-walker algorithm to populate a wxTreeCtrl with a structure identic to the given menubar.

Each node of the wxTreeCtrl is associated with a wxExTreeItemData object which contains the ID of the menuitem it represents (for items representing the top level menus, wxID_INVALID is contained).


Constructor & Destructor Documentation

wxMenuTreeWalker::wxMenuTreeWalker (  )  [inline]

virtual wxMenuTreeWalker::~wxMenuTreeWalker (  )  [inline, virtual]


Member Function Documentation

void wxMenuTreeWalker::DeleteData ( void *  data  )  [protected, virtual]

Deletes the given 'data'.

The derived class should pass to the OnMenuWalk/OnMenuWalkItem functions always the same type of structure/class in 'data' and in this function it should just cast the given pointer to that type and delete it.

Implements wxMenuWalker.

void wxMenuTreeWalker::FillTreeBranch ( wxMenuBar *  p,
wxTreeCtrl *  ctrl,
wxTreeItemId  branch 
)

Attaches the tree structure of the menubar in the given tree control using the given tree item as root.

void wxMenuTreeWalker::FillTreeCtrl ( wxMenuBar *  p,
wxTreeCtrl *  ctrl,
const wxString &  rootname = wxT("root") 
) [inline]

Works like FillTreeBranch but this function also removes all the tree items (before starting) and then builds the root with the given label.

void * wxMenuTreeWalker::OnMenuItemWalk ( wxMenuBar *  p,
wxMenuItem *  ,
void *   
) [protected, virtual]

Called when a wxMenuItem is found inside a wxMenu.

This works like OnMenuWalk() but "data" is something which was given to the WalkMenuItem (which is always the caller of this function). If the current menu item contains a submenu, the returned value is passed to OnMenuWalk() or it's directly deleted...

Implements wxMenuWalker.

void * wxMenuTreeWalker::OnMenuWalk ( wxMenuBar *  p,
wxMenu *  ,
void *   
) [protected, virtual]

Called when a wxMenu is found in the menu bar passed to Walk(), or when a submenu is found by WalkMenuItem().

Implements wxMenuWalker.


Member Data Documentation

wxTreeCtrl* wxMenuTreeWalker::m_pTreeCtrl [private]

wxTreeItemId wxMenuTreeWalker::m_root [private]


The documentation for this class was generated from the following files:
Generated on Sat Mar 10 18:30:48 2007 for Keybinder by  doxygen 1.4.7