4934ffa82a950bd456e36dacc9a9d0c6b4f75271
[platform/core/api/efl-util.git] / include / efl_util.h
1 /*
2  * Copyright (c) 2011 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
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file efl_util.h
29  */
30
31 /**
32  * @addtogroup CAPI_EFL_UTIL_MODULE
33  * @{
34  */
35
36 /**
37  * @brief Enumeration for EFL UTIL ERROR.
38  * @since_tizen 2.3
39  */
40 typedef enum
41 {
42    EFL_UTIL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
43    EFL_UTIL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
44    EFL_UTIL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
45    EFL_UTIL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permisson denied */
46    EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE = TIZEN_ERROR_EFL_UTIL | 0x01 /**< Window type not supported */
47 } efl_util_error_e;
48
49 /**
50  * @brief Enumeration of notification window's priority level.
51  * @since_tizen 2.3
52  */
53 typedef enum
54 {
55    EFL_UTIL_NOTIFICATION_LEVEL_1, /**< Default notification level. (Deprecated since 2.4. Use EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT instead.) */
56    EFL_UTIL_NOTIFICATION_LEVEL_2, /**< Higher notification level than default. (Deprecated since 2.4. Use EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM instead.) */
57    EFL_UTIL_NOTIFICATION_LEVEL_3, /**< The highest notification level. (Deprecated since 2.4. Use EFL_UTIL_NOTIFICATION_LEVEL_TOP instead.) */
58    EFL_UTIL_NOTIFICATION_LEVEL_NONE    = -1, /**< No (reset) notification level. This value makes the window place in normal layer. (@b Since: 2.4) */
59    EFL_UTIL_NOTIFICATION_LEVEL_DEFAULT = 10, /**< Default notification level. (@b Since: 2.4) */
60    EFL_UTIL_NOTIFICATION_LEVEL_MEDIUM  = 20, /**< Higher notification level than default. (@b Since: 2.4) */
61    EFL_UTIL_NOTIFICATION_LEVEL_HIGH    = 30, /**< Higher notification level than medium. (@b Since: 2.4) */
62    EFL_UTIL_NOTIFICATION_LEVEL_TOP     = 40  /**< The highest notification level. (@b Since: 2.4) */
63 } efl_util_notification_level_e; 
64
65 /**
66  * @brief Sets the priority level for the specified notification window, asynchronously.
67  * @since_tizen 2.3
68  * @privlevel public
69  * @privilege %http://tizen.org/privilege/window.priority.set
70  * @remarks This API can be used for a notification type window only.
71  * @param[in] window The EFL window
72  * @param[in] level The notification window level
73  * @return @c 0 on success, otherwise a negative error value
74  * @retval #EFL_UTIL_ERROR_NONE Successful
75  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
76  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Window type not supported
77  */
78 int efl_util_set_notification_window_level(Evas_Object *window, efl_util_notification_level_e level);
79
80
81 /**
82  * @brief Gets the priority level for the specified notification window, asynchronously.
83  * @since_tizen 2.3
84  *
85  * @remarks This API can be used for a notification type window only.
86  * @param[in] window The EFL window
87  * @param[out] level The notification window level
88  * @return @c 0 on success, otherwise a negative error value
89  * @retval #EFL_UTIL_ERROR_NONE Successful
90  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
91  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Window type not supported
92  */
93 int efl_util_get_notification_window_level(Evas_Object *window, efl_util_notification_level_e *level);
94
95 /**
96  * @brief Called when an error occurs for setting notification window level
97  * @since_tizen 2.3
98  * @param[in] window     The EFL window
99  * @param[in] error_code The error code (#EFL_UTIL_ERROR_PERMISSION_DENIED)
100  * @param[in] user_data  The user data passed from the callback registration function
101  * @see efl_util_set_notification_window_level_error_cb()
102  * @see efl_util_unset_notification_window_level_error_cb()
103  */
104 typedef void (*efl_util_notification_window_level_error_cb)(Evas_Object *window, int error_code, void *user_data);
105
106 /**
107  * @brief Registers a callback function to be invoked when an error which set the notification level occurs.
108  * @since_tizen 2.3
109  * @param[in] window    The EFL window
110  * @param[in] callback  The callback function to register
111  * @param[in] user_data The user data to be passed to the callback function
112  * @return @c 0 on success, otherwise a negative error value
113  * @retval #EFL_UTIL_ERROR_NONE Successful
114  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
115  * @retval #EFL_UTIL_ERROR_OUT_OF_MEMORY Out of memory
116  * @post efl_util_notification_window_level_error_cb() will be invoked.
117  * @see efl_util_unset_notification_window_level_error_cb()
118  * @see efl_util_notification_window_level_error_cb()
119  */
120 int efl_util_set_notification_window_level_error_cb(Evas_Object *window, efl_util_notification_window_level_error_cb callback, void *user_data);
121
122 /**
123  * @brief Unregisters the callback function.
124  * @since_tizen 2.3
125  * @param[in] window The EFL window
126  * @return @c 0 on success, otherwise a negative error value
127  * @retval #EFL_UTIL_ERROR_NONE Successful
128  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
129  * @see efl_util_set_notification_window_level_error_cb()
130  */
131 int efl_util_unset_notification_window_level_error_cb(Evas_Object *window);
132
133 /**
134  * @}
135  */
136
137 #ifdef __cplusplus
138 }
139 #endif
140 #endif /* __TIZEN_UI_EFL_UTIL_H__ */