1 | /* |
2 | * GTK - The GIMP Toolkit |
3 | * Copyright (C) 1998, 1999 Red Hat, Inc. |
4 | * All rights reserved. |
5 | * |
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. |
10 | * |
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. |
15 | * |
16 | * You should have received a copy of the GNU Library General Public |
17 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. |
18 | */ |
19 | |
20 | /* |
21 | * Author: James Henstridge <james@daa.com.au> |
22 | * |
23 | * Modified by the GTK+ Team and others 2003. See the AUTHORS |
24 | * file for a list of people on the GTK+ Team. See the ChangeLog |
25 | * files for a list of changes. These files are distributed with |
26 | * GTK+ at ftp://ftp.gtk.org/pub/gtk/. |
27 | */ |
28 | |
29 | #ifndef __GTK_ACTION_GROUP_H__ |
30 | #define __GTK_ACTION_GROUP_H__ |
31 | |
32 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) |
33 | #error "Only <gtk/gtk.h> can be included directly." |
34 | #endif |
35 | |
36 | #include <gtk/deprecated/gtkaction.h> |
37 | #include <gtk/deprecated/gtkstock.h> |
38 | |
39 | G_BEGIN_DECLS |
40 | |
41 | #define GTK_TYPE_ACTION_GROUP (gtk_action_group_get_type ()) |
42 | #define GTK_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACTION_GROUP, GtkActionGroup)) |
43 | #define GTK_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_ACTION_GROUP, GtkActionGroupClass)) |
44 | #define GTK_IS_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACTION_GROUP)) |
45 | #define GTK_IS_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_ACTION_GROUP)) |
46 | #define GTK_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_TYPE_ACTION_GROUP, GtkActionGroupClass)) |
47 | |
48 | typedef struct _GtkActionGroup GtkActionGroup; |
49 | typedef struct _GtkActionGroupPrivate GtkActionGroupPrivate; |
50 | typedef struct _GtkActionGroupClass GtkActionGroupClass; |
51 | typedef struct _GtkActionEntry GtkActionEntry; |
52 | typedef struct _GtkToggleActionEntry GtkToggleActionEntry; |
53 | typedef struct _GtkRadioActionEntry GtkRadioActionEntry; |
54 | |
55 | struct _GtkActionGroup |
56 | { |
57 | GObject parent; |
58 | |
59 | /*< private >*/ |
60 | GtkActionGroupPrivate *priv; |
61 | }; |
62 | |
63 | /** |
64 | * GtkActionGroupClass: |
65 | * @parent_class: The parent class. |
66 | * @get_action: Looks up an action in the action group by name. |
67 | */ |
68 | struct _GtkActionGroupClass |
69 | { |
70 | GObjectClass parent_class; |
71 | |
72 | GtkAction *(* get_action) (GtkActionGroup *action_group, |
73 | const gchar *action_name); |
74 | |
75 | /*< private >*/ |
76 | |
77 | /* Padding for future expansion */ |
78 | void (*_gtk_reserved1) (void); |
79 | void (*_gtk_reserved2) (void); |
80 | void (*_gtk_reserved3) (void); |
81 | void (*_gtk_reserved4) (void); |
82 | }; |
83 | |
84 | /** |
85 | * GtkActionEntry: |
86 | * @name: The name of the action. |
87 | * @stock_id: The stock id for the action, or the name of an icon from the |
88 | * icon theme. |
89 | * @label: The label for the action. This field should typically be marked |
90 | * for translation, see gtk_action_group_set_translation_domain(). If |
91 | * @label is %NULL, the label of the stock item with id @stock_id is used. |
92 | * @accelerator: The accelerator for the action, in the format understood by |
93 | * gtk_accelerator_parse(). |
94 | * @tooltip: The tooltip for the action. This field should typically be |
95 | * marked for translation, see gtk_action_group_set_translation_domain(). |
96 | * @callback: The function to call when the action is activated. |
97 | * |
98 | * #GtkActionEntry structs are used with gtk_action_group_add_actions() to |
99 | * construct actions. |
100 | * |
101 | * Deprecated: 3.10 |
102 | */ |
103 | struct _GtkActionEntry |
104 | { |
105 | const gchar *name; |
106 | const gchar *stock_id; |
107 | const gchar *label; |
108 | const gchar *accelerator; |
109 | const gchar *tooltip; |
110 | GCallback callback; |
111 | }; |
112 | |
113 | /** |
114 | * GtkToggleActionEntry: |
115 | * @name: The name of the action. |
116 | * @stock_id: The stock id for the action, or the name of an icon from the |
117 | * icon theme. |
118 | * @label: The label for the action. This field should typically be marked |
119 | * for translation, see gtk_action_group_set_translation_domain(). |
120 | * @accelerator: The accelerator for the action, in the format understood by |
121 | * gtk_accelerator_parse(). |
122 | * @tooltip: The tooltip for the action. This field should typically be |
123 | * marked for translation, see gtk_action_group_set_translation_domain(). |
124 | * @callback: The function to call when the action is activated. |
125 | * @is_active: The initial state of the toggle action. |
126 | * |
127 | * #GtkToggleActionEntry structs are used with |
128 | * gtk_action_group_add_toggle_actions() to construct toggle actions. |
129 | * |
130 | * Deprecated: 3.10 |
131 | */ |
132 | struct _GtkToggleActionEntry |
133 | { |
134 | const gchar *name; |
135 | const gchar *stock_id; |
136 | const gchar *label; |
137 | const gchar *accelerator; |
138 | const gchar *tooltip; |
139 | GCallback callback; |
140 | gboolean is_active; |
141 | }; |
142 | |
143 | /** |
144 | * GtkRadioActionEntry: |
145 | * @name: The name of the action. |
146 | * @stock_id: The stock id for the action, or the name of an icon from the |
147 | * icon theme. |
148 | * @label: The label for the action. This field should typically be marked |
149 | * for translation, see gtk_action_group_set_translation_domain(). |
150 | * @accelerator: The accelerator for the action, in the format understood by |
151 | * gtk_accelerator_parse(). |
152 | * @tooltip: The tooltip for the action. This field should typically be |
153 | * marked for translation, see gtk_action_group_set_translation_domain(). |
154 | * @value: The value to set on the radio action. See |
155 | * gtk_radio_action_get_current_value(). |
156 | * |
157 | * #GtkRadioActionEntry structs are used with |
158 | * gtk_action_group_add_radio_actions() to construct groups of radio actions. |
159 | * |
160 | * Deprecated: 3.10 |
161 | */ |
162 | struct _GtkRadioActionEntry |
163 | { |
164 | const gchar *name; |
165 | const gchar *stock_id; |
166 | const gchar *label; |
167 | const gchar *accelerator; |
168 | const gchar *tooltip; |
169 | gint value; |
170 | }; |
171 | |
172 | GDK_DEPRECATED_IN_3_10 |
173 | GType gtk_action_group_get_type (void) G_GNUC_CONST; |
174 | GDK_DEPRECATED_IN_3_10 |
175 | GtkActionGroup *gtk_action_group_new (const gchar *name); |
176 | GDK_DEPRECATED_IN_3_10 |
177 | const gchar *gtk_action_group_get_name (GtkActionGroup *action_group); |
178 | GDK_DEPRECATED_IN_3_10 |
179 | gboolean gtk_action_group_get_sensitive (GtkActionGroup *action_group); |
180 | GDK_DEPRECATED_IN_3_10 |
181 | void gtk_action_group_set_sensitive (GtkActionGroup *action_group, |
182 | gboolean sensitive); |
183 | GDK_DEPRECATED_IN_3_10 |
184 | gboolean gtk_action_group_get_visible (GtkActionGroup *action_group); |
185 | GDK_DEPRECATED_IN_3_10 |
186 | void gtk_action_group_set_visible (GtkActionGroup *action_group, |
187 | gboolean visible); |
188 | GDK_DEPRECATED_IN_3_10 |
189 | GtkAccelGroup *gtk_action_group_get_accel_group (GtkActionGroup *action_group); |
190 | GDK_DEPRECATED_IN_3_10 |
191 | void gtk_action_group_set_accel_group (GtkActionGroup *action_group, |
192 | GtkAccelGroup *accel_group); |
193 | |
194 | GDK_DEPRECATED_IN_3_10 |
195 | GtkAction *gtk_action_group_get_action (GtkActionGroup *action_group, |
196 | const gchar *action_name); |
197 | GDK_DEPRECATED_IN_3_10 |
198 | GList *gtk_action_group_list_actions (GtkActionGroup *action_group); |
199 | GDK_DEPRECATED_IN_3_10 |
200 | void gtk_action_group_add_action (GtkActionGroup *action_group, |
201 | GtkAction *action); |
202 | GDK_DEPRECATED_IN_3_10 |
203 | void gtk_action_group_add_action_with_accel (GtkActionGroup *action_group, |
204 | GtkAction *action, |
205 | const gchar *accelerator); |
206 | GDK_DEPRECATED_IN_3_10 |
207 | void gtk_action_group_remove_action (GtkActionGroup *action_group, |
208 | GtkAction *action); |
209 | GDK_DEPRECATED_IN_3_10 |
210 | void gtk_action_group_add_actions (GtkActionGroup *action_group, |
211 | const GtkActionEntry *entries, |
212 | guint n_entries, |
213 | gpointer user_data); |
214 | GDK_DEPRECATED_IN_3_10 |
215 | void gtk_action_group_add_toggle_actions (GtkActionGroup *action_group, |
216 | const GtkToggleActionEntry *entries, |
217 | guint n_entries, |
218 | gpointer user_data); |
219 | GDK_DEPRECATED_IN_3_10 |
220 | void gtk_action_group_add_radio_actions (GtkActionGroup *action_group, |
221 | const GtkRadioActionEntry *entries, |
222 | guint n_entries, |
223 | gint value, |
224 | GCallback on_change, |
225 | gpointer user_data); |
226 | GDK_DEPRECATED_IN_3_10 |
227 | void gtk_action_group_add_actions_full (GtkActionGroup *action_group, |
228 | const GtkActionEntry *entries, |
229 | guint n_entries, |
230 | gpointer user_data, |
231 | GDestroyNotify destroy); |
232 | GDK_DEPRECATED_IN_3_10 |
233 | void gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_group, |
234 | const GtkToggleActionEntry *entries, |
235 | guint n_entries, |
236 | gpointer user_data, |
237 | GDestroyNotify destroy); |
238 | GDK_DEPRECATED_IN_3_10 |
239 | void gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group, |
240 | const GtkRadioActionEntry *entries, |
241 | guint n_entries, |
242 | gint value, |
243 | GCallback on_change, |
244 | gpointer user_data, |
245 | GDestroyNotify destroy); |
246 | GDK_DEPRECATED_IN_3_10 |
247 | void gtk_action_group_set_translate_func (GtkActionGroup *action_group, |
248 | GtkTranslateFunc func, |
249 | gpointer data, |
250 | GDestroyNotify notify); |
251 | GDK_DEPRECATED_IN_3_10 |
252 | void gtk_action_group_set_translation_domain (GtkActionGroup *action_group, |
253 | const gchar *domain); |
254 | GDK_DEPRECATED_IN_3_10 |
255 | const gchar * gtk_action_group_translate_string (GtkActionGroup *action_group, |
256 | const gchar *string); |
257 | |
258 | /* Protected for use by GtkAction */ |
259 | void _gtk_action_group_emit_connect_proxy (GtkActionGroup *action_group, |
260 | GtkAction *action, |
261 | GtkWidget *proxy); |
262 | void _gtk_action_group_emit_disconnect_proxy (GtkActionGroup *action_group, |
263 | GtkAction *action, |
264 | GtkWidget *proxy); |
265 | void _gtk_action_group_emit_pre_activate (GtkActionGroup *action_group, |
266 | GtkAction *action); |
267 | void _gtk_action_group_emit_post_activate (GtkActionGroup *action_group, |
268 | GtkAction *action); |
269 | |
270 | G_END_DECLS |
271 | |
272 | #endif /* __GTK_ACTION_GROUP_H__ */ |
273 | |