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, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
25 * file for a list of people on the GTK+ Team. See the ChangeLog
26 * files for a list of changes. These files are distributed with
27 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
30 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
31 #error "Only <gtk/gtk.h> can be included directly."
34 #ifndef __GTK_BINDINGS_H__
35 #define __GTK_BINDINGS_H__
39 #include <gtk/gtkenums.h>
43 typedef struct _GtkBindingSet GtkBindingSet;
44 typedef struct _GtkBindingEntry GtkBindingEntry;
45 typedef struct _GtkBindingSignal GtkBindingSignal;
46 typedef struct _GtkBindingArg GtkBindingArg;
50 * @set_name: unique name of this binding set
52 * @widget_path_pspecs: unused
53 * @widget_class_pspecs: unused
54 * @class_branch_pspecs: unused
55 * @entries: the key binding entries in this binding set
56 * @current: implementation detail
57 * @parsed: whether this binding set stems from a CSS file and is reset upon theme changes
59 * A binding set maintains a list of activatable key bindings.
60 * A single binding set can match multiple types of widgets.
61 * Similar to style contexts, can be matched by any information contained
62 * in a widgets #GtkWidgetPath. When a binding within a set is matched upon
63 * activation, an action signal is emitted on the target widget to carry out
64 * the actual activation.
70 GSList *widget_path_pspecs;
71 GSList *widget_class_pspecs;
72 GSList *class_branch_pspecs;
73 GtkBindingEntry *entries;
74 GtkBindingEntry *current;
80 * @keyval: key value to match
81 * @modifiers: key modifiers to match
82 * @binding_set: binding set this entry belongs to
83 * @destroyed: implementation detail
84 * @in_emission: implementation detail
85 * @marks_unbound: implementation detail
86 * @set_next: linked list of entries maintained by binding set
87 * @hash_next: implementation detail
88 * @signals: action signals of this entry
90 * Each key binding element of a binding sets binding list is
91 * represented by a GtkBindingEntry.
93 struct _GtkBindingEntry
97 GdkModifierType modifiers;
99 GtkBindingSet *binding_set;
101 guint in_emission : 1;
102 guint marks_unbound : 1;
103 GtkBindingEntry *set_next;
104 GtkBindingEntry *hash_next;
105 GtkBindingSignal *signals;
110 * @arg_type: implementation detail
112 * A #GtkBindingArg holds the data associated with
113 * an argument for a key binding signal emission as
114 * stored in #GtkBindingSignal.
116 struct _GtkBindingArg
128 * @next: implementation detail
129 * @signal_name: the action signal to be emitted
130 * @n_args: number of arguments specified for the signal
131 * @args: the arguments specified for the signal
133 * <anchor id="keybinding-signals"/>
134 * A GtkBindingSignal stores the necessary information to
135 * activate a widget in response to a key press via a signal
138 struct _GtkBindingSignal
140 GtkBindingSignal *next;
146 GtkBindingSet *gtk_binding_set_new (const gchar *set_name);
147 GtkBindingSet *gtk_binding_set_by_class (gpointer object_class);
148 GtkBindingSet *gtk_binding_set_find (const gchar *set_name);
150 gboolean gtk_bindings_activate (GObject *object,
152 GdkModifierType modifiers);
153 gboolean gtk_bindings_activate_event (GObject *object,
155 gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
157 GdkModifierType modifiers,
160 void gtk_binding_entry_skip (GtkBindingSet *binding_set,
162 GdkModifierType modifiers);
163 void gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
165 GdkModifierType modifiers,
166 const gchar *signal_name,
169 void gtk_binding_entry_add_signall (GtkBindingSet *binding_set,
171 GdkModifierType modifiers,
172 const gchar *signal_name,
173 GSList *binding_args);
175 GTokenType gtk_binding_entry_add_signal_from_string
176 (GtkBindingSet *binding_set,
177 const gchar *signal_desc);
179 void gtk_binding_entry_remove (GtkBindingSet *binding_set,
181 GdkModifierType modifiers);
184 void gtk_binding_set_add_path (GtkBindingSet *binding_set,
185 GtkPathType path_type,
186 const gchar *path_pattern,
187 GtkPathPriorityType priority);
191 #endif /* __GTK_BINDINGS_H__ */