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 <gtk/gtkwidget.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 char *str);
58 gboolean (*retrieve_surrounding) (GtkIMContext *context);
59 gboolean (*delete_surrounding) (GtkIMContext *context,
60 int offset,
61 int n_chars);
62
63 /* Virtual functions */
64 void (*set_client_widget) (GtkIMContext *context,
65 GtkWidget *widget);
66 void (*get_preedit_string) (GtkIMContext *context,
67 char **str,
68 PangoAttrList **attrs,
69 int *cursor_pos);
70 gboolean (*filter_keypress) (GtkIMContext *context,
71 GdkEvent *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 char *text,
81 int len,
82 int cursor_index);
83 gboolean (*get_surrounding) (GtkIMContext *context,
84 char **text,
85 int *cursor_index);
86 void (*set_surrounding_with_selection)
87 (GtkIMContext *context,
88 const char *text,
89 int len,
90 int cursor_index,
91 int anchor_index);
92 gboolean (*get_surrounding_with_selection)
93 (GtkIMContext *context,
94 char **text,
95 int *cursor_index,
96 int *anchor_index);
97
98 /*< private >*/
99 /* Padding for future expansion */
100 void (*_gtk_reserved1) (void);
101 void (*_gtk_reserved2) (void);
102 void (*_gtk_reserved3) (void);
103 void (*_gtk_reserved4) (void);
104 void (*_gtk_reserved5) (void);
105};
106
107GDK_AVAILABLE_IN_ALL
108GType gtk_im_context_get_type (void) G_GNUC_CONST;
109
110GDK_AVAILABLE_IN_ALL
111void gtk_im_context_set_client_widget (GtkIMContext *context,
112 GtkWidget *widget);
113GDK_AVAILABLE_IN_ALL
114void gtk_im_context_get_preedit_string (GtkIMContext *context,
115 char **str,
116 PangoAttrList **attrs,
117 int *cursor_pos);
118GDK_AVAILABLE_IN_ALL
119gboolean gtk_im_context_filter_keypress (GtkIMContext *context,
120 GdkEvent *event);
121
122GDK_AVAILABLE_IN_ALL
123gboolean gtk_im_context_filter_key (GtkIMContext *context,
124 gboolean press,
125 GdkSurface *surface,
126 GdkDevice *device,
127 guint32 time,
128 guint keycode,
129 GdkModifierType state,
130 int group);
131
132GDK_AVAILABLE_IN_ALL
133void gtk_im_context_focus_in (GtkIMContext *context);
134GDK_AVAILABLE_IN_ALL
135void gtk_im_context_focus_out (GtkIMContext *context);
136GDK_AVAILABLE_IN_ALL
137void gtk_im_context_reset (GtkIMContext *context);
138GDK_AVAILABLE_IN_ALL
139void gtk_im_context_set_cursor_location (GtkIMContext *context,
140 const GdkRectangle *area);
141GDK_AVAILABLE_IN_ALL
142void gtk_im_context_set_use_preedit (GtkIMContext *context,
143 gboolean use_preedit);
144GDK_DEPRECATED_IN_4_2_FOR(gtk_im_context_set_surrounding_with_selection)
145void gtk_im_context_set_surrounding (GtkIMContext *context,
146 const char *text,
147 int len,
148 int cursor_index);
149GDK_DEPRECATED_IN_4_2_FOR(gtk_im_context_get_surrounding_with_selection)
150gboolean gtk_im_context_get_surrounding (GtkIMContext *context,
151 char **text,
152 int *cursor_index);
153GDK_AVAILABLE_IN_4_2
154void gtk_im_context_set_surrounding_with_selection
155 (GtkIMContext *context,
156 const char *text,
157 int len,
158 int cursor_index,
159 int anchor_index);
160GDK_AVAILABLE_IN_4_2
161gboolean gtk_im_context_get_surrounding_with_selection
162 (GtkIMContext *context,
163 char **text,
164 int *cursor_index,
165 int *anchor_index);
166GDK_AVAILABLE_IN_ALL
167gboolean gtk_im_context_delete_surrounding (GtkIMContext *context,
168 int offset,
169 int n_chars);
170
171G_END_DECLS
172
173#endif /* __GTK_IM_CONTEXT_H__ */
174

source code of gtk/gtk/gtkimcontext.h