summaryrefslogtreecommitdiffstats
path: root/src/Engine.h
diff options
context:
space:
mode:
authorPeng Huang <shawn.p.huang@gmail.com>2010-05-17 10:41:11 +0800
committerPeng Huang <shawn.p.huang@gmail.com>2010-05-17 10:41:11 +0800
commit51438d761eb28fc9c19efc7eef82681ebdc86e65 (patch)
treee4376d04599181443cfd85c12c9c9edc8c6794b4 /src/Engine.h
parent28d811bfa3676d1f96ec7b366caedececb6cc60b (diff)
parentc5aefb2ca27010474d12032f51be840c92ed4770 (diff)
downloadibus-libpinyin-51438d761eb28fc9c19efc7eef82681ebdc86e65.tar.gz
ibus-libpinyin-51438d761eb28fc9c19efc7eef82681ebdc86e65.tar.xz
ibus-libpinyin-51438d761eb28fc9c19efc7eef82681ebdc86e65.zip
Merge branch 'bopomofo'
Conflicts: ibus-pinyin.spec.in
Diffstat (limited to 'src/Engine.h')
-rw-r--r--src/Engine.h87
1 files changed, 87 insertions, 0 deletions
diff --git a/src/Engine.h b/src/Engine.h
index 0b39081..5c4ab49 100644
--- a/src/Engine.h
+++ b/src/Engine.h
@@ -4,12 +4,99 @@
#include <ibus.h>
+#include "Pointer.h"
+#include "Database.h"
+#include "LookupTable.h"
+#include "Property.h"
+#include "Config.h"
+#include "Editor.h"
+#include "FallbackEditor.h"
+
namespace PY {
#define IBUS_TYPE_PINYIN_ENGINE \
(PY::ibus_pinyin_engine_get_type ())
GType ibus_pinyin_engine_get_type (void);
+
+class Engine {
+public:
+ Engine (IBusEngine *engine) : m_engine (engine) {
+ }
+
+ virtual ~Engine (void);
+
+ virtual gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers) = 0;
+ virtual void focusIn (void) = 0;
+ virtual void focusOut (void) = 0;
+ virtual void reset (void) = 0;
+
+ virtual void enable (void) = 0;
+ virtual void disable (void) = 0;
+ virtual void pageUp (void) = 0;
+ virtual void pageDown (void) = 0;
+ virtual void cursorUp (void) = 0;
+ virtual void cursorDown (void) = 0;
+
+ virtual gboolean propertyActivate (const gchar *prop_name, guint prop_state) = 0;
+ virtual void candidateClicked (guint index, guint button, guint state) = 0;
+
+protected:
+ void commitText (Text & text) {
+ ibus_engine_commit_text (m_engine, text);
+ }
+
+ void updatePreeditText (Text & text, guint cursor, gboolean visible) {
+ ibus_engine_update_preedit_text (m_engine, text, cursor, visible);
+ }
+
+ void showPreeditText (void) {
+ ibus_engine_show_preedit_text (m_engine);
+ }
+
+ void hidePreeditText (void) {
+ ibus_engine_hide_preedit_text (m_engine);
+ }
+
+ void updateAuxiliaryText (Text & text, gboolean visible) {
+ ibus_engine_update_auxiliary_text (m_engine, text, visible);
+ }
+
+ void showAuxiliaryText (void) {
+ ibus_engine_show_auxiliary_text (m_engine);
+ }
+
+ void hideAuxiliaryText (void) {
+ ibus_engine_hide_auxiliary_text (m_engine);
+ }
+
+ void updateLookupTable (LookupTable &table, gboolean visible) {
+ ibus_engine_update_lookup_table (m_engine, table, visible);
+ }
+
+ void updateLookupTableFast (LookupTable &table, gboolean visible) {
+ ibus_engine_update_lookup_table_fast (m_engine, table, visible);
+ }
+
+ void showLookupTable (void) {
+ ibus_engine_show_lookup_table (m_engine);
+ }
+
+ void hideLookupTable (void) {
+ ibus_engine_hide_lookup_table (m_engine);
+ }
+
+ void registerProperties (PropList & props) {
+ ibus_engine_register_properties (m_engine, props);
+ }
+
+ void updateProperty (Property & prop) {
+ ibus_engine_update_property (m_engine, prop);
+ }
+
+protected:
+ Pointer<IBusEngine> m_engine; // engine pointer
};
+};
#endif