GtkShortcutTrigger

GtkShortcutTrigger — Triggers to track if shortcuts should be activated

Functions

Types and Values

  GtkShortcutTrigger

Object Hierarchy

    GObject
    ╰── GtkShortcutTrigger

Includes

#include <gtk/gtk.h>

Description

GtkShortcutTrigger is the object used to track if a GtkShortcut should be activated. For this purpose, gtk_shortcut_trigger_trigger() can be called on a GdkEvent.

GtkShortcutTriggers contain functions that allow easy presentation to end users as well as being printed for debugging.

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

Functions

gtk_shortcut_trigger_trigger ()

GtkShortcutTriggerMatch
gtk_shortcut_trigger_trigger (GtkShortcutTrigger *self,
                              GdkEvent *event,
                              gboolean enable_mnemonics);

Checks if the given event triggers self .

Parameters

self

a GtkShortcutTrigger

 

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


gtk_shortcut_trigger_hash ()

guint
gtk_shortcut_trigger_hash (gconstpointer trigger);

Generates a hash value for a GtkShortcutTrigger.

The output of this function is guaranteed to be the same for a given value only per-process. It may change between different processor architectures or even different versions of GTK. Do not use this function as a basis for building protocols or file formats.

The types of trigger is gconstpointer only to allow use of this function with GHashTable. They must each be a GtkShortcutTrigger.

Parameters

trigger

a GtkShortcutTrigger.

[type GtkShortcutTrigger]

Returns

a hash value corresponding to trigger


gtk_shortcut_trigger_equal ()

gboolean
gtk_shortcut_trigger_equal (gconstpointer trigger1,
                            gconstpointer trigger2);

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 GHashTable. They must each be a GtkShortcutTrigger.

Parameters

trigger1

a GtkShortcutTrigger.

[type GtkShortcutTrigger]

trigger2

a GtkShortcutTrigger.

[type GtkShortcutTrigger]

Returns

TRUE if trigger1 and trigger2 are equal


gtk_shortcut_trigger_compare ()

gint
gtk_shortcut_trigger_compare (gconstpointer trigger1,
                              gconstpointer trigger2);

The types of trigger1 and trigger2 are gconstpointer only to allow use of this function as a GCompareFunc. They must each be a GtkShortcutTrigger.

Parameters

trigger1

a GtkShortcutTrigger.

[type GtkShortcutTrigger]

trigger2

a GtkShortcutTrigger.

[type GtkShortcutTrigger]

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 .


gtk_shortcut_trigger_to_string ()

char *
gtk_shortcut_trigger_to_string (GtkShortcutTrigger *self);

Prints the given trigger into a human-readable string. This is a small wrapper around gtk_shortcut_trigger_print() to help when debugging.

Parameters

self

a GtkShortcutTrigger

 

Returns

a new string.

[transfer full]


gtk_shortcut_trigger_print ()

void
gtk_shortcut_trigger_print (GtkShortcutTrigger *self,
                            GString *string);

Prints the given trigger into a string for the developer. This is meant for debugging and logging.

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

Parameters

self

a GtkShortcutTrigger

 

string

a GString to print into

 

gtk_shortcut_trigger_to_label ()

char *
gtk_shortcut_trigger_to_label (GtkShortcutTrigger *self,
                               GdkDisplay *display);

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

self

a GtkShortcutTrigger

 

display

GdkDisplay to print for

 

Returns

a new string.

[transfer full]


gtk_shortcut_trigger_print_label ()

gboolean
gtk_shortcut_trigger_print_label (GtkShortcutTrigger *self,
                                  GdkDisplay *display,
                                  GString *string);

Prints the given trigger into a string. 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

self

a GtkShortcutTrigger

 

display

GdkDisplay to print for

 

string

a GString to print into

 

Returns

TRUE if something was printed or FALSE if the trigger did not have a textual representation suitable for end users.


gtk_keyval_trigger_get_modifiers ()

GdkModifierType
gtk_keyval_trigger_get_modifiers (GtkKeyvalTrigger *self);

Gets the modifiers that must be present to succeed triggering self .

Parameters

self

a keyval GtkShortcutTrigger

 

Returns

the modifiers


gtk_keyval_trigger_get_keyval ()

guint
gtk_keyval_trigger_get_keyval (GtkKeyvalTrigger *self);

Gets the keyval that must be pressed to succeed triggering self .

Parameters

self

a keyval GtkShortcutTrigger

 

Returns

the keyval


gtk_mnemonic_trigger_get_keyval ()

guint
gtk_mnemonic_trigger_get_keyval (GtkMnemonicTrigger *self);

Gets the keyval that must be pressed to succeed triggering self .

Parameters

self

a mnemonic GtkShortcutTrigger

 

Returns

the keyval

See Also

GtkShortcut