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.
19 #include "scluiimpl.h"
25 m_impl = CSCLUIImpl::get_instance();
33 sclboolean CSCLUI::init(sclwindow parent, const SCLParserType parser_type, const char *entry_filepath)
35 sclboolean ret = FALSE;
37 ret = m_impl->init(parent, parser_type, entry_filepath);
43 * Shows the SCL main window
44 * For displaying the SCL UI, you should explicitly call this function after CSCLUI class is created
47 //CSCLUI::show(sclboolean auto_relocate /* = TRUE */ )
56 * Hides the SCL main window
57 * The real hide action does not work about base window because that is child of the active window
69 * Regists an event callback function
70 * so that the user which uses SCL can recevies all events occuring in running
73 CSCLUI::set_ui_event_callback(ISCLUIEventCallback *callback, const sclchar *input_mode)
76 m_impl->set_ui_event_callback(callback, input_mode);
81 * Sets the current input mode to the given mode
83 * gCore->set_input_mode("INPUT_MODE_SYMBOL");
86 CSCLUI::set_input_mode(const sclchar *input_mode)
88 sclboolean ret = FALSE;
91 ret = m_impl->set_input_mode(input_mode);
98 * Sets the current rotation
101 CSCLUI::set_rotation(SCLRotation rotation)
103 sclboolean ret = FALSE;
106 ret = m_impl->set_rotation(rotation);
113 * Gets the current rotation
116 CSCLUI::get_rotation()
118 SCLRotation ret = ROTATION_0;
121 ret = m_impl->get_rotation();
128 * Returns the current display mode
131 CSCLUI::get_display_mode()
133 SCLDisplayMode ret = DISPLAYMODE_PORTRAIT;
136 ret = m_impl->get_display_mode();
143 * Returns the current input mode
146 CSCLUI::get_input_mode()
148 const sclchar *ret = NULL;
151 ret = m_impl->get_input_mode();
160 * Sets a private key to the current context
161 * The other properties except given parameters will keep to the orginal value.
163 * gCore->set_private_key(INPUT_MODE_NUMBER, LYT_PORTRAIT_NOW_3x4, 0, "private", 999, TRUE);
165 * @param fRedraw If true, it will redraw the current key
168 CSCLUI::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)
170 sclint ret = NOT_USED;
173 ret = m_impl->set_private_key(custom_id, label, imagelabel, imagebg, key_event, key_value, redraw);
181 * Unsets a private key to the current context
184 CSCLUI::unset_private_key(const sclchar* custom_id)
187 m_impl->unset_private_key(custom_id);
192 * Sets the current theme
194 /* FIXME : If setting themename is not allowed before initializing,
195 the default theme has to be loaded regardless of current theme name
196 and the appropriate current theme has to be loaded afterwards, which is very inefficient */
198 CSCLUI::set_cur_themename(const sclchar *themename)
200 sclboolean ret = FALSE;
203 ret = m_impl->set_cur_themename(themename);
210 CSCLUI::get_shift_state()
212 SCLShiftState ret = SCL_SHIFT_STATE_OFF;
214 ret = m_impl->get_shift_state();
220 CSCLUI::set_shift_state(SCLShiftState state)
223 m_impl->set_shift_state(state);
228 * This function will be called by the user which uses SCL when the context of the focus application is changed
229 * ISE user should explicitly call this function when the context of application is changed.
230 * For instance, focus-changed, application-changed,, and so on.
231 * This function will call CSCLController to init the related variables.
234 CSCLUI::notify_app_focus_changed()
237 m_impl->notify_app_focus_changed();
242 CSCLUI::reset_popup_timeout()
245 m_impl->notify_app_focus_changed();
250 CSCLUI::close_all_popups()
253 m_impl->close_all_popups();
258 * Returns a scale rate (see default screen resolution in sclconfig.h file)
261 CSCLUI::get_scale_rate()
265 ret = m_impl->get_scale_rate();
271 * Returns a calculated x value according to the current screen resolution
274 CSCLUI::get_scale_x(scl16 x)
278 ret = m_impl->get_scale_x(x);
284 * Returns a calculated y value according to the current screen resolution
287 CSCLUI::get_scale_y(scl16 y)
291 ret = m_impl->get_scale_y(y);
297 * Returns the scl main window size
300 CSCLUI::get_main_window_rect()
302 SclRectangle ret = {0};
305 ret = m_impl->get_main_window_rect();
312 * Returns the size of given input mode
315 CSCLUI::get_input_mode_size(const sclchar *input_mode, SCLDisplayMode display_mode)
320 ret = m_impl->get_input_mode_size(input_mode, display_mode);
327 * Returns the screen resolution
330 CSCLUI::get_screen_resolution(sclint *width, sclint *height)
333 m_impl->get_screen_resolution(width, height);
340 CSCLUI::set_debug_mode(SCLDebugMode mode)
343 m_impl->set_debug_mode(mode);
348 CSCLUI::get_debug_mode()
350 SCLDebugMode ret = DEBUGMODE_DISABLED;
352 ret = m_impl->get_debug_mode();
358 CSCLUI::set_update_pending(sclboolean pend)
361 m_impl->set_update_pending(pend);
366 CSCLUI::enable_button(const sclchar* custom_id, sclboolean enabled)
369 m_impl->enable_button(custom_id, enabled);
374 CSCLUI::get_multi_touch_context_num()
378 ret = m_impl->get_multi_touch_context_num();
384 CSCLUI::get_multi_touch_event(sclint seqorder, SclUIEventDesc *desc)
386 sclboolean ret = FALSE;
388 ret = m_impl->get_multi_touch_event(seqorder, desc);
394 CSCLUI::set_longkey_duration(scllong msc)
396 sclboolean ret = FALSE;
398 ret = m_impl->set_longkey_duration(msc);
404 CSCLUI::set_longkey_cancel_dist(sclshort dist)
406 sclboolean ret = FALSE;
408 ret = m_impl->set_longkey_cancel_dist(dist);
414 CSCLUI::set_repeatkey_duration(scllong msc)
416 sclboolean ret = FALSE;
418 ret = m_impl->set_repeatkey_duration(msc);
424 CSCLUI::set_autopoup_key_duration(scllong msc)
426 sclboolean ret = FALSE;
428 ret = m_impl->set_autopoup_key_duration(msc);
434 CSCLUI::set_button_delay_duration(scllong msc)
436 sclboolean ret = FALSE;
438 ret = m_impl->set_button_delay_duration(msc);
444 CSCLUI::enable_magnifier(sclboolean enabled)
447 m_impl->enable_magnifier(enabled);
452 CSCLUI::enable_sound(sclboolean enabled)
455 m_impl->enable_sound(enabled);
460 CSCLUI::enable_vibration(sclboolean enabled)
463 m_impl->enable_vibration(enabled);
468 CSCLUI::enable_tts(sclboolean enabled)
471 m_impl->enable_tts(enabled);
476 CSCLUI::enable_shift_multi_touch(sclboolean enabled)
479 m_impl->enable_shift_multi_touch(enabled);
484 CSCLUI::enable_touch_offset(sclboolean enabled)
487 m_impl->enable_touch_offset(enabled);
492 CSCLUI::disable_input_events(sclboolean disabled)
495 m_impl->disable_input_events(disabled);
500 CSCLUI::set_cur_sublayout(const sclchar *sub_layout_name)
502 sclboolean ret = FALSE;
504 ret = m_impl->set_cur_sublayout(sub_layout_name);
510 CSCLUI::get_cur_sublayout()
512 const sclchar* ret = NULL;
514 ret = m_impl->get_cur_sublayout();
520 CSCLUI::set_custom_magnifier_label(scltouchdevice touch_id, sclint index, const sclchar* label)
523 m_impl->set_custom_magnifier_label(touch_id, index, label);
528 CSCLUI::set_string_substitution(const sclchar *original, const sclchar *substitute)
531 m_impl->set_string_substitution(original, substitute);
536 CSCLUI::unset_string_substitution(const sclchar *original)
539 m_impl->unset_string_substitution(original);
544 CSCLUI::set_caps_mode(sclint mode) {
546 m_impl->set_caps_mode(mode);
551 CSCLUI::get_caps_mode() {
555 mode = m_impl->get_caps_mode();