input_generator: add a new initialize API work synchronously
[platform/core/api/efl-util.git] / include / efl_util.h.in
1 /*
2  * Copyright (c) 2011-2017 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __TIZEN_UI_EFL_UTIL_H__
18 #define __TIZEN_UI_EFL_UTIL_H__
19
20 #include <tizen.h>
21 #include <Evas.h>
22 #include <tbm_surface.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 #ifdef __GNUC__
29 # if __GNUC__ >= 4
30 #  ifndef API
31 #   define API __attribute__ ((visibility("default")))
32 #  endif
33 # endif
34 #endif
35
36 /**
37  * @file efl_util.h
38  */
39
40 /**
41  * @addtogroup CAPI_EFL_UTIL_WIN_PROPERTY_MODULE
42  * @{
43  */
44
45 /**
46  * @brief Enumeration for EFL UTIL ERROR.
47  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
48  */
49 typedef enum
50 {
51    EFL_UTIL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
52    EFL_UTIL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
53    EFL_UTIL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
54    EFL_UTIL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
55    EFL_UTIL_ERROR_NO_SUCH_DEVICE = TIZEN_ERROR_NO_SUCH_DEVICE, /**< @platform No such device or address (@b Since: $TZ_CFG_VER_24_OR_30$) */
56    EFL_UTIL_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< @platform Function not implemented (@b Since: $TZ_CFG_VER_24_OR_30$) */
57    EFL_UTIL_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< @platform Not supported (@b Since: $TZ_CFG_VER_24_OR_30$) */
58    EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE = TIZEN_ERROR_EFL_UTIL | 0x01, /**< Window type not supported */
59    EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL = TIZEN_ERROR_EFL_UTIL | 0x02,  /**< @platform Screenshot initialization fail (@b Since: $TZ_CFG_VER_24_OR_30$) */
60    EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL = TIZEN_ERROR_EFL_UTIL | 0x03,  /**< @platform Screenshot execution fail (@b Since: $TZ_CFG_VER_24_OR_30$) */
61    EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE = TIZEN_ERROR_EFL_UTIL | 0x04 /**< Resource is not available (@b Since: 4.0) */
62 } efl_util_error_e;
63
64 /**
65  * @brief Enumeration of notification window's priority level.
66  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
67  */
68 typedef enum
69 {
70    EFL_UTIL_NOTIFICATION_LEVEL_NONE    = -1, /**< No (reset) notification level. This value makes the window place in normal layer. (@b Since: $TZ_CFG_VER_24_OR_30$) */
71    EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT = 10, /**< Default notification level. (@b Since: $TZ_CFG_VER_24_OR_30$) */
72    EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM  = 20, /**< Higher notification level than default. (@b Since: $TZ_CFG_VER_24_OR_30$) */
73    EFL_UTIL_NOTIFICATION_LEVEL_HIGH    = 30, /**< Higher notification level than medium. (@b Since: $TZ_CFG_VER_24_OR_30$) */
74    EFL_UTIL_NOTIFICATION_LEVEL_TOP     = 40  /**< The highest notification level. (@b Since: $TZ_CFG_VER_24_OR_30$) */
75 } efl_util_notification_level_e;
76
77 /**
78  * @brief Enumeration of screen mode.
79  * @since_tizen $TZ_CFG_VER_24_OR_30$
80  */
81 typedef enum
82 {
83    EFL_UTIL_SCREEN_MODE_DEFAULT, /**< The mode which turns the screen off after a timeout. */
84    EFL_UTIL_SCREEN_MODE_ALWAYS_ON, /**< The mode which keeps the screen turned on. */
85 } efl_util_screen_mode_e;
86
87 /**
88  * @brief Sets the priority level for the specified notification window.
89  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
90  * @privlevel public
91  * @privilege %http://tizen.org/privilege/window.priority.set
92  * @remarks This API can be used for a notification type window only.
93  *          Up to the version $TZ_CFG_VER_24_OR_231$, it supports as async APIs.
94  *          But it is synchronous call since Tizen 3.0
95  * @param[in] window The EFL window
96  * @param[in] level The notification window level
97  * @return @c 0 on success, otherwise a negative error value
98  * @retval #EFL_UTIL_ERROR_NONE Successful
99  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
100  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Window type not supported
101  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
102  */
103 API int efl_util_set_notification_window_level(Evas_Object *window, efl_util_notification_level_e level);
104
105 /**
106  * @brief Gets the priority level for the specified notification window.
107  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
108  *
109  * @remarks This API can be used for a notification type window only.
110  *          Up to the version $TZ_CFG_VER_24_OR_231$, it supports as async APIs.
111  *          But it is synchronous call since Tizen 3.0
112  * @param[in] window The EFL window
113  * @param[out] level The notification window level
114  * @return @c 0 on success, otherwise a negative error value
115  * @retval #EFL_UTIL_ERROR_NONE Successful
116  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
117  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Window type not supported
118  */
119 API int efl_util_get_notification_window_level(Evas_Object *window, efl_util_notification_level_e *level);
120
121 /**
122  * @brief Sets the alpha window's visual state to opaque state
123  * @details This API sets the alpha window's visual state to opaque state.
124  *          If the alpha window sets the visual state to the opaque,
125  *          then the window manager could handle it as the opaque window while calculating visibility.
126  *          This API will have no effect when used by a non-alpha window.
127  * @since_tizen $TZ_CFG_VER_24_OR_30$
128  * @param[in] window The EFL window
129  * @param[in] opaque The value that indicates whether the window has set a visual state to opaque (0: unset, 1: set)
130  * @return @c 0 on success, otherwise a negative error value
131  * @retval #EFL_UTIL_ERROR_NONE Successful
132  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
133  */
134 API int efl_util_set_window_opaque_state(Evas_Object *window, int opaque);
135
136 /**
137  * @brief Sets the window's screen mode.
138  * @details This API is useful when the application need to keep the display turned on.
139  *          If the application set the mode to #EFL_UTIL_SCREEN_MODE_ALWAYS_ON to its window and the window is shown wholly or partially,
140  *          the window manager requests the display system to keep the display on as long as the window is shown.
141  *          If the window is no longer shown, then the window manger request the display system to go back to normal operation.
142  *          Default screen mode of window is #EFL_UTIL_SCREEN_MODE_DEFAULT.
143  * @since_tizen $TZ_CFG_VER_24_OR_30$
144  * @privlevel public
145  * @privilege %http://tizen.org/privilege/display
146  * @remarks This API needs the privilege.
147  *          If the application which is not get the privilege use this API, the window manager generates the permission deny error.
148  * @param[in] window The EFL window
149  * @param[in] mode The screen mode
150  * @return @c 0 on success, otherwise a negative error value
151  * @retval #EFL_UTIL_ERROR_NONE Successful
152  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
153  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
154  */
155 API int efl_util_set_window_screen_mode(Evas_Object *window, efl_util_screen_mode_e mode);
156
157 /**
158  * @brief Gets the screen mode of the specified window.
159  * @since_tizen $TZ_CFG_VER_24_OR_30$
160  * @param[in] window The EFL window
161  * @param[out] mode The screen mode
162  * @return @c 0 on success, otherwise a negative error value
163  * @retval #EFL_UTIL_ERROR_NONE Successful
164  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
165  */
166 API int efl_util_get_window_screen_mode(Evas_Object *window, efl_util_screen_mode_e *mode);
167
168 /**
169  * @brief Sets the user's preferred brightness of the specified window.
170  * @details This API is useful when the application need to change the brightness of the screen when it is appeared on the screen.
171  *          If the application sets the brightness 0 to 100 to its window and the application window is shown wholly or partially,
172  *          the window manager requests the display system to change the brightness of the screen using user's preferred brightness.
173  *          If the window is no longer shown, then the window manger request the display system to go back to default brightness.
174  *          If the brightness is less than 0, this means to use the default screen brightness.
175  * @since_tizen 3.0
176  * @privlevel public
177  * @privilege %http://tizen.org/privilege/display
178  * @remarks This API needs the privilege.
179  *          If the application which is not get the privilege use this API, the window manager generates the permission deny error.
180  * @param[in] window The EFL window
181  * @param[in] brightness The preferred brightness
182  * @return @c 0 on success, otherwise a negative error value
183  * @retval #EFL_UTIL_ERROR_NONE Successful
184  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
185  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
186  * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Out of memory
187  * @see efl_util_get_window_brightness()
188  */
189 API int efl_util_set_window_brightness(Evas_Object *window, int brightness);
190
191 /**
192  * @brief Gets the user's preferred brightness of the specified window.
193  * @since_tizen 3.0
194  * @param[in] window The EFL window
195  * @param[out] brightness The preferred brightness
196  * @return @c 0 on success, otherwise a negative error value
197  * @retval #EFL_UTIL_ERROR_NONE Successful
198  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
199  * @see efl_util_set_window_brightness()
200  */
201 API int efl_util_get_window_brightness(Evas_Object *window, int *brightness);
202
203
204 /**
205  * @}
206  */
207
208 /**
209  * @addtogroup CAPI_EFL_UTIL_INPUT_MODULE
210  * @{
211  */
212
213  /**
214   * @platform
215   * @brief Definition for the input generator handle.
216   * @since_tizen $TZ_CFG_VER_24_OR_30$
217   */
218
219  typedef struct _efl_util_inputgen_h * efl_util_inputgen_h;
220
221 /**
222  * @platform
223  * @brief Enumeration of device type generated events.
224  * @since_tizen $TZ_CFG_VER_24_OR_30$
225  */
226 typedef enum
227 {
228    EFL_UTIL_INPUT_DEVTYPE_NONE = 0x0, /**< (Deprecated since 3.0.) */
229    EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN = (1 << 0), /**< Touch Screen device */
230    EFL_UTIL_INPUT_DEVTYPE_KEYBOARD = (1 << 1), /**< Keyboard device */
231    EFL_UTIL_INPUT_DEVTYPE_POINTER = (1 << 2), /**< Mouse device (Since 3.0) */
232    EFL_UTIL_INPUT_DEVTYPE_ALL = EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN |
233                                 EFL_UTIL_INPUT_DEVTYPE_KEYBOARD, /**< Both of touch screen and keyboard device (Deprecated since 3.0. Check all enumerations using OR operand instead) */
234    EFL_UTIL_INPUT_DEVTYPE_MAX = (1 << 10) /**< (Deprecated since 3.0.) */
235 } efl_util_input_device_type_e;
236
237 /**
238  * @platform
239  * @brief Enumeration of touch event types.
240  * @since_tizen $TZ_CFG_VER_24_OR_30$
241  */
242 typedef enum
243 {
244    EFL_UTIL_INPUT_TOUCH_NONE, /**< (Deprecated since 3.0.) */
245    EFL_UTIL_INPUT_TOUCH_BEGIN, /**< Finger press. It is same a behavior put your finger on touch screen */
246    EFL_UTIL_INPUT_TOUCH_UPDATE, /**< Finger move. It is same a behavior move your finger on touch screen */
247    EFL_UTIL_INPUT_TOUCH_END, /**< Finger release. It is same a behavior release your finger on touch screen */
248    EFL_UTIL_INPUT_TOUCH_MAX = 10 /**< (Deprecated since 3.0.) */
249 } efl_util_input_touch_type_e;
250
251 /**
252  * @platform
253  * @brief Enumeration of pointer event types.
254  * @since_tizen 3.0
255  */
256 typedef enum
257 {
258    EFL_UTIL_INPUT_POINTER_BUTTON_DOWN, /**< Mouse button press. */
259    EFL_UTIL_INPUT_POINTER_BUTTON_UP, /**< Mouse move. */
260    EFL_UTIL_INPUT_POINTER_MOVE, /**< Mouse button release. */
261 } efl_util_input_pointer_type_e;
262
263 /**
264    * @platform
265    * @brief Initializes system and check input generate functions are supported, open devices generated events.
266    * @since_tizen $TZ_CFG_VER_24_OR_30$
267    * @privlevel platform
268    * @privilege %http://tizen.org/privilege/inputgenerator
269    * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
270    * @remarks The dev_type is changed into the unsigned int to perform bitwise operations. (Since 3.0)
271    * @param[in] dev_type The device type want to generate events (ex> #EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | #EFL_UTIL_INPUT_DEVTYPE_KEYBOARD)
272    * @return #efl_util_inputgen_h on success, otherwise @c NULL
273    * @retval #efl_util_inputgen_h The input generator handle
274    * @exception #EFL_UTIL_ERROR_NONE Successful
275    * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
276    * @exception #EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address
277    * @exception #EFL_UTIL_ERROR_INVALID_OPERATION Function not implemented
278    * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
279    * @see efl_util_input_deinitialize_generator()
280    */
281 API efl_util_inputgen_h efl_util_input_initialize_generator(unsigned int dev_type);
282
283 /**
284    * @platform
285    * @brief Initializes system, check input generate functions are supported and then open events generator devices with given name.
286    * @since_tizen 4.0
287    * @privlevel platform
288    * @privilege %http://tizen.org/privilege/inputgenerator
289    * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
290    * @remarks The dev_type is changed into the unsigned int to perform bitwise operations.
291    * @param[in] dev_type The device type want to generate events (ex> #EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | #EFL_UTIL_INPUT_DEVTYPE_KEYBOARD)
292    * @param[in] name The device name (maximum 31 characters)
293    * @return #efl_util_inputgen_h on success, otherwise @c NULL
294    * @retval #efl_util_inputgen_h The input generator handle
295    * @exception #EFL_UTIL_ERROR_NONE Successful
296    * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
297    * @exception #EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address
298    * @exception #EFL_UTIL_ERROR_INVALID_OPERATION Function not implemented
299    * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
300    * @see efl_util_input_deinitialize_generator()
301    */
302 API efl_util_inputgen_h efl_util_input_initialize_generator_with_name(unsigned int dev_type, const char *name);
303
304 /**
305    * @platform
306    * @brief Initializes the system, checks if input generated functions are supported and then open events generator devices synchronously.
307    * @since_tizen 5.0
308    * @privlevel platform
309    * @privilege %http://tizen.org/privilege/inputgenerator
310    * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
311    * @remarks @a dev_type is changed into the unsigned int to perform bitwise operations.
312    * @remarks If the @a name is NULL, it will be set to "Input Generator"
313    * @remarks The returned object should be released with efl_util_input_deinitialize_generator().
314    * @param[in] dev_type The device type to generate events, values of #efl_util_input_device_type_e combined with bitwise 'or'\n
315    *            Example: #EFL_UTIL_INPUT_DEVTYPE_TOUCHSCREEN | #EFL_UTIL_INPUT_DEVTYPE_KEYBOARD
316    * @param[in] name The device name (maximum 31 characters, can be NULL)
317    * @return #efl_util_inputgen_h on success, otherwise @c NULL
318    * @retval #efl_util_inputgen_h The input generator handle
319    * @exception #EFL_UTIL_ERROR_NONE Successful
320    * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
321    * @exception #EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address
322    * @exception #EFL_UTIL_ERROR_INVALID_OPERATION Function not implemented
323    * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
324    * @exception #EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to initialize input generator
325    * @see efl_util_input_deinitialize_generator()
326    */
327 API efl_util_inputgen_h efl_util_input_initialize_generator_with_sync(unsigned int dev_type, const char *name);
328
329 /**
330    * @platform
331    * @brief Deinitializes system and close opened devices.
332    * @since_tizen $TZ_CFG_VER_24_OR_30$
333    * @privlevel platform
334    * @privilege %http://tizen.org/privilege/inputgenerator
335    * @param[in] inputgen_h The #efl_util_inputgen_h handle
336    * @return @c 0 on success, otherwise a negative error value
337    * @retval #EFL_UTIL_ERROR_NONE Successful
338    * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
339    * @see efl_util_input_initialize_generator()
340    */
341 API int efl_util_input_deinitialize_generator(efl_util_inputgen_h inputgen_h);
342
343 /**
344    * @platform
345    * @brief Generates all of key events using a opened device.
346    * @since_tizen $TZ_CFG_VER_24_OR_30$
347    * @privlevel platform
348    * @privilege %http://tizen.org/privilege/inputgenerator
349    * @param[in] inputgen_h The #efl_util_inputgen_h handle
350    * @param[in] key_name The key name want to generate
351    * @param[in] pressed The value that select key press or release (0: release, 1: press)
352    * @return @c 0 on success, otherwise a negative error value
353    * @retval #EFL_UTIL_ERROR_NONE Successful
354    * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
355    * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to generate key
356    */
357 API int efl_util_input_generate_key(efl_util_inputgen_h inputgen_h, const char *key_name, int pressed);
358
359 /**
360    * @platform
361    * @brief Generates a touch event using a opened device.
362    * @since_tizen $TZ_CFG_VER_24_OR_30$
363    * @privlevel platform
364    * @privilege %http://tizen.org/privilege/inputgenerator
365    * @param[in] inputgen_h The #efl_util_inputgen_h handle
366    * @param[in] idx The index of touched finger
367    * @param[in] touch_type The touch type (ex> #EFL_UTIL_INPUT_TOUCH_BEGIN, #EFL_UTIL_INPUT_TOUCH_UPDATE, #EFL_UTIL_INPUT_TOUCH_END)
368    * @param[in] x The x axis of touch point
369    * @param[in] y The y axis of touch point
370    * @return @c 0 on success, otherwise a negative error value
371    * @retval #EFL_UTIL_ERROR_NONE Successful
372    * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
373    * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to generate touch
374    */
375 API int efl_util_input_generate_touch(efl_util_inputgen_h inputgen_h, int idx, efl_util_input_touch_type_e touch_type, int x, int y);
376
377 /**
378    * @platform
379    * @brief Generate a pointer event using a opened device.
380    * @since_tizen 3.0
381    * @privlevel platform
382    * @privilege %http://tizen.org/privilege/inputgenerator
383    * @param[in] inputgen_h The #efl_util_inputgen_h handle
384    * @param[in] buttons The number of button
385    * @param[in] pointer_type The pointer type (ex> EFL_UTIL_INPUT_POINTER_BUTTON_PRESS, EFL_UTIL_INPUT_POINTER_BUTTON_UP, EFL_UTIL_INPUT_POINTER_MOVE)
386    * @param[in] x x coordination to move
387    * @param[in] y y coordination to move
388    * @return @c 0 on success, otherwise a negative error value
389    * @retval #EFL_UTIL_ERROR_NONE Successful
390    * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
391    * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Has no permission to generate pointer
392    * @retval #EFL_UTIL_ERROR_NO_SUCH_DEVICE No such device or address
393    * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
394    */
395 API int efl_util_input_generate_pointer(efl_util_inputgen_h inputgen_h, int buttons, efl_util_input_pointer_type_e pointer_type, int x, int y);
396
397 /**
398  * @}
399  */
400
401 /**
402  * @addtogroup CAPI_EFL_UTIL_SCREENSHOT_MODULE
403  * @{
404  */
405
406 /**
407  * @platform
408  * @brief Definition for the screenshot handle.
409  * @since_tizen $TZ_CFG_VER_24_OR_30$
410  */
411 typedef struct _efl_util_screenshot_h * efl_util_screenshot_h;
412
413 /**
414  * @platform
415  * @brief Initializes the screenshot.
416  * @since_tizen $TZ_CFG_VER_24_OR_30$
417  * @privlevel platform
418  * @privilege %http://tizen.org/privilege/screenshot
419  * @remarks The specific error code can be obtained using the get_last_result()
420  * method. Error codes are described in Exception section.
421  * @param[in] width width of the screenshot surface
422  * @param[in] height height of the screenshot surface
423  * @return #efl_util_screenshot_h on success, otherwise @c NULL
424  * @retval #efl_util_screenshot_h  The screenshot handle
425  * @exception #EFL_UTIL_ERROR_NONE Successful
426  * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
427  * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
428  * @exception #EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL Initialization failure
429  * @see efl_util_screenshot_deinitialize()
430  */
431 API efl_util_screenshot_h efl_util_screenshot_initialize(int width, int height);
432
433 /**
434  * @platform
435  * @brief Takes a screenshot and get a tbm_surface handle.
436  * @since_tizen $TZ_CFG_VER_24_OR_30$
437  * @privlevel platform
438  * @privilege %http://tizen.org/privilege/screenshot
439  * @remarks The specific error code can be obtained using the get_last_result()
440  *          The #tbm_surface_h must be free by caller
441  * @param[in] screenshot efl_util_screenshot_h handle
442  * @return #tbm_surface_h on success, otherwise @c NULL
443  * @retval #tbm_surface_h The TBM surface handle
444  * @exception #EFL_UTIL_ERROR_NONE Successful
445  * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
446  * @exception #EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL Execution failure
447  * @see efl_util_screenshot_initialize()
448  * @see efl_util_screenshot_deinitialize()
449  */
450 API tbm_surface_h efl_util_screenshot_take_tbm_surface(efl_util_screenshot_h screenshot);
451
452 /**
453  * @platform
454  * @brief Deinitializes the screenshot.
455  * @since_tizen $TZ_CFG_VER_24_OR_30$
456  * @privlevel platform
457  * @privilege %http://tizen.org/privilege/screenshot
458  * @param[in]  screenshot  efl_util_screenshot_h handle
459  * @return @c 0 on success, otherwise a negative error value
460  * @retval #EFL_UTIL_ERROR_NONE Successful
461  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
462  * @see efl_util_screenshot_initialize()
463  */
464 API int efl_util_screenshot_deinitialize(efl_util_screenshot_h screenshot);
465
466 /**
467  * @}
468  */
469
470 /**
471  * @addtogroup CAPI_EFL_UTIL_GESTURE_MODULE
472  * @{
473  */
474
475 /**
476  * @brief Definition for the gesture handle.
477  * @since_tizen 4.0
478  */
479 typedef struct _efl_util_gesture_h * efl_util_gesture_h;
480
481 /**
482  * @brief Definition for the edge swipe gesture event.
483  * @since_tizen 4.0
484  */
485 API extern int EFL_UTIL_EVENT_GESTURE_EDGE_SWIPE;
486
487 /**
488  * @brief Definition for the edge swipe gesture event.
489  * @since_tizen 4.0
490  */
491 API extern int EFL_UTIL_EVENT_GESTURE_EDGE_DRAG;
492
493 /**
494  * @brief Definition for the tap gesture event.
495  * @since_tizen 4.0
496  */
497 API extern int EFL_UTIL_EVENT_GESTURE_TAP;
498
499 /**
500  * @brief Definition for the palm cover gesture event.
501  * @since_tizen 4.0
502  */
503 API extern int EFL_UTIL_EVENT_GESTURE_PALM_COVER;
504
505 /**
506  * @brief Enumeration of gesture type
507  * @since_tizen 4.0
508  */
509 typedef enum _efl_util_gesture_type_e
510 {
511    EFL_UTIL_GESTURE_TYPE_NONE       = 0,        /**< None gesture type */
512    EFL_UTIL_GESTURE_TYPE_EDGE_SWIPE = (1 << 0), /**< Edge swipe gesture type */
513    EFL_UTIL_GESTURE_TYPE_EDGE_DRAG  = (1 << 1), /**< Edge drag gesture type */
514    EFL_UTIL_GESTURE_TYPE_TAP        = (1 << 2), /**< Tap gesture type */
515    EFL_UTIL_GESTURE_TYPE_PALM_COVER = (1 << 3), /**< Palm cover gesture type */
516    EFL_UTIL_GESTURE_TYPE_PAN        = (1 << 4), /**< Pan gesture type */
517    EFL_UTIL_GESTURE_TYPE_PINCH      = (1 << 5), /**< Pinch gesture type */
518    EFL_UTIL_GESTURE_TYPE_PALM_SWIPE = (1 << 6)  /**< Palm swipe gesture type */
519 } efl_util_gesture_type_e;
520
521 /**
522  * @brief Enumeration of gesture mode
523  * @since_tizen 4.0
524  */
525 typedef enum _efl_util_gesture_mode_e
526 {
527    EFL_UTIL_GESTURE_MODE_NONE    = 0, /**< None gesture mode */
528    EFL_UTIL_GESTURE_MODE_BEGIN,       /**< Begin a gesture event */
529    EFL_UTIL_GESTURE_MODE_UPDATE,      /**< continually update a gesture event */
530    EFL_UTIL_GESTURE_MODE_END,         /**< End a gesture event */
531    EFL_UTIL_GESTURE_MODE_DONE         /**< Occur a gesture event */
532 } efl_util_gesture_mode_e;
533
534 /**
535  * @brief Enumeration of gesture edge
536  * @since_tizen 4.0
537  */
538 typedef enum _efl_util_gesture_edge_e
539 {
540    EFL_UTIL_GESTURE_EDGE_NONE    = 0, /**< None edge point */
541    EFL_UTIL_GESTURE_EDGE_TOP,         /**< Top edge position of screen */
542    EFL_UTIL_GESTURE_EDGE_RIGHT,       /**< Right edge position of screen */
543    EFL_UTIL_GESTURE_EDGE_BOTTOM,      /**< Bottom edge position of screen */
544    EFL_UTIL_GESTURE_EDGE_LEFT         /**< Left edge position of screen */
545 } efl_util_gesture_edge_e;
546
547 /**
548  * @brief Enumeration of gesture edge size
549  * @since_tizen 4.0
550  */
551 typedef enum _efl_util_gesture_edge_size_e
552 {
553    EFL_UTIL_GESTURE_EDGE_SIZE_NONE,    /**< None size of edge */
554    EFL_UTIL_GESTURE_EDGE_SIZE_FULL,    /**< Full size in the edge */
555    EFL_UTIL_GESTURE_EDGE_SIZE_PARTIAL  /**< Part of edge */
556 } efl_util_gesture_edge_size_e;
557
558 /**
559  * @brief Definition for the gesture data handle
560  * @since_tizen 4.0
561  */
562 typedef void *efl_util_gesture_data;
563
564 /**
565  * @brief Definition for the edge swipe gesture's event data structure
566  * @since_tizen 4.0
567  */
568 typedef struct _efl_util_event_gesture_edge_swipe_s
569 {
570    efl_util_gesture_mode_e mode;  /**< Mode of a gesture event */
571    unsigned int fingers;          /**< Number of fingers */
572    int sx;                        /**< Start x point of edge area */
573    int sy;                        /**< Start y point of edge area */
574    unsigned int edge;             /**< Start edge location */
575 } efl_util_event_gesture_edge_swipe_s;
576
577 /**
578  * @brief Definition for the edge drag gesture's event data structure
579  * @since_tizen 4.0
580  */
581 typedef struct efl_util_event_gesture_edge_drag_s
582 {
583    efl_util_gesture_mode_e mode;  /**< Mode of a gesture event */
584    unsigned int fingers;          /**< Number of fingers */
585    int cx;                        /**< Center x point of edge area */
586    int cy;                        /**< Center y point of edge area */
587    unsigned int edge;             /**< Start edge location */
588 } efl_util_event_gesture_edge_drag_s;
589
590 /**
591  * @brief Definition for the tap gesture's event data structure
592  * @since_tizen 4.0
593  */
594 typedef struct _efl_util_event_gesture_tap_s
595 {
596    efl_util_gesture_mode_e mode;  /**< Mode of a gesture event */
597    unsigned int fingers;          /**< Number of fingers */
598    unsigned int repeats;          /**< Number of tap repeats */
599 } efl_util_event_gesture_tap_s;
600
601 /**
602  * @brief Definition for the palm cover gesture's event data structure
603  * @since_tizen 4.0
604  */
605 typedef struct _efl_util_event_gesture_palm_cover_s
606 {
607    efl_util_gesture_mode_e mode;  /**< Mode of a gesture event */
608    unsigned int duration;         /**< Duration time of gesture behavior */
609    int cx;                        /**< Center x point of edge area */
610    int cy;                        /**< Center y point of edge area */
611    unsigned int size;             /**< Size of touched area */
612    double pressure;               /**< Pressure of touched finger */
613 } efl_util_event_gesture_palm_cover_s;
614
615 /**
616  * @brief Initializes system and check if global gestures are supported.
617  * @since_tizen 4.0
618  * @remarks The specific error code can be obtained using the get_last_result() method.
619  *          Error codes are described in Exception section.
620  * @return #efl_util_gesture_h on success, otherwise @c NULL
621  * @retval #efl_util_gesture_h The global gesture handle
622  * @exception #EFL_UTIL_ERROR_NONE Successful
623  * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
624  * @exception #EFL_UTIL_ERROR_NOT_SUPPORTED Not supported
625  * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
626  * @see efl_util_gesture_deinitialize()
627  */
628 API efl_util_gesture_h efl_util_gesture_initialize(void);
629
630 /**
631  * @brief Deinitializes system.
632  * @since_tizen 4.0
633  * @param[in] gesture_h The #efl_util_gesture_h handle
634  * @return @c 0 on success, otherwise a negative error value
635  * @retval #EFL_UTIL_ERROR_NONE Successful
636  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
637  * @see efl_util_gesture_initialize()
638  */
639 API int efl_util_gesture_deinitialize(efl_util_gesture_h gesture_h);
640
641 /**
642  * @brief Generates a edge swipe gesture's grab info handle.
643  * @since_tizen 4.0
644  * @param[in] gesture_h The #efl_util_gesture_h handle
645  * @param[in] fingers   The number of fingers
646  * @param[in] edge      The position of edge
647  * @remarks The specific error code can be obtained using the get_last_result() method.
648  *          Error codes are described in Exception section.
649  * @return #efl_util_gesture_data on success, otherwise @c NULL
650  * @retval #efl_util_gesture_data The specific gesture data handle
651  * @exception #EFL_UTIL_ERROR_NONE Successful
652  * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
653  * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
654  * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
655  */
656 API efl_util_gesture_data efl_util_gesture_edge_swipe_new(efl_util_gesture_h gesture_h, unsigned int fingers, efl_util_gesture_edge_e edge);
657
658 /**
659  * @brief Frees a memory of edge swipe gesture's grab info handle.
660  * @since_tizen 4.0
661  * @param[in] gesture_h The #efl_util_gesture_h handle
662  * @param[in] data      The #efl_util_gesture_data handle
663  * @return @c 0 on success, otherwise a negative error value
664  * @retval #EFL_UTIL_ERROR_NONE Successful
665  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
666  */
667 API int efl_util_gesture_edge_swipe_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
668
669
670 /**
671  * @brief Sets a specific size of edge for edge swipe gesture.
672  * @since_tizen 4.0
673  * @param[in] data        The #efl_util_gesture_data handle
674  * @param[in] edge_size   The #efl_util_gesture_edge_size_e enum
675  * @param[in] start_point The start point of edge area
676  * @param[in] end_point   The end point of edge area
677  * @return @c 0 on success, otherwise a negative error value
678  * @retval #EFL_UTIL_ERROR_NONE Successful
679  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
680  * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
681  */
682 API int efl_util_gesture_edge_swipe_size_set(efl_util_gesture_data data, efl_util_gesture_edge_size_e edge_size, unsigned int start_point, unsigned int end_point);
683
684 /**
685  * @brief Generates a edge drag gesture's grab info handle.
686  * @since_tizen 4.0
687  * @param[in] gesture_h The #efl_util_gesture_h handle
688  * @param[in] fingers   The number of fingers
689  * @param[in] edge      The position of edge
690  * @remarks The specific error code can be obtained using the get_last_result() method.
691  *          Error codes are described in Exception section.
692  * @return #efl_util_gesture_data on success, otherwise @c NULL
693  * @retval #efl_util_gesture_data The specific gesture data handle
694  * @exception #EFL_UTIL_ERROR_NONE Successful
695  * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
696  * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
697  * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
698  */
699 API efl_util_gesture_data efl_util_gesture_edge_drag_new(efl_util_gesture_h gesture_h, unsigned int fingers, efl_util_gesture_edge_e edge);
700
701 /**
702  * @brief Frees a memory of edge drag gesture's grab info handle.
703  * @since_tizen 4.0
704  * @param[in] gesture_h The #efl_util_gesture_h handle
705  * @param[in] data      The #efl_util_gesture_data handle
706  * @return @c 0 on success, otherwise a negative error value
707  * @retval #EFL_UTIL_ERROR_NONE Successful
708  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
709  */
710 API int efl_util_gesture_edge_drag_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
711
712 /**
713  * @brief Sets a specific size of edge for edge drag gesture.
714  * @since_tizen 4.0
715  * @param[in] data        The #efl_util_gesture_data handle
716  * @param[in] edge_size   The #efl_util_gesture_edge_size_e enum
717  * @param[in] start_point The start point of edge area
718  * @param[in] end_point   The end point of edge area
719  * @return @c 0 on success, otherwise a negative error value
720  * @retval #EFL_UTIL_ERROR_NONE Successful
721  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
722  * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
723  */
724 API int efl_util_gesture_edge_drag_size_set(efl_util_gesture_data data, efl_util_gesture_edge_size_e edge_size, unsigned int start_point, unsigned int end_point);
725
726 /**
727  * @brief Generates a tap gesture's grab info handle.
728  * @since_tizen 4.0
729  * @param[in] gesture_h The #efl_util_gesture_h handle
730  * @param[in] fingers   The number of fingers
731  * @param[in] repeats   The number of repeats
732  * @remarks The specific error code can be obtained using the get_last_result() method.
733  *          Error codes are described in Exception section.
734  * @return #efl_util_gesture_data on success, otherwise @c NULL
735  * @retval #efl_util_gesture_data The specific gesture data handle
736  * @exception #EFL_UTIL_ERROR_NONE Successful
737  * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
738  * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
739  * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
740  */
741 API efl_util_gesture_data efl_util_gesture_tap_new(efl_util_gesture_h gesture_h, unsigned int fingers, unsigned int repeats);
742
743 /**
744  * @brief Frees a memory of tap gesture's grab info handle.
745  * @since_tizen 4.0
746  * @param[in] gesture_h The #efl_util_gesture_h handle
747  * @param[in] data      The #efl_util_gesture_data handle
748  * @return @c 0 on success, otherwise a negative error value
749  * @retval #EFL_UTIL_ERROR_NONE Successful
750  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
751  */
752 API int efl_util_gesture_tap_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
753
754 /**
755  * @brief Generates a palm cover gesture's grab info handle.
756  * @since_tizen 4.0
757  * @param[in] gesture_h The #efl_util_gesture_h handle
758  * @remarks The specific error code can be obtained using the get_last_result() method.
759  *          Error codes are described in Exception section.
760  * @return #efl_util_gesture_data on success, otherwise @c NULL
761  * @retval #efl_util_gesture_data The specific gesture data handle
762  * @exception #EFL_UTIL_ERROR_NONE Successful
763  * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
764  * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
765  * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
766  */
767 API efl_util_gesture_data efl_util_gesture_palm_cover_new(efl_util_gesture_h gesture_h);
768
769 /**
770  * @brief Frees a memory of palm cover gesture's grab info handle.
771  * @since_tizen 4.0
772  * @param[in] gesture_h The #efl_util_gesture_h handle
773  * @param[in] data      The #efl_util_gesture_data handle
774  * @return @c 0 on success, otherwise a negative error value
775  * @retval #EFL_UTIL_ERROR_NONE Successful
776  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
777  */
778 API int efl_util_gesture_palm_cover_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
779
780 /**
781  * @platform
782  * @brief Grabs a global gesture.
783  * @since_tizen 4.0
784  * @privlevel platform
785  * @privilege %http://tizen.org/privilege/gesturegrab
786  * @param[in] gesture_h The #efl_util_gesture_h handle
787  * @param[in] data      The #efl_util_gesture_data handle.
788  * @return @c 0 on success, otherwise a negative error value
789  * @retval #EFL_UTIL_ERROR_NONE Successful
790  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
791  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
792  * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
793  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED Not supported
794  * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
795  */
796 API int efl_util_gesture_grab(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
797
798 /**
799  * @platform
800  * @brief Ungrabs a global gesture.
801  * @since_tizen 4.0
802  * @privlevel platform
803  * @privilege %http://tizen.org/privilege/gesturegrab
804  * @param[in] gesture_h The #efl_util_gesture_h handle
805  * @param[in] data      The #efl_util_gesture_data handle.
806  * @return @c 0 on success, otherwise a negative error value
807  * @retval #EFL_UTIL_ERROR_NONE Successful
808  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
809  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
810  * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
811  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED Not supported
812  * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
813  */
814 API int efl_util_gesture_ungrab(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
815
816 /**
817  * @brief Selects a global gesture on given window.
818  * @since_tizen 4.0
819  * @param[in] gesture_h The #efl_util_gesture_h handle
820  * @param[in] window    The efl window
821  * @param[in] data      The #efl_util_gesture_data handle.
822  * @return @c 0 on success, otherwise a negative error value
823  * @retval #EFL_UTIL_ERROR_NONE Successful
824  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
825  * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
826  * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
827  */
828 API int efl_util_gesture_select(efl_util_gesture_h gesture_h, Evas_Object *window, efl_util_gesture_data data);
829
830 /**
831  * @brief Deselects a global gesture on given window.
832  * @since_tizen 4.0
833  * @param[in] gesture_h The #efl_util_gesture_h handle
834  * @param[in] window    The efl window
835  * @param[in] data      The #efl_util_gesture_data handle
836  * @return @c 0 on success, otherwise a negative error value
837  * @retval #EFL_UTIL_ERROR_NONE Successful
838  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
839  * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
840  * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
841  */
842 API int efl_util_gesture_deselect(efl_util_gesture_h gesture_h, Evas_Object *window, efl_util_gesture_data data);
843
844 /**
845  * @platform
846  * @brief Activates or deactivates a global gesture.
847  * @since_tizen 4.0
848  * @privlevel platform
849  * @privilege %http://tizen.org/privilege/gestureactivation
850  * @param[in] gesture_h The #efl_util_gesture_h handle
851  * @param[in] type      The gesture type to activate /deactivate combined by #efl_util_gesture_type_e to bitwise operation
852  * @param[in] active    The activated boolean value
853  * @return @c 0 on success, otherwise a negative error value
854  * @retval #EFL_UTIL_ERROR_NONE Successful
855  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
856  * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
857  * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
858  * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
859  */
860 API int efl_util_gesture_activate_set(efl_util_gesture_h gesture_h, unsigned int type, Eina_Bool active);
861
862 /**
863  * @brief Activates or deactivates a global gesture on given window.
864  * @since_tizen 4.0
865  * @param[in] gesture_h The #efl_util_gesture_h handle
866  * @param[in] window    The efl window
867  * @param[in] type      The gesture type to activate /deactivate combined by #efl_util_gesture_type_e to bitwise operation
868  * @param[in] active    The activated boolean value
869  * @return @c 0 on success, otherwise a negative error value
870  * @retval #EFL_UTIL_ERROR_NONE Successful
871  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
872  * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
873  * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
874  */
875 API int efl_util_gesture_activate_set_on_window(efl_util_gesture_h gesture_h, Evas_Object *window, unsigned int type, Eina_Bool active);
876
877 /**
878  * @}
879  */
880
881 #ifdef __cplusplus
882 }
883 #endif
884 #endif /* __TIZEN_UI_EFL_UTIL_H__ */