Gtk-- Reference: Gtk::AccelLabel

Class Index | Cross Index | Namespace Index

# Class Gtk::AccelLabel

A label which displays an accelerator key to the right of the text.
Contained in: Gtk
Derived from: Gtk::Label
Derived by: none

#include <gtk--/accellabel.h>

### public function member index:
``explicit`` | `AccelLabel` | `(`const` `string`& `label`)`;
``guint`` | `get_accel_width` | `() `const``;
``GtkAccelLabel`*` | `gtkobj` | `()`;
``const` `GtkAccelLabel`*` | `gtkobj` | `() `const``;
``static` `bool`` | `isA` | `(`Object`* `object`)`;
``bool`` | `refetch` | `()`;
``void`` | `set_accel_widget` | `(`Widget`& `accel_widget`)`;
``virtual`` | `~AccelLabel` | `()`;

## Description:

The ``Gtk::AccelLabel`` widget is a subclass of ``Gtk::Label`` that also displays an accelerator key to 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 ``Gtk::AccelLabel`` displays the accelerators which have been added to a particular widget. This widget is set by calling `set_accel_widget`. For example, a ``Gtk::MenuItem`` widget may have an accelerator added to emit the "activate" signal when the 'Ctl+S' key combination is pressed. A ``Gtk::AccelLabel`` is created and added to the ``Gtk::MenuItem``, and `set_accel_widget` is called with the ``Gtk::MenuItem`` as the argument. The ``Gtk::AccelLabel`` will now display 'Ctl+S' after its label.

## Function Member Descriptions:

Gtk::AccelLabel::AccelLabel - Creates a new ``Gtk::AccelLabel``.

``explicit`` `AccelLabel``(`const` `string`& `label`)`;

> string: The label string.

Gtk::AccelLabel::gtkobj - Returns the underlaying gtk+ object.

``GtkAccelLabel`*` `gtkobj``()`;
Gtk::AccelLabel::isA - Returns true if object is this type.

``static` `bool`` `isA``(`Object`* `object`)`;
Gtk::AccelLabel::refetch - Recreates the string representing the accelerator keys.

``bool`` `refetch``()`;

> This should not be needed since the string is automatically updated whenever accelerators are added or removed from the associated widget.

Gtk::AccelLabel::set_accel_widget - Sets the widget whose accelerators are to be shown.

``void`` `set_accel_widget``(`Widget`& `accel_widget`)`;