From c18e74986fb1e608e313497d3b3914ab22a4854b Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Thu, 13 May 2010 19:15:39 +0800 Subject: Make bopomofo as a separate input engine. --- src/Engine.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/Engine.h') diff --git a/src/Engine.h b/src/Engine.h index 0b39081..b05ab6e 100644 --- a/src/Engine.h +++ b/src/Engine.h @@ -10,6 +10,7 @@ namespace PY { (PY::ibus_pinyin_engine_get_type ()) GType ibus_pinyin_engine_get_type (void); + }; #endif -- cgit From 35e5f6a5e90dde1b3683774247a4d9bb304bcc3c Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Fri, 14 May 2010 10:44:01 +0800 Subject: Create BopomofoEngine --- src/Engine.h | 87 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) (limited to 'src/Engine.h') diff --git a/src/Engine.h b/src/Engine.h index b05ab6e..0ae3906 100644 --- a/src/Engine.h +++ b/src/Engine.h @@ -4,6 +4,15 @@ #include +#include "Pointer.h" +#include "Database.h" +#include "LookupTable.h" +#include "Property.h" +#include "Config.h" +#include "Editor.h" +#include "FallbackEditor.h" +#include "PinyinProperties.h" + namespace PY { #define IBUS_TYPE_PINYIN_ENGINE \ @@ -11,6 +20,84 @@ namespace PY { 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 m_engine; // engine pointer }; +}; #endif -- cgit From d153239dd1681837f445719cacca045a43c9d877 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Mon, 17 May 2010 10:01:11 +0800 Subject: register properties in focusIn --- src/Engine.h | 1 - 1 file changed, 1 deletion(-) (limited to 'src/Engine.h') diff --git a/src/Engine.h b/src/Engine.h index 0ae3906..5c4ab49 100644 --- a/src/Engine.h +++ b/src/Engine.h @@ -11,7 +11,6 @@ #include "Config.h" #include "Editor.h" #include "FallbackEditor.h" -#include "PinyinProperties.h" namespace PY { -- cgit