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_UI_MANAGER_H__
30#define __GTK_UI_MANAGER_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/gtkaccelgroup.h>
37#include <gtk/gtkwidget.h>
38#include <gtk/deprecated/gtkaction.h>
39#include <gtk/deprecated/gtkactiongroup.h>
40
41G_BEGIN_DECLS
42
43#define GTK_TYPE_UI_MANAGER (gtk_ui_manager_get_type ())
44#define GTK_UI_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_UI_MANAGER, GtkUIManager))
45#define GTK_UI_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_UI_MANAGER, GtkUIManagerClass))
46#define GTK_IS_UI_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_UI_MANAGER))
47#define GTK_IS_UI_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_UI_MANAGER))
48#define GTK_UI_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GTK_TYPE_UI_MANAGER, GtkUIManagerClass))
49
50typedef struct _GtkUIManager GtkUIManager;
51typedef struct _GtkUIManagerClass GtkUIManagerClass;
52typedef struct _GtkUIManagerPrivate GtkUIManagerPrivate;
53
54
55struct _GtkUIManager {
56 GObject parent;
57
58 /*< private >*/
59 GtkUIManagerPrivate *private_data;
60};
61
62struct _GtkUIManagerClass {
63 GObjectClass parent_class;
64
65 /* Signals */
66 void (* add_widget) (GtkUIManager *manager,
67 GtkWidget *widget);
68 void (* actions_changed) (GtkUIManager *manager);
69 void (* connect_proxy) (GtkUIManager *manager,
70 GtkAction *action,
71 GtkWidget *proxy);
72 void (* disconnect_proxy) (GtkUIManager *manager,
73 GtkAction *action,
74 GtkWidget *proxy);
75 void (* pre_activate) (GtkUIManager *manager,
76 GtkAction *action);
77 void (* post_activate) (GtkUIManager *manager,
78 GtkAction *action);
79
80 /* Virtual functions */
81 GtkWidget * (* get_widget) (GtkUIManager *manager,
82 const gchar *path);
83 GtkAction * (* get_action) (GtkUIManager *manager,
84 const gchar *path);
85
86 /* Padding for future expansion */
87 void (*_gtk_reserved1) (void);
88 void (*_gtk_reserved2) (void);
89 void (*_gtk_reserved3) (void);
90 void (*_gtk_reserved4) (void);
91};
92
93/**
94 * GtkUIManagerItemType:
95 * @GTK_UI_MANAGER_AUTO: Pick the type of the UI element according to context.
96 * @GTK_UI_MANAGER_MENUBAR: Create a menubar.
97 * @GTK_UI_MANAGER_MENU: Create a menu.
98 * @GTK_UI_MANAGER_TOOLBAR: Create a toolbar.
99 * @GTK_UI_MANAGER_PLACEHOLDER: Insert a placeholder.
100 * @GTK_UI_MANAGER_POPUP: Create a popup menu.
101 * @GTK_UI_MANAGER_MENUITEM: Create a menuitem.
102 * @GTK_UI_MANAGER_TOOLITEM: Create a toolitem.
103 * @GTK_UI_MANAGER_SEPARATOR: Create a separator.
104 * @GTK_UI_MANAGER_ACCELERATOR: Install an accelerator.
105 * @GTK_UI_MANAGER_POPUP_WITH_ACCELS: Same as %GTK_UI_MANAGER_POPUP, but the
106 * actions’ accelerators are shown.
107 *
108 * These enumeration values are used by gtk_ui_manager_add_ui() to determine
109 * what UI element to create.
110 *
111 * Deprecated: 3.10
112 */
113typedef enum {
114 GTK_UI_MANAGER_AUTO = 0,
115 GTK_UI_MANAGER_MENUBAR = 1 << 0,
116 GTK_UI_MANAGER_MENU = 1 << 1,
117 GTK_UI_MANAGER_TOOLBAR = 1 << 2,
118 GTK_UI_MANAGER_PLACEHOLDER = 1 << 3,
119 GTK_UI_MANAGER_POPUP = 1 << 4,
120 GTK_UI_MANAGER_MENUITEM = 1 << 5,
121 GTK_UI_MANAGER_TOOLITEM = 1 << 6,
122 GTK_UI_MANAGER_SEPARATOR = 1 << 7,
123 GTK_UI_MANAGER_ACCELERATOR = 1 << 8,
124 GTK_UI_MANAGER_POPUP_WITH_ACCELS = 1 << 9
125} GtkUIManagerItemType;
126
127GDK_DEPRECATED_IN_3_10
128GType gtk_ui_manager_get_type (void) G_GNUC_CONST;
129GDK_DEPRECATED_IN_3_10
130GtkUIManager *gtk_ui_manager_new (void);
131GDK_DEPRECATED_IN_3_4
132void gtk_ui_manager_set_add_tearoffs (GtkUIManager *manager,
133 gboolean add_tearoffs);
134GDK_DEPRECATED_IN_3_4
135gboolean gtk_ui_manager_get_add_tearoffs (GtkUIManager *manager);
136
137GDK_DEPRECATED_IN_3_10
138void gtk_ui_manager_insert_action_group (GtkUIManager *manager,
139 GtkActionGroup *action_group,
140 gint pos);
141GDK_DEPRECATED_IN_3_10
142void gtk_ui_manager_remove_action_group (GtkUIManager *manager,
143 GtkActionGroup *action_group);
144GDK_DEPRECATED_IN_3_10
145GList *gtk_ui_manager_get_action_groups (GtkUIManager *manager);
146GDK_DEPRECATED_IN_3_10
147GtkAccelGroup *gtk_ui_manager_get_accel_group (GtkUIManager *manager);
148GDK_DEPRECATED_IN_3_10
149GtkWidget *gtk_ui_manager_get_widget (GtkUIManager *manager,
150 const gchar *path);
151GDK_DEPRECATED_IN_3_10
152GSList *gtk_ui_manager_get_toplevels (GtkUIManager *manager,
153 GtkUIManagerItemType types);
154GDK_DEPRECATED_IN_3_10
155GtkAction *gtk_ui_manager_get_action (GtkUIManager *manager,
156 const gchar *path);
157GDK_DEPRECATED_IN_3_10
158guint gtk_ui_manager_add_ui_from_string (GtkUIManager *manager,
159 const gchar *buffer,
160 gssize length,
161 GError **error);
162GDK_DEPRECATED_IN_3_10
163guint gtk_ui_manager_add_ui_from_file (GtkUIManager *manager,
164 const gchar *filename,
165 GError **error);
166GDK_DEPRECATED_IN_3_10
167guint gtk_ui_manager_add_ui_from_resource(GtkUIManager *manager,
168 const gchar *resource_path,
169 GError **error);
170GDK_DEPRECATED_IN_3_10
171void gtk_ui_manager_add_ui (GtkUIManager *manager,
172 guint merge_id,
173 const gchar *path,
174 const gchar *name,
175 const gchar *action,
176 GtkUIManagerItemType type,
177 gboolean top);
178GDK_DEPRECATED_IN_3_10
179void gtk_ui_manager_remove_ui (GtkUIManager *manager,
180 guint merge_id);
181GDK_DEPRECATED_IN_3_10
182gchar *gtk_ui_manager_get_ui (GtkUIManager *manager);
183GDK_DEPRECATED_IN_3_10
184void gtk_ui_manager_ensure_update (GtkUIManager *manager);
185GDK_DEPRECATED_IN_3_10
186guint gtk_ui_manager_new_merge_id (GtkUIManager *manager);
187
188G_END_DECLS
189
190#endif /* __GTK_UI_MANAGER_H__ */
191