fixes compile
[platform/upstream/ibus-libpinyin.git] / src / PYPBopomofoEngine.h
1 /* vim:set et ts=4 sts=4:
2  *
3  * ibus-libpinyin - Intelligent Pinyin engine based on libpinyin for IBus
4  *
5  * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
6  * Copyright (c) 2010 BYVoid <byvoid1@gmail.com>
7  * Copyright (c) 2011 Peng Wu <alexepico@gmail.com>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2, or (at your option)
12  * any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
22  */
23 #ifndef __PY_LIB_PINYIN_BOPOMOFO_ENGINE_H_
24 #define __PY_LIB_PINYIN_BOPOMOFO_ENGINE_H_
25
26 #include "PYEngine.h"
27 #include "PYPinyinProperties.h"
28
29 namespace PY {
30
31 class LibPinyinBopomofoEngine : public Engine {
32 public:
33     LibPinyinBopomofoEngine (IBusEngine *engine);
34     ~LibPinyinBopomofoEngine (void);
35
36     // virtual functions
37     gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
38     void focusIn (void);
39     void focusOut (void);
40     void reset (void);
41     void enable (void);
42     void disable (void);
43     void pageUp (void);
44     void pageDown (void);
45     void cursorUp (void);
46     void cursorDown (void);
47     gboolean propertyActivate (const gchar *prop_name, guint prop_state);
48     void candidateClicked (guint index, guint button, guint state);
49
50 private:
51     gboolean processPunct (guint keyval, guint keycode, guint modifiers);
52
53 private:
54     void showSetupDialog (void);
55     void connectEditorSignals (EditorPtr editor);
56
57 private:
58     void commitText (Text & text);
59
60 private:
61     PinyinProperties m_props;
62
63     guint m_prev_pressed_key;
64
65     enum {
66         MODE_INIT = 0,          // init mode
67         MODE_PUNCT,             // punct mode
68 #if 0
69         MODE_RAW,               // raw mode
70         MODE_ENGLISH,           // press v into English input mode
71         MODE_STROKE,            // press u into stroke input mode
72         MODE_EXTENSION,         // press i into extension input mode
73 #endif
74         MODE_LAST,
75     } m_input_mode;
76
77     EditorPtr m_editors[MODE_LAST];
78     EditorPtr m_fallback_editor;
79 };
80
81 };
82
83
84 #endif