gtkmm 4.10.0

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

Triggers to track if shortcuts should be activated. More...

`#include <gtkmm/shortcuttrigger.h>`

Inheritance diagram for Gtk::ShortcutTrigger:
[legend]

## Public Member Functions
| ShortcutTrigger (ShortcutTrigger && src) noexcept
ShortcutTrigger & | operator= (ShortcutTrigger && src) noexcept
| ~ShortcutTrigger () noexcept override
GtkShortcutTrigger * | gobj ()
| Provides access to the underlying C GObject. More...
const GtkShortcutTrigger * | gobj () const
| Provides access to the underlying C GObject. More...
GtkShortcutTrigger * | 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::ustring | to_string () const
| Prints the given trigger into a human-readable string. More...
Glib::ustring | to_label (const Glib::RefPtr< const Gdk::Display > & display) const
| Gets textual representation for the given trigger. More...
bool | equal (const Glib::RefPtr< const ShortcutTrigger > & trigger2) const
| Checks if trigger1 and trigger2 trigger under the same conditions. More...
int | compare (const Glib::RefPtr< const ShortcutTrigger > & trigger2) const
| The types of trigger1 and trigger2 are `gconstpointer` only to allow use of this function as a `CompareFunc`. More...
Gdk::KeyMatch | trigger (const Glib::RefPtr< const Gdk::Event > & event, bool enable_mnemonics) const
| Checks if the given event triggers self. More...
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
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## 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< ShortcutTrigger > | parse_string (const Glib::ustring &string)
| Tries to parse the given string into a trigger. More...

## Protected Member Functions
| ShortcutTrigger ()
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 Functions
(Note that these are not member functions.)
Glib::RefPtr< Gtk::ShortcutTrigger > | wrap (GtkShortcutTrigger * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

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

## Detailed Description

Triggers to track if shortcuts should be activated.

Gtk::ShortcutTrigger is the object used to track if a Gtk::Shortcut should be activated. For this purpose, trigger() can be called on a Gdk::Event.

ShortcutTriggers contain methods that allow easy presentation to end users as well as being printed for debugging.

All ShortcutTriggers are immutable, you can only specify their properties during construction. If you want to change a trigger, you have to replace it with a new one.

See also
  Gtk::Shortcut

Since gtkmm 3.98:

## Constructor & Destructor Documentation

## ◆ ShortcutTrigger() [1/2]

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

## ◆ ~ShortcutTrigger()

Gtk::ShortcutTrigger::~ShortcutTrigger | ( |  | ) |
| override noexcept

## ◆ ShortcutTrigger() [2/2]

Gtk::ShortcutTrigger::ShortcutTrigger | ( |  | ) |
| protected

## Member Function Documentation

## ◆ compare()

int Gtk::ShortcutTrigger::compare | ( | const Glib::RefPtr< const ShortcutTrigger > & | trigger2 | ) | const

The types of trigger1 and trigger2 are `gconstpointer` only to allow use of this function as a `CompareFunc`.

They must each be a `Gtk::ShortcutTrigger`.

Parameters

  trigger2 | A `Gtk::ShortcutTrigger`.

Returns
  An integer less than, equal to, or greater than zero if trigger1 is found, respectively, to be less than, to match, or be greater than trigger2.

## ◆ equal()

bool Gtk::ShortcutTrigger::equal | ( | const Glib::RefPtr< const ShortcutTrigger > & | trigger2 | ) | const

Checks if trigger1 and trigger2 trigger under the same conditions.

The types of one and two are `gconstpointer` only to allow use of this function with `HashTable`. They must each be a `Gtk::ShortcutTrigger`.

Parameters

  trigger2 | A `Gtk::ShortcutTrigger`.

Returns
  `true` if trigger1 and trigger2 are equal.

## ◆ get_type()

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

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

## ◆ gobj() [1/2]

GtkShortcutTrigger* Gtk::ShortcutTrigger::gobj | ( |  | ) |
| inline

Provides access to the underlying C GObject.

## ◆ gobj() [2/2]

const GtkShortcutTrigger* Gtk::ShortcutTrigger::gobj | ( |  | ) | const
| inline

Provides access to the underlying C GObject.

## ◆ gobj_copy()

GtkShortcutTrigger* Gtk::ShortcutTrigger::gobj_copy | ( |  | ) |

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

## ◆ operator=()

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

## ◆ parse_string()

static Glib::RefPtr<ShortcutTrigger> Gtk::ShortcutTrigger::parse_string | ( | const Glib::ustring & | string | ) |
| static

Tries to parse the given string into a trigger.

On success, the parsed trigger is returned. When parsing failed, `nullptr` is returned.

The accepted strings are:

- `never`, for `Gtk::NeverTrigger`
- a string parsed by gtk_accelerator_parse(), for a `Gtk::KeyvalTrigger`, e.g. `<Control>C`
- underscore, followed by a single character, for `Gtk::MnemonicTrigger`, e.g. `_l`
- two valid trigger strings, separated by a `|` character, for a `Gtk::AlternativeTrigger`: `<Control>q|<Control>w`

Note that you will have to escape the `<` and `>` characters when specifying triggers in XML files, such as GtkBuilder ui files. Use `<` instead of `<` and `>` instead of `>`.

Parameters

  string | The string to parse.

Returns
  A new `Gtk::ShortcutTrigger`.

## ◆ to_label()

Glib::ustring Gtk::ShortcutTrigger::to_label | ( | const Glib::RefPtr< const Gdk::Display > & | display | ) | const

Gets textual representation for the given trigger.

This function is returning a translated string for presentation to end users for example in menu items or in help texts.

The display in use may influence the resulting string in various forms, such as resolving hardware keycodes or by causing display-specific modifier names.

The form of the representation may change at any time and is not guaranteed to stay identical.

Parameters

  display | `Gdk::Display` to print for.

Returns
  A new string.

## ◆ to_string()

Glib::ustring Gtk::ShortcutTrigger::to_string | ( |  | ) | const

Prints the given trigger into a human-readable string.

This is meant for debugging and logging. The form of the representation may change at any time and is not guaranteed to stay identical.

Returns
  A new string.

## ◆ trigger()

Gdk::KeyMatch Gtk::ShortcutTrigger::trigger | ( | const Glib::RefPtr< const Gdk::Event > & | event,
|  | bool | enable_mnemonics
| ) |  | const

Checks if the given event triggers self.

Parameters

  event | The event to check.
  enable_mnemonics | `true` if mnemonics should trigger. Usually the value of this property is determined by checking that the passed in event is a Key event and has the right modifiers set.

Returns
  Whether the event triggered the shortcut.

## Friends And Related Function Documentation

## ◆ wrap()

Glib::RefPtr< Gtk::ShortcutTrigger > wrap | ( | GtkShortcutTrigger * | 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.