2 * Copyright 2012-2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Flora License, Version 1.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://floralicense.org/license/
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include "sclstructs.h"
23 #include "scleventcallback.h"
30 /* To use pimpl idiom */
34 * @brief The base class to work as a soft-based keyboard
36 * This class implements all functions for working as a soft-based keyboard
37 * In side of ISE developer, they can modify it by their requirements.
46 * @brief This API initializes SCL library and creates new SCL context
47 * @param[in] main_window a pointer to main window object
48 * @param[in] parser_type decides which parser should be selected for parsing SCL UI resource file
49 * @param[in] entry_filepath a file path to SCL's UI resource entry file
50 * @return non-zero value is returned when successful
52 sclboolean init(sclwindow main_window, SCLParserType parser_type, const sclchar *entry_filepath);
55 * @brief This API requests SCL library to show the S/W keyboard on the screen
56 * @param[in] auto_relocate Indicates whether the SCL library should relocate the keyboard window automatically
57 * When set to FALSE, the developer should move the window to its expected position.
59 //void show(sclboolean auto_relocate = TRUE);
63 * @brief This API requests SCL library to hide the S/W keyboard from the screen
64 * @param[in] ctx target SCL context
70 * @brief This API registers a callback interface, to handle the events generated by SCL library
71 * @param[in] callback a pointer to ISCLEventCallback interface implementation class
72 * @param[in] input_mode when given not NULL, this callback processes event on that input_mode only.
74 void set_ui_event_callback(ISCLUIEventCallback *callback, const sclchar *input_mode = NULL);
77 * @brief This API requests SCL library to rotate the window to given degree
78 * @param[in] degree an SCLRotation value for rotating the keyboard
79 * @return non-zero value is returned when successful
81 sclboolean set_rotation(SCLRotation degree);
84 * @brief This API returns the current rotation degree
85 * @return current rotation value
87 SCLRotation get_rotation();
90 * @brief This API checks if the current display mode is portrait or landscape
91 * @return current display mode
93 SCLDisplayMode get_display_mode();
96 * @brief This API request SCL library to change to given input mode
97 * @param[in] input_mode the name of the desired input mode
98 * @return non-zero value is returned when successful
100 sclboolean set_input_mode(const sclchar *input_mode);
103 * @brief This API retrieves the current input mode
104 * @return a string pointer that indicates the name of current input mode
106 const sclchar* get_input_mode();
109 * @brief This API request SCL library to suspend screen updates
110 * @param[in] pend whether to suspend screen updates
112 void set_update_pending(sclboolean pend);
115 * @brief This API request SCL library to change a specific key with user customized values, with different parameters
116 * @param[in] custom_id the name of the key to be reset
117 * @param[in] label the string to be displayed on the button
118 * @param[in] label the file path to button's label image
119 * @param[in] imagebg the file path to button's background image
120 * @param[in] key_event a numeric value to be emitted when this button is clicked
121 * @param[in] key_value a string value to be emitted when this button is clicked
122 * @param[in] redraw whether to redraw the key right after updating detailed information
123 * @return internal private key index
125 sclint set_private_key(const sclchar* custom_id, sclchar* label, sclchar* imagelabel[SCL_BUTTON_STATE_MAX], sclchar* imagebg[SCL_BUTTON_STATE_MAX], sclulong key_event, sclchar *key_value, sclboolean redraw);
128 * @brief This API request SCL library to reset a key to its original configuration
129 * @param[in] custom_id the name of the key to be reset
131 void unset_private_key(const sclchar* custom_id);
134 * @brief This API request SCL library to enable a button with given ID
135 * @param[in] custom_id the name of the key to be enabled
136 * @param[in] enabled whether this button should be enabled or not
138 void enable_button(const sclchar* custom_id, sclboolean enabled);
141 * @brief This API sets the name of the current theme to change the look and feel of S/W keyboard
142 * @param[in] themename the name of the theme to be applied
143 * @return non-zero value is returned when successful
145 sclboolean set_cur_themename(const sclchar *themename);
148 * @brief This API sets the name of the desired predefined sub-layout, which changes only some part of current layout
149 * @param[in] themename the name of the theme to be applied
150 * @return non-zero value is returned when successful
152 sclboolean set_cur_sublayout(const sclchar *sub_layout_name);
155 * @brief This API retrieves the name of current selected sub-layout
156 * @return the string pointer that indicates the name of current sub-layout
158 const sclchar* get_cur_sublayout();
161 * @brief This API sets the current shift state
162 * @param[in] state the SCLShiftState value for desired shift state
164 void set_shift_state(SCLShiftState state);
167 * @brief This API retrieves the current shift state
168 * @return current shift state
170 SCLShiftState get_shift_state();
173 * @brief This API notifies the SCL library that the application's focus was moved to another input context
175 void notify_app_focus_changed();
178 * @brief This API request SCL library to reset the timer, which closes all popup windows when expired
180 void reset_popup_timeout();
183 * @brief This API request SCL library to close all opened popup windows
185 void close_all_popups();
188 * @brief This API acquires the size of main window
189 * @param[out] rect the geometry information of main window
191 SclRectangle get_main_window_rect();
194 * @brief This API retrieves the current input mode
195 * @param[in] input_mode the name of the desired input mode
196 * @param[in] display_mode desired display mode value
197 * @return a size struct contains the input_mode's size in given display_mode
199 SclSize get_input_mode_size(const sclchar *input_mode, SCLDisplayMode display_mode);
202 * @brief This API acquires the screen size of current device
203 * @param[out] width the x-axis size of screen
204 * @param[out] height the y-axis size of screem
206 void get_screen_resolution(sclint *width, sclint *height);
209 * @brief This API request SCL library to scale the input value,
210 by calculating the rate of target screen size and current screen size
211 * @param[in] x the value that needs to be scaled
212 * @return scaled value
214 scl16 get_scale_x(scl16 x);
217 * @brief This API request SCL library to scale the input value,
218 by calculating the rate of target screen size and current screen size
219 * @param[in] y the value that needs to be scaled
220 * @return scaled value
222 scl16 get_scale_y(scl16 y);
225 * @brief This API returns the smaller scale rate, between x and y
228 sclfloat get_scale_rate();
231 * @brief This API returns the number of current multi touch contexts,
232 * which means how many fingers are currently pressing the touch device
233 * @return number of touch contexts
235 sclint get_multi_touch_context_num();
238 * @brief This API retrieves the descriptor for the nth multi touch context, for processing multi touch events
239 * @param[in] seqorder the sequence order of currently requesting multi touch context
240 * @param[out] desc a pointer to SclKeyEventDesc struct, to be filled with given multi touch context's detailed information
241 * @return non-zero value is returned when successful
243 sclboolean get_multi_touch_event(sclint seqorder, SclUIEventDesc *desc);
246 * @brief This API requests SCL library to start working in debug mode
248 void set_debug_mode(SCLDebugMode mode);
251 * @brief This API retrieves the current debug mode of SCL library
253 SCLDebugMode get_debug_mode();
256 * @brief This API sets the timeout value for recognizing long press event
257 * @param[in] msc the time before the system waits until it determines the press event is long press event
258 * @return non-zero value is returned when successful
260 sclboolean set_longkey_duration(scllong msc);
263 * @brief This API sets the threshold value for recognizing long press event
264 * @param[in] dist maximum distance, in pixels.
265 the move event should not go beyond this distance from its initial pressed ponit
266 * @return non-zero value is returned when successful
268 sclboolean set_longkey_cancel_dist(sclshort dist);
271 * @brief This API sets the timeout value for emitting repeat key event
272 * @param[in] msc the time that SCL library has to wait before emitting next repeat key even
273 * @return non-zero value is returned when successful
275 sclboolean set_repeatkey_duration(scllong msc);
278 * @brief This API sets the timeout value for recognizing long press event, if current button supports hidden text popup
279 * @param[in] msc the time before the system waits until it determines the press event is long press event
280 * @return non-zero value is returned when successful
282 sclboolean set_autopoup_key_duration(scllong msc);
285 * @brief This API sets the timeout value before it reverts the ui feedback of button press event
286 * @param[in] msc the time before the system waits until it resets the pressed key to its normal state
287 * @return non-zero value is returned when successful
289 sclboolean set_button_delay_duration(scllong msc);
292 * @brief This API requests SCL library to enable/disable magnifier window
293 * @param[in] enabled indicates whether mangifier window should be displayed or not
295 void enable_magnifier(sclboolean enabled);
298 * @brief This API requests SCL library to enable/disable sound feedback
299 * @param[in] enabled indicates whether sound feedback should be played or not, when a key is pressed
301 void enable_sound(sclboolean enabled);
304 * @brief This API requests SCL library to enable/disable vibration feedback
305 * @param[in] enabled indicates whether vibration feedback should be played or not, when a key is pressed
307 void enable_vibration(sclboolean enabled);
310 * @brief This API requests SCL library to enable/disable tts feedback
311 * @param[in] enabled indicates whether tts feedback should be played or not, when a key is pressed
313 void enable_tts(sclboolean enabled);
316 * @brief This API requests SCL library to enable/disable shift multi touch action
317 * @param[in] enabled indicates whether shift button should provide multi touch action
319 void enable_shift_multi_touch(sclboolean enabled);
322 * @brief This API requests SCL library to apply the touch offset adjustment
323 * @param[in] enabled indicates whether the touch offset adjustment should applied or not
325 void enable_touch_offset(sclboolean enabled);
328 * @brief This API requests SCL library to ignore any events raised from the keyboard window
329 * @param[in] enabled indicates whether the keyboard window should ignore any touch events it receives
331 void disable_input_events(sclboolean disabled);
334 * @brief This API requests SCL library to change the content of magnifier window that will be displayed
335 * @param[in] touch_id indicates which multi touch context this customization should be applied to
336 * @param[in] index indicates the index of magnifier window's label
337 * @param[in] label the string to be displayed on the magnfier window
339 void set_custom_magnifier_label(scltouchdevice touch_id, sclint index, const sclchar* label);
342 * @brief This API requests SCL library to substitute a string with given one when displaying it
343 * @param[in] original indicates the string that should be substituted from
344 * @param[in] substitute indicates the string that should be substituted to
346 void set_string_substitution(const sclchar *original, const sclchar *substitute);
349 * @brief This API requests SCL library to reset substitution for the given string
350 * @param[in] original indicates the string that was registered to be substituted from
352 void unset_string_substitution(const sclchar *original);
354 sclint get_caps_mode();
355 void set_caps_mode(sclint);
364 #endif //__SCL_CORE_H__