]> Pileus Git - ~andy/gtk/blob - gtk/gtkbindings.h
93bd46e2304123d83c9b5154966121e9be04bdfd
[~andy/gtk] / gtk / gtkbindings.h
1 /* GTK - The GIMP Toolkit
2  * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3  *
4  * GtkBindingSet: Keybinding manager for GtkObjects.
5  * Copyright (C) 1998 Tim Janik
6  *
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.
11  *
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.
16  *
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.
21  */
22
23 /*
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/. 
28  */
29
30 #ifndef __GTK_BINDINGS_H__
31 #define __GTK_BINDINGS_H__
32
33
34 #include <gdk/gdk.h>
35 #include <gtk/gtkobject.h>
36 #include <gtk/gtkenums.h>
37
38
39 #ifdef __cplusplus
40 extern "C" {
41 #endif /* __cplusplus */
42
43
44 /* Binding sets
45  */
46
47 typedef struct _GtkBindingSet           GtkBindingSet;
48 typedef struct _GtkBindingEntry         GtkBindingEntry;
49 typedef struct _GtkBindingSignal        GtkBindingSignal;
50 typedef struct _GtkBindingArg           GtkBindingArg;
51
52 struct _GtkBindingSet
53 {
54   gchar                 *set_name;
55   gint                   priority;
56   GSList                *widget_path_pspecs;
57   GSList                *widget_class_pspecs;
58   GSList                *class_branch_pspecs;
59   GtkBindingEntry       *entries;
60   GtkBindingEntry       *current;
61 };
62
63 struct _GtkBindingEntry
64 {
65   /* key portion
66    */
67   guint                  keyval;
68   GdkModifierType        modifiers;
69   
70   GtkBindingSet         *binding_set;
71   guint                 destroyed : 1;
72   guint                 in_emission : 1;
73   GtkBindingEntry       *set_next;
74   GtkBindingEntry       *hash_next;
75   GtkBindingSignal      *signals;
76 };
77
78 struct _GtkBindingSignal
79 {
80   GtkBindingSignal      *next;
81   gchar                 *signal_name;
82   guint                  n_args;
83   GtkBindingArg         *args;
84 };
85
86 struct _GtkBindingArg
87 {
88   GtkType       arg_type;
89   union {
90     glong        long_data;
91     gdouble      double_data;
92     gchar       *string_data;
93   } d;
94 };
95
96
97 /* Application-level methods */
98
99 GtkBindingSet*  gtk_binding_set_new     (const gchar    *set_name);
100 GtkBindingSet*  gtk_binding_set_by_class(gpointer        object_class);
101 GtkBindingSet*  gtk_binding_set_find    (const gchar    *set_name);
102 gboolean gtk_bindings_activate          (GtkObject      *object,
103                                          guint           keyval,
104                                          GdkModifierType modifiers);
105 gboolean gtk_binding_set_activate       (GtkBindingSet  *binding_set,
106                                          guint           keyval,
107                                          GdkModifierType modifiers,
108                                          GtkObject      *object);
109 #define  gtk_binding_entry_add          gtk_binding_entry_clear
110 void     gtk_binding_entry_clear        (GtkBindingSet  *binding_set,
111                                          guint           keyval,
112                                          GdkModifierType modifiers);
113 void     gtk_binding_entry_add_signal   (GtkBindingSet  *binding_set,
114                                          guint           keyval,
115                                          GdkModifierType modifiers,
116                                          const gchar    *signal_name,
117                                          guint           n_args,
118                                          ...);
119 void     gtk_binding_set_add_path       (GtkBindingSet  *binding_set,
120                                          GtkPathType     path_type,
121                                          const gchar    *path_pattern,
122                                          GtkPathPriorityType priority);
123
124
125 /* Non-public methods */
126
127 void     gtk_binding_entry_remove       (GtkBindingSet  *binding_set,
128                                          guint           keyval,
129                                          GdkModifierType modifiers);
130 void     gtk_binding_entry_add_signall  (GtkBindingSet  *binding_set,
131                                          guint           keyval,
132                                          GdkModifierType modifiers,
133                                          const gchar    *signal_name,
134                                          GSList         *binding_args);
135 guint    gtk_binding_parse_binding      (GScanner       *scanner);
136
137
138
139
140 #ifdef __cplusplus
141 }
142 #endif /* __cplusplus */
143
144
145 #endif /* __GTK_BINDINGS_H__ */