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; }
61 bool read (const gchar * name, bool defval);
62 gint read (const gchar * name, gint defval);
63 const gchar * read (const gchar * name, const gchar * defval);
65 virtual void readDefaultValues (void);
67 virtual gboolean valueChanged (const std::string & section,
68 const std::string & name,
71 static void valueChangedCallback (IBusConfig *config,
78 std::string m_section;
84 gboolean m_shift_select_candidate;
85 gboolean m_minus_equal_page;
86 gboolean m_comma_period_page;
87 gboolean m_auto_commit;
89 gboolean m_double_pinyin;
90 gint m_double_pinyin_schema;
91 gboolean m_double_pinyin_show_raw;
93 gboolean m_init_chinese;
95 gboolean m_init_full_punct;
96 gboolean m_init_simp_chinese;
97 gboolean m_special_phrases;
99 gint m_bopomofo_keyboard_mapping;
101 gboolean m_guide_key;
102 gboolean m_auxiliary_select_key_f;
103 gboolean m_auxiliary_select_key_kp;
107 class PinyinConfig : public Config {
109 static void init (Bus & bus);
110 static PinyinConfig & instance (void) { return *m_instance; }
113 PinyinConfig (Bus & bus);
114 virtual void readDefaultValues (void);
116 virtual gboolean valueChanged (const std::string & section,
117 const std::string & name,
118 const GValue *value);
121 static std::unique_ptr<PinyinConfig> m_instance;
125 class BopomofoConfig : public Config {
127 static void init (Bus & bus);
128 static BopomofoConfig & instance (void) { return *m_instance; }
131 BopomofoConfig (Bus & bus);
132 virtual void readDefaultValues (void);
134 virtual gboolean valueChanged (const std::string & section,
135 const std::string & name,
136 const GValue *value);
139 static std::unique_ptr<BopomofoConfig> m_instance;