gtkmm: Gtk::Shortcut Class Reference

gtkmm 4.12.0

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Symbols | List of all members
Gtk::Shortcut Class Reference
Event Controllers and Gestures

An object describing a keyboard shortcut. More...

`#include <gtkmm/shortcut.h>`

Inheritance diagram for Gtk::Shortcut:
[legend]

## Public Member Functions
| Shortcut (Shortcut && src) noexcept
Shortcut & | operator= (Shortcut && src) noexcept
| ~Shortcut () noexcept override
GtkShortcut * | gobj ()
| Provides access to the underlying C GObject.
const GtkShortcut * | gobj () const
| Provides access to the underlying C GObject.
GtkShortcut * | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Glib::RefPtr< ShortcutTrigger > | get_trigger () const
| Gets the trigger used to trigger self.
void | set_trigger (const Glib::RefPtr< const ShortcutTrigger > & trigger)
| Sets the new trigger for self to be trigger.
Glib::RefPtr< ShortcutAction > | get_action () const
| Gets the action that is activated by this shortcut.
void | set_trigger (const Glib::RefPtr< const ShortcutAction > & action)
| Sets the new action for self to be action.
Glib::VariantBase | get_arguments () const
| Gets the arguments that are passed when activating the shortcut.
void | set_arguments (const Glib::VariantBase & args) const
| Sets the arguments to pass when activating the shortcut.
Glib::PropertyProxy< Glib::RefPtr< ShortcutTrigger > > | property_trigger ()
| The trigger that triggers this shortcut.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ShortcutTrigger > > | property_trigger () const
| The trigger that triggers this shortcut.
Glib::PropertyProxy< Glib::RefPtr< ShortcutAction > > | property_action ()
| The action that gets activated by this shortcut.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ShortcutAction > > | property_action () const
| The action that gets activated by this shortcut.
Glib::PropertyProxy< Glib::VariantBase > | property_arguments ()
| Arguments passed to activation.
Glib::PropertyProxy_ReadOnly< Glib::VariantBase > | property_arguments () const
| Arguments passed to activation.
Public Member Functions inherited from Glib::Object
| Object (const Object &)=delete
Object & | operator= (const Object &)=delete
| Object (Object &&src) noexcept
Object & | operator= (Object &&src) noexcept
void * | get_data (const QueryQuark &key)
void | set_data (const Quark &key, void *data)
void | set_data (const Quark &key, void *data, DestroyNotify notify)
void | remove_data (const QueryQuark &quark)
void * | steal_data (const QueryQuark &quark)
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false)
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const

## Static Public Member Functions
static GType | get_type ()
| Get the GType for this class, for use with the underlying GObject type system.
static Glib::RefPtr< Shortcut > | create (const Glib::RefPtr< const ShortcutTrigger > & trigger, const Glib::RefPtr< const ShortcutAction > & action)

## Protected Member Functions
| Shortcut (const Glib::RefPtr< const ShortcutTrigger > & trigger, const Glib::RefPtr< const ShortcutAction > & action)
Protected Member Functions inherited from Glib::Object
| Object ()
| Object (const Glib::ConstructParams &construct_params)
| Object (GObject *castitem)
| ~Object () noexcept override
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Symbols
(Note that these are not member symbols.)
Glib::RefPtr< Gtk::Shortcut > | wrap (GtkShortcut * object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Additional Inherited Members
Public Types inherited from Glib::Object
typedef void(*)(gpointer data | DestroyNotify)

## Detailed Description

An object describing a keyboard shortcut.

Gtk::Shortcut is the low level object used for managing keyboard shortcuts. It contains a description of how to trigger the shortcut via a Gtk::ShortcutTrigger and a way to activate the shortcut on a widget via Gtk::ShortcutAction.

The actual work is usually done via Gtk::ShortcutController, which decides if and when to activate a shortcut. Using that controller directly however is rarely necessary as various higher level convenience APIs exist on Widgets that make it easier to use shortcuts in GTK.

Gtk::Shortcut does provide functionality to make it easy for users to work with shortcuts, either by providing informational strings for display purposes or by allowing shortcuts to be configured.

See also
  Gtk::ShortcutController, Gtk::ShortcutAction, Gtk::ShortcutTrigger

Since gtkmm 3.98:

## Constructor & Destructor Documentation

## ◆ Shortcut() [1/2]

Gtk::Shortcut::Shortcut | ( | Shortcut && | src | ) |
| noexcept

## ◆ ~Shortcut()

Gtk::Shortcut::~Shortcut | ( |  | ) |
| overridenoexcept

## ◆ Shortcut() [2/2]

Gtk::Shortcut::Shortcut | ( | const Glib::RefPtr< const ShortcutTrigger > & | trigger,
|  | const Glib::RefPtr< const ShortcutAction > & | action
| ) |  |
| explicitprotected

## Member Function Documentation

## ◆ create()

static Glib::RefPtr< Shortcut > Gtk::Shortcut::create | ( | const Glib::RefPtr< const ShortcutTrigger > & | trigger,
|  | const Glib::RefPtr< const ShortcutAction > & | action
| ) |  |
| static

## ◆ get_action()

Glib::RefPtr< ShortcutAction > Gtk::Shortcut::get_action | ( |  | ) | const

Gets the action that is activated by this shortcut.

Returns
  The action.

## ◆ get_arguments()

Glib::VariantBase Gtk::Shortcut::get_arguments | ( |  | ) | const

Gets the arguments that are passed when activating the shortcut.

Returns
  The arguments.

## ◆ get_trigger()

Glib::RefPtr< ShortcutTrigger > Gtk::Shortcut::get_trigger | ( |  | ) | const

Gets the trigger used to trigger self.

Returns
  The trigger used.

## ◆ get_type()

static GType Gtk::Shortcut::get_type | ( |  | ) |
| static

Get the GType for this class, for use with the underlying GObject type system.

## ◆ gobj() [1/2]

GtkShortcut * Gtk::Shortcut::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkShortcut * Gtk::Shortcut::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkShortcut * Gtk::Shortcut::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

## ◆ operator=()

Shortcut & Gtk::Shortcut::operator= | ( | Shortcut && | src | ) |
| noexcept

## ◆ property_action() [1/2]

Glib::PropertyProxy< Glib::RefPtr< ShortcutAction > > Gtk::Shortcut::property_action | ( |  | ) |

The action that gets activated by this shortcut.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_action() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ShortcutAction > > Gtk::Shortcut::property_action | ( |  | ) | const

The action that gets activated by this shortcut.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_arguments() [1/2]

Glib::PropertyProxy< Glib::VariantBase > Gtk::Shortcut::property_arguments | ( |  | ) |

Arguments passed to activation.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_arguments() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::VariantBase > Gtk::Shortcut::property_arguments | ( |  | ) | const

Arguments passed to activation.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ property_trigger() [1/2]

Glib::PropertyProxy< Glib::RefPtr< ShortcutTrigger > > Gtk::Shortcut::property_trigger | ( |  | ) |

The trigger that triggers this shortcut.

Returns
  A PropertyProxy that allows you to get or set the value of the property, or receive notification when the value of the property changes.

## ◆ property_trigger() [2/2]

Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ShortcutTrigger > > Gtk::Shortcut::property_trigger | ( |  | ) | const

The trigger that triggers this shortcut.

Returns
  A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

## ◆ set_arguments()

void Gtk::Shortcut::set_arguments | ( | const Glib::VariantBase & | args | ) | const

Sets the arguments to pass when activating the shortcut.

Parameters

  args | Arguments to pass when activating self.

## ◆ set_trigger() [1/2]

void Gtk::Shortcut::set_trigger | ( | const Glib::RefPtr< const ShortcutAction > & | action | ) |

Sets the new action for self to be action.

Parameters

  action | The new action. If the action is `nullptr`, the nothing action will be used.

## ◆ set_trigger() [2/2]

void Gtk::Shortcut::set_trigger | ( | const Glib::RefPtr< const ShortcutTrigger > & | trigger | ) |

Sets the new trigger for self to be trigger.

Parameters

  trigger | The new trigger. If the trigger is `nullptr`, the never trigger will be used.

## Friends And Related Symbol Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::Shortcut > wrap | ( | GtkShortcut * | object,
|  | bool | take_copy = `false`
| ) |  |
| related

A Glib::wrap() method for this object.

Parameters

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns
  A C++ instance that wraps this C instance.