fixes compile
[platform/upstream/ibus-libpinyin.git] / src / PYConfig.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  *
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., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, 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     std::string dictionaries (void) const       { return m_dictionaries; }
44     guint option (void) const                   { return m_option & m_option_mask; }
45     guint orientation (void) const              { return m_orientation; }
46     guint pageSize (void) const                 { return m_page_size; }
47     gboolean ctrlSwitch(void) const             { return m_ctrl_switch; }
48     gboolean shiftSelectCandidate (void) const  { return m_shift_select_candidate; }
49     gboolean minusEqualPage (void) const        { return m_minus_equal_page; }
50     gboolean commaPeriodPage (void) const       { return m_comma_period_page; }
51     gboolean autoCommit (void) const            { return m_auto_commit; }
52     gboolean doublePinyin (void) const          { return m_double_pinyin; }
53     gint doublePinyinSchema (void) const        { return m_double_pinyin_schema; }
54     gboolean doublePinyinShowRaw (void) const   { return m_double_pinyin_show_raw; }
55     gboolean initChinese (void) const           { return m_init_chinese; }
56     gboolean initFull (void) const              { return m_init_full; }
57     gboolean initFullPunct (void) const         { return m_init_full_punct; }
58     gboolean initSimpChinese (void) const       { return m_init_simp_chinese; }
59     gboolean specialPhrases (void) const        { return m_special_phrases; }
60     gint bopomofoKeyboardMapping (void) const   { return m_bopomofo_keyboard_mapping; }
61     gint selectKeys (void) const                { return m_select_keys; }
62     gboolean guideKey (void) const              { return m_guide_key; }
63     gboolean auxiliarySelectKeyF (void) const   { return m_auxiliary_select_key_f; }
64     gboolean auxiliarySelectKeyKP (void) const  { return m_auxiliary_select_key_kp; }
65     gboolean enterKey (void) const  { return m_enter_key; }
66
67 protected:
68     bool read (const gchar * name, bool defval);
69     gint read (const gchar * name, gint defval);
70     std::string read (const gchar * name, const gchar * defval);
71     void initDefaultValues (void);
72
73     virtual void readDefaultValues (void);
74     virtual gboolean valueChanged (const std::string  &section,
75                                    const std::string  &name,
76                                    GVariant           *value);
77 private:
78     static void valueChangedCallback (IBusConfig     *config,
79                                       const gchar    *section,
80                                       const gchar    *name,
81                                       GVariant       *value,
82                                       Config         *self);
83
84 protected:
85     std::string m_section;
86     std::string m_dictionaries;
87     guint m_option;
88     guint m_option_mask;
89
90     gint m_orientation;
91     guint m_page_size;
92     gboolean m_ctrl_switch;
93     gboolean m_shift_select_candidate;
94     gboolean m_minus_equal_page;
95     gboolean m_comma_period_page;
96     gboolean m_auto_commit;
97
98     gboolean m_double_pinyin;
99     gint m_double_pinyin_schema;
100     gboolean m_double_pinyin_show_raw;
101
102     gboolean m_init_chinese;
103     gboolean m_init_full;
104     gboolean m_init_full_punct;
105     gboolean m_init_simp_chinese;
106     gboolean m_special_phrases;
107
108     gint m_bopomofo_keyboard_mapping;
109     gint m_select_keys;
110     gboolean m_guide_key;
111     gboolean m_auxiliary_select_key_f;
112     gboolean m_auxiliary_select_key_kp;
113
114     gboolean m_enter_key;
115 };
116
117 };
118 #endif