gtkimcontext.h 7.38 KB
Newer Older
Cody Russell's avatar
Cody Russell committed
1
/* GTK - The GIMP Toolkit
2
3
4
 * Copyright (C) 2000 Red Hat Software
 *
 * This library is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU Lesser General Public
6
7
8
9
10
11
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * 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
Javier Jardón's avatar
Javier Jardón committed
15
 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16
17
18
19
20
 */

#ifndef __GTK_IM_CONTEXT_H__
#define __GTK_IM_CONTEXT_H__

21

22
23
24
25
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
#error "Only <gtk/gtk.h> can be included directly."
#endif

26
#include <gtk/gtkwidget.h>
27

28

29
G_BEGIN_DECLS
30
31

#define GTK_TYPE_IM_CONTEXT              (gtk_im_context_get_type ())
Manish Singh's avatar
Manish Singh committed
32
33
34
35
36
#define GTK_IM_CONTEXT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT, GtkIMContext))
#define GTK_IM_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT, GtkIMContextClass))
#define GTK_IS_IM_CONTEXT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IM_CONTEXT))
#define GTK_IS_IM_CONTEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT))
#define GTK_IM_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT, GtkIMContextClass))
37
38
39
40
41
42
43


typedef struct _GtkIMContext       GtkIMContext;
typedef struct _GtkIMContextClass  GtkIMContextClass;

struct _GtkIMContext
{
44
  GObject parent_instance;
45
46
47
48
};

struct _GtkIMContextClass
{
49
  /*< private >*/
50
  GObjectClass parent_class;
51

52
  /*< public >*/
53
  /* Signals */
54
55
56
  void     (*preedit_start)        (GtkIMContext *context);
  void     (*preedit_end)          (GtkIMContext *context);
  void     (*preedit_changed)      (GtkIMContext *context);
Benjamin Otte's avatar
Benjamin Otte committed
57
  void     (*commit)               (GtkIMContext *context, const char *str);
58
59
  gboolean (*retrieve_surrounding) (GtkIMContext *context);
  gboolean (*delete_surrounding)   (GtkIMContext *context,
Benjamin Otte's avatar
Benjamin Otte committed
60
61
				    int           offset,
				    int           n_chars);
62
63

  /* Virtual functions */
64
65
  void     (*set_client_widget)   (GtkIMContext   *context,
				   GtkWidget      *widget);
66
  void     (*get_preedit_string)  (GtkIMContext   *context,
Benjamin Otte's avatar
Benjamin Otte committed
67
				   char          **str,
68
				   PangoAttrList **attrs,
Benjamin Otte's avatar
Benjamin Otte committed
69
				   int            *cursor_pos);
70
  gboolean (*filter_keypress)     (GtkIMContext   *context,
Matthias Clasen's avatar
Matthias Clasen committed
71
			           GdkEvent       *event);
72
73
74
  void     (*focus_in)            (GtkIMContext   *context);
  void     (*focus_out)           (GtkIMContext   *context);
  void     (*reset)               (GtkIMContext   *context);
75
  void     (*set_cursor_location) (GtkIMContext   *context,
76
77
78
				   GdkRectangle   *area);
  void     (*set_use_preedit)     (GtkIMContext   *context,
				   gboolean        use_preedit);
79
  void     (*set_surrounding)     (GtkIMContext   *context,
Benjamin Otte's avatar
Benjamin Otte committed
80
				   const char     *text,
Benjamin Otte's avatar
Benjamin Otte committed
81
82
				   int             len,
				   int             cursor_index);
83
  gboolean (*get_surrounding)     (GtkIMContext   *context,
Benjamin Otte's avatar
Benjamin Otte committed
84
				   char          **text,
Benjamin Otte's avatar
Benjamin Otte committed
85
				   int            *cursor_index);
86
87
88
89
90
91
92
93
94
95
96
97
  void     (*set_surrounding_with_selection)
                                  (GtkIMContext   *context,
				   const char     *text,
				   int             len,
				   int             cursor_index,
                                   int             anchor_index);
  gboolean (*get_surrounding_with_selection)
                                  (GtkIMContext   *context,
				   char          **text,
				   int            *cursor_index,
                                   int            *anchor_index);

98
  /*< private >*/
99
100
101
102
103
104
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
  void (*_gtk_reserved5) (void);
105
106
};

107
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
108
GType    gtk_im_context_get_type            (void) G_GNUC_CONST;
109

110
GDK_AVAILABLE_IN_ALL
111
112
void     gtk_im_context_set_client_widget   (GtkIMContext       *context,
                                             GtkWidget          *widget);
113
GDK_AVAILABLE_IN_ALL
114
void     gtk_im_context_get_preedit_string  (GtkIMContext       *context,
Benjamin Otte's avatar
Benjamin Otte committed
115
					     char              **str,
116
					     PangoAttrList     **attrs,
Benjamin Otte's avatar
Benjamin Otte committed
117
					     int                *cursor_pos);
118
GDK_AVAILABLE_IN_ALL
119
gboolean gtk_im_context_filter_keypress     (GtkIMContext       *context,
120
121
122
123
124
125
126
127
128
129
130
131
                                             GdkEvent           *event);

GDK_AVAILABLE_IN_ALL
gboolean gtk_im_context_filter_key          (GtkIMContext       *context,
                                             gboolean            press,
                                             GdkSurface         *surface,
                                             GdkDevice          *device,
                                             guint32             time,
                                             guint               keycode,
                                             GdkModifierType     state,
                                             int                 group);

132
GDK_AVAILABLE_IN_ALL
133
void     gtk_im_context_focus_in            (GtkIMContext       *context);
134
GDK_AVAILABLE_IN_ALL
135
void     gtk_im_context_focus_out           (GtkIMContext       *context);
136
GDK_AVAILABLE_IN_ALL
137
void     gtk_im_context_reset               (GtkIMContext       *context);
138
GDK_AVAILABLE_IN_ALL
139
140
void     gtk_im_context_set_cursor_location (GtkIMContext       *context,
					     const GdkRectangle *area);
141
GDK_AVAILABLE_IN_ALL
142
143
void     gtk_im_context_set_use_preedit     (GtkIMContext       *context,
					     gboolean            use_preedit);
144
GDK_DEPRECATED_IN_4_2_FOR(gtk_im_context_set_surrounding_with_selection)
145
void     gtk_im_context_set_surrounding     (GtkIMContext       *context,
146
147
148
149
                                             const char         *text,
                                             int                 len,
                                             int                 cursor_index);
GDK_DEPRECATED_IN_4_2_FOR(gtk_im_context_get_surrounding_with_selection)
150
gboolean gtk_im_context_get_surrounding     (GtkIMContext       *context,
151
152
                                             char              **text,
                                             int                *cursor_index);
153
GDK_AVAILABLE_IN_4_2
154
155
156
157
158
159
void     gtk_im_context_set_surrounding_with_selection
                                            (GtkIMContext       *context,
                                             const char         *text,
                                             int                 len,
                                             int                 cursor_index,
                                             int                 anchor_index);
160
GDK_AVAILABLE_IN_4_2
161
162
163
164
165
gboolean gtk_im_context_get_surrounding_with_selection
                                            (GtkIMContext       *context,
                                             char              **text,
                                             int                *cursor_index,
                                             int                *anchor_index);
166
GDK_AVAILABLE_IN_ALL
167
gboolean gtk_im_context_delete_surrounding  (GtkIMContext       *context,
Benjamin Otte's avatar
Benjamin Otte committed
168
169
					     int                 offset,
					     int                 n_chars);
170

171
G_END_DECLS
172
173

#endif /* __GTK_IM_CONTEXT_H__ */