]> Pileus Git - ~andy/gtk/blob - gtk/gtkbindings.h
Update Norwegian bokmål translation.
[~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 #if defined(GTK_DISABLE_SINGLE_INCLUDES) && !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
31 #error "Only <gtk/gtk.h> can be included directly."
32 #endif
33
34 #ifndef __GTK_BINDINGS_H__
35 #define __GTK_BINDINGS_H__
36
37
38 #include <gdk/gdk.h>
39 #include <gtk/gtkobject.h>
40
41
42 G_BEGIN_DECLS
43
44
45 /* Binding sets
46  */
47
48 typedef struct _GtkBindingSet           GtkBindingSet;
49 typedef struct _GtkBindingEntry         GtkBindingEntry;
50 typedef struct _GtkBindingSignal        GtkBindingSignal;
51 typedef struct _GtkBindingArg           GtkBindingArg;
52
53 struct _GtkBindingSet
54 {
55   gchar                 *set_name;
56   gint                   priority;
57   GSList                *widget_path_pspecs;
58   GSList                *widget_class_pspecs;
59   GSList                *class_branch_pspecs;
60   GtkBindingEntry       *entries;
61   GtkBindingEntry       *current;
62   guint                  parsed : 1; /* From RC content */
63 };
64
65 struct _GtkBindingEntry
66 {
67   /* key portion
68    */
69   guint                  keyval;
70   GdkModifierType        modifiers;
71   
72   GtkBindingSet         *binding_set;
73   guint                 destroyed : 1;
74   guint                 in_emission : 1;
75   guint                 marks_unbound : 1;
76   GtkBindingEntry       *set_next;
77   GtkBindingEntry       *hash_next;
78   GtkBindingSignal      *signals;
79 };
80
81 struct _GtkBindingArg
82 {
83   GType          arg_type;
84   union {
85     glong        long_data;
86     gdouble      double_data;
87     gchar       *string_data;
88   } d;
89 };
90
91 struct _GtkBindingSignal
92 {
93   GtkBindingSignal      *next;
94   gchar                 *signal_name;
95   guint                  n_args;
96   GtkBindingArg         *args;
97 };
98
99 /* Application-level methods */
100
101 GtkBindingSet*  gtk_binding_set_new     (const gchar    *set_name);
102 GtkBindingSet*  gtk_binding_set_by_class(gpointer        object_class);
103 GtkBindingSet*  gtk_binding_set_find    (const gchar    *set_name);
104 gboolean gtk_bindings_activate          (GtkObject      *object,
105                                          guint           keyval,
106                                          GdkModifierType modifiers);
107 gboolean gtk_bindings_activate_event    (GtkObject      *object,
108                                          GdkEventKey    *event);
109 gboolean gtk_binding_set_activate       (GtkBindingSet  *binding_set,
110                                          guint           keyval,
111                                          GdkModifierType modifiers,
112                                          GtkObject      *object);
113
114 #ifndef GTK_DISABLE_DEPRECATED
115 #define  gtk_binding_entry_add          gtk_binding_entry_clear
116 void     gtk_binding_entry_clear        (GtkBindingSet  *binding_set,
117                                          guint           keyval,
118                                          GdkModifierType modifiers);
119 guint    gtk_binding_parse_binding      (GScanner       *scanner);
120 #endif /* GTK_DISABLE_DEPRECATED */
121
122 void     gtk_binding_entry_skip         (GtkBindingSet  *binding_set,
123                                          guint           keyval,
124                                          GdkModifierType modifiers);
125 void     gtk_binding_entry_add_signal   (GtkBindingSet  *binding_set,
126                                          guint           keyval,
127                                          GdkModifierType modifiers,
128                                          const gchar    *signal_name,
129                                          guint           n_args,
130                                          ...);
131 void     gtk_binding_entry_add_signall  (GtkBindingSet  *binding_set,
132                                          guint           keyval,
133                                          GdkModifierType modifiers,
134                                          const gchar    *signal_name,
135                                          GSList         *binding_args);
136 void     gtk_binding_entry_remove       (GtkBindingSet  *binding_set,
137                                          guint           keyval,
138                                          GdkModifierType modifiers);
139
140 void     gtk_binding_set_add_path       (GtkBindingSet  *binding_set,
141                                          GtkPathType     path_type,
142                                          const gchar    *path_pattern,
143                                          GtkPathPriorityType priority);
144
145
146 /* Non-public methods */
147
148 guint    _gtk_binding_parse_binding     (GScanner       *scanner);
149 void     _gtk_binding_reset_parsed      (void);
150 void     _gtk_binding_entry_add_signall (GtkBindingSet  *binding_set,
151                                          guint           keyval,
152                                          GdkModifierType modifiers,
153                                          const gchar    *signal_name,
154                                          GSList         *binding_args);
155
156 G_END_DECLS
157
158 #endif /* __GTK_BINDINGS_H__ */