Fl_Widget | +----Fl_Menu_----Fl_Menu_Item | +----Fl_Choice, Fl_Menu_Bar, Fl_Menu_Button
#include <FL/Fl_Menu_.H>
The class contains a pointer to an array of structures of type Fl_Menu_Item. The array may either be supplied directly by the user program, or it may be "private": a dynamically allocated array managed by the Fl_Menu_.
Returns a pointer to the last menu item that was picked.
The menu is set to a private copy of the passed Fl_Menu_Item array. This is useful if you want to modify the flags of the menu items. If the user_data argument is non-NULL, then the user_data members of the menu items are set to the given value.
Adds a new menu item, with a title string, shortcut string, callback, argument to the callback, and flags. If the menu array was directly set with menu(x) then copy() is done to make a private array.
The characters "&", "/", "\", and "_" are treated as special characters in the label string. The "&" character specifies that the following character is an accelerator and will be underlined. The "\" character is used to escape the next character in the string. Labels starting with the "_" character cause a divider to be placed before that menu item.
A label of the form "foo/bar/baz" will create a submenus called "foo" and "bar" with an entry called "baz". The "/" character is ignored if it appears as the first character of the label string, e.g. "/foo/bar/baz".
The label string is copied to new memory and can be freed. The other arguments (including the shortcut) are copied into the menu item unchanged.
If an item exists already with that name then it is replaced with this new one. Otherwise this new one is added to the end of the correct menu or submenu. The return value is the offset into the array that the new entry was placed at.
Shortcut can be 0L, or either a modifier/key combination (for example FL_CTRL+'A') or a string describing the shortcut in one of two ways:
[#+^]<ascii_value> eg. "97", "^97", "+97", "#97" [#+^]<ascii_char> eg. "a", "^a", "+a", "#a"..where <ascii_value> is a decimal value representing an ascii character (eg. 97 is the ascii for 'a'), and the optional prefixes enhance the value that follows. Multiple prefixes must appear in the above order.
# - Alt + - Shift ^ - ControlText shortcuts are converted to integer shortcut by calling int fl_old_shortcut(const char*).
The return value is the index into the array that the entry was put.
The passed string is split at any '|' characters and then add(s,0,0,0,0) is done with each section. This is often useful if you are just using the value, and is compatible with Forms and other GL programs. The section strings use the same special characters as described for the long version of add()
Currently there can be only one global()menu. Setting a new one will replace the old one. There is no way to remove the global() setting (so don't destroy the widget!)
Returns a pointer to the menu item with the given (full) pathname. If no matching menu item can be found, a NULL pointer is returned. This function does not search submenus that are linked via FL_SUBMENU_POINTER.
Returns the 'menu pathname' (eg. "File/Quit") for the recently picked item in user supplied string 'name'. Useful in the callback function for a menu item, to determine the last picked item's 'menu pathname' string.
If finditem is specified, name will contain the 'menu pathname' for that item.
Returns:
In the case of errors (-1 or -2), 'name' will be an empty string.