2 * GTK - The GIMP Toolkit
3 * Copyright (C) 1998, 1999 Red Hat, Inc.
6 * This Library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This Library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with the Gnome Library; see the file COPYING.LIB. If not,
18 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 * Author: James Henstridge <james@daa.com.au>
25 * Modified by the GTK+ Team and others 2003. See the AUTHORS
26 * file for a list of people on the GTK+ Team. See the ChangeLog
27 * files for a list of changes. These files are distributed with
28 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
31 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
32 #error "Only <gtk/gtk.h> can be included directly."
35 #ifndef __GTK_ACTION_GROUP_H__
36 #define __GTK_ACTION_GROUP_H__
38 #include <gtk/gtkaction.h>
39 #include <gtk/gtktypeutils.h> /* for GtkTranslateFunc */
43 #define GTK_TYPE_ACTION_GROUP (gtk_action_group_get_type ())
44 #define GTK_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACTION_GROUP, GtkActionGroup))
45 #define GTK_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_ACTION_GROUP, GtkActionGroupClass))
46 #define GTK_IS_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACTION_GROUP))
47 #define GTK_IS_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_ACTION_GROUP))
48 #define GTK_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_TYPE_ACTION_GROUP, GtkActionGroupClass))
50 typedef struct _GtkActionGroup GtkActionGroup;
51 typedef struct _GtkActionGroupPrivate GtkActionGroupPrivate;
52 typedef struct _GtkActionGroupClass GtkActionGroupClass;
53 typedef struct _GtkActionEntry GtkActionEntry;
54 typedef struct _GtkToggleActionEntry GtkToggleActionEntry;
55 typedef struct _GtkRadioActionEntry GtkRadioActionEntry;
57 struct _GtkActionGroup
63 GtkActionGroupPrivate *GSEAL (private_data);
66 struct _GtkActionGroupClass
68 GObjectClass parent_class;
70 GtkAction *(* get_action) (GtkActionGroup *action_group,
71 const gchar *action_name);
73 /* Padding for future expansion */
74 void (*_gtk_reserved1) (void);
75 void (*_gtk_reserved2) (void);
76 void (*_gtk_reserved3) (void);
77 void (*_gtk_reserved4) (void);
82 * @name: The name of the action.
83 * @stock_id: The stock id for the action, or the name of an icon from the
85 * @label: The label for the action. This field should typically be marked
86 * for translation, see gtk_action_group_set_translation_domain(). If
87 * @label is %NULL, the label of the stock item with id @stock_id is used.
88 * @accelerator: The accelerator for the action, in the format understood by
89 * gtk_accelerator_parse().
90 * @tooltip: The tooltip for the action. This field should typically be
91 * marked for translation, see gtk_action_group_set_translation_domain().
92 * @callback: The function to call when the action is activated.
94 * #GtkActionEntry structs are used with gtk_action_group_add_actions() to
97 struct _GtkActionEntry
100 const gchar *stock_id;
102 const gchar *accelerator;
103 const gchar *tooltip;
108 * GtkToggleActionEntry:
109 * @name: The name of the action.
110 * @stock_id: The stock id for the action, or the name of an icon from the
112 * @label: The label for the action. This field should typically be marked
113 * for translation, see gtk_action_group_set_translation_domain().
114 * @accelerator: The accelerator for the action, in the format understood by
115 * gtk_accelerator_parse().
116 * @tooltip: The tooltip for the action. This field should typically be
117 * marked for translation, see gtk_action_group_set_translation_domain().
118 * @callback: The function to call when the action is activated.
119 * @is_active: The initial state of the toggle action.
121 * #GtkToggleActionEntry structs are used with
122 * gtk_action_group_add_toggle_actions() to construct toggle actions.
124 struct _GtkToggleActionEntry
127 const gchar *stock_id;
129 const gchar *accelerator;
130 const gchar *tooltip;
136 * GtkRadioActionEntry:
137 * @name: The name of the action.
138 * @stock_id: The stock id for the action, or the name of an icon from the
140 * @label: The label for the action. This field should typically be marked
141 * for translation, see gtk_action_group_set_translation_domain().
142 * @accelerator: The accelerator for the action, in the format understood by
143 * gtk_accelerator_parse().
144 * @tooltip: The tooltip for the action. This field should typically be
145 * marked for translation, see gtk_action_group_set_translation_domain().
146 * @value: The value to set on the radio action. See
147 * gtk_radio_action_get_current_value().
149 * #GtkRadioActionEntry structs are used with
150 * gtk_action_group_add_radio_actions() to construct groups of radio actions.
152 struct _GtkRadioActionEntry
155 const gchar *stock_id;
157 const gchar *accelerator;
158 const gchar *tooltip;
162 GType gtk_action_group_get_type (void) G_GNUC_CONST;
163 GtkActionGroup *gtk_action_group_new (const gchar *name);
164 G_CONST_RETURN gchar *gtk_action_group_get_name (GtkActionGroup *action_group);
165 gboolean gtk_action_group_get_sensitive (GtkActionGroup *action_group);
166 void gtk_action_group_set_sensitive (GtkActionGroup *action_group,
168 gboolean gtk_action_group_get_visible (GtkActionGroup *action_group);
169 void gtk_action_group_set_visible (GtkActionGroup *action_group,
171 GtkAction *gtk_action_group_get_action (GtkActionGroup *action_group,
172 const gchar *action_name);
173 GList *gtk_action_group_list_actions (GtkActionGroup *action_group);
174 void gtk_action_group_add_action (GtkActionGroup *action_group,
176 void gtk_action_group_add_action_with_accel (GtkActionGroup *action_group,
178 const gchar *accelerator);
179 void gtk_action_group_remove_action (GtkActionGroup *action_group,
181 void gtk_action_group_add_actions (GtkActionGroup *action_group,
182 const GtkActionEntry *entries,
185 void gtk_action_group_add_toggle_actions (GtkActionGroup *action_group,
186 const GtkToggleActionEntry *entries,
189 void gtk_action_group_add_radio_actions (GtkActionGroup *action_group,
190 const GtkRadioActionEntry *entries,
195 void gtk_action_group_add_actions_full (GtkActionGroup *action_group,
196 const GtkActionEntry *entries,
199 GDestroyNotify destroy);
200 void gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_group,
201 const GtkToggleActionEntry *entries,
204 GDestroyNotify destroy);
205 void gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group,
206 const GtkRadioActionEntry *entries,
211 GDestroyNotify destroy);
212 void gtk_action_group_set_translate_func (GtkActionGroup *action_group,
213 GtkTranslateFunc func,
215 GDestroyNotify notify);
216 void gtk_action_group_set_translation_domain (GtkActionGroup *action_group,
217 const gchar *domain);
218 G_CONST_RETURN gchar *gtk_action_group_translate_string (GtkActionGroup *action_group,
219 const gchar *string);
221 /* Protected for use by GtkAction */
222 void _gtk_action_group_emit_connect_proxy (GtkActionGroup *action_group,
225 void _gtk_action_group_emit_disconnect_proxy (GtkActionGroup *action_group,
228 void _gtk_action_group_emit_pre_activate (GtkActionGroup *action_group,
230 void _gtk_action_group_emit_post_activate (GtkActionGroup *action_group,
235 #endif /* __GTK_ACTION_GROUP_H__ */