Main Page Widgets Namespaces Book

# Gtk::AccelGroup Class Reference

A Gtk::AccelGroup represents a group of keyboard accelerators, typically attached to a toplevel Gtk::Window (with Gtk::Window::add_accel_group()). More...

Inheritance diagram for Gtk::AccelGroup:

[legend]
List of all members.

## Public Member Functions

virtual | ~AccelGroup ()
GtkAccelGroup* | gobj ()
| Provides access to the underlying C GObject.
const GtkAccelGroup* | gobj () const
| Provides access to the underlying C GObject.
GtkAccelGroup* | gobj_copy ()
void | lock ()
| Locks the given accelerator group.
void | unlock ()
| Undoes the last call to lock() on this accel_group .
bool | disconnect_key (guint accel_key, Gdk::ModifierType accel_mods)
| Removes an accelerator previously installed through connect().
Glib::SignalProxy3< void, guint, GdkModifierType, GClosure* > | signal_accel_changed ()

## Static Public Member Functions

Glib::RefPtr<AccelGroup> | create ()
| Creates a new Gtk::AccelGroup object.
bool | valid (guint keyval, Gdk::ModifierType modifiers)
| Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator.
void | parse (const Glib::ustring& accelerator, guint& accelerator_key, Gdk::ModifierType& accelerator_mods)
| Parse the accelerator string.
Glib::ustring | name (guint accelerator_key, Gdk::ModifierType accelerator_mods)
| Converts an accelerator keyval and modifier mask into a string parseable by parse().
void | set_default_mod_mask (Gdk::ModifierType default_mod_mask)
| Sets the modifiers that will be considered significant for keyboard accelerators.
Gdk::ModifierType | get_default_mod_mask ()
| See set_default_mod_mask().
bool | activate (Gtk::Object& object, guint accel_key, Gdk::ModifierType accel_mods)
| Finds the first accelerator in any Gtk::AccelGroup attached to object that matches accel_key and accel_mods , and activates that accelerator.

## Protected Member Functions

| AccelGroup ()
virtual void | on_accel_changed (guint keyval, GdkModifierType modifier, GClosure* accel_closure)

## Related Functions

(Note that these are not member functions.)
Glib::RefPtr<Gtk::AccelGroup> | wrap (GtkAccelGroup* object, bool take_copy=false)

## Detailed Description

A Gtk::AccelGroup represents a group of keyboard accelerators, typically attached to a toplevel Gtk::Window (with Gtk::Window::add_accel_group()).

Usually you won't need to create a Gtk::AccelGroup directly; instead, gtkmm automatically sets up the accelerators for your menus. Note that accelerators are different from mnemonics. Accelerators are shortcuts for activating a menu item; they appear alongside the menu item for which they're a shortcut. For example "Ctrl+Q" might appear alongside the "Quit" menu item. Mnemonics are shortcuts for GUI elements such as text entries or buttons; they appear as underlined characters. See the Gtk::Label constructor. Menu items can have both accelerators and mnemonics, of course.

You can use Gtk::Window::get_accel_group() to get an accel group for that window, then use it with other widgets too.

## Constructor & Destructor Documentation

virtual Gtk::AccelGroup::~AccelGroup | ( |  | ) | `[virtual]`

Gtk::AccelGroup::AccelGroup | ( |  | ) | `[protected]`

## Member Function Documentation

bool Gtk::AccelGroup::activate | ( | Gtk::Object& | object,
|  | guint | accel_key,
|  | Gdk::ModifierType | accel_mods
| ) | `[static]`

Finds the first accelerator in any Gtk::AccelGroup attached to object that matches accel_key and accel_mods , and activates that accelerator.

If an accelerator was activated and handled this keypress, `true` is returned.

Parameters:

  object | The G::Object, usually a Gtk::Window, on which to activate the accelerator.
  accel_key | Accelerator keyval from a key event.
  accel_mods | Keyboard state mask from a key event.

Returns:
  `true` if the accelerator was handled, `false` otherwise.

Glib::RefPtr<AccelGroup> Gtk::AccelGroup::create | ( |  | ) | `[static]`

Creates a new Gtk::AccelGroup object.

Returns:
  A Glib::RefPtr<> to a newly created Gtk::AccelGroup object.

bool Gtk::AccelGroup::disconnect_key | ( | guint | accel_key,
|  | Gdk::ModifierType | accel_mods
| ) |

Removes an accelerator previously installed through connect().

Parameters:

  accel_key | Key value of the accelerator.
  accel_mods | Modifier combination of the accelerator.

Returns:
  `true` if there was an accelerator which could be removed, `false` otherwise.

Gdk::ModifierType Gtk::AccelGroup::get_default_mod_mask | ( |  | ) | `[static]`

| See set_default_mod_mask().

const GtkAccelGroup* Gtk::AccelGroup::gobj | ( |  | ) | const`[inline]`

| Provides access to the underlying C GObject. Reimplemented from Glib::ObjectBase.

GtkAccelGroup* Gtk::AccelGroup::gobj | ( |  | ) | `[inline]`

| Provides access to the underlying C GObject. Reimplemented from Glib::ObjectBase.

GtkAccelGroup* Gtk::AccelGroup::gobj_copy | ( |  | ) |

void Gtk::AccelGroup::lock | ( |  | ) |

| Locks the given accelerator group. Locking an acelerator group prevents the accelerators contained within it to be changed during runtime. Refer to gtk_accel_map_change_entry() about runtime accelerator changes. If called more than once, accel_group remains locked until unlock() has been called an equivalent number of times.

Glib::ustring Gtk::AccelGroup::name | ( | guint | accelerator_key,
|  | Gdk::ModifierType | accelerator_mods
| ) | `[static]`

| Converts an accelerator keyval and modifier mask into a string parseable by parse(). For example, if you pass in 'q' and Gdk::CONTROL_MASK, it returns "& lt;Control& gt;q".

virtual void Gtk::AccelGroup::on_accel_changed | ( | guint | keyval,
|  | GdkModifierType | modifier,
|  | GClosure* | accel_closure
| ) | `[protected, virtual]`

void Gtk::AccelGroup::parse | ( | const Glib::ustring& | accelerator,
|  | guint& | accelerator_key,
|  | Gdk::ModifierType& | accelerator_mods
| ) | `[static]`

Parse the accelerator string.

Parameters:

  accelerator | See the Gtk::AccelKey constructor for the format.
  accelerator_key | Output argument
  accelerator_mods | Output argument

void Gtk::AccelGroup::set_default_mod_mask | ( | Gdk::ModifierType | default_mod_mask | ) | `[static]`

Sets the modifiers that will be considered significant for keyboard accelerators.

The default mod mask is Gdk::CONTROL_MASK | Gdk::SHIFT_MASK | Gdk::MOD1_MASK, that is, Control, Shift, and Alt. Other modifiers will ignored by default. You must include at least the three default modifiers in any value you pass to this function.

The default mod mask should be changed on application startup, before using any accelerator groups.

Glib::SignalProxy3<void,guint,GdkModifierType,GClosure*> Gtk::AccelGroup::signal_accel_changed | ( |  | ) |

Prototype:
  `void accel_changed(guint keyval, GdkModifierType modifier, GClosure* accel_closure)`

void Gtk::AccelGroup::unlock | ( |  | ) |

| Undoes the last call to lock() on this accel_group .

bool Gtk::AccelGroup::valid | ( | guint | keyval,
|  | Gdk::ModifierType | modifiers
| ) | `[static]`

| Determines whether a given keyval and modifier mask constitute a valid keyboard accelerator. For example, the 'a' keyval plus Gdk::CONTROL_MASK is valid - this is a "Ctrl+a" accelerator. But you can't, for instance, use the GDK_Control_L keyval as an accelerator.

## Friends And Related Function Documentation

Glib::RefPtr<Gtk::AccelGroup> wrap | ( | GtkAccelGroup* | object,
|  | bool | take_copy = false
| ) | `[related]`

The documentation for this class was generated from the following file:

- accelgroup.h