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;
92 bool m_lookup_table_always_on;
95 SunPyInstance(SunPyFactory *factory,
96 CHotkeyProfile *hotkey_profile,
97 const String& encoding, int id);
98 virtual ~SunPyInstance();
101 * - toggle full width punctuation mode
102 * - toggle full width letter mode
103 * - chinese/english switch
104 * - caret left/right/home/end
105 * - candidate table cursor_up/cursor_down/page_up/page_down/number_select
109 virtual bool process_key_event (const KeyEvent& key);
110 virtual void move_preedit_caret (unsigned int pos);
111 virtual void select_candidate (unsigned int item);
112 virtual void update_lookup_table_page_size (unsigned int page_size);
113 virtual void lookup_table_page_up ();
114 virtual void lookup_table_page_down ();
115 virtual void reset ();
116 virtual void focus_in ();
117 virtual void focus_out ();
118 virtual void flush ();
120 * update the configuration of the input method
122 virtual void trigger_property (const String &property);
124 * decide whether to display candidate window according to layout
126 virtual void set_layout (unsigned int layout);
130 * expose this inherited protected method
131 * so that CScimWinHandler can call it
133 using IMEngineInstanceBase::commit_string;
135 void refresh_status_property(bool cn);
136 void refresh_fullsymbol_property(bool full);
137 void refresh_fullpunc_property(bool full);
138 void redraw_preedit_string(const IPreeditString* ppd);
139 void redraw_lookup_table(const ICandidateList* pcl);
142 void create_session(CHotkeyProfile*);
143 void destroy_session();
145 void init_lookup_table_labels ();
146 void reload_config (const ConfigPointer &config);
147 void refresh_all_properties ();
148 void initialize_all_properties();
150 AttributeList build_preedit_attribs(const IPreeditString* ppd);
152 void lookup_page_up();
153 void lookup_page_down();
156 // emacs: -*- c++-mode -*-
157 #endif//SUNPINYIN_IMENGINE_H