| 1 | /* GTK - The GIMP Toolkit | 
| 2 |  * Copyright (C) 1998, 2001 Tim Janik | 
| 3 |  * | 
| 4 |  * This library is free software; you can redistribute it and/or | 
| 5 |  * modify it under the terms of the GNU Lesser General Public | 
| 6 |  * License as published by the Free Software Foundation; either | 
| 7 |  * version 2 of the License, or (at your option) any later version. | 
| 8 |  * | 
| 9 |  * This library is distributed in the hope that it will be useful, | 
| 10 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU | 
| 12 |  * Lesser General Public License for more details. | 
| 13 |  * | 
| 14 |  * You should have received a copy of the GNU Lesser General Public | 
| 15 |  * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 
| 16 |  */ | 
| 17 |  | 
| 18 | /* | 
| 19 |  * Modified by the GTK+ Team and others 1997-2000.  See the AUTHORS | 
| 20 |  * file for a list of people on the GTK+ Team.  See the ChangeLog | 
| 21 |  * files for a list of changes.  These files are distributed with | 
| 22 |  * GTK+ at ftp://ftp.gtk.org/pub/gtk/. | 
| 23 |  */ | 
| 24 |  | 
| 25 | #ifndef __GTK_ACCEL_GROUP_H__ | 
| 26 | #define __GTK_ACCEL_GROUP_H__ | 
| 27 |  | 
| 28 |  | 
| 29 | #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION) | 
| 30 | #error "Only <gtk/gtk.h> can be included directly." | 
| 31 | #endif | 
| 32 |  | 
| 33 | #include <gdk/gdk.h> | 
| 34 | #include <gtk/gtkenums.h> | 
| 35 |  | 
| 36 | G_BEGIN_DECLS | 
| 37 |  | 
| 38 |  | 
| 39 | /* --- type macros --- */ | 
| 40 | #define GTK_TYPE_ACCEL_GROUP              (gtk_accel_group_get_type ()) | 
| 41 | #define GTK_ACCEL_GROUP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ACCEL_GROUP, GtkAccelGroup)) | 
| 42 | #define GTK_ACCEL_GROUP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCEL_GROUP, GtkAccelGroupClass)) | 
| 43 | #define GTK_IS_ACCEL_GROUP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ACCEL_GROUP)) | 
| 44 | #define GTK_IS_ACCEL_GROUP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCEL_GROUP)) | 
| 45 | #define GTK_ACCEL_GROUP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCEL_GROUP, GtkAccelGroupClass)) | 
| 46 |  | 
| 47 |  | 
| 48 | /* --- accel flags --- */ | 
| 49 | /** | 
| 50 |  * GtkAccelFlags: | 
| 51 |  * @GTK_ACCEL_VISIBLE: Accelerator is visible | 
| 52 |  * @GTK_ACCEL_LOCKED: Accelerator not removable | 
| 53 |  * @GTK_ACCEL_MASK: Mask | 
| 54 |  * | 
| 55 |  * Accelerator flags used with gtk_accel_group_connect(). | 
| 56 |  */ | 
| 57 | typedef enum | 
| 58 | { | 
| 59 |   GTK_ACCEL_VISIBLE        = 1 << 0, | 
| 60 |   GTK_ACCEL_LOCKED         = 1 << 1, | 
| 61 |   GTK_ACCEL_MASK           = 0x07 | 
| 62 | } GtkAccelFlags; | 
| 63 |  | 
| 64 |  | 
| 65 | /* --- typedefs & structures --- */ | 
| 66 | typedef struct _GtkAccelGroup	          GtkAccelGroup; | 
| 67 | typedef struct _GtkAccelGroupClass        GtkAccelGroupClass; | 
| 68 | typedef struct _GtkAccelGroupPrivate      GtkAccelGroupPrivate; | 
| 69 | typedef struct _GtkAccelKey               GtkAccelKey; | 
| 70 | typedef struct _GtkAccelGroupEntry        GtkAccelGroupEntry; | 
| 71 | typedef gboolean (*GtkAccelGroupActivate) (GtkAccelGroup  *accel_group, | 
| 72 | 					   GObject        *acceleratable, | 
| 73 | 					   guint           keyval, | 
| 74 | 					   GdkModifierType modifier); | 
| 75 |  | 
| 76 | /** | 
| 77 |  * GtkAccelGroupFindFunc: | 
| 78 |  * @key:  | 
| 79 |  * @closure:  | 
| 80 |  * @data: (closure): | 
| 81 |  *  | 
| 82 |  * Since: 2.2 | 
| 83 |  */ | 
| 84 | typedef gboolean (*GtkAccelGroupFindFunc) (GtkAccelKey    *key, | 
| 85 | 					   GClosure       *closure, | 
| 86 | 					   gpointer        data); | 
| 87 |  | 
| 88 | /** | 
| 89 |  * GtkAccelGroup: | 
| 90 |  *  | 
| 91 |  * An object representing and maintaining a group of accelerators. | 
| 92 |  */ | 
| 93 | struct _GtkAccelGroup | 
| 94 | { | 
| 95 |   GObject               parent; | 
| 96 |   GtkAccelGroupPrivate *priv; | 
| 97 | }; | 
| 98 |  | 
| 99 | /** | 
| 100 |  * GtkAccelGroupClass: | 
| 101 |  * @parent_class: The parent class. | 
| 102 |  * @accel_changed: Signal emitted when an entry is added to or removed | 
| 103 |  *    from the accel group. | 
| 104 |  */ | 
| 105 | struct _GtkAccelGroupClass | 
| 106 | { | 
| 107 |   GObjectClass parent_class; | 
| 108 |  | 
| 109 |   /*< public >*/ | 
| 110 |  | 
| 111 |   void	(*accel_changed)	(GtkAccelGroup	*accel_group, | 
| 112 | 				 guint           keyval, | 
| 113 | 				 GdkModifierType modifier, | 
| 114 | 				 GClosure       *accel_closure); | 
| 115 |  | 
| 116 |   /*< private >*/ | 
| 117 |  | 
| 118 |   /* Padding for future expansion */ | 
| 119 |   void (*_gtk_reserved1) (void); | 
| 120 |   void (*_gtk_reserved2) (void); | 
| 121 |   void (*_gtk_reserved3) (void); | 
| 122 |   void (*_gtk_reserved4) (void); | 
| 123 | }; | 
| 124 |  | 
| 125 | /** | 
| 126 |  * GtkAccelKey: | 
| 127 |  * @accel_key: The accelerator keyval | 
| 128 |  * @accel_mods:The accelerator modifiers | 
| 129 |  * @accel_flags: The accelerator flags | 
| 130 |  */ | 
| 131 | struct _GtkAccelKey | 
| 132 | { | 
| 133 |   guint           accel_key; | 
| 134 |   GdkModifierType accel_mods; | 
| 135 |   guint           accel_flags : 16; | 
| 136 | }; | 
| 137 |  | 
| 138 |  | 
| 139 | /* -- Accelerator Groups --- */ | 
| 140 | GDK_AVAILABLE_IN_ALL | 
| 141 | GType          gtk_accel_group_get_type           (void) G_GNUC_CONST; | 
| 142 | GDK_AVAILABLE_IN_ALL | 
| 143 | GtkAccelGroup* gtk_accel_group_new	      	  (void); | 
| 144 | GDK_AVAILABLE_IN_ALL | 
| 145 | gboolean       gtk_accel_group_get_is_locked      (GtkAccelGroup  *accel_group); | 
| 146 | GDK_AVAILABLE_IN_ALL | 
| 147 | GdkModifierType  | 
| 148 |                gtk_accel_group_get_modifier_mask  (GtkAccelGroup  *accel_group); | 
| 149 | GDK_AVAILABLE_IN_ALL | 
| 150 | void	       gtk_accel_group_lock		  (GtkAccelGroup  *accel_group); | 
| 151 | GDK_AVAILABLE_IN_ALL | 
| 152 | void	       gtk_accel_group_unlock		  (GtkAccelGroup  *accel_group); | 
| 153 | GDK_AVAILABLE_IN_ALL | 
| 154 | void	       gtk_accel_group_connect		  (GtkAccelGroup  *accel_group, | 
| 155 | 						   guint	   accel_key, | 
| 156 | 						   GdkModifierType accel_mods, | 
| 157 | 						   GtkAccelFlags   accel_flags, | 
| 158 | 						   GClosure	  *closure); | 
| 159 | GDK_AVAILABLE_IN_ALL | 
| 160 | void           gtk_accel_group_connect_by_path    (GtkAccelGroup  *accel_group, | 
| 161 | 						   const gchar	  *accel_path, | 
| 162 | 						   GClosure	  *closure); | 
| 163 | GDK_AVAILABLE_IN_ALL | 
| 164 | gboolean       gtk_accel_group_disconnect	  (GtkAccelGroup  *accel_group, | 
| 165 | 						   GClosure	  *closure); | 
| 166 | GDK_AVAILABLE_IN_ALL | 
| 167 | gboolean       gtk_accel_group_disconnect_key	  (GtkAccelGroup  *accel_group, | 
| 168 | 						   guint	   accel_key, | 
| 169 | 						   GdkModifierType accel_mods); | 
| 170 | GDK_AVAILABLE_IN_ALL | 
| 171 | gboolean       gtk_accel_group_activate           (GtkAccelGroup   *accel_group, | 
| 172 |                                                    GQuark	   accel_quark, | 
| 173 |                                                    GObject	  *acceleratable, | 
| 174 |                                                    guint	   accel_key, | 
| 175 |                                                    GdkModifierType accel_mods); | 
| 176 |  | 
| 177 |  | 
| 178 | /* --- GtkActivatable glue --- */ | 
| 179 | void		_gtk_accel_group_attach		(GtkAccelGroup	*accel_group, | 
| 180 | 						 GObject	*object); | 
| 181 | void		_gtk_accel_group_detach		(GtkAccelGroup	*accel_group, | 
| 182 | 						 GObject	*object); | 
| 183 | GDK_AVAILABLE_IN_ALL | 
| 184 | gboolean        gtk_accel_groups_activate      	(GObject	*object, | 
| 185 | 						 guint		 accel_key, | 
| 186 | 						 GdkModifierType accel_mods); | 
| 187 | GDK_AVAILABLE_IN_ALL | 
| 188 | GSList*	        gtk_accel_groups_from_object    (GObject	*object); | 
| 189 | GDK_AVAILABLE_IN_ALL | 
| 190 | GtkAccelKey*	gtk_accel_group_find		(GtkAccelGroup	      *accel_group, | 
| 191 | 						 GtkAccelGroupFindFunc find_func, | 
| 192 | 						 gpointer              data); | 
| 193 | GDK_AVAILABLE_IN_ALL | 
| 194 | GtkAccelGroup*	gtk_accel_group_from_accel_closure (GClosure    *closure); | 
| 195 |  | 
| 196 |  | 
| 197 | /* --- Accelerators--- */ | 
| 198 | GDK_AVAILABLE_IN_ALL | 
| 199 | gboolean gtk_accelerator_valid		      (guint	        keyval, | 
| 200 | 					       GdkModifierType  modifiers) G_GNUC_CONST; | 
| 201 | GDK_AVAILABLE_IN_ALL | 
| 202 | void	 gtk_accelerator_parse		      (const gchar     *accelerator, | 
| 203 | 					       guint	       *accelerator_key, | 
| 204 | 					       GdkModifierType *accelerator_mods); | 
| 205 | GDK_AVAILABLE_IN_3_4 | 
| 206 | void gtk_accelerator_parse_with_keycode       (const gchar     *accelerator, | 
| 207 |                                                guint           *accelerator_key, | 
| 208 |                                                guint          **accelerator_codes, | 
| 209 |                                                GdkModifierType *accelerator_mods); | 
| 210 | GDK_AVAILABLE_IN_ALL | 
| 211 | gchar*	 gtk_accelerator_name		      (guint	        accelerator_key, | 
| 212 | 					       GdkModifierType  accelerator_mods); | 
| 213 | GDK_AVAILABLE_IN_3_4 | 
| 214 | gchar*	 gtk_accelerator_name_with_keycode    (GdkDisplay      *display, | 
| 215 |                                                guint            accelerator_key, | 
| 216 |                                                guint            keycode, | 
| 217 |                                                GdkModifierType  accelerator_mods); | 
| 218 | GDK_AVAILABLE_IN_ALL | 
| 219 | gchar*   gtk_accelerator_get_label            (guint           accelerator_key, | 
| 220 |                                                GdkModifierType accelerator_mods); | 
| 221 | GDK_AVAILABLE_IN_3_4 | 
| 222 | gchar*   gtk_accelerator_get_label_with_keycode (GdkDisplay      *display, | 
| 223 |                                                  guint            accelerator_key, | 
| 224 |                                                  guint            keycode, | 
| 225 |                                                  GdkModifierType  accelerator_mods); | 
| 226 | GDK_AVAILABLE_IN_ALL | 
| 227 | void	 gtk_accelerator_set_default_mod_mask (GdkModifierType  default_mod_mask); | 
| 228 | GDK_AVAILABLE_IN_ALL | 
| 229 | GdkModifierType | 
| 230 | 	 gtk_accelerator_get_default_mod_mask (void); | 
| 231 |  | 
| 232 | GDK_AVAILABLE_IN_ALL | 
| 233 | GtkAccelGroupEntry*	gtk_accel_group_query	(GtkAccelGroup	*accel_group, | 
| 234 | 						 guint		 accel_key, | 
| 235 | 						 GdkModifierType accel_mods, | 
| 236 | 						 guint          *n_entries); | 
| 237 |  | 
| 238 | struct _GtkAccelGroupEntry | 
| 239 | { | 
| 240 |   GtkAccelKey  key; | 
| 241 |   GClosure    *closure; | 
| 242 |   GQuark       accel_path_quark; | 
| 243 | }; | 
| 244 |  | 
| 245 | G_DEFINE_AUTOPTR_CLEANUP_FUNC(GtkAccelGroup, g_object_unref) | 
| 246 |  | 
| 247 | G_END_DECLS | 
| 248 |  | 
| 249 | #endif /* __GTK_ACCEL_GROUP_H__ */ | 
| 250 |  |