Menubar
A menubar is a collection of menus, allowing the user to select
options which trigger associated actions. Operations support the
construction of these menus. Each menu has an integer index; each of
its options has an integer index relative to it. These indices are
returned by the create methods and used by most other methods.
Which types of menus are supported is implementation dependent.
Currently there are two types:
- Null: a "normal" menubar of options with actions
- "radiobuttons
opt1|opt2|...|optn": the
last-chosen option remains selected
Which types of options are supported is implementation dependent.
Currently there are two types:
- Null: a "normal" option that can be chosen once
- "checkbox": the option can be toggled (note that this only
works in a normal menubar)
Implementations:
- Menubar_Text
A textual menubar for UI_Text. Gets option choices as (menu, option)
pairs of integers. Constructor args: Reader, Writer, UI_Text.
- Menubar_Tk_Bar
Menus arrange in a bar for Tk. Constructor args: UI_Tk.
- Menubar_Tk_Buttons
Menus arranged as collections of buttons for Tk. Constructor args:
UI_Tk, bool vertical.
Member functions:
- add_separator: Menubar . int -> void
Adds a separator
to the menu.
- create_menu: Menubar . string name . string type=0 -> int
Creates a menu of the given name and type (see above), returning
its index.
- create_option: Menubar . int . string name . Callback
. bool enabled=true . string type=0 -> int
Creates an option of
the type (see above) for the menu, with the name and action, initially
enabled or not.
- enable_option: Menubar . int . int . bool=true
-> void
Activates/deactivates the option.
- num_menus: Menubar -> int
Returns the number of
menus defined.
- num_options: Menubar . int -> int
Returns the number of
options defined for the menu.
- select_option: Menubar . int . int . bool do_cb=true -> void
Acts as if the user had selected the option, doing the callback if
requested.
- set_menu_name: Menubar . int . string -> void
Sets the name for the menu.
- set_option_action: Menubar . int . int . Callback -> void
Sets the action for the option.
- set_option_name: Menubar . int . int . string -> void
Sets the name for the option.