1 /* Copyright (C) 2006 Openismus GmbH
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.
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.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 02111-1307, USA.
19 #ifndef __GTK_IM_CONTEXT_MULTIPRESS_H
20 #define __GTK_IM_CONTEXT_MULTIPRESS_H
22 #include <gtk/gtkimcontext.h>
26 #define GTK_TYPE_IM_CONTEXT_MULTIPRESS (gtk_im_context_multipress_get_type())
27 #define gtk_im_context_multipress(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_IM_CONTEXT_MULTIPRESS, GtkImContextMultipress))
28 #define gtk_im_context_multipress_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT_MULTIPRESS, GtkImContextMultipressClass))
29 #define GTK_IS_IM_CONTEXT_MULTIPRESS(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_IM_CONTEXT_MULTIPRESS))
30 #define GTK_IS_IM_CONTEXT_MULTIPRESS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT_MULTIPRESS))
31 #define gtk_im_context_multipress_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT_MULTIPRESS, GtkImContextMultipressClass))
34 typedef struct _KeySequence KeySequence;
36 typedef struct _GtkImContextMultipress GtkImContextMultipress;
38 /** This input method allows multi-press character input, like that found on mobile phones.
40 * This is based on GtkImContextSimple, which allows "compose" based on sequences of characters.
41 * But instead the character sequences are defined by lists of characters for a key,
42 * so that repeated pressing of the same key can cycle through the possible output characters,
43 * with automatic choosing of the character after a time delay.
45 struct _GtkImContextMultipress
49 /* Sequence information, loading from the configuration file: */
50 KeySequence** key_sequences; /* Built when we read the config file. Not null-terminated. */
51 gsize key_sequences_count; /* Number of KeySequence struct instances. */
54 /* The last character entered so far during a compose.
55 * If this is NULL then we are not composing yet.
57 guint key_last_entered;
59 /* The position of the compose in the possible sequence.
60 * For instance, this is 2 if aa has been pressed to show b (from abc0).
66 /* The character(s) that will be used if it the current character(s) is accepted: */
67 const gchar* tentative_match;
71 typedef struct _GtkImContextMultipressClass GtkImContextMultipressClass;
73 struct _GtkImContextMultipressClass
75 GtkIMContextClass parent_class;
78 void gtk_im_context_multipress_register_type (GTypeModule* type_module);
79 GType gtk_im_context_multipress_get_type (void) G_GNUC_CONST;
80 GtkIMContext *gtk_im_context_multipress_new (void);
85 #endif /* __GTK_IM_CONTEXT_MULTIPRESS_H */