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