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