Use guint to replace gint for state argument of property_activate
[platform/upstream/ibus.git] / src / ibusengine.h
1 /* vim:set et sts=4: */
2 /* ibus - The Input Bus
3  * Copyright (C) 2008-2009 Huang Peng <shawn.p.huang@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 #ifndef __IBUS_ENGINE_H_
21 #define __IBUS_ENGINE_H_
22
23 #include <dbus/dbus.h>
24 #include "ibusservice.h"
25 #include "ibusattribute.h"
26 #include "ibuslookuptable.h"
27 #include "ibusproperty.h"
28
29 /*
30  * Type macros.
31  */
32
33 /* define GOBJECT macros */
34 #define IBUS_TYPE_ENGINE             \
35     (ibus_engine_get_type ())
36 #define IBUS_ENGINE(obj)             \
37     (G_TYPE_CHECK_INSTANCE_CAST ((obj), IBUS_TYPE_ENGINE, IBusEngine))
38 #define IBUS_ENGINE_CLASS(klass)     \
39     (G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_ENGINE, IBusEngineClass))
40 #define IBUS_IS_ENGINE(obj)          \
41     (G_TYPE_CHECK_INSTANCE_TYPE ((obj), IBUS_TYPE_ENGINE))
42 #define IBUS_IS_ENGINE_CLASS(klass)  \
43     (G_TYPE_CHECK_CLASS_TYPE ((klass), IBUS_TYPE_ENGINE))
44 #define IBUS_ENGINE_GET_CLASS(obj)   \
45     (G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_ENGINE, IBusEngineClass))
46
47 G_BEGIN_DECLS
48
49 typedef struct _IBusEngine IBusEngine;
50 typedef struct _IBusEngineClass IBusEngineClass;
51
52 struct _IBusEngine {
53     IBusService parent;
54     /* instance members */
55     gboolean enabled;
56     gboolean has_focus;
57
58     /* cursor location */
59     IBusRectangle cursor_area;
60     guint client_capabilities;
61 };
62
63 struct _IBusEngineClass {
64     IBusServiceClass parent;
65
66     /* class members */
67     gboolean    (* process_key_event)
68                                     (IBusEngine     *engine,
69                                      guint           keyval,
70                                      guint           state);
71     void        (* focus_in)        (IBusEngine     *engine);
72     void        (* focus_out)       (IBusEngine     *engine);
73     void        (* reset)           (IBusEngine     *engine);
74     void        (* enable)          (IBusEngine     *engine);
75     void        (* disable)         (IBusEngine     *engine);
76     void        (* set_cursor_location)
77                                     (IBusEngine     *engine,
78                                     gint             x,
79                                     gint             y,
80                                     gint             w,
81                                     gint             h);
82     void        (* set_capabilities)
83                                     (IBusEngine     *engine,
84                                      guint           caps);
85
86     void        (* page_up)         (IBusEngine     *engine);
87     void        (* page_down)       (IBusEngine     *engine);
88     void        (* cursor_up)       (IBusEngine     *engine);
89     void        (* cursor_down)     (IBusEngine     *engine);
90
91     void        (* property_activate)
92                                     (IBusEngine     *engine,
93                                      const gchar    *prop_name,
94                                      guint           prop_state);
95     void        (* property_show)   (IBusEngine     *engine,
96                                      const gchar    *prop_name);
97     void        (* property_hide)   (IBusEngine     *engine,
98                                      const gchar    *prop_name);
99
100     /*< private >*/
101     /* padding */
102     gpointer pdummy[9];
103 };
104
105 GType        ibus_engine_get_type       (void);
106 IBusEngine  *ibus_engine_new            (const gchar        *name,
107                                          const gchar        *path,
108                                          IBusConnection     *connection);
109 void         ibus_engine_commit_text    (IBusEngine         *engine,
110                                          IBusText           *text);
111 void         ibus_engine_update_preedit_text
112                                         (IBusEngine         *engine,
113                                          IBusText           *text,
114                                          guint               cursor_pos,
115                                          gboolean            visible);
116 void         ibus_engine_show_preedit_text
117                                         (IBusEngine         *engine);
118 void         ibus_engine_hide_preedit_text
119                                         (IBusEngine         *engine);
120 void         ibus_engine_update_auxiliary_text
121                                          (IBusEngine        *engine,
122                                           IBusText          *text,
123                                           gboolean           visible);
124 void         ibus_engine_show_auxiliary_text
125                                         (IBusEngine         *engine);
126 void         ibus_engine_hide_auxiliary_text
127                                         (IBusEngine         *engine);
128 void         ibus_engine_update_lookup_table
129                                         (IBusEngine         *engine,
130                                          IBusLookupTable    *lookup_table,
131                                          gboolean            visible);
132 void         ibus_engine_show_lookup_table
133                                         (IBusEngine         *engine);
134 void         ibus_engine_hide_lookup_table
135                                         (IBusEngine         *engine);
136
137 void         ibus_engine_forward_key_event
138                                         (IBusEngine         *engine,
139                                          guint               keyval,
140                                          gboolean            is_press,
141                                          guint               state);
142
143 void         ibus_engine_register_properties
144                                         (IBusEngine         *engine,
145                                          IBusPropList       *prop_list);
146 void         ibus_engine_update_property(IBusEngine         *engine,
147                                          IBusProperty       *prop);
148 const gchar *ibus_engine_get_name       (IBusEngine         *engine);
149
150 G_END_DECLS
151 #endif
152