A menu bar is a series of menus accessible from the top of a frame.
To respond to a menu selection, provide a handler for EVT_MENU, in the frame that contains the menu bar. If you have a toolbar which uses the same identifiers as your EVT_MENU entries, events from the toolbar will also be processed by your EVT_MENU event handlers.
Tip: under Windows, if you discover that menu shortcuts (for example, Alt-F to show the file menu)
are not working, check any EVT_CHAR events you are handling in child windows.
If you are not calling event.Skip() for events that you don’t process in these event handlers,
menu shortcuts may cease to work.
MenuBar.new(Integer style = 0)
Default constructor.
MenuBar.new(Integer n, Menu menus[], String titles[],
Integer style = 0)
Construct a menu bar from arrays of menus and titles.
MB_DOCKABLE the menu bar can be detached (GTK only).
destructor()
Destructor, destroying the menu bar and removing it from the parent frame (if any).
Boolean append(Menu menu, String title)
Adds the item to the end of the menu bar.
true on success, false if an error occurred.
check(Integer id, Boolean check)
Checks or unchecks a menu item.
Only use this when the menu bar has been associated with a frame; otherwise, use the Menu equivalent call.
enable(Integer id, Boolean enable)
Enables or disables (greys out) a menu item.
Only use this when the menu bar has been associated with a frame; otherwise, use the Menu equivalent call.
enable_top(Integer pos, Boolean enable)
Enables or disables a whole menu.
Only use this when the menu bar has been associated with a frame.
Integer find_menu(String title)
Returns the index of the menu with the given title or NOT_FOUND if no
such menu exists in this menubar. The title parameter may specify either
the menu title (with accelerator characters, i.e. "&File") or just the
menu label ("File") indifferently.
Integer find_menu_item(String menuString, String itemString)
Finds the menu item id for a menu name/menu item string pair.
The menu item identifier, or NOT_FOUND if none was found.
Any special menu codes are stripped out of source and target strings before matching.
MenuItem find_item(Integer id, Menu menu = nil)
Finds the menu item object associated with the given menu item identifier.
The found menu item object, or NULL if one was not found.
String *get_help_string(Integer id)
Gets the help string associated with the menu item identifier.
The help string, or the empty string if there was no help string or the menu item was not found.
String get_label(Integer id)
Gets the label associated with a menu item.
The menu item label, or the empty string if the item was not found.
Use only after the menubar has been associated with a frame.
String get_label_top(Integer pos)
Returns the label of a top-level menu. Note that the returned string does not include the accelerator characters which could have been specified in the menu title string during its construction.
The menu label, or the empty string if the menu was not found.
Use only after the menubar has been associated with a frame.
Menu get_menu(Integer menuIndex)
Returns the menu at menuIndex (zero-based).
Integer get_menu_count()
Returns the number of menus in this menubar.
Boolean insert(Integer pos, Menu menu, String title)
Inserts the menu at the given position into the menu bar. Inserting menu at position $0$ will insert it in the very beginning of it, inserting at position get_menu_count()() is the same as calling Append().
true on success, false if an error occurred.
Boolean is_checked(Integer id)
Determines whether an item is checked.
true if the item was found and is checked, false otherwise.
Boolean is_enabled(Integer id)
Determines whether an item is enabled.
true if the item was found and is enabled, false otherwise.
refresh()
Redraw the menu bar
Menu remove(Integer pos)
Removes the menu from the menu bar and returns the menu object – the caller is responsible for deleting it. This function may be used together with MenuBar#insert to change the menubar dynamically.
Menu replace(Integer pos, Menu menu,
String title)
Replaces the menu at the given position with another one.
The menu which was previously at position pos. The caller is responsible for deleting it.
MenuBar#insert, MenuBar#remove
set_help_string(Integer id, String helpString)
Sets the help string associated with a menu item.
set_label(Integer id, String label)
Sets the label of a menu item.
Use only after the menubar has been associated with a frame.
set_label_top(Integer pos, String label)
Sets the label of a top-level menu.
Use only after the menubar has been associated with a frame.
[This page automatically generated from the Textile source at Thu May 01 00:50:41 +0100 2008]