gtkmm: Gtk::ShortcutTrigger Class Reference

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

#include <gtkmm/shortcuttrigger.h>

Inheritance diagram for Gtk::ShortcutTrigger:

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...

 
- Public Member Functions inherited from Glib::Object
 Object (const Object &)=delete
 
Objectoperator= (const Object &)=delete
 
 Object (Object &&src) noexcept
 
Objectoperator= (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::Objectwrap (GObject *object, bool take_copy=false)
 
- Public Member Functions inherited from Glib::ObjectBase
 ObjectBase (const ObjectBase &)=delete
 
ObjectBaseoperator= (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 ()
 
trackableoperator= (const trackable &src)
 
trackableoperator= (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< ShortcutTriggerparse_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
 
ObjectBaseoperator= (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::ShortcutTriggerwrap (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

Gtk::ShortcutTrigger::ShortcutTrigger ( ShortcutTrigger&&  src)
noexcept
Gtk::ShortcutTrigger::~ShortcutTrigger ( )
overridenoexcept
Gtk::ShortcutTrigger::ShortcutTrigger ( )
protected

Member Function Documentation

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.
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.
static GType Gtk::ShortcutTrigger::get_type ( )
static

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

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

Provides access to the underlying C GObject.

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

Provides access to the underlying C GObject.

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.

ShortcutTrigger& Gtk::ShortcutTrigger::operator= ( ShortcutTrigger&&  src)
noexcept
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 or nullptr on error.
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.
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.
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

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.