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, see <http://www.gnu.org/licenses/>.
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/.
25 #ifndef __GTK_ACCEL_GROUP_H__
26 #define __GTK_ACCEL_GROUP_H__
29 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
30 #error "Only <gtk/gtk.h> can be included directly."
34 #include <gtk/gtkenums.h>
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))
48 /* --- accel flags --- */
51 GTK_ACCEL_VISIBLE = 1 << 0, /* display in GtkAccelLabel? */
52 GTK_ACCEL_LOCKED = 1 << 1, /* is it removable? */
57 /* --- typedefs & structures --- */
58 typedef struct _GtkAccelGroup GtkAccelGroup;
59 typedef struct _GtkAccelGroupClass GtkAccelGroupClass;
60 typedef struct _GtkAccelGroupPrivate GtkAccelGroupPrivate;
61 typedef struct _GtkAccelKey GtkAccelKey;
62 typedef struct _GtkAccelGroupEntry GtkAccelGroupEntry;
63 typedef gboolean (*GtkAccelGroupActivate) (GtkAccelGroup *accel_group,
64 GObject *acceleratable,
66 GdkModifierType modifier);
69 * GtkAccelGroupFindFunc:
76 typedef gboolean (*GtkAccelGroupFindFunc) (GtkAccelKey *key,
83 * An object representing and maintaining a group of accelerators.
88 GtkAccelGroupPrivate *priv;
91 struct _GtkAccelGroupClass
93 GObjectClass parent_class;
95 void (*accel_changed) (GtkAccelGroup *accel_group,
97 GdkModifierType modifier,
98 GClosure *accel_closure);
100 /* Padding for future expansion */
101 void (*_gtk_reserved1) (void);
102 void (*_gtk_reserved2) (void);
103 void (*_gtk_reserved3) (void);
104 void (*_gtk_reserved4) (void);
110 GdkModifierType accel_mods;
111 guint accel_flags : 16;
115 /* -- Accelerator Groups --- */
116 GType gtk_accel_group_get_type (void) G_GNUC_CONST;
117 GtkAccelGroup* gtk_accel_group_new (void);
118 gboolean gtk_accel_group_get_is_locked (GtkAccelGroup *accel_group);
120 gtk_accel_group_get_modifier_mask (GtkAccelGroup *accel_group);
121 void gtk_accel_group_lock (GtkAccelGroup *accel_group);
122 void gtk_accel_group_unlock (GtkAccelGroup *accel_group);
123 void gtk_accel_group_connect (GtkAccelGroup *accel_group,
125 GdkModifierType accel_mods,
126 GtkAccelFlags accel_flags,
128 void gtk_accel_group_connect_by_path (GtkAccelGroup *accel_group,
129 const gchar *accel_path,
131 gboolean gtk_accel_group_disconnect (GtkAccelGroup *accel_group,
133 gboolean gtk_accel_group_disconnect_key (GtkAccelGroup *accel_group,
135 GdkModifierType accel_mods);
136 gboolean gtk_accel_group_activate (GtkAccelGroup *accel_group,
138 GObject *acceleratable,
140 GdkModifierType accel_mods);
143 /* --- GtkActivatable glue --- */
144 void _gtk_accel_group_attach (GtkAccelGroup *accel_group,
146 void _gtk_accel_group_detach (GtkAccelGroup *accel_group,
148 gboolean gtk_accel_groups_activate (GObject *object,
150 GdkModifierType accel_mods);
151 GSList* gtk_accel_groups_from_object (GObject *object);
152 GtkAccelKey* gtk_accel_group_find (GtkAccelGroup *accel_group,
153 GtkAccelGroupFindFunc find_func,
155 GtkAccelGroup* gtk_accel_group_from_accel_closure (GClosure *closure);
158 /* --- Accelerators--- */
159 gboolean gtk_accelerator_valid (guint keyval,
160 GdkModifierType modifiers) G_GNUC_CONST;
161 void gtk_accelerator_parse (const gchar *accelerator,
162 guint *accelerator_key,
163 GdkModifierType *accelerator_mods);
165 void gtk_accelerator_parse_with_keycode (const gchar *accelerator,
166 guint *accelerator_key,
167 guint **accelerator_codes,
168 GdkModifierType *accelerator_mods);
169 gchar* gtk_accelerator_name (guint accelerator_key,
170 GdkModifierType accelerator_mods);
172 gchar* gtk_accelerator_name_with_keycode (GdkDisplay *display,
173 guint accelerator_key,
175 GdkModifierType accelerator_mods);
176 gchar* gtk_accelerator_get_label (guint accelerator_key,
177 GdkModifierType accelerator_mods);
179 gchar* gtk_accelerator_get_label_with_keycode (GdkDisplay *display,
180 guint accelerator_key,
182 GdkModifierType accelerator_mods);
183 void gtk_accelerator_set_default_mod_mask (GdkModifierType default_mod_mask);
185 gtk_accelerator_get_default_mod_mask (void);
188 /* --- internal --- */
189 GtkAccelGroupEntry* gtk_accel_group_query (GtkAccelGroup *accel_group,
191 GdkModifierType accel_mods,
194 void _gtk_accel_group_reconnect (GtkAccelGroup *accel_group,
195 GQuark accel_path_quark);
196 GSList* _gtk_accel_group_get_accelerables (GtkAccelGroup *accel_group);
198 struct _GtkAccelGroupEntry
202 GQuark accel_path_quark;
209 #endif /* __GTK_ACCEL_GROUP_H__ */