2 * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
25 #include "sclconfig.h"
26 #include "sclstructs.h"
28 #ifndef __SCL_UTILS_H__
29 #define __SCL_UTILS_H__
35 #ifndef _POSIX_PATH_MAX
36 #define _POSIX_PATH_MAX 255
43 * @brief The base class to work as a soft-based keyboard
45 * This class implements all functions for working as a soft-based keyboard
46 * In side of ISE developer, they can modify it by their requirements.
51 CSCLUtilsImpl() { m_scr_size.width = 0;m_scr_size.height = 0; }
53 virtual void init() = 0;
54 virtual void fini() = 0;
56 virtual sclboolean get_screen_resolution(sclint *x, sclint *y) = 0;
57 virtual sclboolean update_screen_resolution() = 0;
58 virtual sclboolean play_tts(const sclchar *str) = 0;
59 virtual sclboolean play_sound(const sclchar* snd_style) = 0;
60 virtual sclboolean play_vibration(const sclchar* vibe_style, const scllong duration) = 0;
62 virtual sclboolean open_devices() = 0;
63 virtual sclboolean close_devices() = 0;
65 virtual sclint log(const sclchar *msg) = 0;
71 class CSCLUtilsImplLinux : public CSCLUtilsImpl
77 sclboolean get_screen_resolution(sclint *x, sclint *y);
78 sclboolean update_screen_resolution();
79 sclboolean play_tts(const sclchar *str);
80 sclboolean play_sound(const sclchar* snd_style);
81 sclboolean play_vibration(const sclchar* vibe_style, const scllong duration);
83 sclboolean open_devices();
84 sclboolean close_devices();
86 sclint log(const sclchar *msg);
89 class CSCLUtilsImplWin32 : public CSCLUtilsImpl
95 sclboolean get_screen_resolution(sclint *x, sclint *y);
96 sclboolean update_screen_resolution();
97 sclboolean play_tts(const sclchar *str);
98 sclboolean play_sound(const sclchar* snd_style);
99 sclboolean play_vibration(const sclchar* vibe_style, const scllong duration);
101 sclboolean open_devices();
102 sclboolean close_devices();
104 sclint log(const sclchar *msg);
114 virtual sclboolean get_screen_resolution(sclint *x, sclint *y);
115 virtual sclboolean update_screen_resolution();
116 virtual sclboolean play_tts(const sclchar *str);
117 virtual sclboolean play_sound(const sclchar* snd_style);
118 virtual sclboolean play_vibration(const sclchar* vibe_style, const scllong duration);
120 CSCLUtilsImpl* GetCSCLUtilsImpl();
123 CSCLUtilsImpl* m_impl;
126 class EXAPI CSCLUtils : public _CSCLUtils
131 virtual ~CSCLUtils();
133 static CSCLUtils* get_instance();
138 void scale_x(scl16 *x);
139 void scale_y(scl16 *y);
140 scl16 get_scaled_x(scl16 x);
141 scl16 get_scaled_y(scl16 y);
142 sclfloat get_smallest_scale_rate();
143 sclfloat get_scale_rate_x();
144 sclfloat get_scale_rate_y();
145 sclfloat get_smallest_custom_scale_rate();
146 sclfloat get_custom_scale_rate_x();
147 sclfloat get_custom_scale_rate_y();
149 void set_custom_scale_rate_x(sclfloat x);
150 void set_custom_scale_rate_y(sclfloat y);
152 sclchar* get_str_dup(const sclchar* str);
154 sclboolean sleep(sclulong msc);
156 sclchar* get_composed_path(sclchar* buf, const sclchar* prefix, const sclchar* path);
157 sclchar* get_decomposed_path(sclchar* buf, const sclchar* prefix, const sclchar* path);
158 const SclNinePatchInfo* get_nine_patch_info(const sclchar *image_path);
160 sclboolean get_autopopup_window_variables(sclchar * const autopopup_keys[MAX_SIZE_OF_AUTOPOPUP_STRING], sclbyte *num_keys,
161 sclbyte *num_columns, sclbyte *num_rows, sclint *width, sclint *height);
163 scl16 get_unique_id();
165 sclboolean is_rect_overlap(SclRectangle rect1, SclRectangle rect2);
166 sclfloat get_distance(sclint x1, sclint y1, sclint x2, sclint y2);
167 sclfloat get_distance(SclPoint pt1, SclPoint pt2);
169 sclfloat get_approximate_distance(sclint x1, sclint y1, sclint x2, sclint y2);
170 sclfloat get_approximate_distance(SclPoint pt1, SclPoint pt2);
172 sclint log(const sclchar *fmt, ...);
174 void update_scale_rate_values();
175 sclboolean update_screen_resolution();
177 sclfloat m_scn_rate_x;
178 sclfloat m_scn_rate_y;
180 sclfloat m_custom_scale_rate_x;
181 sclfloat m_custom_scale_rate_y;
183 sclint m_scn_resolution_x;
184 sclint m_scn_resolution_y;
186 std::map<sclchar*, SclNinePatchInfo> m_nine_patch_info_map;
190 } /* End of scl namespace */
196 #endif //__SCL_UTILS_H__