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

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

#include <gtkmm/shortcuttrigger.h>

Inheritance diagram for Gtk::ShortcutTrigger:
Inheritance graph
[legend]

Public Member Functions

 ShortcutTrigger (ShortcutTrigger && src) noexcept
 
ShortcutTriggeroperator= (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...
 

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

Protected Member Functions

 ShortcutTrigger ()
 

Related Functions

(Note that these are not member functions.)

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

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 ( )
overridenoexcept

◆ 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
trigger2A 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
trigger2A 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:

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
stringThe 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
displayGdk::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
eventThe event to check.
enable_mnemonicstrue 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
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.