clean up PYConfig.h/cc
[platform/upstream/ibus-libpinyin.git] / src / PYConfig.h
1 /* vim:set et ts=4 sts=4:
2  *
3  * ibus-pinyin - The Chinese PinYin engine for IBus
4  *
5  * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
6  *
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)
10  * any later version.
11  *
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.
16  *
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.
20  */
21 #ifndef __PY_CONFIG_H_
22 #define __PY_CONFIG_H_
23
24 #ifdef HAVE_CONFIG_H
25 #  include <config.h>
26 #endif
27
28 #include <string>
29 #include <ibus.h>
30 #include "PYUtil.h"
31 #include "PYObject.h"
32
33 namespace PY {
34
35 class Bus;
36
37 class Config : public Object {
38 protected:
39     Config (Bus & bus, const std::string & name);
40     virtual ~Config (void);
41
42 public:
43     guint option (void) const                   { return m_option & m_option_mask; }
44     guint orientation (void) const              { return m_orientation; }
45     guint pageSize (void) const                 { return m_page_size; }
46     gboolean shiftSelectCandidate (void) const  { return m_shift_select_candidate; }
47     gboolean minusEqualPage (void) const        { return m_minus_equal_page; }
48     gboolean commaPeriodPage (void) const       { return m_comma_period_page; }
49     gboolean autoCommit (void) const            { return m_auto_commit; }
50     gboolean doublePinyin (void) const          { return m_double_pinyin; }
51     gint doublePinyinSchema (void) const        { return m_double_pinyin_schema; }
52     gboolean doublePinyinShowRaw (void) const   { return m_double_pinyin_show_raw; }
53     gboolean initChinese (void) const           { return m_init_chinese; }
54     gboolean initFull (void) const              { return m_init_full; }
55     gboolean initFullPunct (void) const         { return m_init_full_punct; }
56     gboolean initSimpChinese (void) const       { return m_init_simp_chinese; }
57     gboolean specialPhrases (void) const        { return m_special_phrases; }
58     gint bopomofoKeyboardMapping (void) const   { return m_bopomofo_keyboard_mapping; }
59     gint selectKeys (void) const                { return m_select_keys; }
60     gboolean guideKey (void) const              { return m_guide_key; }
61     gboolean auxiliarySelectKeyF (void) const   { return m_auxiliary_select_key_f; }
62     gboolean auxiliarySelectKeyKP (void) const  { return m_auxiliary_select_key_kp; }
63     gboolean enterKey (void) const  { return m_enter_key; }
64
65 protected:
66     bool read (const gchar * name, bool defval);
67     gint read (const gchar * name, gint defval);
68     std::string read (const gchar * name, const gchar * defval);
69     void initDefaultValues (void);
70
71     virtual void readDefaultValues (void);
72     virtual gboolean valueChanged (const std::string  &section,
73                                    const std::string  &name,
74                                    GVariant           *value);
75 private:
76     static void valueChangedCallback (IBusConfig     *config,
77                                       const gchar    *section,
78                                       const gchar    *name,
79                                       GVariant       *value,
80                                       Config         *self);
81
82 protected:
83     std::string m_section;
84     guint m_option;
85     guint m_option_mask;
86
87     gint m_orientation;
88     guint m_page_size;
89     gboolean m_shift_select_candidate;
90     gboolean m_minus_equal_page;
91     gboolean m_comma_period_page;
92     gboolean m_auto_commit;
93
94     gboolean m_double_pinyin;
95     gint m_double_pinyin_schema;
96     gboolean m_double_pinyin_show_raw;
97
98     gboolean m_init_chinese;
99     gboolean m_init_full;
100     gboolean m_init_full_punct;
101     gboolean m_init_simp_chinese;
102     gboolean m_special_phrases;
103
104     gint m_bopomofo_keyboard_mapping;
105     gint m_select_keys;
106     gboolean m_guide_key;
107     gboolean m_auxiliary_select_key_f;
108     gboolean m_auxiliary_select_key_kp;
109
110     gboolean m_enter_key;
111 };
112
113 };
114 #endif