]> Pileus Git - ~andy/gtk/blob - gtk/gtkuimanager.h
whitespace cleanup: remove trailing whitespace and excess newlines and
[~andy/gtk] / gtk / gtkuimanager.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_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
32 #error "Only <gtk/gtk.h> can be included directly."
33 #endif
34
35 #ifndef __GTK_UI_MANAGER_H__
36 #define __GTK_UI_MANAGER_H__
37
38
39 #include <glib.h>
40 #include <glib-object.h>
41 #include <gtk/gtkaccelgroup.h>
42 #include <gtk/gtkwidget.h>
43 #include <gtk/gtkaction.h>
44 #include <gtk/gtkactiongroup.h>
45
46 G_BEGIN_DECLS
47
48 #define GTK_TYPE_UI_MANAGER            (gtk_ui_manager_get_type ())
49 #define GTK_UI_MANAGER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_UI_MANAGER, GtkUIManager))
50 #define GTK_UI_MANAGER_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_UI_MANAGER, GtkUIManagerClass))
51 #define GTK_IS_UI_MANAGER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_UI_MANAGER))
52 #define GTK_IS_UI_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_UI_MANAGER))
53 #define GTK_UI_MANAGER_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_UI_MANAGER, GtkUIManagerClass))
54
55 typedef struct _GtkUIManager      GtkUIManager;
56 typedef struct _GtkUIManagerClass GtkUIManagerClass;
57 typedef struct _GtkUIManagerPrivate GtkUIManagerPrivate;
58
59
60 struct _GtkUIManager {
61   GObject parent;
62
63   /*< private >*/
64
65   GtkUIManagerPrivate *private_data;
66 };
67
68 struct _GtkUIManagerClass {
69   GObjectClass parent_class;
70
71   /* Signals */
72   void (* add_widget)       (GtkUIManager *merge,
73                              GtkWidget    *widget);
74   void (* actions_changed)  (GtkUIManager *merge);
75   void (* connect_proxy)    (GtkUIManager *merge,
76                              GtkAction    *action,
77                              GtkWidget    *proxy);
78   void (* disconnect_proxy) (GtkUIManager *merge,
79                              GtkAction    *action,
80                              GtkWidget    *proxy);
81   void (* pre_activate)     (GtkUIManager *merge,
82                              GtkAction    *action);
83   void (* post_activate)    (GtkUIManager *merge,
84                              GtkAction    *action);
85
86   /* Virtual functions */
87   GtkWidget * (* get_widget) (GtkUIManager *manager,
88                               const gchar  *path);
89   GtkAction * (* get_action) (GtkUIManager *manager,
90                               const gchar  *path);
91
92   /* Padding for future expansion */
93   void (*_gtk_reserved1) (void);
94   void (*_gtk_reserved2) (void);
95 };
96
97 typedef enum {
98   GTK_UI_MANAGER_AUTO         = 0,
99   GTK_UI_MANAGER_MENUBAR      = 1 << 0,
100   GTK_UI_MANAGER_MENU         = 1 << 1,
101   GTK_UI_MANAGER_TOOLBAR      = 1 << 2,
102   GTK_UI_MANAGER_PLACEHOLDER  = 1 << 3,
103   GTK_UI_MANAGER_POPUP        = 1 << 4,
104   GTK_UI_MANAGER_MENUITEM     = 1 << 5,
105   GTK_UI_MANAGER_TOOLITEM     = 1 << 6,
106   GTK_UI_MANAGER_SEPARATOR    = 1 << 7,
107   GTK_UI_MANAGER_ACCELERATOR  = 1 << 8
108 } GtkUIManagerItemType;
109
110 #ifdef G_OS_WIN32
111 /* Reserve old name for DLL ABI backward compatibility */
112 #define gtk_ui_manager_add_ui_from_file gtk_ui_manager_add_ui_from_file_utf8
113 #endif
114
115 GType          gtk_ui_manager_get_type            (void) G_GNUC_CONST;
116 GtkUIManager  *gtk_ui_manager_new                 (void);
117 void           gtk_ui_manager_set_add_tearoffs    (GtkUIManager          *self,
118                                                    gboolean               add_tearoffs);
119 gboolean       gtk_ui_manager_get_add_tearoffs    (GtkUIManager          *self);
120 void           gtk_ui_manager_insert_action_group (GtkUIManager          *self,
121                                                    GtkActionGroup        *action_group,
122                                                    gint                   pos);
123 void           gtk_ui_manager_remove_action_group (GtkUIManager          *self,
124                                                    GtkActionGroup        *action_group);
125 GList         *gtk_ui_manager_get_action_groups   (GtkUIManager          *self);
126 GtkAccelGroup *gtk_ui_manager_get_accel_group     (GtkUIManager          *self);
127 GtkWidget     *gtk_ui_manager_get_widget          (GtkUIManager          *self,
128                                                    const gchar           *path);
129 GSList        *gtk_ui_manager_get_toplevels       (GtkUIManager          *self,
130                                                    GtkUIManagerItemType   types);
131 GtkAction     *gtk_ui_manager_get_action          (GtkUIManager          *self,
132                                                    const gchar           *path);
133 guint          gtk_ui_manager_add_ui_from_string  (GtkUIManager          *self,
134                                                    const gchar           *buffer,
135                                                    gssize                 length,
136                                                    GError               **error);
137 guint          gtk_ui_manager_add_ui_from_file    (GtkUIManager          *self,
138                                                    const gchar           *filename,
139                                                    GError               **error);
140 void           gtk_ui_manager_add_ui              (GtkUIManager          *self,
141                                                    guint                  merge_id,
142                                                    const gchar           *path,
143                                                    const gchar           *name,
144                                                    const gchar           *action,
145                                                    GtkUIManagerItemType   type,
146                                                    gboolean               top);
147 void           gtk_ui_manager_remove_ui           (GtkUIManager          *self,
148                                                    guint                  merge_id);
149 gchar         *gtk_ui_manager_get_ui              (GtkUIManager          *self);
150 void           gtk_ui_manager_ensure_update       (GtkUIManager          *self);
151 guint          gtk_ui_manager_new_merge_id        (GtkUIManager          *self);
152
153 G_END_DECLS
154
155 #endif /* __GTK_UI_MANAGER_H__ */