gtkmm  4.8.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gtk::Shortcut Class Reference

An object describing a keyboard shortcut. More...

#include <gtkmm/shortcut.h>

Inherits Glib::Object.

Public Member Functions

 Shortcut (Shortcut && src) noexcept
 
Shortcutoperator= (Shortcut && src) noexcept
 
 ~Shortcut () noexcept override
 
GtkShortcut * gobj ()
 Provides access to the underlying C GObject. More...
 
const GtkShortcut * gobj () const
 Provides access to the underlying C GObject. More...
 
GtkShortcut * gobj_copy ()
 Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More...
 
Glib::RefPtr< ShortcutTriggerget_trigger () const
 Gets the trigger used to trigger self. More...
 
void set_trigger (const Glib::RefPtr< const ShortcutTrigger > & trigger)
 Sets the new trigger for self to be trigger. More...
 
Glib::RefPtr< ShortcutActionget_action () const
 Gets the action that is activated by this shortcut. More...
 
void set_trigger (const Glib::RefPtr< const ShortcutAction > & action)
 Sets the new action for self to be action. More...
 
Glib::VariantBase get_arguments () const
 Gets the arguments that are passed when activating the shortcut. More...
 
void set_arguments (const Glib::VariantBase & args) const
 Sets the arguments to pass when activating the shortcut. More...
 
Glib::PropertyProxy< Glib::RefPtr< ShortcutTrigger > > property_trigger ()
 The trigger that triggers this shortcut. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ShortcutTrigger > > property_trigger () const
 The trigger that triggers this shortcut. More...
 
Glib::PropertyProxy< Glib::RefPtr< ShortcutAction > > property_action ()
 The action that gets activated by this shortcut. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< ShortcutAction > > property_action () const
 The action that gets activated by this shortcut. More...
 
Glib::PropertyProxy< Glib::VariantBase > property_arguments ()
 Arguments passed to activation. More...
 
Glib::PropertyProxy_ReadOnly< Glib::VariantBase > property_arguments () const
 Arguments passed to activation. More...
 

Static Public Member Functions

static GType get_type ()
 Get the GType for this class, for use with the underlying GObject type system. More...
 
static Glib::RefPtr< Shortcutcreate (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)
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gtk::Shortcutwrap (GtkShortcut * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

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
argsArguments 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
actionThe 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
triggerThe new trigger. If the trigger is nullptr, the never trigger will be used.

Friends And Related Function Documentation

◆ wrap()

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

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

Parameters
objectThe C instance.
take_copyFalse 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.