]> Pileus Git - ~andy/gtk/blob - gtk/gtkbindings.h
When setting styles, remove unecessary explicits draws and clears.
[~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 Library 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  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library 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 #ifndef __GTK_BINDINGS_H__
23 #define __GTK_BINDINGS_H__
24
25
26 #include <gdk/gdk.h>
27 #include <gtk/gtkobject.h>
28 #include <gtk/gtkenums.h>
29
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34
35
36 /* Pattern matching
37  */
38 typedef struct  _GtkPatternSpec GtkPatternSpec;
39
40 struct _GtkPatternSpec
41 {
42   GtkMatchType   match_type;
43   guint          pattern_length;
44   gchar         *pattern;
45   gchar         *pattern_reversed;
46   gpointer       user_data;
47   guint          seq_id;
48 };
49
50 void     gtk_pattern_spec_init      (GtkPatternSpec      *pspec,
51                                      const gchar         *pattern);
52 void     gtk_pattern_spec_free_segs (GtkPatternSpec      *pspec);
53 gboolean gtk_pattern_match          (GtkPatternSpec      *pspec,
54                                      guint                string_length,
55                                      const gchar         *string,
56                                      const gchar         *string_reversed);
57 gboolean gtk_pattern_match_string   (GtkPatternSpec      *pspec,
58                                      const gchar         *string);
59 gboolean gtk_pattern_match_simple   (const gchar         *pattern,
60                                      const gchar         *string);
61
62
63 /* Binding sets
64  */
65
66 typedef struct _GtkBindingSet           GtkBindingSet;
67 typedef struct _GtkBindingEntry         GtkBindingEntry;
68 typedef struct _GtkBindingSignal        GtkBindingSignal;
69 typedef struct _GtkBindingArg           GtkBindingArg;
70
71 struct _GtkBindingSet
72 {
73   gchar                 *set_name;
74   gint                   priority;
75   GSList                *widget_path_pspecs;
76   GSList                *widget_class_pspecs;
77   GSList                *class_branch_pspecs;
78   GtkBindingEntry       *entries;
79   GtkBindingEntry       *current;
80 };
81
82 struct _GtkBindingEntry
83 {
84   /* key portion
85    */
86   guint                  keyval;
87   guint                  modifiers;
88   
89   GtkBindingSet         *binding_set;
90   guint                 destroyed : 1;
91   guint                 in_emission : 1;
92   GtkBindingEntry       *set_next;
93   GtkBindingEntry       *hash_next;
94   GtkBindingSignal      *signals;
95 };
96
97 struct _GtkBindingSignal
98 {
99   GtkBindingSignal      *next;
100   gchar                 *signal_name;
101   guint                  n_args;
102   GtkBindingArg         *args;
103 };
104
105 struct _GtkBindingArg
106 {
107   GtkType       arg_type;
108   union {
109     glong        long_data;
110     gdouble      double_data;
111     gchar       *string_data;
112   } d;
113 };
114
115
116 /* Application-level methods */
117
118 GtkBindingSet*  gtk_binding_set_new     (const gchar    *set_name);
119 GtkBindingSet*  gtk_binding_set_by_class(gpointer        object_class);
120 GtkBindingSet*  gtk_binding_set_find    (const gchar    *set_name);
121 gboolean gtk_bindings_activate          (GtkObject      *object,
122                                          guint           keyval,
123                                          guint           modifiers);
124 gboolean gtk_binding_set_activate       (GtkBindingSet  *binding_set,
125                                          guint           keyval,
126                                          guint           modifiers,
127                                          GtkObject      *object);
128 #define  gtk_binding_entry_add          gtk_binding_entry_clear
129 void     gtk_binding_entry_clear        (GtkBindingSet  *binding_set,
130                                          guint           keyval,
131                                          guint           modifiers);
132 void     gtk_binding_entry_add_signal   (GtkBindingSet  *binding_set,
133                                          guint           keyval,
134                                          guint           modifiers,
135                                          const gchar    *signal_name,
136                                          guint           n_args,
137                                          ...);
138 void     gtk_binding_set_add_path       (GtkBindingSet  *binding_set,
139                                          GtkPathType     path_type,
140                                          const gchar    *path_pattern,
141                                          GtkPathPriorityType priority);
142
143
144 /* Non-public methods */
145
146 void     gtk_binding_entry_remove       (GtkBindingSet  *binding_set,
147                                          guint           keyval,
148                                          guint           modifiers);
149 void     gtk_binding_entry_add_signall  (GtkBindingSet  *binding_set,
150                                          guint           keyval,
151                                          guint           modifiers,
152                                          const gchar    *signal_name,
153                                          GSList         *binding_args);
154 guint    gtk_binding_parse_binding      (GScanner       *scanner);
155
156
157
158
159 #ifdef __cplusplus
160 }
161 #endif /* __cplusplus */
162
163
164 #endif /* __GTK_BINDINGS_H__ */