]> Pileus Git - ~andy/gtk/blob - gtk/gtkactiongroup.h
22d99f48dc3501f963be0a85c7d005516bcfa124
[~andy/gtk] / gtk / gtkactiongroup.h
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 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.
20  */
21
22 /* 
23  * Author: James Henstridge <james@daa.com.au>
24  *
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/. 
29  */
30 #ifndef __GTK_ACTION_GROUP_H__
31 #define __GTK_ACTION_GROUP_H__
32
33 #include <gtk/gtkaction.h>
34 #include <gtk/gtkitemfactory.h> /* for GtkTranslateFunc */
35
36 #define GTK_TYPE_ACTION_GROUP              (gtk_action_group_get_type ())
37 #define GTK_ACTION_GROUP(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACTION_GROUP, GtkActionGroup))
38 #define GTK_ACTION_GROUP_CLASS(vtable)     (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_ACTION_GROUP, GtkActionGroupClass))
39 #define GTK_IS_ACTION_GROUP(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACTION_GROUP))
40 #define GTK_IS_ACTION_GROUP_CLASS(vtable)  (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_ACTION_GROUP))
41 #define GTK_ACTION_GROUP_GET_CLASS(inst)   (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_TYPE_ACTION_GROUP, GtkActionGroupClass))
42
43 typedef struct _GtkActionGroup        GtkActionGroup;
44 typedef struct _GtkActionGroupPrivate GtkActionGroupPrivate;
45 typedef struct _GtkActionGroupClass   GtkActionGroupClass;
46 typedef struct _GtkActionEntry        GtkActionEntry;
47 typedef struct _GtkToggleActionEntry  GtkToggleActionEntry;
48 typedef struct _GtkRadioActionEntry   GtkRadioActionEntry;
49
50 struct _GtkActionGroup
51 {
52   GObject parent;
53
54   /*< private >*/
55
56   GtkActionGroupPrivate *private_data;
57 };
58
59 struct _GtkActionGroupClass
60 {
61   GObjectClass parent_class;
62
63   GtkAction *(* get_action) (GtkActionGroup *action_group,
64                              const gchar    *action_name);
65
66   /* Padding for future expansion */
67   void (*_gtk_reserved1) (void);
68   void (*_gtk_reserved2) (void);
69   void (*_gtk_reserved3) (void);
70   void (*_gtk_reserved4) (void);
71 };
72
73 struct _GtkActionEntry 
74 {
75   gchar     *name;
76   gchar     *stock_id;
77   gchar     *label;
78   gchar     *accelerator;
79   gchar     *tooltip;
80   GCallback  callback;
81 };
82
83 struct _GtkToggleActionEntry 
84 {
85   gchar     *name;
86   gchar     *stock_id;
87   gchar     *label;
88   gchar     *accelerator;
89   gchar     *tooltip;
90   GCallback  callback;
91   gboolean   is_active;
92 };
93
94 struct _GtkRadioActionEntry 
95 {
96   gchar *name;
97   gchar *stock_id;
98   gchar *label;
99   gchar *accelerator;
100   gchar *tooltip;
101   gint   value; 
102 };
103
104 GType           gtk_action_group_get_type                (void);
105 GtkActionGroup *gtk_action_group_new                     (const gchar          *name);
106 const gchar    *gtk_action_group_get_name                (GtkActionGroup       *action_group);
107 GtkAction      *gtk_action_group_get_action              (GtkActionGroup       *action_group,
108                                                           const gchar          *action_name);
109 GList          *gtk_action_group_list_actions            (GtkActionGroup       *action_group);
110 void            gtk_action_group_add_action              (GtkActionGroup       *action_group,
111                                                           GtkAction            *action);
112 void            gtk_action_group_remove_action           (GtkActionGroup       *action_group,
113                                                           GtkAction            *action);
114 void            gtk_action_group_add_actions             (GtkActionGroup       *action_group,
115                                                           GtkActionEntry       *entries,
116                                                           guint                 n_entries,
117                                                           gpointer              user_data);
118 void            gtk_action_group_add_toggle_actions      (GtkActionGroup       *action_group,
119                                                           GtkToggleActionEntry *entries,
120                                                           guint                 n_entries,
121                                                           gpointer              user_data);
122 void            gtk_action_group_add_radio_actions       (GtkActionGroup       *action_group,
123                                                           GtkRadioActionEntry  *entries,
124                                                           guint                 n_entries,
125                                                           gint                  value,
126                                                           GCallback             on_change,
127                                                           gpointer              user_data);
128 void            gtk_action_group_add_actions_full        (GtkActionGroup       *action_group,
129                                                           GtkActionEntry       *entries,
130                                                           guint                 n_entries,
131                                                           gpointer              user_data,
132                                                           GDestroyNotify        destroy);
133 void            gtk_action_group_add_toggle_actions_full (GtkActionGroup       *action_group,
134                                                           GtkToggleActionEntry *entries,
135                                                           guint                 n_entries,
136                                                           gpointer              user_data,
137                                                           GDestroyNotify        destroy);
138 void            gtk_action_group_add_radio_actions_full  (GtkActionGroup       *action_group,
139                                                           GtkRadioActionEntry  *entries,
140                                                           guint                 n_entries,
141                                                           gint                  value,
142                                                           GCallback             on_change,
143                                                           gpointer              user_data,
144                                                           GDestroyNotify        destroy);
145 void            gtk_action_group_set_translate_func      (GtkActionGroup       *action_group,
146                                                           GtkTranslateFunc      func,
147                                                           gpointer              data,
148                                                           GtkDestroyNotify      notify);
149 void            gtk_action_group_set_translation_domain  (GtkActionGroup       *action_group,
150                                                           const gchar          *domain);
151
152
153 #endif  /* __GTK_ACTION_GROUP_H__ */