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