gtkimcontext.h 5.17 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 Jardon's avatar
Javier Jardon 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 <gdk/gdk.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 57 58 59 60 61
  void     (*preedit_start)        (GtkIMContext *context);
  void     (*preedit_end)          (GtkIMContext *context);
  void     (*preedit_changed)      (GtkIMContext *context);
  void     (*commit)               (GtkIMContext *context, const gchar *str);
  gboolean (*retrieve_surrounding) (GtkIMContext *context);
  gboolean (*delete_surrounding)   (GtkIMContext *context,
				    gint          offset,
				    gint          n_chars);
62 63

  /* Virtual functions */
64 65 66 67 68 69 70 71 72 73 74
  void     (*set_client_window)   (GtkIMContext   *context,
				   GdkWindow      *window);
  void     (*get_preedit_string)  (GtkIMContext   *context,
				   gchar         **str,
				   PangoAttrList **attrs,
				   gint           *cursor_pos);
  gboolean (*filter_keypress)     (GtkIMContext   *context,
			           GdkEventKey    *event);
  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 80 81 82 83 84 85
  void     (*set_surrounding)     (GtkIMContext   *context,
				   const gchar    *text,
				   gint            len,
				   gint            cursor_index);
  gboolean (*get_surrounding)     (GtkIMContext   *context,
				   gchar         **text,
				   gint           *cursor_index);
86
  /*< private >*/
87 88 89 90 91 92 93
  /* Padding for future expansion */
  void (*_gtk_reserved1) (void);
  void (*_gtk_reserved2) (void);
  void (*_gtk_reserved3) (void);
  void (*_gtk_reserved4) (void);
  void (*_gtk_reserved5) (void);
  void (*_gtk_reserved6) (void);
94 95
};

96
GDK_AVAILABLE_IN_ALL
Manish Singh's avatar
Manish Singh committed
97
GType    gtk_im_context_get_type            (void) G_GNUC_CONST;
98

99
GDK_AVAILABLE_IN_ALL
100 101
void     gtk_im_context_set_client_window   (GtkIMContext       *context,
					     GdkWindow          *window);
102
GDK_AVAILABLE_IN_ALL
103 104 105 106
void     gtk_im_context_get_preedit_string  (GtkIMContext       *context,
					     gchar             **str,
					     PangoAttrList     **attrs,
					     gint               *cursor_pos);
107
GDK_AVAILABLE_IN_ALL
108 109
gboolean gtk_im_context_filter_keypress     (GtkIMContext       *context,
					     GdkEventKey        *event);
110
GDK_AVAILABLE_IN_ALL
111
void     gtk_im_context_focus_in            (GtkIMContext       *context);
112
GDK_AVAILABLE_IN_ALL
113
void     gtk_im_context_focus_out           (GtkIMContext       *context);
114
GDK_AVAILABLE_IN_ALL
115
void     gtk_im_context_reset               (GtkIMContext       *context);
116
GDK_AVAILABLE_IN_ALL
117 118
void     gtk_im_context_set_cursor_location (GtkIMContext       *context,
					     const GdkRectangle *area);
119
GDK_AVAILABLE_IN_ALL
120 121
void     gtk_im_context_set_use_preedit     (GtkIMContext       *context,
					     gboolean            use_preedit);
122
GDK_AVAILABLE_IN_ALL
123 124 125 126
void     gtk_im_context_set_surrounding     (GtkIMContext       *context,
					     const gchar        *text,
					     gint                len,
					     gint                cursor_index);
127
GDK_AVAILABLE_IN_ALL
128 129 130
gboolean gtk_im_context_get_surrounding     (GtkIMContext       *context,
					     gchar             **text,
					     gint               *cursor_index);
131
GDK_AVAILABLE_IN_ALL
132 133 134
gboolean gtk_im_context_delete_surrounding  (GtkIMContext       *context,
					     gint                offset,
					     gint                n_chars);
135

136
G_END_DECLS
137 138

#endif /* __GTK_IM_CONTEXT_H__ */