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_PINYIN_PROPERTIES_H_
22 #define __PY_PINYIN_PROPERTIES_H_
23 
24 #include "PYSignal.h"
25 #include "PYProperty.h"
26 
27 namespace PY {
28 
29 class Config;
30 
31 class PinyinProperties {
32 public:
33     PinyinProperties (Config & config);
34 
35     void toggleModeChinese   (void);
36     void toggleModeFull      (void);
37     void toggleModeFullPunct (void);
38     void toggleModeSimp      (void);
39 
40     void reset (void);
41 
modeChinese(void)42     gboolean modeChinese (void) const   { return m_mode_chinese; }
modeFull(void)43     gboolean modeFull (void) const      { return m_mode_full; }
modeFullPunct(void)44     gboolean modeFullPunct (void) const { return m_mode_full_punct; }
modeSimp(void)45     gboolean modeSimp (void) const      { return m_mode_simp; }
46 
properties(void)47     PropList & properties (void)        { return m_props; }
48 
49     gboolean propertyActivate (const gchar *prop_name, guint prop_state);
50 
signalUpdateProperty(void)51     signal <void (Property &)> & signalUpdateProperty (void)
52     {
53         return m_signal_update_property;
54     }
55 
56 private:
updateProperty(Property & prop)57     void updateProperty (Property & prop) const
58     {
59         m_signal_update_property (prop);
60     }
61 
62     signal <void (Property &)> m_signal_update_property;
63 
64 private:
65     Config    & m_config;
66     gboolean    m_mode_chinese;
67     gboolean    m_mode_full;
68     gboolean    m_mode_full_punct;
69     gboolean    m_mode_simp;
70 
71     /* properties */
72     Property    m_prop_chinese;
73     Property    m_prop_full;
74     Property    m_prop_full_punct;
75     Property    m_prop_simp;
76     Property    m_prop_setup;
77     PropList    m_props;
78 };
79 
80 };
81 
82 #endif
83