1 <!-- ##### SECTION Title ##### -->
4 <!-- ##### SECTION Short_Description ##### -->
7 <!-- ##### SECTION Long_Description ##### -->
9 Actions are organised into groups. An action group is essentially a
10 map from names to #GtkAction objects.
13 All actions that would make sense to use in a particular context
14 should be in a single group. Multiple action groups may be used for a
15 particular user interface. In fact, it is expected that most nontrivial
16 applications will make use of multiple groups. For example, in an application
17 that can edit multiple documents, one group holding global actions
18 (e.g. quit, about, new), and one group per document holding actions that
19 act on that document (eg. save, cut/copy/paste, etc). Each window's menus
20 would be constructed from a combination of two action groups.
22 <para id="Action-Accel">
23 Accelerators are handled by the GTK+ accelerator map. All actions are assigned an
24 accelerator path (which normally has the form
25 <literal><Actions>/<replaceable>group-name</replaceable>/<replaceable>action-name</replaceable></literal>)
26 and a shortcut is associated with this accelerator path. All menuitems and
27 toolitems take on this accelerator path. The GTK+ accelerator map code makes
28 sure that the correct shortcut is displayed next to the menu item.
31 <refsect2 id="GtkActionGroup-BUILDER-UI">
32 <title>GtkActionGroup as GtkBuildable</title>
34 The GtkActionGroup implementation of the GtkBuildable interface accepts
35 GtkAction objects as <child> elements in UI definitions.
38 Note that it is probably more common to define actions and action groups
39 in the code, since they are directly related to what the code can do.
42 The GtkActionGroup implementation of the GtkBuildable interface supports a
43 custom <accelerator> element, which has attributes named key and
44 modifiers and allows to specify accelerators. This is similar to the
45 <accelerator> element of GtkWidget, the main difference is that
46 it doesn't allow you to specify a signal.
49 <title>A <structname>GtkDialog</structname> UI definition fragment.</title>
50 <programlisting><![CDATA[
51 <object class="GtkActionGroup" id="actiongroup">
53 <object class="GtkAction" id="About">
54 <property name="name">About</property>
55 <property name="stock_id">gtk-about</property>
56 <signal handler="about_activate" name="activate"/>
58 <accelerator key="F1" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK"/>
65 <!-- ##### SECTION See_Also ##### -->
70 <!-- ##### SECTION Stability_Level ##### -->
73 <!-- ##### SECTION Image ##### -->
76 <!-- ##### STRUCT GtkActionGroup ##### -->
78 The <structname>GtkActionGroup</structname> struct contains only private
79 members and should not be accessed directly.
83 <!-- ##### SIGNAL GtkActionGroup::connect-proxy ##### -->
88 @actiongroup: the object which received the signal.
92 <!-- ##### SIGNAL GtkActionGroup::disconnect-proxy ##### -->
97 @actiongroup: the object which received the signal.
101 <!-- ##### SIGNAL GtkActionGroup::post-activate ##### -->
106 @actiongroup: the object which received the signal.
109 <!-- ##### SIGNAL GtkActionGroup::pre-activate ##### -->
114 @actiongroup: the object which received the signal.
117 <!-- ##### ARG GtkActionGroup:name ##### -->
122 <!-- ##### ARG GtkActionGroup:sensitive ##### -->
127 <!-- ##### ARG GtkActionGroup:visible ##### -->
132 <!-- ##### FUNCTION gtk_action_group_new ##### -->
141 <!-- ##### FUNCTION gtk_action_group_get_name ##### -->
150 <!-- ##### FUNCTION gtk_action_group_get_sensitive ##### -->
159 <!-- ##### FUNCTION gtk_action_group_set_sensitive ##### -->
168 <!-- ##### FUNCTION gtk_action_group_get_visible ##### -->
177 <!-- ##### FUNCTION gtk_action_group_set_visible ##### -->
186 <!-- ##### FUNCTION gtk_action_group_get_action ##### -->
196 <!-- ##### FUNCTION gtk_action_group_list_actions ##### -->
205 <!-- ##### FUNCTION gtk_action_group_add_action ##### -->
214 <!-- ##### FUNCTION gtk_action_group_add_action_with_accel ##### -->
224 <!-- ##### FUNCTION gtk_action_group_remove_action ##### -->
233 <!-- ##### STRUCT GtkActionEntry ##### -->
235 <structname>GtkActionEntry</structname> structs are used with
236 gtk_action_group_add_actions() to construct actions.
239 @name: The name of the action.
240 @stock_id: The stock id for the action, or the name of an icon from the icon
242 @label: The label for the action. This field should typically be marked for
243 translation, see gtk_action_group_set_translation_domain(). If @label
244 is %NULL, the label of the stock item with id @stock_id is used.
245 @accelerator: The accelerator for the action, in the format understood by
246 gtk_accelerator_parse().
247 @tooltip: The tooltip for the action. This field should typically be marked
248 for translation, see gtk_action_group_set_translation_domain().
249 @callback: The function to call when the action is activated.
251 <!-- ##### FUNCTION gtk_action_group_add_actions ##### -->
262 <!-- ##### FUNCTION gtk_action_group_add_actions_full ##### -->
274 <!-- ##### STRUCT GtkToggleActionEntry ##### -->
276 <structname>GtkToggleActionEntry</structname> structs are used with
277 gtk_action_group_add_toggle_actions() to construct toggle actions.
280 @name: The name of the action.
281 @stock_id: The stock id for the action, or the name of an icon from the icon
283 @label: The label for the action. This field should typically be marked for
284 translation, see gtk_action_group_set_translation_domain().
285 @accelerator: The accelerator for the action, in the format understood by
286 gtk_accelerator_parse().
287 @tooltip: The tooltip for the action. This field should typically be marked
288 for translation, see gtk_action_group_set_translation_domain().
289 @callback: The function to call when the action is activated.
290 @is_active: The initial state of the toggle action.
292 <!-- ##### FUNCTION gtk_action_group_add_toggle_actions ##### -->
303 <!-- ##### FUNCTION gtk_action_group_add_toggle_actions_full ##### -->
315 <!-- ##### STRUCT GtkRadioActionEntry ##### -->
317 <structname>GtkRadioActionEntry</structname> structs are used with
318 gtk_action_group_add_radio_actions() to construct groups of radio actions.
321 @name: The name of the action.
322 @stock_id: The stock id for the action, or the name of an icon from the icon
324 @label: The label for the action. This field should typically be marked for
325 translation, see gtk_action_group_set_translation_domain().
326 @accelerator: The accelerator for the action, in the format understood by
327 gtk_accelerator_parse().
328 @tooltip: The tooltip for the action. This field should typically be marked for
329 translation, see gtk_action_group_set_translation_domain().
330 @value: The value to set on the radio action. See gtk_radio_action_get_current_value().
332 <!-- ##### FUNCTION gtk_action_group_add_radio_actions ##### -->
345 <!-- ##### FUNCTION gtk_action_group_add_radio_actions_full ##### -->
359 <!-- ##### FUNCTION gtk_action_group_set_translate_func ##### -->
370 <!-- ##### FUNCTION gtk_action_group_set_translation_domain ##### -->
379 <!-- ##### FUNCTION gtk_action_group_translate_string ##### -->