Menu_t Class Reference

Menu object, which represents a menu. More...

#include <UTMenu.h>

Inheritance diagram for Menu_t:
MenuNode_t BTreeNode_t< MenuNode_t, uint >

List of all members.

Public Member Functions

 Menu_t ()
 Menu_t (int resource_id, Resource_t *resources=NULL)
 Menu_t (int menu_id, String_t *submenu_name)
virtual ~Menu_t ()
String_tLabel () const
int MenuID () const
void AddSubmenu (Menu_t *menu, int index=-1)
Menu_tFindSubmenu (int menu_id)
Menu_tRemoveSubmenu (Menu_t *menu)
Menu_tRemoveSubmenu (int menu_id)
void AddItem (MenuItem_t *item, int index=-1)
MenuItem_tFindItem (int menu_id)
MenuItem_tRemoveItem (MenuItem_t *item)
MenuItem_tRemoveItem (int menu_id)
void AddBreak (MenuBreak_t *item, int index=-1)
MenuBreak_tFindBreak (int menu_id)
MenuBreak_tRemoveBreak (MenuBreak_t *item)
MenuBreak_tRemoveBreak (int menu_id)
void AddWindowMenuMerge (MenuMerge_t *merge, int index=-1)
MenuMerge_tFindWindowMenuMerge (int menu_id)
MenuMerge_tRemoveWindowMenuMerge (MenuMerge_t *merge)
MenuMerge_tRemoveWindowMenuMerge (int menu_id)
int CountNodes () const
MenuNode_tNodeAt (int index) const

Detailed Description

Non-core library: UTgui

A menu object represents a part of a menu which will be displayed to the user. As seen by the user, the application menu will be combined with a window menu. On some OS's like Linux, any window with a window menu will have this combination displayed below its title bar. The same is true for Windows when the application is not in MDI mode. Windows applications in MDI mode or MacOS applications will display a single global menu which reflects the current focus window. If the current focus window does not have a menu and the focus window is subordinate to another window, the subordinate_to chain will be traversed until a window with a menu is found, in which case that window's menu will be used. If no window with a menu is found, the application menu will be used without combining with any window menu.

Definition at line 182 of file UTMenu.h.


Constructor & Destructor Documentation

Menu_t::Menu_t (  ) 

Menu constructor.

Menu_t::Menu_t ( int  resource_id,
Resource_t resources = NULL 
)

Menu constructor, where the menu is created using a resource template. Once the menu has been created, menu items can be looked up by their ID's to be connected to an appropriate MessageReceiver_t. If resources is NULL, App_t::AppResources will be used.

Menu_t::Menu_t ( int  menu_id,
String_t submenu_name 
)

Submenu constructor. A menu ID of zero means "no ID", which is reasonable if the menu will never be searched for by its ID.

virtual Menu_t::~Menu_t (  )  [virtual]

Menu destructor.


Member Function Documentation

String_t * Menu_t::Label (  )  const [inline]

Returns the label if one exists.

Definition at line 584 of file UTMenu.h.

int Menu_t::MenuID (  )  const [inline]

Returns the menu's ID. A menu ID of zero means "no ID", which is reasonable if the menu will never be searched for by its ID.

Reimplemented from MenuNode_t.

Definition at line 591 of file UTMenu.h.

void Menu_t::AddSubmenu ( Menu_t menu,
int  index = -1 
)

Adds a submenu to the menu at the specified index. If index is -1, it will be added at the end. Note that for application menus, once they have been installed using App_t::SetAppMenu, additional menus will have been created, for example the Application menu on MacOS or creation of File, Edit, and/or Help menus as needed on other platforms. Consequently, the application menu cannot have submenus added to it without first calculating the necessary index by finding an adjacent landmark item by its ID.

Menu_t* Menu_t::FindSubmenu ( int  menu_id  ) 

Finds a submenu with the specified ID. The submenu can be nested inside another submenu.

Menu_t* Menu_t::RemoveSubmenu ( Menu_t menu  ) 

Removes a submenu. The caller is responsible for deleting it when appropriate. The submenu must exist or an assertion failure will occur. The submenu can be nested inside another submenu.

Menu_t* Menu_t::RemoveSubmenu ( int  menu_id  ) 

Removes a submenu with the specified ID. The caller is responsible for deleting it when appropriate. The submenu must exist or an assertion failure will occur. The submenu can be nested inside another submenu.

void Menu_t::AddItem ( MenuItem_t item,
int  index = -1 
)

Adds a menu item to the menu at the specified index. If index is -1, it will be added at the end.

MenuItem_t* Menu_t::FindItem ( int  menu_id  ) 

Finds a menu item with the specified ID. The menu item can be nested inside a submenu.

MenuItem_t* Menu_t::RemoveItem ( MenuItem_t item  ) 

Removes a menu item. The caller is responsible for deleting it when appropriate. The menu item must exist or an assertion failure will occur. The menu item can be nested inside a submenu.

MenuItem_t* Menu_t::RemoveItem ( int  menu_id  ) 

Removes a menu item with the specified ID. The caller is responsible for deleting it when appropriate. The menu item must exist or an assertion failure will occur. The menu item can be nested inside a submenu.

void Menu_t::AddBreak ( MenuBreak_t item,
int  index = -1 
)

Adds a menu break (dividing line) to the menu at the specified index. If index is -1, it will be added at the end. Because merging can result in two adjacent breaks in the final merged menu, if two breaks occur back-to-back in a menu, only one break line will be displayed.

MenuBreak_t* Menu_t::FindBreak ( int  menu_id  ) 

Finds a menu break with the specified ID. The menu break can be nested inside a submenu.

MenuBreak_t* Menu_t::RemoveBreak ( MenuBreak_t item  ) 

Removes a menu break. The caller is responsible for deleting it when appropriate. The menu break must exist or an assertion failure will occur. The menu break can be nested inside a submenu.

MenuBreak_t* Menu_t::RemoveBreak ( int  menu_id  ) 

Removes a menu break with the specified ID. The caller is responsible for deleting it when appropriate. The menu break must exist or an assertion failure will occur. The menu break can be nested inside a submenu.

void Menu_t::AddWindowMenuMerge ( MenuMerge_t merge,
int  index = -1 
)

Adds a window menu merge point to the menu at the specified index. If index is -1, it will be added at the end. At such a point, if a window menu is being merged into this application menu, the window menu contents will be inserted before any further items are added from this. Any submenus for which both this and the window menu have matching IDs will be combined into a single menu with the submenus' contents merged in the same way. If no merge point is provided in an application menu, the window menu contents will be added to the end. Because merging can result in two adjacent breaks in the final merged menu, if two breaks occur back-to-back in a menu, only one break line will be displayed.

MenuMerge_t* Menu_t::FindWindowMenuMerge ( int  menu_id  ) 

Finds a window menu merge point with the specified ID. The merge point can be nested inside a submenu.

MenuMerge_t* Menu_t::RemoveWindowMenuMerge ( MenuMerge_t merge  ) 

Removes a window menu merge point. The caller is responsible for deleting it when appropriate. The merge point must exist or an assertion failure will occur. The merge point can be nested inside a submenu.

MenuMerge_t* Menu_t::RemoveWindowMenuMerge ( int  menu_id  ) 

Removes a window menu merge point with the specified ID. The caller is responsible for deleting it when appropriate. The merge point must exist or an assertion failure will occur. The merge point can be nested inside a submenu.

int Menu_t::CountNodes (  )  const [inline]

Returns the number of nodes in the menu (items or submenus).

Definition at line 598 of file UTMenu.h.

MenuNode_t * Menu_t::NodeAt ( int  index  )  const [inline]

Returns the menu node at the specified index.

Definition at line 605 of file UTMenu.h.


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

Generated on Tue Dec 14 22:35:07 2010 for UT library by  doxygen 1.6.1