1 /* vim:set et ts=4 sts=4:
3 * ibus-pinyin - The Chinese PinYin engine for IBus
5 * Copyright (c) 2010-2011 Peng Wu <alexepico@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., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #ifndef __PY_ENGLISH_EDITOR_
23 #define __PY_ENGLISH_EDITOR_
26 #include "PYLookupTable.h"
30 class EnglishDatabase;
32 class EnglishEditor : public Editor {
34 const float m_train_factor;
36 EnglishEditor (PinyinProperties &props, Config & config);
37 virtual ~EnglishEditor();
39 virtual gboolean processKeyEvent (guint keyval, guint keycode, guint modifers);
40 virtual void pageUp (void);
41 virtual void pageDown (void);
42 virtual void cursorUp (void);
43 virtual void cursorDown (void);
44 virtual void update (void);
45 virtual void reset (void);
46 virtual void candidateClicked (guint index, guint button, guint state);
49 gboolean updateStateFromInput (void);
51 void clearLookupTable (void);
52 void updateLookupTable (void);
53 void updatePreeditText (void);
54 void updateAuxiliaryText (void);
56 gboolean selectCandidateInPage (guint index);
57 gboolean selectCandidate (guint index);
59 gboolean processSpace(guint keyval);
60 gboolean processEnter(guint keyval);
62 gboolean removeCharBefore (void);
63 gboolean removeCharAfter (void);
65 gboolean processLabelKey(guint keyval);
66 gboolean processEditKey(guint keyval);
67 gboolean processPageKey(guint keyval);
69 gboolean train(const char *word, float delta);
72 LookupTable m_lookup_table;
74 String m_preedit_text;
75 String m_auxiliary_text;
77 EnglishDatabase *m_english_database;