1/* GTK - The GIMP Toolkit
2 * Copyright (C) 2000 Red Hat Software
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __GTK_IM_CONTEXT_H__
19#define __GTK_IM_CONTEXT_H__
20
21
22#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
23#error "Only <gtk/gtk.h> can be included directly."
24#endif
25
26#include <gdk/gdk.h>
27
28
29G_BEGIN_DECLS
30
31#define GTK_TYPE_IM_CONTEXT (gtk_im_context_get_type ())
32#define GTK_IM_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT, GtkIMContext))
33#define GTK_IM_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT, GtkIMContextClass))
34#define GTK_IS_IM_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IM_CONTEXT))
35#define GTK_IS_IM_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT))
36#define GTK_IM_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT, GtkIMContextClass))
37
38
39typedef struct _GtkIMContext GtkIMContext;
40typedef struct _GtkIMContextClass GtkIMContextClass;
41
42struct _GtkIMContext
43{
44 GObject parent_instance;
45};
46
47struct _GtkIMContextClass
48{
49 /*< private >*/
50 GObjectClass parent_class;
51
52 /*< public >*/
53 /* Signals */
54 void (*preedit_start) (GtkIMContext *context);
55 void (*preedit_end) (GtkIMContext *context);
56 void (*preedit_changed) (GtkIMContext *context);
57 void (*commit) (GtkIMContext *context, const gchar *str);
58 gboolean (*retrieve_surrounding) (GtkIMContext *context);
59 gboolean (*delete_surrounding) (GtkIMContext *context,
60 gint offset,
61 gint n_chars);
62
63 /* Virtual functions */
64 void (*set_client_window) (GtkIMContext *context,
65 GdkWindow *window);
66 void (*get_preedit_string) (GtkIMContext *context,
67 gchar **str,
68 PangoAttrList **attrs,
69 gint *cursor_pos);
70 gboolean (*filter_keypress) (GtkIMContext *context,
71 GdkEventKey *event);
72 void (*focus_in) (GtkIMContext *context);
73 void (*focus_out) (GtkIMContext *context);
74 void (*reset) (GtkIMContext *context);
75 void (*set_cursor_location) (GtkIMContext *context,
76 GdkRectangle *area);
77 void (*set_use_preedit) (GtkIMContext *context,
78 gboolean use_preedit);
79 void (*set_surrounding) (GtkIMContext *context,
80 const gchar *text,
81 gint len,
82 gint cursor_index);
83 gboolean (*get_surrounding) (GtkIMContext *context,
84 gchar **text,
85 gint *cursor_index);
86 /*< private >*/
87 /* Padding for future expansion */
88 void (*_gtk_reserved1) (void);
89 void (*_gtk_reserved2) (void);
90 void (*_gtk_reserved3) (void);
91 void (*_gtk_reserved4) (void);
92 void (*_gtk_reserved5) (void);
93 void (*_gtk_reserved6) (void);
94};
95
96GDK_AVAILABLE_IN_ALL
97GType gtk_im_context_get_type (void) G_GNUC_CONST;
98
99GDK_AVAILABLE_IN_ALL
100void gtk_im_context_set_client_window (GtkIMContext *context,
101 GdkWindow *window);
102GDK_AVAILABLE_IN_ALL
103void gtk_im_context_get_preedit_string (GtkIMContext *context,
104 gchar **str,
105 PangoAttrList **attrs,
106 gint *cursor_pos);
107GDK_AVAILABLE_IN_ALL
108gboolean gtk_im_context_filter_keypress (GtkIMContext *context,
109 GdkEventKey *event);
110GDK_AVAILABLE_IN_ALL
111void gtk_im_context_focus_in (GtkIMContext *context);
112GDK_AVAILABLE_IN_ALL
113void gtk_im_context_focus_out (GtkIMContext *context);
114GDK_AVAILABLE_IN_ALL
115void gtk_im_context_reset (GtkIMContext *context);
116GDK_AVAILABLE_IN_ALL
117void gtk_im_context_set_cursor_location (GtkIMContext *context,
118 const GdkRectangle *area);
119GDK_AVAILABLE_IN_ALL
120void gtk_im_context_set_use_preedit (GtkIMContext *context,
121 gboolean use_preedit);
122GDK_AVAILABLE_IN_ALL
123void gtk_im_context_set_surrounding (GtkIMContext *context,
124 const gchar *text,
125 gint len,
126 gint cursor_index);
127GDK_AVAILABLE_IN_ALL
128gboolean gtk_im_context_get_surrounding (GtkIMContext *context,
129 gchar **text,
130 gint *cursor_index);
131GDK_AVAILABLE_IN_ALL
132gboolean gtk_im_context_delete_surrounding (GtkIMContext *context,
133 gint offset,
134 gint n_chars);
135
136G_END_DECLS
137
138#endif /* __GTK_IM_CONTEXT_H__ */
139