gesture: add gesture APIs
[platform/core/api/efl-util.git] / include / efl_util.h.in
index 258648f..8055226 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ * Copyright (c) 2011-2017 Samsung Electronics Co., Ltd All Rights Reserved
  *
  * Licensed under the Apache License, Version 2.0 (the License);
  * you may not use this file except in compliance with the License.
@@ -57,7 +57,8 @@ typedef enum
    EFL_UTIL_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< @platform Not supported (@b Since: $TZ_CFG_VER_24_OR_30$) */
    EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE = TIZEN_ERROR_EFL_UTIL | 0x01, /**< Window type not supported */
    EFL_UTIL_ERROR_SCREENSHOT_INIT_FAIL = TIZEN_ERROR_EFL_UTIL | 0x02,  /**< @platform Screenshot initialization fail (@b Since: $TZ_CFG_VER_24_OR_30$) */
-   EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL = TIZEN_ERROR_EFL_UTIL | 0x03  /**< @platform Screenshot execution fail (@b Since: $TZ_CFG_VER_24_OR_30$) */
+   EFL_UTIL_ERROR_SCREENSHOT_EXECUTION_FAIL = TIZEN_ERROR_EFL_UTIL | 0x03,  /**< @platform Screenshot execution fail (@b Since: $TZ_CFG_VER_24_OR_30$) */
+   EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE = TIZEN_ERROR_EFL_UTIL | 0x04 /**< Resource is not available (@b Since: 4.0) */
 } efl_util_error_e;
 
 /**
@@ -532,6 +533,417 @@ API int efl_util_screenshot_deinitialize(efl_util_screenshot_h screenshot);
  * @}
  */
 
+/**
+ * @addtogroup CAPI_EFL_UTIL_GESTURE_MODULE
+ * @{
+ */
+
+/**
+ * @brief Definition for the gesture handle.
+ * @since_tizen 4.0
+ */
+typedef struct _efl_util_gesture_h * efl_util_gesture_h;
+
+/**
+ * @brief Definition for the edge swipe gesture event.
+ * @since_tizen 4.0
+ */
+API extern int EFL_UTIL_EVENT_GESTURE_EDGE_SWIPE;
+
+/**
+ * @brief Definition for the edge swipe gesture event.
+ * @since_tizen 4.0
+ */
+API extern int EFL_UTIL_EVENT_GESTURE_EDGE_DRAG;
+
+/**
+ * @brief Definition for the tap gesture event.
+ * @since_tizen 4.0
+ */
+API extern int EFL_UTIL_EVENT_GESTURE_TAP;
+
+/**
+ * @brief Definition for the palm cover gesture event.
+ * @since_tizen 4.0
+ */
+API extern int EFL_UTIL_EVENT_GESTURE_PALM_COVER;
+
+/**
+ * @brief Enumeration of gesture type
+ * @since_tizen 4.0
+ */
+typedef enum _efl_util_gesture_type_e
+{
+   EFL_UTIL_GESTURE_TYPE_NONE       = 0,        /**< None gesture type */
+   EFL_UTIL_GESTURE_TYPE_EDGE_SWIPE = (1 << 0), /**< Edge swipe gesture type */
+   EFL_UTIL_GESTURE_TYPE_EDGE_DRAG  = (1 << 1), /**< Edge drag gesture type */
+   EFL_UTIL_GESTURE_TYPE_TAP        = (1 << 2), /**< Tap gesture type */
+   EFL_UTIL_GESTURE_TYPE_PALM_COVER = (1 << 3), /**< Palm cover gesture type */
+   EFL_UTIL_GESTURE_TYPE_PAN        = (1 << 4), /**< Pan gesture type */
+   EFL_UTIL_GESTURE_TYPE_PINCH      = (1 << 5), /**< Pinch gesture type */
+   EFL_UTIL_GESTURE_TYPE_PALM_SWIPE = (1 << 6)  /**< Palm swipe gesture type */
+} efl_util_gesture_type_e;
+
+/**
+ * @brief Enumeration of gesture mode
+ * @since_tizen 4.0
+ */
+typedef enum _efl_util_gesture_mode_e
+{
+   EFL_UTIL_GESTURE_MODE_NONE    = 0, /**< None gesture mode */
+   EFL_UTIL_GESTURE_MODE_BEGIN,       /**< Begin a gesture event */
+   EFL_UTIL_GESTURE_MODE_UPDATE,      /**< continually update a gesture event */
+   EFL_UTIL_GESTURE_MODE_END,         /**< End a gesture event */
+   EFL_UTIL_GESTURE_MODE_DONE         /**< Occur a gesture event */
+} efl_util_gesture_mode_e;
+
+/**
+ * @brief Enumeration of gesture edge
+ * @since_tizen 4.0
+ */
+typedef enum _efl_util_gesture_edge_e
+{
+   EFL_UTIL_GESTURE_EDGE_NONE    = 0, /**< None edge point */
+   EFL_UTIL_GESTURE_EDGE_TOP,         /**< Top edge position of screen */
+   EFL_UTIL_GESTURE_EDGE_RIGHT,       /**< Right edge position of screen */
+   EFL_UTIL_GESTURE_EDGE_BOTTOM,      /**< Bottom edge position of screen */
+   EFL_UTIL_GESTURE_EDGE_LEFT         /**< Left edge position of screen */
+} efl_util_gesture_edge_e;
+
+/**
+ * @brief Enumeration of gesture edge size
+ * @since_tizen 4.0
+ */
+typedef enum _efl_util_gesture_edge_size_e
+{
+   EFL_UTIL_GESTURE_EDGE_SIZE_NONE,    /**< None size of edge */
+   EFL_UTIL_GESTURE_EDGE_SIZE_FULL,    /**< Full size in the edge */
+   EFL_UTIL_GESTURE_EDGE_SIZE_PARTIAL  /**< Part of edge */
+} efl_util_gesture_edge_size_e;
+
+/**
+ * @brief Definition for the gesture data handle
+ * @since_tizen 4.0
+ */
+typedef void *efl_util_gesture_data;
+
+/**
+ * @brief Definition for the edge swipe gesture's event data structure
+ * @since_tizen 4.0
+ */
+typedef struct _efl_util_event_gesture_edge_swipe_s
+{
+   efl_util_gesture_mode_e mode;  /**< Mode of a gesture event */
+   unsigned int fingers;          /**< Number of fingers */
+   int sx;                        /**< Start x point of edge area */
+   int sy;                        /**< Start y point of edge area */
+   unsigned int edge;             /**< Start edge location */
+} efl_util_event_gesture_edge_swipe_s;
+
+/**
+ * @brief Definition for the edge drag gesture's event data structure
+ * @since_tizen 4.0
+ */
+typedef struct efl_util_event_gesture_edge_drag_s
+{
+   efl_util_gesture_mode_e mode;  /**< Mode of a gesture event */
+   unsigned int fingers;          /**< Number of fingers */
+   int cx;                        /**< Center x point of edge area */
+   int cy;                        /**< Center y point of edge area */
+   unsigned int edge;             /**< Start edge location */
+} efl_util_event_gesture_edge_drag_s;
+
+/**
+ * @brief Definition for the tap gesture's event data structure
+ * @since_tizen 4.0
+ */
+typedef struct _efl_util_event_gesture_tap_s
+{
+   efl_util_gesture_mode_e mode;  /**< Mode of a gesture event */
+   unsigned int fingers;          /**< Number of fingers */
+   unsigned int repeats;          /**< Number of tap repeats */
+} efl_util_event_gesture_tap_s;
+
+/**
+ * @brief Definition for the palm cover gesture's event data structure
+ * @since_tizen 4.0
+ */
+typedef struct _efl_util_event_gesture_palm_cover_s
+{
+   efl_util_gesture_mode_e mode;  /**< Mode of a gesture event */
+   unsigned int duration;         /**< Duration time of gesture behavior */
+   int cx;                        /**< Center x point of edge area */
+   int cy;                        /**< Center y point of edge area */
+   unsigned int size;             /**< Size of touched area */
+   double pressure;               /**< Pressure of touched finger */
+} efl_util_event_gesture_palm_cover_s;
+
+/**
+ * @brief Initializes system and check if global gestures are supported.
+ * @since_tizen 4.0
+ * @remarks The specific error code can be obtained using the get_last_result() method.
+ *          Error codes are described in Exception section.
+ * @return #efl_util_gesture_h on success, otherwise @c NULL
+ * @retval #efl_util_gesture_h The global gesture handle
+ * @exception #EFL_UTIL_ERROR_NONE Successful
+ * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @exception #EFL_UTIL_ERROR_NOT_SUPPORTED Not supported
+ * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ * @see efl_util_gesture_deinitialize()
+ */
+API efl_util_gesture_h efl_util_gesture_initialize(void);
+
+/**
+ * @brief Deinitializes system.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see efl_util_gesture_initialize()
+ */
+API int efl_util_gesture_deinitialize(efl_util_gesture_h gesture_h);
+
+/**
+ * @brief Generates a edge swipe gesture's grab info handle.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] fingers   The number of fingers
+ * @param[in] edge      The position of edge
+ * @remarks The specific error code can be obtained using the get_last_result() method.
+ *          Error codes are described in Exception section.
+ * @return #efl_util_gesture_data on success, otherwise @c NULL
+ * @retval #efl_util_gesture_data The specific gesture data handle
+ * @exception #EFL_UTIL_ERROR_NONE Successful
+ * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+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);
+
+/**
+ * @brief Frees a memory of edge swipe gesture's grab info handle.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] data      The #efl_util_gesture_data handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+API int efl_util_gesture_edge_swipe_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
+
+
+/**
+ * @brief Sets a specific size of edge for edge swipe gesture.
+ * @since_tizen 4.0
+ * @param[in] data        The #efl_util_gesture_data handle
+ * @param[in] edge_size   The #efl_util_gesture_edge_size_e enum
+ * @param[in] start_point The start point of edge area
+ * @param[in] end_point   The end point of edge area
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+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);
+
+/**
+ * @brief Generates a edge drag gesture's grab info handle.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] fingers   The number of fingers
+ * @param[in] edge      The position of edge
+ * @remarks The specific error code can be obtained using the get_last_result() method.
+ *          Error codes are described in Exception section.
+ * @return #efl_util_gesture_data on success, otherwise @c NULL
+ * @retval #efl_util_gesture_data The specific gesture data handle
+ * @exception #EFL_UTIL_ERROR_NONE Successful
+ * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+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);
+
+/**
+ * @brief Frees a memory of edge drag gesture's grab info handle.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] data      The #efl_util_gesture_data handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+API int efl_util_gesture_edge_drag_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
+
+/**
+ * @brief Sets a specific size of edge for edge drag gesture.
+ * @since_tizen 4.0
+ * @param[in] data        The #efl_util_gesture_data handle
+ * @param[in] edge_size   The #efl_util_gesture_edge_size_e enum
+ * @param[in] start_point The start point of edge area
+ * @param[in] end_point   The end point of edge area
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+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);
+
+/**
+ * @brief Generates a tap gesture's grab info handle.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] fingers   The number of fingers
+ * @param[in] repeats   The number of repeats
+ * @remarks The specific error code can be obtained using the get_last_result() method.
+ *          Error codes are described in Exception section.
+ * @return #efl_util_gesture_data on success, otherwise @c NULL
+ * @retval #efl_util_gesture_data The specific gesture data handle
+ * @exception #EFL_UTIL_ERROR_NONE Successful
+ * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+API efl_util_gesture_data efl_util_gesture_tap_new(efl_util_gesture_h gesture_h, unsigned int fingers, unsigned int repeats);
+
+/**
+ * @brief Frees a memory of tap gesture's grab info handle.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] data      The #efl_util_gesture_data handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+API int efl_util_gesture_tap_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
+
+/**
+ * @brief Generates a palm cover gesture's grab info handle.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @remarks The specific error code can be obtained using the get_last_result() method.
+ *          Error codes are described in Exception section.
+ * @return #efl_util_gesture_data on success, otherwise @c NULL
+ * @retval #efl_util_gesture_data The specific gesture data handle
+ * @exception #EFL_UTIL_ERROR_NONE Successful
+ * @exception #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @exception #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @exception #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+API efl_util_gesture_data efl_util_gesture_palm_cover_new(efl_util_gesture_h gesture_h);
+
+/**
+ * @brief Frees a memory of palm cover gesture's grab info handle.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] data      The #efl_util_gesture_data handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+API int efl_util_gesture_palm_cover_free(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
+
+/**
+ * @platform
+ * @brief Grabs a global gesture.
+ * @since_tizen 4.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/gesturegrab
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] data      The #efl_util_gesture_data handle.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED Not supported
+ * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+API int efl_util_gesture_grab(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
+
+/**
+ * @platform
+ * @brief Ungrabs a global gesture.
+ * @since_tizen 4.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/gesturegrab
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] data      The #efl_util_gesture_data handle.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED Not supported
+ * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+API int efl_util_gesture_ungrab(efl_util_gesture_h gesture_h, efl_util_gesture_data data);
+
+/**
+ * @brief Selects a global gesture on given window.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] window    The efl window
+ * @param[in] data      The #efl_util_gesture_data handle.
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+API int efl_util_gesture_select(efl_util_gesture_h gesture_h, Evas_Object *window, efl_util_gesture_data data);
+
+/**
+ * @brief Deselects a global gesture on given window.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] window    The efl window
+ * @param[in] data      The #efl_util_gesture_data handle
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+API int efl_util_gesture_deselect(efl_util_gesture_h gesture_h, Evas_Object *window, efl_util_gesture_data data);
+
+/**
+ * @platform
+ * @brief Activates or deactivates a global gesture.
+ * @since_tizen 4.0
+ * @privlevel platform
+ * @privilege %http://tizen.org/privilege/gestureactivation
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] type      The gesture type to activate /deactivate combined by #efl_util_gesture_type_e to bitwise operation
+ * @param[in] active    The activated boolean value
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_PERMISSION_DENIED Permission denied
+ * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+API int efl_util_gesture_activate_set(efl_util_gesture_h gesture_h, unsigned int type, Eina_Bool active);
+
+/**
+ * @brief Activates or deactivates a global gesture on given window.
+ * @since_tizen 4.0
+ * @param[in] gesture_h The #efl_util_gesture_h handle
+ * @param[in] window    The efl window
+ * @param[in] type      The gesture type to activate /deactivate combined by #efl_util_gesture_type_e to bitwise operation
+ * @param[in] active    The activated boolean value
+ * @return @c 0 on success, otherwise a negative error value
+ * @retval #EFL_UTIL_ERROR_NONE Successful
+ * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Memory allocation failure
+ * @retval #EFL_UTIL_ERROR_NO_RESOURCE_AVAILABLE Resource is not available
+ */
+API int efl_util_gesture_activate_set_on_window(efl_util_gesture_h gesture_h, Evas_Object *window, unsigned int type, Eina_Bool active);
+
+/**
+ * @}
+ */
+
 #ifdef __cplusplus
 }
 #endif