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_H__
30 #define __GTK_ACTION_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/gtkwidget.h>
37 
38 G_BEGIN_DECLS
39 
40 #define GTK_TYPE_ACTION            (gtk_action_get_type ())
41 #define GTK_ACTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACTION, GtkAction))
42 #define GTK_ACTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACTION, GtkActionClass))
43 #define GTK_IS_ACTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACTION))
44 #define GTK_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACTION))
45 #define GTK_ACTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_ACTION, GtkActionClass))
46 
47 typedef struct _GtkAction      GtkAction;
48 typedef struct _GtkActionClass GtkActionClass;
49 typedef struct _GtkActionPrivate GtkActionPrivate;
50 
51 struct _GtkAction
52 {
53   GObject object;
54 
55   /*< private >*/
56   GtkActionPrivate *private_data;
57 };
58 
59 /**
60  * GtkActionClass:
61  * @parent_class: The parent class.
62  * @activate: Signal emitted when the action is activated.
63  */
64 struct _GtkActionClass
65 {
66   GObjectClass parent_class;
67 
68   /*< public >*/
69 
70   /* activation signal */
71   void       (* activate)           (GtkAction    *action);
72 
73   /*< private >*/
74 
75   GType      menu_item_type;
76   GType      toolbar_item_type;
77 
78   /* widget creation routines (not signals) */
79   GtkWidget *(* create_menu_item)   (GtkAction *action);
80   GtkWidget *(* create_tool_item)   (GtkAction *action);
81   void       (* connect_proxy)      (GtkAction *action,
82 				     GtkWidget *proxy);
83   void       (* disconnect_proxy)   (GtkAction *action,
84 				     GtkWidget *proxy);
85 
86   GtkWidget *(* create_menu)        (GtkAction *action);
87 
88   /* Padding for future expansion */
89   void (*_gtk_reserved1) (void);
90   void (*_gtk_reserved2) (void);
91   void (*_gtk_reserved3) (void);
92   void (*_gtk_reserved4) (void);
93 };
94 
95 GDK_DEPRECATED_IN_3_10
96 GType        gtk_action_get_type               (void) G_GNUC_CONST;
97 GDK_DEPRECATED_IN_3_10
98 GtkAction   *gtk_action_new                    (const gchar *name,
99 						const gchar *label,
100 						const gchar *tooltip,
101 						const gchar *stock_id);
102 GDK_DEPRECATED_IN_3_10
103 const gchar* gtk_action_get_name               (GtkAction     *action);
104 GDK_DEPRECATED_IN_3_10
105 gboolean     gtk_action_is_sensitive           (GtkAction     *action);
106 GDK_DEPRECATED_IN_3_10
107 gboolean     gtk_action_get_sensitive          (GtkAction     *action);
108 GDK_DEPRECATED_IN_3_10
109 void         gtk_action_set_sensitive          (GtkAction     *action,
110 						gboolean       sensitive);
111 GDK_DEPRECATED_IN_3_10
112 gboolean     gtk_action_is_visible             (GtkAction     *action);
113 GDK_DEPRECATED_IN_3_10
114 gboolean     gtk_action_get_visible            (GtkAction     *action);
115 GDK_DEPRECATED_IN_3_10
116 void         gtk_action_set_visible            (GtkAction     *action,
117 						gboolean       visible);
118 GDK_DEPRECATED_IN_3_10
119 void         gtk_action_activate               (GtkAction     *action);
120 GDK_DEPRECATED_IN_3_10
121 GtkWidget *  gtk_action_create_icon            (GtkAction     *action,
122 						GtkIconSize    icon_size);
123 GDK_DEPRECATED_IN_3_10
124 GtkWidget *  gtk_action_create_menu_item       (GtkAction     *action);
125 GDK_DEPRECATED_IN_3_10
126 GtkWidget *  gtk_action_create_tool_item       (GtkAction     *action);
127 GDK_DEPRECATED_IN_3_10
128 GtkWidget *  gtk_action_create_menu            (GtkAction     *action);
129 GDK_DEPRECATED_IN_3_10
130 GSList *     gtk_action_get_proxies            (GtkAction     *action);
131 GDK_DEPRECATED_IN_3_10
132 void         gtk_action_connect_accelerator    (GtkAction     *action);
133 GDK_DEPRECATED_IN_3_10
134 void         gtk_action_disconnect_accelerator (GtkAction     *action);
135 GDK_DEPRECATED_IN_3_10
136 const gchar *gtk_action_get_accel_path         (GtkAction     *action);
137 GDK_DEPRECATED_IN_3_10
138 GClosure    *gtk_action_get_accel_closure      (GtkAction     *action);
139 GDK_DEPRECATED_IN_3_10
140 void         gtk_action_block_activate         (GtkAction     *action);
141 GDK_DEPRECATED_IN_3_10
142 void         gtk_action_unblock_activate       (GtkAction     *action);
143 
144 void         _gtk_action_add_to_proxy_list     (GtkAction     *action,
145 						GtkWidget     *proxy);
146 void         _gtk_action_remove_from_proxy_list(GtkAction     *action,
147 						GtkWidget     *proxy);
148 
149 /* protected ... for use by child actions */
150 void         _gtk_action_emit_activate         (GtkAction     *action);
151 
152 /* protected ... for use by action groups */
153 GDK_DEPRECATED_IN_3_10
154 void         gtk_action_set_accel_path         (GtkAction     *action,
155 						const gchar   *accel_path);
156 GDK_DEPRECATED_IN_3_10
157 void         gtk_action_set_accel_group        (GtkAction     *action,
158 						GtkAccelGroup *accel_group);
159 void         _gtk_action_sync_menu_visible     (GtkAction     *action,
160 						GtkWidget     *proxy,
161 						gboolean       empty);
162 
163 GDK_DEPRECATED_IN_3_10
164 void                  gtk_action_set_label              (GtkAction   *action,
165                                                          const gchar *label);
166 GDK_DEPRECATED_IN_3_10
167 const gchar *         gtk_action_get_label              (GtkAction   *action);
168 GDK_DEPRECATED_IN_3_10
169 void                  gtk_action_set_short_label        (GtkAction   *action,
170                                                          const gchar *short_label);
171 GDK_DEPRECATED_IN_3_10
172 const gchar *         gtk_action_get_short_label        (GtkAction   *action);
173 GDK_DEPRECATED_IN_3_10
174 void                  gtk_action_set_tooltip            (GtkAction   *action,
175                                                          const gchar *tooltip);
176 GDK_DEPRECATED_IN_3_10
177 const gchar *         gtk_action_get_tooltip            (GtkAction   *action);
178 GDK_DEPRECATED_IN_3_10
179 void                  gtk_action_set_stock_id           (GtkAction   *action,
180                                                          const gchar *stock_id);
181 GDK_DEPRECATED_IN_3_10
182 const gchar *         gtk_action_get_stock_id           (GtkAction   *action);
183 GDK_DEPRECATED_IN_3_10
184 void                  gtk_action_set_gicon              (GtkAction   *action,
185                                                          GIcon       *icon);
186 GDK_DEPRECATED_IN_3_10
187 GIcon                *gtk_action_get_gicon              (GtkAction   *action);
188 GDK_DEPRECATED_IN_3_10
189 void                  gtk_action_set_icon_name          (GtkAction   *action,
190                                                          const gchar *icon_name);
191 GDK_DEPRECATED_IN_3_10
192 const gchar *         gtk_action_get_icon_name          (GtkAction   *action);
193 GDK_DEPRECATED_IN_3_10
194 void                  gtk_action_set_visible_horizontal (GtkAction   *action,
195                                                          gboolean     visible_horizontal);
196 GDK_DEPRECATED_IN_3_10
197 gboolean              gtk_action_get_visible_horizontal (GtkAction   *action);
198 GDK_DEPRECATED_IN_3_10
199 void                  gtk_action_set_visible_vertical   (GtkAction   *action,
200                                                          gboolean     visible_vertical);
201 GDK_DEPRECATED_IN_3_10
202 gboolean              gtk_action_get_visible_vertical   (GtkAction   *action);
203 GDK_DEPRECATED_IN_3_10
204 void                  gtk_action_set_is_important       (GtkAction   *action,
205                                                          gboolean     is_important);
206 GDK_DEPRECATED_IN_3_10
207 gboolean              gtk_action_get_is_important       (GtkAction   *action);
208 GDK_DEPRECATED_IN_3_10
209 void                  gtk_action_set_always_show_image  (GtkAction   *action,
210                                                          gboolean     always_show);
211 GDK_DEPRECATED_IN_3_10
212 gboolean              gtk_action_get_always_show_image  (GtkAction   *action);
213 
214 
215 G_END_DECLS
216 
217 #endif  /* __GTK_ACTION_H__ */
218