| 1 |
/* |
| 2 |
* Copyright (c) 2009 Kov Chai <[email protected]> |
| 3 |
* |
| 4 |
* The contents of this file are subject to the terms of either the GNU Lesser |
| 5 |
* General Public License Version 2.1 only ("LGPL") or the Common Development and |
| 6 |
* Distribution License ("CDDL")(collectively, the "License"). You may not use this |
| 7 |
* file except in compliance with the License. You can obtain a copy of the CDDL at |
| 8 |
* http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at |
| 9 |
* http://www.opensource.org/licenses/lgpl-license.php. See the License for the |
| 10 |
* specific language governing permissions and limitations under the License. When |
| 11 |
* distributing the software, include this License Header Notice in each file and |
| 12 |
* include the full text of the License in the License file as well as the |
| 13 |
* following notice: |
| 14 |
* |
| 15 |
* NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE |
| 16 |
* (CDDL) |
| 17 |
* For Covered Software in this distribution, this License shall be governed by the |
| 18 |
* laws of the State of California (excluding conflict-of-law provisions). |
| 19 |
* Any litigation relating to this License shall be subject to the jurisdiction of |
| 20 |
* the Federal Courts of the Northern District of California and the state courts |
| 21 |
* of the State of California, with venue lying in Santa Clara County, California. |
| 22 |
* |
| 23 |
* Contributor(s): |
| 24 |
* |
| 25 |
* If you wish your version of this file to be governed by only the CDDL or only |
| 26 |
* the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to |
| 27 |
* include this software in this distribution under the [CDDL or LGPL Version 2.1] |
| 28 |
* license." If you don't indicate a single choice of license, a recipient has the |
| 29 |
* option to distribute your version of this file under either the CDDL or the LGPL |
| 30 |
* Version 2.1, or to extend the choice of license to its licensees as provided |
| 31 |
* above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL |
| 32 |
* Version 2 license, then the option applies only if the new code is made subject |
| 33 |
* to such option by the copyright holder. |
| 34 |
*/ |
| 35 |
|
| 36 |
#include "sunpinyin_engine_proxy.h" |
| 37 |
#include "sunpinyin_engine.h" |
| 38 |
#include "sunpinyin_config.h" |
| 39 |
#include "engine.h" |
| 40 |
|
| 41 |
|
| 42 |
#define IBUS_SUNPINYIN_ENGINE_CLASS(klass) \ |
| 43 |
(G_TYPE_CHECK_CLASS_CAST ((klass), IBUS_TYPE_SUNPINYIN_ENGINE, IBusSunPinyinEngineClass)) |
| 44 |
#define IBUS_SUNPINYIN_ENGINE_GET_CLASS(obj) \ |
| 45 |
(G_TYPE_INSTANCE_GET_CLASS ((obj), IBUS_TYPE_SUNPINYIN_ENGINE, IBusSunPinyinEngineClass)) |
| 46 |
|
| 47 |
struct IBusSunPinyinEngineClass { |
| 48 |
IBusEngineClass parent; |
| 49 |
}; |
| 50 |
|
| 51 |
typedef SunPinyinEngine IBusSunPinyinEngine; |
| 52 |
|
| 53 |
/* functions prototype */ |
| 54 |
static void ibus_sunpinyin_engine_class_init (IBusSunPinyinEngineClass *); |
| 55 |
|
| 56 |
IBusEngineClass *parent_class = NULL; |
| 57 |
|
| 58 |
GType |
| 59 |
ibus_sunpinyin_engine_get_type (void) |
| 60 |
{ |
| 61 |
static GType type = 0; |
| 62 |
|
| 63 |
static const GTypeInfo type_info = { |
| 64 |
sizeof (IBusSunPinyinEngineClass), |
| 65 |
(GBaseInitFunc) NULL, |
| 66 |
(GBaseFinalizeFunc) NULL, |
| 67 |
(GClassInitFunc) ibus_sunpinyin_engine_class_init, |
| 68 |
NULL, |
| 69 |
NULL, |
| 70 |
sizeof (IBusSunPinyinEngine), |
| 71 |
0, |
| 72 |
(GInstanceInitFunc) ibus_sunpinyin_engine_init, |
| 73 |
}; |
| 74 |
|
| 75 |
if (type == 0) { |
| 76 |
type = g_type_register_static (IBUS_TYPE_ENGINE, |
| 77 |
"IBusSunPinyinEngine", |
| 78 |
&type_info, |
| 79 |
(GTypeFlags) 0); |
| 80 |
} |
| 81 |
|
| 82 |
return type; |
| 83 |
} |
| 84 |
|
| 85 |
// initialize the meta class object |
| 86 |
void |
| 87 |
ibus_sunpinyin_engine_class_init (IBusSunPinyinEngineClass *klass) |
| 88 |
{ |
| 89 |
IBusObjectClass *ibus_object_class = IBUS_OBJECT_CLASS (klass); |
| 90 |
IBusEngineClass *engine_class = IBUS_ENGINE_CLASS (klass); |
| 91 |
|
| 92 |
parent_class = (IBusEngineClass *) g_type_class_peek_parent (klass); |
| 93 |
|
| 94 |
ibus_object_class->destroy = (IBusObjectDestroyFunc) ibus_sunpinyin_engine_destroy; |
| 95 |
|
| 96 |
engine_class->process_key_event = ibus_sunpinyin_engine_process_key_event; |
| 97 |
engine_class->focus_in = ibus_sunpinyin_engine_focus_in; |
| 98 |
engine_class->focus_out = ibus_sunpinyin_engine_focus_out; |
| 99 |
engine_class->reset = ibus_sunpinyin_engine_reset; |
| 100 |
engine_class->enable = ibus_sunpinyin_engine_enable; |
| 101 |
engine_class->disable = ibus_sunpinyin_engine_disable; |
| 102 |
engine_class->page_up = ibus_sunpinyin_engine_page_up; |
| 103 |
engine_class->page_down = ibus_sunpinyin_engine_page_down; |
| 104 |
engine_class->cursor_up = ibus_sunpinyin_engine_cursor_up; |
| 105 |
engine_class->cursor_down = ibus_sunpinyin_engine_cursor_down; |
| 106 |
engine_class->property_activate = ibus_sunpinyin_engine_property_activate; |
| 107 |
engine_class->candidate_clicked = ibus_sunpinyin_engine_candidate_clicked; |
| 108 |
} |
| 109 |
|
| 110 |
// -*- indent-tabs-mode: nil -*- vim:et:ts=4 |