]> Pileus Git - ~andy/gtk/blob - modules/input/gtkimcontextmultipress.h
Create enum PrinterStateLevel
[~andy/gtk] / modules / input / gtkimcontextmultipress.h
1 /* Copyright (C) 2006 Openismus GmbH
2  *
3  * This library is free software; you can redistribute it and/or
4  * modify it under the terms of the GNU Lesser General Public
5  * License as published by the Free Software Foundation; either
6  * version 2 of the License, or (at your option) any later version.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11  * Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public
14  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
15  */
16
17 #ifndef __GTK_IM_CONTEXT_MULTIPRESS_H__
18 #define __GTK_IM_CONTEXT_MULTIPRESS_H__
19
20 #include <gtk/gtk.h>
21
22 G_BEGIN_DECLS
23
24 #define GTK_TYPE_IM_CONTEXT_MULTIPRESS            (gtk_im_context_multipress_get_type ())
25 #define GTK_IM_CONTEXT_MULTIPRESS(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT_MULTIPRESS, GtkImContextMultipress))
26 #define GTK_IM_CONTEXT_MULTIPRESS_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT_MULTIPRESS, GtkImContextMultipressClass))
27 #define GTK_IS_IM_CONTEXT_MULTIPRESS(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IM_CONTEXT_MULTIPRESS))
28 #define GTK_IS_IM_CONTEXT_MULTIPRESS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT_MULTIPRESS))
29 #define GTK_IM_CONTEXT_MULTIPRESS_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT_MULTIPRESS, GtkImContextMultipressClass))
30
31 typedef struct _GtkImContextMultipress GtkImContextMultipress;
32
33 /* This input method allows multi-press character input, like that found on
34  * mobile phones.
35  *
36  * This is based on GtkImContextSimple, which allows "compose" based on
37  * sequences of characters.  But instead the character sequences are defined
38  * by lists of characters for a key, so that repeated pressing of the same key
39  * can cycle through the possible output characters, with automatic choosing
40  * of the character after a time delay.
41  */
42 struct _GtkImContextMultipress
43 {
44   /*< private >*/
45   GtkIMContext parent;
46
47   /* Sequence information, loaded from the configuration file: */
48   GHashTable* key_sequences;
49   gsize dummy; /* ABI-preserving placeholder */
50
51   /* The last character entered so far during a compose.
52    * If this is NULL then we are not composing yet.
53    */
54   guint key_last_entered;
55   
56   /* The position of the compose in the possible sequence.
57    *  For instance, this is 2 if aa has been pressed to show b (from abc0).
58    */
59   guint compose_count; 
60   guint timeout_id;
61
62   /* The character(s) that will be used if it the current character(s) is accepted: */
63   const gchar *tentative_match;
64 };
65
66
67 typedef struct _GtkImContextMultipressClass  GtkImContextMultipressClass;
68
69 struct _GtkImContextMultipressClass
70 {
71   GtkIMContextClass parent_class;
72 };
73
74 void gtk_im_context_multipress_register_type (GTypeModule* type_module);
75 GType gtk_im_context_multipress_get_type (void);
76 GtkIMContext *gtk_im_context_multipress_new (void);
77
78 G_END_DECLS
79
80 #endif /* __GTK_IM_CONTEXT_MULTIPRESS_H__ */