Synopsis
#include <gtk/gtk.h>
GtkActionGroup;
GtkActionGroup* gtk_action_group_new (const gchar *name);
const gchar* gtk_action_group_get_name (GtkActionGroup *action_group);
gboolean gtk_action_group_get_sensitive (GtkActionGroup *action_group);
void gtk_action_group_set_sensitive (GtkActionGroup *action_group,
gboolean sensitive);
gboolean gtk_action_group_get_visible (GtkActionGroup *action_group);
void gtk_action_group_set_visible (GtkActionGroup *action_group,
gboolean visible);
GtkAction* gtk_action_group_get_action (GtkActionGroup *action_group,
const gchar *action_name);
GList* gtk_action_group_list_actions (GtkActionGroup *action_group);
void gtk_action_group_add_action (GtkActionGroup *action_group,
GtkAction *action);
void gtk_action_group_add_action_with_accel
(GtkActionGroup *action_group,
GtkAction *action,
const gchar *accelerator);
void gtk_action_group_remove_action (GtkActionGroup *action_group,
GtkAction *action);
GtkActionEntry;
void gtk_action_group_add_actions (GtkActionGroup *action_group,
const GtkActionEntry *entries,
guint n_entries,
gpointer user_data);
void gtk_action_group_add_actions_full (GtkActionGroup *action_group,
const GtkActionEntry *entries,
guint n_entries,
gpointer user_data,
GDestroyNotify destroy);
GtkToggleActionEntry;
void gtk_action_group_add_toggle_actions (GtkActionGroup *action_group,
const GtkToggleActionEntry *entries,
guint n_entries,
gpointer user_data);
void gtk_action_group_add_toggle_actions_full
(GtkActionGroup *action_group,
const GtkToggleActionEntry *entries,
guint n_entries,
gpointer user_data,
GDestroyNotify destroy);
GtkRadioActionEntry;
void gtk_action_group_add_radio_actions (GtkActionGroup *action_group,
const GtkRadioActionEntry *entries,
guint n_entries,
gint value,
GCallback on_change,
gpointer user_data);
void gtk_action_group_add_radio_actions_full
(GtkActionGroup *action_group,
const GtkRadioActionEntry *entries,
guint n_entries,
gint value,
GCallback on_change,
gpointer user_data,
GDestroyNotify destroy);
void gtk_action_group_set_translate_func (GtkActionGroup *action_group,
GtkTranslateFunc func,
gpointer data,
GDestroyNotify notify);
void gtk_action_group_set_translation_domain
(GtkActionGroup *action_group,
const gchar *domain);
const gchar* gtk_action_group_translate_string (GtkActionGroup *action_group,
const gchar *string);
Properties"name" gchar* : Read / Write / Construct Only "sensitive" gboolean : Read / Write "visible" gboolean : Read / Write DescriptionActions are organised into groups. An action group is essentially a map from names to GtkAction objects. All actions that would make sense to use in a particular context should be in a single group. Multiple action groups may be used for a particular user interface. In fact, it is expected that most nontrivial applications will make use of multiple groups. For example, in an application that can edit multiple documents, one group holding global actions (e.g. quit, about, new), and one group per document holding actions that act on that document (eg. save, cut/copy/paste, etc). Each window's menus would be constructed from a combination of two action groups.
Accelerators are handled by the GTK+ accelerator map. All actions are assigned an
accelerator path (which normally has the form
GtkActionGroup as GtkBuildableThe GtkActionGroup implementation of the GtkBuildable interface accepts GtkAction objects as <child> elements in UI definitions. Note that it is probably more common to define actions and action groups in the code, since they are directly related to what the code can do. The GtkActionGroup implementation of the GtkBuildable interface supports a custom <accelerator> element, which has attributes named key and modifiers and allows to specify accelerators. This is similar to the <accelerator> element of GtkWidget, the main difference is that it doesn't allow you to specify a signal. Example 31. A GtkDialog UI definition fragment.
<object class="GtkActionGroup" id="actiongroup">
<child>
<object class="GtkAction" id="About">
<property name="name">About</property>
<property name="stock_id">gtk-about</property>
<signal handler="about_activate" name="activate"/>
</object>
<accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/>
</child>
</object>
DetailsGtkActionGrouptypedef struct _GtkActionGroup GtkActionGroup; The GtkActionGroup struct contains only private members and should not be accessed directly. gtk_action_group_new ()GtkActionGroup* gtk_action_group_new (const gchar *name); Creates a new GtkActionGroup object. The name of the action group is used when associating keybindings with the actions.
Since 2.4 gtk_action_group_get_name ()const gchar* gtk_action_group_get_name (GtkActionGroup *action_group); Gets the name of the action group.
Since 2.4 gtk_action_group_get_sensitive ()gboolean gtk_action_group_get_sensitive (GtkActionGroup *action_group);
Returns
Since 2.4 gtk_action_group_set_sensitive ()void gtk_action_group_set_sensitive (GtkActionGroup *action_group, gboolean sensitive);
Changes the sensitivity of
Since 2.4 gtk_action_group_get_visible ()gboolean gtk_action_group_get_visible (GtkActionGroup *action_group);
Returns
Since 2.4 gtk_action_group_set_visible ()void gtk_action_group_set_visible (GtkActionGroup *action_group, gboolean visible);
Changes the visible of
Since 2.4 gtk_action_group_get_action ()GtkAction* gtk_action_group_get_action (GtkActionGroup *action_group, const gchar *action_name); Looks up an action in the action group by name.
Since 2.4 gtk_action_group_list_actions ()GList* gtk_action_group_list_actions (GtkActionGroup *action_group); Lists the actions in the action group.
Since 2.4 gtk_action_group_add_action ()void gtk_action_group_add_action (GtkActionGroup *action_group, GtkAction *action);
Adds an action object to the action group. Note that this function
does not set up the accel path of the action, which can lead to problems
if a user tries to modify the accelerator of a menuitem associated with
the action. Therefore you must either set the accel path yourself with
Since 2.4 gtk_action_group_add_action_with_accel ()void gtk_action_group_add_action_with_accel
(GtkActionGroup *action_group,
GtkAction *action,
const gchar *accelerator);
Adds an action object to the action group and sets up the accelerator.
If
Accel paths are set to
Since 2.4 gtk_action_group_remove_action ()void gtk_action_group_remove_action (GtkActionGroup *action_group, GtkAction *action); Removes an action object from the action group.
Since 2.4 GtkActionEntrytypedef struct {
const gchar *name;
const gchar *stock_id;
const gchar *label;
const gchar *accelerator;
const gchar *tooltip;
GCallback callback;
} GtkActionEntry;
GtkActionEntry structs are used with
gtk_action_group_add_actions ()void gtk_action_group_add_actions (GtkActionGroup *action_group, const GtkActionEntry *entries, guint n_entries, gpointer user_data); This is a convenience function to create a number of actions and add them to the action group.
The "activate" signals of the actions are connected to the callbacks and
their accel paths are set to
Since 2.4 gtk_action_group_add_actions_full ()void gtk_action_group_add_actions_full (GtkActionGroup *action_group, const GtkActionEntry *entries, guint n_entries, gpointer user_data, GDestroyNotify destroy);
This variant of
Since 2.4 GtkToggleActionEntrytypedef struct {
const gchar *name;
const gchar *stock_id;
const gchar *label;
const gchar *accelerator;
const gchar *tooltip;
GCallback callback;
gboolean is_active;
} GtkToggleActionEntry;
GtkToggleActionEntry structs are used with
gtk_action_group_add_toggle_actions ()void gtk_action_group_add_toggle_actions (GtkActionGroup *action_group, const GtkToggleActionEntry *entries, guint n_entries, gpointer user_data); This is a convenience function to create a number of toggle actions and add them to the action group.
The "activate" signals of the actions are connected to the callbacks and
their accel paths are set to
Since 2.4 gtk_action_group_add_toggle_actions_full ()void gtk_action_group_add_toggle_actions_full
(GtkActionGroup *action_group,
const GtkToggleActionEntry *entries,
guint n_entries,
gpointer user_data,
GDestroyNotify destroy);
This variant of
Since 2.4 GtkRadioActionEntrytypedef struct {
const gchar *name;
const gchar *stock_id;
const gchar *label;
const gchar *accelerator;
const gchar *tooltip;
gint value;
} GtkRadioActionEntry;
GtkRadioActionEntry structs are used with
gtk_action_group_add_radio_actions ()void gtk_action_group_add_radio_actions (GtkActionGroup *action_group, const GtkRadioActionEntry *entries, guint n_entries, gint value, GCallback on_change, gpointer user_data); This is a convenience routine to create a group of radio actions and add them to the action group.
The "changed" signal of the first radio action is connected to the
Since 2.4 gtk_action_group_add_radio_actions_full ()void gtk_action_group_add_radio_actions_full
(GtkActionGroup *action_group,
const GtkRadioActionEntry *entries,
guint n_entries,
gint value,
GCallback on_change,
gpointer user_data,
GDestroyNotify destroy);
This variant of
Since 2.4 gtk_action_group_set_translate_func ()void gtk_action_group_set_translate_func (GtkActionGroup *action_group, GtkTranslateFunc func, gpointer data, GDestroyNotify notify);
Sets a function to be used for translating the
If you're using
Since 2.4 gtk_action_group_set_translation_domain ()void gtk_action_group_set_translation_domain
(GtkActionGroup *action_group,
const gchar *domain);
Sets the translation domain and uses
If you're not using
Since 2.4 gtk_action_group_translate_string ()const gchar* gtk_action_group_translate_string (GtkActionGroup *action_group, const gchar *string);
Translates a string using the specified
Since 2.6 Property DetailsThe
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
the group |
|
the action |
|
the proxy |
|
user data set when the signal handler was connected. |
Since 2.4
"disconnect-proxy" signalvoid user_function (GtkActionGroup *action_group, GtkAction *action, GtkWidget *proxy, gpointer user_data)
The ::disconnect-proxy signal is emitted after disconnecting a proxy from an action in the group.
GtkUIManager proxies the signal and provides global notification just before any action is connected to a proxy, which is probably more convenient to use.
|
the group |
|
the action |
|
the proxy |
|
user data set when the signal handler was connected. |
Since 2.4
"post-activate" signalvoid user_function (GtkActionGroup *action_group, GtkAction *action, gpointer user_data)
The ::post-activate signal is emitted just after the action in the
action_group is activated
This is intended for GtkUIManager to proxy the signal and provide global notification just after any action is activated.
|
the group |
|
the action |
|
user data set when the signal handler was connected. |
Since 2.4
"pre-activate" signalvoid user_function (GtkActionGroup *action_group, GtkAction *action, gpointer user_data)
The ::pre-activate signal is emitted just before the action in the
action_group is activated
This is intended for GtkUIManager to proxy the signal and provide global notification just before any action is activated.
|
the group |
|
the action |
|
user data set when the signal handler was connected. |
Since 2.4