2
* Copyright (c) 2007 Kov Chai <tchaikov@gmail.com>
4
* The contents of this file are subject to the terms of either the GNU Lesser
5
* General Public License Version 2.1 only ("LGPL") or the Common Development and
6
* Distribution License ("CDDL")(collectively, the "License"). You may not use this
7
* file except in compliance with the License. You can obtain a copy of the CDDL at
8
* http://www.opensource.org/licenses/cddl1.php and a copy of the LGPLv2.1 at
9
* http://www.opensource.org/licenses/lgpl-license.php. See the License for the
10
* specific language governing permissions and limitations under the License. When
11
* distributing the software, include this License Header Notice in each file and
12
* include the full text of the License in the License file as well as the
15
* NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE
17
* For Covered Software in this distribution, this License shall be governed by the
18
* laws of the State of California (excluding conflict-of-law provisions).
19
* Any litigation relating to this License shall be subject to the jurisdiction of
20
* the Federal Courts of the Northern District of California and the state courts
21
* of the State of California, with venue lying in Santa Clara County, California.
25
* If you wish your version of this file to be governed by only the CDDL or only
26
* the LGPL Version 2.1, indicate your decision by adding "[Contributor]" elects to
27
* include this software in this distribution under the [CDDL or LGPL Version 2.1]
28
* license." If you don't indicate a single choice of license, a recipient has the
29
* option to distribute your version of this file under either the CDDL or the LGPL
30
* Version 2.1, or to extend the choice of license to its licensees as provided
31
* above. However, if you add LGPL Version 2.1 code and therefore, elected the LGPL
32
* Version 2 license, then the option applies only if the new code is made subject
33
* to such option by the copyright holder.
36
#ifndef SUNPINYIN_IMENGINE_H
37
#define SUNPINYIN_IMENGINE_H
43
class SunPyFactory : public IMEngineFactoryBase
45
ConfigPointer m_config;
48
Connection m_reload_signal_connection;
49
CHotkeyProfile *m_hotkey_profile;
51
friend class SunPyInstance;
54
SunPyFactory (const ConfigPointer &config);
56
virtual ~SunPyFactory ();
58
virtual WideString get_name () const;
59
virtual WideString get_authors () const;
60
virtual WideString get_credits () const;
61
virtual WideString get_help () const;
62
virtual String get_uuid () const;
63
virtual String get_icon_file () const;
65
virtual IMEngineInstancePointer create_instance (const String& encoding, int id = -1);
68
bool valid () const { return m_valid; }
69
void reload_config(const ConfigPointer& config);
73
bool load_user_config ();
76
class SunPyInstance : public IMEngineInstanceBase
78
SunPyFactory *m_factory;
80
CScimWinHandler *m_wh;
81
CHotkeyProfile *m_hotkey_profile;
82
SunLookupTable *m_lookup_table;
84
Connection m_reload_signal_connection;
88
SunPyInstance(SunPyFactory *factory,
89
CHotkeyProfile *hotkey_profile,
90
const String& encoding, int id);
91
virtual ~SunPyInstance();
94
* - toggle full width punctuation mode
95
* - toggle full width letter mode
96
* - chinese/english switch
97
* - caret left/right/home/end
98
* - candidate table cursor_up/cursor_down/page_up/page_down/number_select
102
virtual bool process_key_event (const KeyEvent& key);
103
virtual void move_preedit_caret (unsigned int pos);
104
virtual void select_candidate (unsigned int item);
105
virtual void update_lookup_table_page_size (unsigned int page_size);
106
virtual void lookup_table_page_up ();
107
virtual void lookup_table_page_down ();
108
virtual void reset ();
109
virtual void focus_in ();
110
virtual void focus_out ();
112
* update the configuration of the input method
114
virtual void trigger_property (const String &property);
118
* expose this inherited protected method
119
* so that CScimWinHandler can call it
121
using IMEngineInstanceBase::commit_string;
123
void refresh_status_property(bool cn);
124
void refresh_fullsymbol_property(bool full);
125
void refresh_fullpunc_property(bool full);
126
void redraw_preedit_string(const IPreeditString* ppd);
127
void redraw_lookup_table(const ICandidateList* pcl);
130
void create_session(CHotkeyProfile*);
131
void destroy_session();
133
void init_lookup_table_labels ();
134
void reload_config (const ConfigPointer &config);
135
void refresh_all_properties ();
136
void initialize_all_properties();
138
AttributeList build_preedit_attribs(const IPreeditString* ppd);
140
void lookup_page_up();
141
void lookup_page_down();
144
// emacs: -*- c++-mode -*-
145
#endif//SUNPINYIN_IMENGINE_H