Menu object, which represents a menu. More...
#include <UTMenu.h>
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_t * | Label () const |
int | MenuID () const |
void | AddSubmenu (Menu_t *menu, int index=-1) |
Menu_t * | FindSubmenu (int menu_id) |
Menu_t * | RemoveSubmenu (Menu_t *menu) |
Menu_t * | RemoveSubmenu (int menu_id) |
void | AddItem (MenuItem_t *item, int index=-1) |
MenuItem_t * | FindItem (int menu_id) |
MenuItem_t * | RemoveItem (MenuItem_t *item) |
MenuItem_t * | RemoveItem (int menu_id) |
void | AddBreak (MenuBreak_t *item, int index=-1) |
MenuBreak_t * | FindBreak (int menu_id) |
MenuBreak_t * | RemoveBreak (MenuBreak_t *item) |
MenuBreak_t * | RemoveBreak (int menu_id) |
void | AddWindowMenuMerge (MenuMerge_t *merge, int index=-1) |
MenuMerge_t * | FindWindowMenuMerge (int menu_id) |
MenuMerge_t * | RemoveWindowMenuMerge (MenuMerge_t *merge) |
MenuMerge_t * | RemoveWindowMenuMerge (int menu_id) |
int | CountNodes () const |
MenuNode_t * | NodeAt (int index) const |
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.
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.
String_t * Menu_t::Label | ( | ) | const [inline] |
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.
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.
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] |
MenuNode_t * Menu_t::NodeAt | ( | int | index | ) | const [inline] |