]> Pileus Git - ~andy/gtk/blob - gtk/gtkaction.h
gtkaction: unseal private pointer
[~andy/gtk] / gtk / gtkaction.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
31 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
32 #error "Only <gtk/gtk.h> can be included directly."
33 #endif
34
35 #ifndef __GTK_ACTION_H__
36 #define __GTK_ACTION_H__
37
38 #include <gtk/gtkwidget.h>
39
40 G_BEGIN_DECLS
41
42 #define GTK_TYPE_ACTION            (gtk_action_get_type ())
43 #define GTK_ACTION(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACTION, GtkAction))
44 #define GTK_ACTION_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACTION, GtkActionClass))
45 #define GTK_IS_ACTION(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACTION))
46 #define GTK_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACTION))
47 #define GTK_ACTION_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_ACTION, GtkActionClass))
48
49 typedef struct _GtkAction      GtkAction;
50 typedef struct _GtkActionClass GtkActionClass;
51 typedef struct _GtkActionPrivate GtkActionPrivate;
52
53 struct _GtkAction
54 {
55   GObject object;
56
57   /*< private >*/
58   GtkActionPrivate *private_data;
59 };
60
61 struct _GtkActionClass
62 {
63   GObjectClass parent_class;
64
65   /* activation signal */
66   void       (* activate)           (GtkAction    *action);
67
68   GType      menu_item_type;
69   GType      toolbar_item_type;
70
71   /* widget creation routines (not signals) */
72   GtkWidget *(* create_menu_item)   (GtkAction *action);
73   GtkWidget *(* create_tool_item)   (GtkAction *action);
74   void       (* connect_proxy)      (GtkAction *action,
75                                      GtkWidget *proxy);
76   void       (* disconnect_proxy)   (GtkAction *action,
77                                      GtkWidget *proxy);
78
79   GtkWidget *(* create_menu)        (GtkAction *action);
80
81   /* Padding for future expansion */
82   void (*_gtk_reserved2) (void);
83   void (*_gtk_reserved3) (void);
84   void (*_gtk_reserved4) (void);
85 };
86
87 GType        gtk_action_get_type               (void) G_GNUC_CONST;
88 GtkAction   *gtk_action_new                    (const gchar *name,
89                                                 const gchar *label,
90                                                 const gchar *tooltip,
91                                                 const gchar *stock_id);
92 G_CONST_RETURN gchar* gtk_action_get_name      (GtkAction     *action);
93 gboolean     gtk_action_is_sensitive           (GtkAction     *action);
94 gboolean     gtk_action_get_sensitive          (GtkAction     *action);
95 void         gtk_action_set_sensitive          (GtkAction     *action,
96                                                 gboolean       sensitive);
97 gboolean     gtk_action_is_visible             (GtkAction     *action);
98 gboolean     gtk_action_get_visible            (GtkAction     *action);
99 void         gtk_action_set_visible            (GtkAction     *action,
100                                                 gboolean       visible);
101 void         gtk_action_activate               (GtkAction     *action);
102 GtkWidget *  gtk_action_create_icon            (GtkAction     *action,
103                                                 GtkIconSize    icon_size);
104 GtkWidget *  gtk_action_create_menu_item       (GtkAction     *action);
105 GtkWidget *  gtk_action_create_tool_item       (GtkAction     *action);
106 GtkWidget *  gtk_action_create_menu            (GtkAction     *action);
107 GSList *     gtk_action_get_proxies            (GtkAction     *action);
108 void         gtk_action_connect_accelerator    (GtkAction     *action);
109 void         gtk_action_disconnect_accelerator (GtkAction     *action);
110 G_CONST_RETURN gchar *gtk_action_get_accel_path (GtkAction     *action);
111 GClosure    *gtk_action_get_accel_closure      (GtkAction     *action);
112 void         gtk_action_block_activate         (GtkAction     *action);
113 void         gtk_action_unblock_activate       (GtkAction     *action);
114
115
116 void         _gtk_action_add_to_proxy_list     (GtkAction     *action,
117                                                 GtkWidget     *proxy);
118 void         _gtk_action_remove_from_proxy_list(GtkAction     *action,
119                                                 GtkWidget     *proxy);
120
121 /* protected ... for use by child actions */
122 void         _gtk_action_emit_activate         (GtkAction     *action);
123
124 /* protected ... for use by action groups */
125 void         gtk_action_set_accel_path         (GtkAction     *action,
126                                                 const gchar   *accel_path);
127 void         gtk_action_set_accel_group        (GtkAction     *action,
128                                                 GtkAccelGroup *accel_group);
129 void         _gtk_action_sync_menu_visible     (GtkAction     *action,
130                                                 GtkWidget     *proxy,
131                                                 gboolean       empty);
132
133 void                  gtk_action_set_label              (GtkAction   *action,
134                                                          const gchar *label);
135 G_CONST_RETURN gchar *gtk_action_get_label              (GtkAction   *action);
136 void                  gtk_action_set_short_label        (GtkAction   *action,
137                                                          const gchar *short_label);
138 G_CONST_RETURN gchar *gtk_action_get_short_label        (GtkAction   *action);
139 void                  gtk_action_set_tooltip            (GtkAction   *action,
140                                                          const gchar *tooltip);
141 G_CONST_RETURN gchar *gtk_action_get_tooltip            (GtkAction   *action);
142 void                  gtk_action_set_stock_id           (GtkAction   *action,
143                                                          const gchar *stock_id);
144 G_CONST_RETURN gchar *gtk_action_get_stock_id           (GtkAction   *action);
145 void                  gtk_action_set_gicon              (GtkAction   *action,
146                                                          GIcon       *icon);
147 GIcon                *gtk_action_get_gicon              (GtkAction   *action);
148 void                  gtk_action_set_icon_name          (GtkAction   *action,
149                                                          const gchar *icon_name);
150 G_CONST_RETURN gchar *gtk_action_get_icon_name          (GtkAction   *action);
151 void                  gtk_action_set_visible_horizontal (GtkAction   *action,
152                                                          gboolean     visible_horizontal);
153 gboolean              gtk_action_get_visible_horizontal (GtkAction   *action);
154 void                  gtk_action_set_visible_vertical   (GtkAction   *action,
155                                                          gboolean     visible_vertical);
156 gboolean              gtk_action_get_visible_vertical   (GtkAction   *action);
157 void                  gtk_action_set_is_important       (GtkAction   *action,
158                                                          gboolean     is_important);
159 gboolean              gtk_action_get_is_important       (GtkAction   *action);
160 void                  gtk_action_set_always_show_image  (GtkAction   *action,
161                                                          gboolean     always_show);
162 gboolean              gtk_action_get_always_show_image  (GtkAction   *action);
163
164
165 G_END_DECLS
166
167 #endif  /* __GTK_ACTION_H__ */