fixes compile
[platform/upstream/ibus-libpinyin.git] / src / PYPunctEditor.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  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2, or (at your option)
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21  */
22 #ifndef __PY_PUNCT_EDITOR_
23 #define __PY_PUNCT_EDITOR_
24
25 #include <vector>
26
27 #include "PYLookupTable.h"
28 #include "PYEditor.h"
29
30 namespace PY {
31
32 class PunctEditor : public Editor {
33 public:
34     PunctEditor (PinyinProperties &props, Config & config);
35
36     virtual gboolean processKeyEvent (guint keyval, guint keycode, guint modifiers);
37     virtual void pageUp (void);
38     virtual void pageDown (void);
39     virtual void cursorUp (void);
40     virtual void cursorDown (void);
41     virtual void update (void);
42     virtual void reset (void);
43     virtual void candidateClicked (guint index, guint button, guint state);
44
45     virtual gboolean processPunct (guint keyval, guint keycode, guint modifiers);
46     virtual gboolean processSpace (guint keyval, guint keycode, guint modifiers);
47     virtual gboolean insert (gchar ch);
48     virtual void updateLookupTable (void);
49     virtual void updateAuxiliaryText (void);
50     virtual void updatePreeditText (void);
51     virtual gboolean selectCandidate (guint i);
52     virtual gboolean selectCandidateInPage (guint i);
53     virtual void commit (const gchar *str);
54     virtual void commit (void);
55     virtual gboolean removeCharBefore (void);
56     virtual gboolean removeCharAfter (void);
57     virtual gboolean moveCursorLeft (void);
58     virtual gboolean moveCursorRight (void);
59     virtual gboolean moveCursorToBegin (void);
60     virtual gboolean moveCursorToEnd (void);
61
62     void fillLookupTable (void);
63     void updatePunctCandidates (gchar ch);
64 protected:
65     enum {
66         MODE_DISABLE,
67         MODE_INIT,
68         MODE_NORMAL,
69     } m_punct_mode;
70     LookupTable m_lookup_table;
71     String m_buffer;
72     std::vector<const gchar *> m_selected_puncts;
73     std::vector<const gchar *> m_punct_candidates;
74
75 };
76
77 };
78 #endif