Top |
Functions
gboolean | (*GtkShortcutFunc) () |
char * | gtk_shortcut_action_to_string () |
void | gtk_shortcut_action_print () |
GtkShortcutAction * | gtk_shortcut_action_parse_string () |
gboolean | gtk_shortcut_action_activate () |
GtkShortcutAction * | gtk_nothing_action_get () |
GtkShortcutAction * | gtk_callback_action_new () |
GtkShortcutAction * | gtk_mnemonic_action_get () |
GtkShortcutAction * | gtk_activate_action_get () |
GtkShortcutAction * | gtk_signal_action_new () |
const char * | gtk_signal_action_get_signal_name () |
GtkShortcutAction * | gtk_named_action_new () |
const char * | gtk_named_action_get_action_name () |
Object Hierarchy
GObject ╰── GtkShortcutAction ├── GtkSignalAction ├── GtkNothingAction ├── GtkNamedAction ╰── GtkCallbackAction
Description
GtkShortcutAction is the object used to describe what a GtkShortcut should
do when triggered. To activate a GtkShortcutAction manually,
gtk_shortcut_action_activate()
can be called.
GtkShortcutActions contain functions that allow easy presentation to end users as well as being printed for debugging.
All GtkShortcutActions are immutable, you can only specify their properties during construction. If you want to change a action, you have to replace it with a new one. If you need to pass arguments to an action, these are specified by the higher-level GtkShortcut object.
GTK provides various actions:
GtkMnemonicAction: a shortcut action that calls
gtk_widget_mnemonic_activate()
GtkCallbackAction: a shortcut action that invokes a given callback
GtkSignalAction: a shortcut action that emits a given signal
GtkActivateAction: a shortcut action that calls
gtk_widget_activate()
GtkNamedAction: a shortcut action that calls
gtk_widget_activate_action()
GtkNothingAction: a shortcut action that does nothing
Functions
GtkShortcutFunc ()
gboolean (*GtkShortcutFunc) (GtkWidget *widget
,GVariant *args
,gpointer user_data
);
Prototype for shortcuts based on user callbacks.
gtk_shortcut_action_to_string ()
char *
gtk_shortcut_action_to_string (GtkShortcutAction *self
);
Prints the given action into a human-readable string.
This is a small wrapper around gtk_shortcut_action_print()
to help
when debugging.
gtk_shortcut_action_print ()
void gtk_shortcut_action_print (GtkShortcutAction *self
,GString *string
);
Prints the given action 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.
gtk_shortcut_action_parse_string ()
GtkShortcutAction *
gtk_shortcut_action_parse_string (const char *string
);
Tries to parse the given string into an action. On
success, the parsed action is returned. When parsing
failed, NULL
is returned.
The accepted strings are:
nothing
, for GtkNothingActionactivate
, for GtkActivateActionmnemonic-activate
, for GtkMnemonicActionaction(NAME)
, for a GtkNamedAction for the action namedNAME
signal(NAME)
, for a GtkSignalAction for the signalNAME
[constructor]
gtk_shortcut_action_activate ()
gboolean gtk_shortcut_action_activate (GtkShortcutAction *self
,GtkShortcutActionFlags flags
,GtkWidget *widget
,GVariant *args
);
Activates the action on the widget
with the given args
.
Note that some actions ignore the passed in flags
, widget
or args
.
Activation of an action can fail for various reasons. If the action
is not supported by the widget
, if the args
don't match the action
or if the activation otherwise had no effect, FALSE
will be returned.
gtk_nothing_action_get ()
GtkShortcutAction *
gtk_nothing_action_get (void
);
Gets the nothing action. This is an action that does nothing and where activating it always fails.
gtk_callback_action_new ()
GtkShortcutAction * gtk_callback_action_new (GtkShortcutFunc callback
,gpointer data
,GDestroyNotify destroy
);
Create a custom action that calls the given callback
when
activated.
gtk_mnemonic_action_get ()
GtkShortcutAction *
gtk_mnemonic_action_get (void
);
Gets the mnemonic action. This is an action that calls
gtk_widget_mnemonic_activate()
on the given widget upon activation.
gtk_activate_action_get ()
GtkShortcutAction *
gtk_activate_action_get (void
);
Gets the activate action. This is an action that calls gtk_widget_activate()
on the given widget upon activation.
gtk_signal_action_new ()
GtkShortcutAction *
gtk_signal_action_new (const char *signal_name
);
Creates an action that when activated, emits the given action signal on the provided widget unpacking the given args into arguments passed to the signal.
gtk_signal_action_get_signal_name ()
const char *
gtk_signal_action_get_signal_name (GtkSignalAction *self
);
Returns the name of the signal that will be emitted.
gtk_named_action_new ()
GtkShortcutAction *
gtk_named_action_new (const char *name
);
Creates an action that when activated, activates the action given by
the detailed name
on the widget passing the given arguments to it.
See gtk_widget_insert_action_group()
for how to add actions to widgets.
gtk_named_action_get_action_name ()
const char *
gtk_named_action_get_action_name (GtkNamedAction *self
);
Returns the name of the action that will be activated.
Types and Values
enum GtkShortcutActionFlags
List of flags that can be passed to action activation. More flags may be added in the future.
GtkNothingAction
typedef struct _GtkNothingAction GtkNothingAction;
A GtkShortcutAction that does nothing.
GtkCallbackAction
typedef struct _GtkCallbackAction GtkCallbackAction;
A GtkShortcutAction that invokes a callback.
GtkMnemonicAction
typedef struct _GtkMnemonicAction GtkMnemonicAction;
A GtkShortcutAction that calls gtk_widget_mnemonic_activate()
.
GtkActivateAction
typedef struct _GtkActivateAction GtkActivateAction;
A GtkShortcutAction that calls gtk_widget_activate()
.
GtkSignalAction
typedef struct _GtkSignalAction GtkSignalAction;
A GtkShortcutAction that emits a signal.
Signals that are used in this way are referred to as keybinding signals,
and they are expected to be defined with the G_SIGNAL_ACTION
flag.
GtkNamedAction
typedef struct _GtkNamedAction GtkNamedAction;
A GtkShortcutAction that activates an action by name.