1.96 class menu_bar

A menu_bar represents a series of popup objects operated as pulldown menus. See for example the menu_bar in the PCE manual window. Various techniques are commonly used to give commands through graphical interfaces:

1.96.1 Class variables

menu_bar.label_font: font = normal
@see menu_bar-label_font
menu_bar.size: size = size(80,20)
The minimum size for a box to display a label. See menu_bar->compute and menu_bar<-item_size.
See also
menu_bar->compute

1.96.2 Instance variables

menu_bar-button: button_name*
Name of the button (see event<-button) that caused the first menu to appear. Used internally.
menu_bar <- buttons: chain
Chain holding button objects to represent each of the entries. When a popup object is menu_bar->append’ed, a button is added to this chain to visualise the popup. The button<-popup slot refers to the popup.

This implementation allows for easy emulation of the OpenLook look-and-feel style as OpenLook does not define menu-bars.

menu_bar <- current: popup*
Currently visible popup object or @nil if the menu_bar is inactive
menu_bar <- format: {left,center,right}
Describes how the labels are formatted in their boxes. See also graphical->pen and dialog_item->label_font.
See also
dialog_item->label_font
dialog_item <- label_font: font*
@see menu_bar.label_font @see dialog_item->label_font
menu_bar <- members: chain
Chain of popup objects. The popup<-labels are displayed left-to-right from from this chain.

1.96.3 Send methods

menu_bar ->active_member: popup=member:popup, active=bool
(De) activate the indicated popup object. When inactive, the label will be greyed-out. Modifies graphical<-active.
See also
menu_bar->all_active
menu_bar ->all_active: bool
Invokes menu_bar->active_member for all member popups.
See also
menu_bar->active_member
menu_bar ->all_off: member:popup
@see menu_bar->all_on
menu_bar ->all_on: member:popup
Activates menu->on on the specified popup object, activating all menu_item objects part of it.
See also
menu_bar->all_off
menu_bar ->append: member=popup, alignment=[{left,right}], before=[name|popup]
Attach a popup object to the menu_bar. The menu_bar object will append a button object to menu_bar<-buttons with the following attributes:
button<-popup Set to the popup
dialog_item<-label dialog_item<-label
button<-font Set to dialog_item<-label_font
graphical<-pen Set to graphical<-pen
button<-radius Set tp menu_bar<-radius

The dialog_item<-label_font, graphical<-pen and menu_bar<-radius of the button are

menu_bar ->assign_accelerators:
Assign accelerators for the items.

See also dialog->assign_accelerators and menu->assign_accelerators.

menu_bar ->clear:
@see menu_bar->append
menu_bar ->compute:
Determines the size and menu_bar<-item_size. The menu_bar<-item_size is the largest of menu_bar.size and the size needed to display the largest label.
See also
menu_bar.size
menu_bar ->delete: member:popup
Delete the indicated popup from the menu_bar.
See also
menu_bar->append
menu_bar ->geometry: x=[int], y=[int], width=[int], height=[int]
Changes the menu-bar geometry. It the width argument is not @default and larger than the space required by the buttons, the first button with dialog_item<-alignment and all succeeding buttons are flushed to the right. See also menu_bar->append.
menu_bar ->initialise: name=[name]
Create a menu_bar from its label. The label is not shown, but the menu_bar will be given this name. This may be used to find the reference of the menu_bar in the dialog object (see dialog<-member).

Diagnostics: The default name is the class name (menu_bar).

dialog_item ->label_font: font*
@see menu_bar-label_font
menu_bar ->off: name|menu_item
@see menu_bar->on
menu_bar ->on: name|menu_item
Invokes menu->on with same argument on all member popups. Always succeeds.
See also
menu_bar->off
menu_bar ->show_popup: popup
Make popup menu_bar<-current and dialog_item->open it. See also menu_bar<-current and menu_bar<-popup_from_event. Used by menu_bar->event.

1.96.4 Get methods

menu_bar <-contains: -> any
Returns the chain of menu_bar<-members popup's
menu_bar <-hor_stretch: -> 0..
Horizontal stretchability. The returned value (1) ensures that, if the containing device (normally a dialog object) is given a layout, the menu_bar is stretched to the right-edge of the window. See also menu_bar->geometry.
menu_bar <-member: name|popup -> popup
When the argument is a popup object, return it if it is a member of this menu_bar. When the argument is a name, return the first popup whose dialog_item<-label equals the argument.
menu_bar <-popup_from_event: event -> popup
Find popup to open from event. This method locates the button on which the event took place and returns the associated popup. Used by menu_bar->event. See also menu_bar->show_popup and menu_bar<-current.