1 /* vim:set et ts=4 sts=4:
3 * ibus-pinyin - The Chinese PinYin engine for IBus
5 * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@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.
21 #ifndef __PY_CONFIG_H_
22 #define __PY_CONFIG_H_
33 class Config : Object {
35 Config (Bus & bus, const std::string & name);
36 virtual ~Config (void);
39 guint option (void) const { return m_option & m_option_mask; }
40 guint orientation (void) const { return m_orientation; }
41 guint pageSize (void) const { return m_page_size; }
42 gboolean shiftSelectCandidate (void) const { return m_shift_select_candidate; }
43 gboolean minusEqualPage (void) const { return m_minus_equal_page; }
44 gboolean commaPeriodPage (void) const { return m_comma_period_page; }
45 gboolean autoCommit (void) const { return m_auto_commit; }
46 gboolean doublePinyin (void) const { return m_double_pinyin; }
47 gint doublePinyinSchema (void) const { return m_double_pinyin_schema; }
48 gboolean doublePinyinShowRaw (void) const { return m_double_pinyin_show_raw; }
49 gboolean initChinese (void) const { return m_init_chinese; }
50 gboolean initFull (void) const { return m_init_full; }
51 gboolean initFullPunct (void) const { return m_init_full_punct; }
52 gboolean initSimpChinese (void) const { return m_init_simp_chinese; }
53 gboolean specialPhrases (void) const { return m_special_phrases; }
54 gint bopomofoKeyboardMapping (void) const { return m_bopomofo_keyboard_mapping; }
55 gint selectKeys (void) const { return m_select_keys; }
56 gboolean guideKey (void) const { return m_guide_key; }
57 gboolean auxiliarySelectKeyF (void) const { return m_auxiliary_select_key_f; }
58 gboolean auxiliarySelectKeyKP (void) const { return m_auxiliary_select_key_kp; }
59 gboolean enterKey (void) const { return m_enter_key; }
62 bool read (const gchar * name, bool defval);
63 gint read (const gchar * name, gint defval);
64 std::string read (const gchar * name, const gchar * defval);
66 virtual void readDefaultValues (void);
68 virtual gboolean valueChanged (const std::string §ion,
69 const std::string &name,
72 static void valueChangedCallback (IBusConfig *config,
79 std::string m_section;
85 gboolean m_shift_select_candidate;
86 gboolean m_minus_equal_page;
87 gboolean m_comma_period_page;
88 gboolean m_auto_commit;
90 gboolean m_double_pinyin;
91 gint m_double_pinyin_schema;
92 gboolean m_double_pinyin_show_raw;
94 gboolean m_init_chinese;
96 gboolean m_init_full_punct;
97 gboolean m_init_simp_chinese;
98 gboolean m_special_phrases;
100 gint m_bopomofo_keyboard_mapping;
102 gboolean m_guide_key;
103 gboolean m_auxiliary_select_key_f;
104 gboolean m_auxiliary_select_key_kp;
106 gboolean m_enter_key;
110 class PinyinConfig : public Config {
112 static void init (Bus & bus);
113 static PinyinConfig & instance (void) { return *m_instance; }
116 PinyinConfig (Bus & bus);
117 virtual void readDefaultValues (void);
119 virtual gboolean valueChanged (const std::string §ion,
120 const std::string &name,
124 static std::unique_ptr<PinyinConfig> m_instance;
128 class BopomofoConfig : public Config {
130 static void init (Bus & bus);
131 static BopomofoConfig & instance (void) { return *m_instance; }
134 BopomofoConfig (Bus & bus);
135 virtual void readDefaultValues (void);
137 virtual gboolean valueChanged (const std::string §ion,
138 const std::string &name,
142 static std::unique_ptr<BopomofoConfig> m_instance;