1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1998, 2001 Tim Janik
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.
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.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
27 #ifndef __GTK_ACCEL_GROUP_H__
28 #define __GTK_ACCEL_GROUP_H__
32 #include <gtk/gtkenums.h>
37 /* --- type macros --- */
38 #define GTK_TYPE_ACCEL_GROUP (gtk_accel_group_get_type ())
39 #define GTK_ACCEL_GROUP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GTK_TYPE_ACCEL_GROUP, GtkAccelGroup))
40 #define GTK_ACCEL_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_ACCEL_GROUP, GtkAccelGroupClass))
41 #define GTK_IS_ACCEL_GROUP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GTK_TYPE_ACCEL_GROUP))
42 #define GTK_IS_ACCEL_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ACCEL_GROUP))
43 #define GTK_ACCEL_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_ACCEL_GROUP, GtkAccelGroupClass))
46 /* --- accel flags --- */
49 GTK_ACCEL_VISIBLE = 1 << 0, /* display in GtkAccelLabel? */
50 GTK_ACCEL_LOCKED = 1 << 1, /* is it removable? */
55 /* --- typedefs & structures --- */
56 typedef struct _GtkAccelGroup GtkAccelGroup;
57 typedef struct _GtkAccelGroupClass GtkAccelGroupClass;
58 typedef struct _GtkAccelKey GtkAccelKey;
59 typedef struct _GtkAccelGroupEntry GtkAccelGroupEntry;
60 typedef gboolean (*GtkAccelGroupActivate) (GtkAccelGroup *accel_group,
61 GObject *acceleratable,
63 GdkModifierType modifier);
68 GdkModifierType modifier_mask;
69 GSList *acceleratables;
71 GtkAccelGroupEntry *priv_accels;
73 struct _GtkAccelGroupClass
75 GObjectClass parent_class;
77 void (*accel_changed) (GtkAccelGroup *accel_group,
79 GdkModifierType modifier,
80 GClosure *accel_closure);
85 GdkModifierType accel_mods;
86 guint accel_flags : 16;
90 /* -- Accelerator Groups --- */
91 GType gtk_accel_group_get_type (void);
92 GtkAccelGroup* gtk_accel_group_new (void);
93 void gtk_accel_group_lock (GtkAccelGroup *accel_group);
94 void gtk_accel_group_unlock (GtkAccelGroup *accel_group);
95 void gtk_accel_group_connect (GtkAccelGroup *accel_group,
97 GdkModifierType accel_mods,
98 GtkAccelFlags accel_flags,
100 GQuark accel_path_quark);
101 gboolean gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
103 GdkModifierType accel_mods);
104 gboolean gtk_accel_groups_disconnect_closure (GClosure *closure);
107 /* --- GtkActivatable glue --- */
108 void _gtk_accel_group_attach (GtkAccelGroup *accel_group,
110 void _gtk_accel_group_detach (GtkAccelGroup *accel_group,
112 gboolean gtk_accel_groups_activate (GObject *acceleratable,
114 GdkModifierType accel_mods);
115 GSList* gtk_accel_groups_from_acceleratable (GObject *object);
116 GtkAccelKey* gtk_accel_group_find (GtkAccelGroup *accel_group,
117 gboolean (*find_func) (GtkAccelKey *key,
121 GtkAccelGroup* gtk_accel_group_from_accel_closure (GClosure *closure);
124 /* --- Accelerators--- */
125 gboolean gtk_accelerator_valid (guint keyval,
126 GdkModifierType modifiers) G_GNUC_CONST;
127 void gtk_accelerator_parse (const gchar *accelerator,
128 guint *accelerator_key,
129 GdkModifierType *accelerator_mods);
130 gchar* gtk_accelerator_name (guint accelerator_key,
131 GdkModifierType accelerator_mods);
132 void gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask);
133 guint gtk_accelerator_get_default_mod_mask (void);
136 /* --- internal --- */
137 GtkAccelGroupEntry* gtk_accel_group_query (GtkAccelGroup *accel_group,
139 GdkModifierType accel_mods,
141 struct _GtkAccelGroupEntry
145 GQuark accel_path_quark;
149 #ifndef GTK_DISABLE_DEPRECATED
150 #define gtk_accel_group_ref g_object_ref
151 #define gtk_accel_group_unref g_object_unref
152 #endif /* GTK_DISABLE_DEPRECATED */
157 #endif /* __GTK_ACCEL_GROUP_H__ */