| 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_ACTION_GROUP_H__ |
| 32 | #define __GTK_ACTION_GROUP_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/gtkaction.h> |
| 39 | #include <gtk/gtktypeutils.h> /* for GtkTranslateFunc */ |
| 40 | |
| 41 | G_BEGIN_DECLS |
| 42 | |
| 43 | #define GTK_TYPE_ACTION_GROUP (gtk_action_group_get_type ()) |
| 44 | #define GTK_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_ACTION_GROUP, GtkActionGroup)) |
| 45 | #define GTK_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_CAST ((vtable), GTK_TYPE_ACTION_GROUP, GtkActionGroupClass)) |
| 46 | #define GTK_IS_ACTION_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_ACTION_GROUP)) |
| 47 | #define GTK_IS_ACTION_GROUP_CLASS(vtable) (G_TYPE_CHECK_CLASS_TYPE ((vtable), GTK_TYPE_ACTION_GROUP)) |
| 48 | #define GTK_ACTION_GROUP_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), GTK_TYPE_ACTION_GROUP, GtkActionGroupClass)) |
| 49 | |
| 50 | typedef struct _GtkActionGroup GtkActionGroup; |
| 51 | typedef struct _GtkActionGroupPrivate GtkActionGroupPrivate; |
| 52 | typedef struct _GtkActionGroupClass GtkActionGroupClass; |
| 53 | typedef struct _GtkActionEntry GtkActionEntry; |
| 54 | typedef struct _GtkToggleActionEntry GtkToggleActionEntry; |
| 55 | typedef struct _GtkRadioActionEntry GtkRadioActionEntry; |
| 56 | |
| 57 | struct _GtkActionGroup |
| 58 | { |
| 59 | GObject parent; |
| 60 | |
| 61 | /*< private >*/ |
| 62 | |
| 63 | GtkActionGroupPrivate *GSEAL (private_data); |
| 64 | }; |
| 65 | |
| 66 | struct _GtkActionGroupClass |
| 67 | { |
| 68 | GObjectClass parent_class; |
| 69 | |
| 70 | GtkAction *(* get_action) (GtkActionGroup *action_group, |
| 71 | const gchar *action_name); |
| 72 | |
| 73 | /* Padding for future expansion */ |
| 74 | void (*_gtk_reserved1) (void); |
| 75 | void (*_gtk_reserved2) (void); |
| 76 | void (*_gtk_reserved3) (void); |
| 77 | void (*_gtk_reserved4) (void); |
| 78 | }; |
| 79 | |
| 80 | struct _GtkActionEntry |
| 81 | { |
| 82 | const gchar *name; |
| 83 | const gchar *stock_id; |
| 84 | const gchar *label; |
| 85 | const gchar *accelerator; |
| 86 | const gchar *tooltip; |
| 87 | GCallback callback; |
| 88 | }; |
| 89 | |
| 90 | struct _GtkToggleActionEntry |
| 91 | { |
| 92 | const gchar *name; |
| 93 | const gchar *stock_id; |
| 94 | const gchar *label; |
| 95 | const gchar *accelerator; |
| 96 | const gchar *tooltip; |
| 97 | GCallback callback; |
| 98 | gboolean is_active; |
| 99 | }; |
| 100 | |
| 101 | struct _GtkRadioActionEntry |
| 102 | { |
| 103 | const gchar *name; |
| 104 | const gchar *stock_id; |
| 105 | const gchar *label; |
| 106 | const gchar *accelerator; |
| 107 | const gchar *tooltip; |
| 108 | gint value; |
| 109 | }; |
| 110 | |
| 111 | GType gtk_action_group_get_type (void) G_GNUC_CONST; |
| 112 | GtkActionGroup *gtk_action_group_new (const gchar *name); |
| 113 | const gchar *gtk_action_group_get_name (GtkActionGroup *action_group); |
| 114 | gboolean gtk_action_group_get_sensitive (GtkActionGroup *action_group); |
| 115 | void gtk_action_group_set_sensitive (GtkActionGroup *action_group, |
| 116 | gboolean sensitive); |
| 117 | gboolean gtk_action_group_get_visible (GtkActionGroup *action_group); |
| 118 | void gtk_action_group_set_visible (GtkActionGroup *action_group, |
| 119 | gboolean visible); |
| 120 | GtkAction *gtk_action_group_get_action (GtkActionGroup *action_group, |
| 121 | const gchar *action_name); |
| 122 | GList *gtk_action_group_list_actions (GtkActionGroup *action_group); |
| 123 | void gtk_action_group_add_action (GtkActionGroup *action_group, |
| 124 | GtkAction *action); |
| 125 | void gtk_action_group_add_action_with_accel (GtkActionGroup *action_group, |
| 126 | GtkAction *action, |
| 127 | const gchar *accelerator); |
| 128 | void gtk_action_group_remove_action (GtkActionGroup *action_group, |
| 129 | GtkAction *action); |
| 130 | void gtk_action_group_add_actions (GtkActionGroup *action_group, |
| 131 | const GtkActionEntry *entries, |
| 132 | guint n_entries, |
| 133 | gpointer user_data); |
| 134 | void gtk_action_group_add_toggle_actions (GtkActionGroup *action_group, |
| 135 | const GtkToggleActionEntry *entries, |
| 136 | guint n_entries, |
| 137 | gpointer user_data); |
| 138 | void gtk_action_group_add_radio_actions (GtkActionGroup *action_group, |
| 139 | const GtkRadioActionEntry *entries, |
| 140 | guint n_entries, |
| 141 | gint value, |
| 142 | GCallback on_change, |
| 143 | gpointer user_data); |
| 144 | void gtk_action_group_add_actions_full (GtkActionGroup *action_group, |
| 145 | const GtkActionEntry *entries, |
| 146 | guint n_entries, |
| 147 | gpointer user_data, |
| 148 | GDestroyNotify destroy); |
| 149 | void gtk_action_group_add_toggle_actions_full (GtkActionGroup *action_group, |
| 150 | const GtkToggleActionEntry *entries, |
| 151 | guint n_entries, |
| 152 | gpointer user_data, |
| 153 | GDestroyNotify destroy); |
| 154 | void gtk_action_group_add_radio_actions_full (GtkActionGroup *action_group, |
| 155 | const GtkRadioActionEntry *entries, |
| 156 | guint n_entries, |
| 157 | gint value, |
| 158 | GCallback on_change, |
| 159 | gpointer user_data, |
| 160 | GDestroyNotify destroy); |
| 161 | void gtk_action_group_set_translate_func (GtkActionGroup *action_group, |
| 162 | GtkTranslateFunc func, |
| 163 | gpointer data, |
| 164 | GDestroyNotify notify); |
| 165 | void gtk_action_group_set_translation_domain (GtkActionGroup *action_group, |
| 166 | const gchar *domain); |
| 167 | const gchar *gtk_action_group_translate_string (GtkActionGroup *action_group, |
| 168 | const gchar *string); |
| 169 | |
| 170 | /* Protected for use by GtkAction */ |
| 171 | void _gtk_action_group_emit_connect_proxy (GtkActionGroup *action_group, |
| 172 | GtkAction *action, |
| 173 | GtkWidget *proxy); |
| 174 | void _gtk_action_group_emit_disconnect_proxy (GtkActionGroup *action_group, |
| 175 | GtkAction *action, |
| 176 | GtkWidget *proxy); |
| 177 | void _gtk_action_group_emit_pre_activate (GtkActionGroup *action_group, |
| 178 | GtkAction *action); |
| 179 | void _gtk_action_group_emit_post_activate (GtkActionGroup *action_group, |
| 180 | GtkAction *action); |
| 181 | |
| 182 | G_END_DECLS |
| 183 | |
| 184 | #endif /* __GTK_ACTION_GROUP_H__ */ |
| 185 | |