Abstract base class for FLTK menus
Inherits from Widget
Subclasses: Choice Menu_Bar Menu_Button
down_box | text | textfont | value | |
size | textcolor | textsize | ||
add | global | mode | replace | shortcut |
clear | item_text | remove | set_mode | |
type | name | summary |
integer | value | Offset of last item chosen |
readonly string | text | Text of last item chosen |
type | name | summary |
integer | add(Menu_Entry m_e) | Add an entry |
void | clear() | Remove all entries |
All widgets that have a menu in FLTK are subclassed off of this class. Currently FLTK provides you with Menu_Button, Menu_Bar, and Choice.
You can either directly manipulate the contents of the menu by adding strings and writing your callbacks in terms of item index numbers, or you can use the Menu_Entry wrapper.
Menu_Entry isn't an FLTK class; it's an invention of the Lua FLTK wrapper. It looks somewhat like an Fl_Menu_Item.
Make the shortcuts for this menu work no matter what window has the focus when you type it. This is done by using the FLTK function Fl::add_handler(). This Menu_ widget does not have to be visible (ie the window it is in can be hidden, or it does not have to be put in a window at all).
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!)
The number of entries currently in the menu, plus one. (The extra
is for a hidden terminator entry.) If no items have ever been added, this is zero.
Removes all entries from the menu.
Adds a Menu_Entry to the menu at the end of the items list.
Returns the 0-based offset it was placed at. See Menu_Entry for more information.
As a convenience, if m_e is a string, a
Menu_Entry will be wrapped around it for you.
Changes the text of item n.
Don't use this function if you're using Menu_Entrys;
update the label and call redraw() on the Menu_Entry
instead.
Deletes item n from the menu.
Note that all offsets after the deleted item will change.
Changes the shortcut of the entry.
Don't use this function if you're using Menu_Entrys;
update the shortcut and call redraw() on the Menu_Entry
instead.
Changes the flags of the entry.
Don't use this function if you're using Menu_Entrys;
update the flag properties and call redraw() on the Menu_Entry
instead.
Return the current flags of the entry.
The value is the index of the last item chosen by
the user. It is zero initially.
Returns the label of the last item chosen.
Returns the label of the item.
The default text font for menu items.
The default text font size for menu items.
The default color for the text of menu items.
This box type is used to surround the currently-selected items in
the menus. If this is Boxtype.none then it acts like
Boxtype.thin_up and selection_color acts like
Color.white, for back compatability.
clear(): void
add(Menu_Entry m_e): integer
replace(integer offset, string label): void
remove(integer offset): void
shortcut(integer offset, integer shortcut): void
set_mode(integer offset, integer flags): void
mode(integer offset): int
value: integer
text: readonly string
item_text(integer offset): int
textfont: Font
textsize: integer
textcolor: Color
down_box: Boxtype
doctool generated at Sun Aug 12 22:23:18 2001