1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * GtkBindingSet: Keybinding manager for GObjects.
5 * Copyright (C) 1998 Tim Janik
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
22 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
23 * file for a list of people on the GTK+ Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
28 #ifndef __GTK_BINDINGS_H__
29 #define __GTK_BINDINGS_H__
32 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
33 #error "Only <gtk/gtk.h> can be included directly."
37 #include <gtk/gtkenums.h>
41 typedef struct _GtkBindingSet GtkBindingSet;
42 typedef struct _GtkBindingEntry GtkBindingEntry;
43 typedef struct _GtkBindingSignal GtkBindingSignal;
44 typedef struct _GtkBindingArg GtkBindingArg;
48 * @set_name: unique name of this binding set
50 * @widget_path_pspecs: unused
51 * @widget_class_pspecs: unused
52 * @class_branch_pspecs: unused
53 * @entries: the key binding entries in this binding set
54 * @current: implementation detail
55 * @parsed: whether this binding set stems from a CSS file and is reset upon theme changes
57 * A binding set maintains a list of activatable key bindings.
58 * A single binding set can match multiple types of widgets.
59 * Similar to style contexts, can be matched by any information contained
60 * in a widgets #GtkWidgetPath. When a binding within a set is matched upon
61 * activation, an action signal is emitted on the target widget to carry out
62 * the actual activation.
68 GSList *widget_path_pspecs;
69 GSList *widget_class_pspecs;
70 GSList *class_branch_pspecs;
71 GtkBindingEntry *entries;
72 GtkBindingEntry *current;
78 * @keyval: key value to match
79 * @modifiers: key modifiers to match
80 * @binding_set: binding set this entry belongs to
81 * @destroyed: implementation detail
82 * @in_emission: implementation detail
83 * @marks_unbound: implementation detail
84 * @set_next: linked list of entries maintained by binding set
85 * @hash_next: implementation detail
86 * @signals: action signals of this entry
88 * Each key binding element of a binding sets binding list is
89 * represented by a GtkBindingEntry.
91 struct _GtkBindingEntry
95 GdkModifierType modifiers;
97 GtkBindingSet *binding_set;
99 guint in_emission : 1;
100 guint marks_unbound : 1;
101 GtkBindingEntry *set_next;
102 GtkBindingEntry *hash_next;
103 GtkBindingSignal *signals;
108 * @arg_type: implementation detail
110 * A #GtkBindingArg holds the data associated with
111 * an argument for a key binding signal emission as
112 * stored in #GtkBindingSignal.
114 struct _GtkBindingArg
126 * @next: implementation detail
127 * @signal_name: the action signal to be emitted
128 * @n_args: number of arguments specified for the signal
129 * @args: the arguments specified for the signal
131 * <anchor id="keybinding-signals"/>
132 * A GtkBindingSignal stores the necessary information to
133 * activate a widget in response to a key press via a signal
136 struct _GtkBindingSignal
138 GtkBindingSignal *next;
144 GtkBindingSet *gtk_binding_set_new (const gchar *set_name);
145 GtkBindingSet *gtk_binding_set_by_class (gpointer object_class);
146 GtkBindingSet *gtk_binding_set_find (const gchar *set_name);
148 gboolean gtk_bindings_activate (GObject *object,
150 GdkModifierType modifiers);
151 gboolean gtk_bindings_activate_event (GObject *object,
153 gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
155 GdkModifierType modifiers,
158 void gtk_binding_entry_skip (GtkBindingSet *binding_set,
160 GdkModifierType modifiers);
161 void gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
163 GdkModifierType modifiers,
164 const gchar *signal_name,
167 void gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
169 GdkModifierType modifiers,
170 const gchar *signal_name,
171 GSList *binding_args);
173 GTokenType gtk_binding_entry_add_signal_from_string
174 (GtkBindingSet *binding_set,
175 const gchar *signal_desc);
177 void gtk_binding_entry_remove (GtkBindingSet *binding_set,
179 GdkModifierType modifiers);
181 GDK_DEPRECATED_IN_3_0
182 void gtk_binding_set_add_path (GtkBindingSet *binding_set,
183 GtkPathType path_type,
184 const gchar *path_pattern,
185 GtkPathPriorityType priority);
189 #endif /* __GTK_BINDINGS_H__ */