]> Pileus Git - ~andy/gtk/blob - gtk/gtkimcontext.h
1c5dfd0664083b011a5915219ba6789790af619e
[~andy/gtk] / gtk / gtkimcontext.h
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, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20 #if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
21 #error "Only <gtk/gtk.h> can be included directly."
22 #endif
23
24 #ifndef __GTK_IM_CONTEXT_H__
25 #define __GTK_IM_CONTEXT_H__
26
27
28 #include <gdk/gdk.h>
29
30
31 G_BEGIN_DECLS
32
33 #define GTK_TYPE_IM_CONTEXT              (gtk_im_context_get_type ())
34 #define GTK_IM_CONTEXT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT, GtkIMContext))
35 #define GTK_IM_CONTEXT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_IM_CONTEXT, GtkIMContextClass))
36 #define GTK_IS_IM_CONTEXT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_IM_CONTEXT))
37 #define GTK_IS_IM_CONTEXT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_IM_CONTEXT))
38 #define GTK_IM_CONTEXT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_IM_CONTEXT, GtkIMContextClass))
39
40
41 typedef struct _GtkIMContext       GtkIMContext;
42 typedef struct _GtkIMContextClass  GtkIMContextClass;
43
44 struct _GtkIMContext
45 {
46   GObject parent_instance;
47 };
48
49 struct _GtkIMContextClass
50 {
51   /*< private >*/
52   GObjectClass parent_class;
53
54   /*< public >*/
55   /* Signals */
56   void     (*preedit_start)        (GtkIMContext *context);
57   void     (*preedit_end)          (GtkIMContext *context);
58   void     (*preedit_changed)      (GtkIMContext *context);
59   void     (*commit)               (GtkIMContext *context, const gchar *str);
60   gboolean (*retrieve_surrounding) (GtkIMContext *context);
61   gboolean (*delete_surrounding)   (GtkIMContext *context,
62                                     gint          offset,
63                                     gint          n_chars);
64
65   /* Virtual functions */
66   void     (*set_client_window)   (GtkIMContext   *context,
67                                    GdkWindow      *window);
68   void     (*get_preedit_string)  (GtkIMContext   *context,
69                                    gchar         **str,
70                                    PangoAttrList **attrs,
71                                    gint           *cursor_pos);
72   gboolean (*filter_keypress)     (GtkIMContext   *context,
73                                    GdkEventKey    *event);
74   void     (*focus_in)            (GtkIMContext   *context);
75   void     (*focus_out)           (GtkIMContext   *context);
76   void     (*reset)               (GtkIMContext   *context);
77   void     (*set_cursor_location) (GtkIMContext   *context,
78                                    GdkRectangle   *area);
79   void     (*set_use_preedit)     (GtkIMContext   *context,
80                                    gboolean        use_preedit);
81   void     (*set_surrounding)     (GtkIMContext   *context,
82                                    const gchar    *text,
83                                    gint            len,
84                                    gint            cursor_index);
85   gboolean (*get_surrounding)     (GtkIMContext   *context,
86                                    gchar         **text,
87                                    gint           *cursor_index);
88   /*< private >*/
89   /* Padding for future expansion */
90   void (*_gtk_reserved1) (void);
91   void (*_gtk_reserved2) (void);
92   void (*_gtk_reserved3) (void);
93   void (*_gtk_reserved4) (void);
94   void (*_gtk_reserved5) (void);
95   void (*_gtk_reserved6) (void);
96 };
97
98 GType    gtk_im_context_get_type            (void) G_GNUC_CONST;
99
100 void     gtk_im_context_set_client_window   (GtkIMContext       *context,
101                                              GdkWindow          *window);
102 void     gtk_im_context_get_preedit_string  (GtkIMContext       *context,
103                                              gchar             **str,
104                                              PangoAttrList     **attrs,
105                                              gint               *cursor_pos);
106 gboolean gtk_im_context_filter_keypress     (GtkIMContext       *context,
107                                              GdkEventKey        *event);
108 void     gtk_im_context_focus_in            (GtkIMContext       *context);
109 void     gtk_im_context_focus_out           (GtkIMContext       *context);
110 void     gtk_im_context_reset               (GtkIMContext       *context);
111 void     gtk_im_context_set_cursor_location (GtkIMContext       *context,
112                                              const GdkRectangle *area);
113 void     gtk_im_context_set_use_preedit     (GtkIMContext       *context,
114                                              gboolean            use_preedit);
115 void     gtk_im_context_set_surrounding     (GtkIMContext       *context,
116                                              const gchar        *text,
117                                              gint                len,
118                                              gint                cursor_index);
119 gboolean gtk_im_context_get_surrounding     (GtkIMContext       *context,
120                                              gchar             **text,
121                                              gint               *cursor_index);
122 gboolean gtk_im_context_delete_surrounding  (GtkIMContext       *context,
123                                              gint                offset,
124                                              gint                n_chars);
125
126 G_END_DECLS
127
128 #endif /* __GTK_IM_CONTEXT_H__ */