diff options
author | Peng Wu <alexepico@gmail.com> | 2011-12-20 16:42:41 +0800 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2011-12-22 12:23:15 +0800 |
commit | 904ce4a5ade3e04c063081b549b75efafad73f56 (patch) | |
tree | 1b030035e3601e02aab4651b462ab71d2e1bffca /src/PYPConfig.h | |
parent | 31abb4ac2825319bd33bd9f6748cc4627ab5311e (diff) | |
download | ibus-libpinyin-904ce4a5ade3e04c063081b549b75efafad73f56.tar.gz ibus-libpinyin-904ce4a5ade3e04c063081b549b75efafad73f56.tar.xz ibus-libpinyin-904ce4a5ade3e04c063081b549b75efafad73f56.zip |
add LibPinyin Config
Diffstat (limited to 'src/PYPConfig.h')
-rw-r--r-- | src/PYPConfig.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/src/PYPConfig.h b/src/PYPConfig.h new file mode 100644 index 0000000..19d3ba5 --- /dev/null +++ b/src/PYPConfig.h @@ -0,0 +1,100 @@ +/* vim:set et ts=4 sts=4: + * + * ibus-pinyin - The Chinese PinYin engine for IBus + * + * Copyright (c) 2008-2010 Peng Huang <shawn.p.huang@gmail.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef __PY_LIBPINYIN_CONFIG_H_ +#define __PY_LIBPINYIN_CONFIG_H_ + +#ifdef HAVE_CONFIG_H +# include <config.h> +#endif + +#include <string> +#include <ibus.h> +#include "PYUtil.h" +#include "PYObject.h" +#include "PYConfig.h" +#include <pinyin.h> + +namespace PY { + +class Bus; + +class LibPinyinConfig : public Config { +protected: + LibPinyinConfig (Bus & bus, const std::string & name); + virtual ~LibPinyinConfig (void); + +public: + +protected: + void initDefaultValues (void); + + virtual void readDefaultValues (void); + virtual gboolean valueChanged (const std::string §ion, + const std::string &name, + GVariant *value); +private: + static void valueChangedCallback (IBusConfig *config, + const gchar *section, + const gchar *name, + GVariant *value, + LibPinyinConfig *self); + +protected: +}; + +/* PinyinConfig */ +class LibPinyinPinyinConfig : public LibPinyinConfig { +public: + static void init (Bus & bus); + static LibPinyinPinyinConfig & instance (void) { return *m_instance; } + +protected: + LibPinyinPinyinConfig (Bus & bus); + virtual void readDefaultValues (void); + + virtual gboolean valueChanged (const std::string §ion, + const std::string &name, + GVariant *value); + +private: + static std::unique_ptr<LibPinyinPinyinConfig> m_instance; +}; + +/* Bopomof Config */ +class LibPinyinBopomofoConfig : public LibPinyinConfig { +public: + static void init (Bus & bus); + static LibPinyinBopomofoConfig & instance (void) { return *m_instance; } + +protected: + LibPinyinBopomofoConfig (Bus & bus); + virtual void readDefaultValues (void); + + virtual gboolean valueChanged (const std::string §ion, + const std::string &name, + GVariant *value); + +private: + static std::unique_ptr<LibPinyinBopomofoConfig> m_instance; +}; + +}; +#endif |