1 /* vim:set et ts=4 sts=4:
3 * ibus-libpinyin - Intelligent Pinyin engine based on libpinyin for IBus
5 * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #ifndef __PY_ENGINE_H_
22 #define __PY_ENGINE_H_
26 #include "PYPointer.h"
27 #include "PYLookupTable.h"
28 #include "PYProperty.h"
33 #define IBUS_TYPE_PINYIN_ENGINE \
34 (PY::ibus_pinyin_engine_get_type ())
36 GType ibus_pinyin_engine_get_type (void);
40 Engine (IBusEngine *engine) : m_engine (engine) { }
41 virtual ~Engine (void);
44 virtual gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers) = 0;
45 virtual void focusIn (void) = 0;
46 virtual void focusOut (void) = 0;
47 virtual void reset (void) = 0;
48 virtual void enable (void) = 0;
49 virtual void disable (void) = 0;
50 virtual void pageUp (void) = 0;
51 virtual void pageDown (void) = 0;
52 virtual void cursorUp (void) = 0;
53 virtual void cursorDown (void) = 0;
54 virtual gboolean propertyActivate (const gchar *prop_name, guint prop_state) = 0;
55 virtual void candidateClicked (guint index, guint button, guint state) = 0;
58 void commitText (Text & text) const
60 ibus_engine_commit_text (m_engine, text);
63 void updatePreeditText (Text & text, guint cursor, gboolean visible) const
65 ibus_engine_update_preedit_text (m_engine, text, cursor, visible);
68 void showPreeditText (void) const
70 ibus_engine_show_preedit_text (m_engine);
73 void hidePreeditText (void) const
75 ibus_engine_hide_preedit_text (m_engine);
78 void updateAuxiliaryText (Text & text, gboolean visible) const
80 ibus_engine_update_auxiliary_text (m_engine, text, visible);
83 void showAuxiliaryText (void) const
85 ibus_engine_show_auxiliary_text (m_engine);
88 void hideAuxiliaryText (void) const
90 ibus_engine_hide_auxiliary_text (m_engine);
93 void updateLookupTable (LookupTable &table, gboolean visible) const
95 ibus_engine_update_lookup_table (m_engine, table, visible);
98 void updateLookupTableFast (LookupTable &table, gboolean visible) const
100 ibus_engine_update_lookup_table_fast (m_engine, table, visible);
103 void showLookupTable (void) const
105 ibus_engine_show_lookup_table (m_engine);
108 void hideLookupTable (void) const
110 ibus_engine_hide_lookup_table (m_engine);
113 void registerProperties (PropList & props) const
115 ibus_engine_register_properties (m_engine, props);
118 void updateProperty (Property & prop) const
120 ibus_engine_update_property (m_engine, prop);
124 Pointer<IBusEngine> m_engine; // engine pointer