The AccelLabel widget is a subclass of Label that also displays an
accelerator key on the right of the label text, e.g. 'Ctl+S'. It is
commonly used in menus to show the keyboard short-cuts for commands.
The accelerator key to display is not set explicitly. Instead, the
AccelLabel displays the accelerators which have been added to a particular
widget. This widget is set by calling accelLabelSetAccelWidget.
For example, a MenuItem widget may have an accelerator added to emit
the "activate" signal when the 'Ctl+S' key combination is pressed. A
AccelLabel is created and added to the MenuItem, and
accelLabelSetAccelWidget is called with the MenuItem as the second
argument. The AccelLabel will now display 'Ctl+S' after its label.
Note that creating a MenuItem with
Graphics.UI.Gtk.MenuComboToolbar.MenuItem.menuItemNewWithLabel (or one of
the similar functions for CheckMenuItem and RadioMenuItem) automatically
adds a AccelLabel to the MenuItem and calls accelLabelSetAccelWidget
to set it up for you.
An AccelLabel will only display accelerators which have
Graphics.UI.Gtk.Abstract.Widget.AccelVisible
set (see Graphics.UI.Gtk.Abstract.Widget.AccelFlags).
A AccelLabel can display multiple accelerators and
even signal names, though it is almost always used to display just one
accelerator key.
|