wayland/X11: conditional build for wayland and X11
[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
18 #ifndef __TIZEN_UI_EFL_UTIL_H__
19 #define __TIZEN_UI_EFL_UTIL_H__
20
21 #include <tizen.h>
22 #include <Evas.h>
23
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27
28 /**
29  * @addtogroup CAPI_EFL_UTIL_MODULE
30  * @{
31  */
32
33 // Duplicated from utilX.h, should be moved to somewhere common in the future
34
35 #ifndef KEY_VOLUMEUP
36 #define KEY_VOLUMEUP            "XF86AudioRaiseVolume"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Up' key */
37 #endif
38
39 #ifndef KEY_VOLUMEDOWN
40 #define KEY_VOLUMEDOWN          "XF86AudioLowerVolume"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Volume Down' key */
41 #endif
42
43 #ifndef KEY_CAMERA
44 #define KEY_CAMERA              "XF86WebCam"    /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Half-Press of Camera' key */
45 #endif
46
47 #ifndef KEY_CONFIG
48 #define KEY_CONFIG              "XF86Pictures"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Full-Press of Camera' key */
49 #endif
50
51 #ifndef KEY_POWER
52 #define KEY_POWER               "XF86PowerOff"  /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Power' key */
53 #endif
54
55 #ifndef KEY_PAUSE
56 #define KEY_PAUSE               "XF86Standby"   /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause' key */
57 #endif
58
59 #ifndef KEY_CANCEL
60 #define KEY_CANCEL              "Cancel"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Cancel' key */
61 #endif
62
63 // Earjack/BT Headset/Multimedia keys
64 #ifndef KEY_PLAYCD
65 #define KEY_PLAYCD              "XF86AudioPlay" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Play Audio' key */
66 #endif
67
68 #ifndef KEY_STOPCD
69 #define KEY_STOPCD              "XF86AudioStop" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Stop Audio' key */
70 #endif
71
72 #ifndef KEY_PAUSECD
73 #define KEY_PAUSECD             "XF86AudioPause"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Pause Audio' key */
74 #endif
75
76 #ifndef KEY_NEXTSONG
77 #define KEY_NEXTSONG            "XF86AudioNext" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Next Song' key */
78 #endif
79
80 #ifndef KEY_PREVIOUSSONG
81 #define KEY_PREVIOUSSONG        "XF86AudioPrev" /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Previous Song' key */
82 #endif
83
84 #ifndef KEY_REWIND
85 #define KEY_REWIND              "XF86AudioRewind"       /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Rewind Song' key */
86 #endif
87
88 #ifndef KEY_FASTFORWARD
89 #define KEY_FASTFORWARD         "XF86AudioForward"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Forward Song' key */
90 #endif
91
92 #ifndef KEY_MEDIA
93 #define KEY_MEDIA               "XF86AudioMedia"        /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Media' key */
94 #endif
95
96 // 3-Touch key
97 #ifndef KEY_SEND
98 #define KEY_SEND                "XF86Send"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
99 #endif
100
101 #ifndef KEY_SELECT
102 #define KEY_SELECT              "XF86Phone"     /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
103 #endif
104
105 #ifndef KEY_END
106 #define KEY_END                 "XF86Stop"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
107 #endif
108
109 // Renamed 3-Touch key
110 #ifndef KEY_MENU
111 #define KEY_MENU                "XF86Send"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Send' key */
112 #endif
113
114 #ifndef KEY_HOME
115 #define KEY_HOME                "XF86Phone"     /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'Home' key */
116 #endif
117
118 #ifndef KEY_BACK
119 #define KEY_BACK                "XF86Stop"      /**< this macro means the XKeySym (XServer Key Symbol) corresponds to 'End' key */
120 #endif
121
122 #ifndef OR_EXCLUSIVE_GRAB
123 #define OR_EXCLUSIVE_GRAB       0xf00000        /**< this means that the client window will always get the grabbed-key exclusively regardless of the position on the window stack but the grab is overridable by the other client window */
124 #endif
125
126 #ifndef EXCLUSIVE_GRAB
127 #define EXCLUSIVE_GRAB          0x0f0000        /**< this means that the client window will always get the grabbed-key exclusively regardless of the position on the window stack */
128 #endif
129
130 #ifndef TOP_POSITION_GRAB
131 #define TOP_POSITION_GRAB       0x00f000        /**< this means that the client window will get the grabbed-key only when on the top of the grabbing-window stack */
132 #endif
133
134 #ifndef SHARED_GRAB
135 #define SHARED_GRAB             0x000f00        /**< this means that the client window will get the grabbed-key together with the other client window(s) */
136 #endif
137
138 #ifndef GRAB_MODE_MASK
139 #define GRAB_MODE_MASK  0xffff00        /**< this mask will be used for getting the key-grab mode of a client window */
140 #endif
141
142 typedef enum _Efl_Util_Window_Type
143 {
144         EFL_UTIL_WINDOW_TYPE_NORMAL = 8, /**< ecore_x compatible, ECORE_X_WINDOW_TYPE_NORMAL */
145         EFL_UTIL_WINDOW_TYPE_NOTIFICATION = 12, /**< ecore_x compatible, ECORE_X_WINDOW_TYPE_NOTIFICATION */
146 } Efl_Util_Window_Type;
147
148 typedef enum _Efl_Util_Notification_Level
149 {
150         EFL_UTIL_NOTIFICATION_LEVEL_LOW, /**< low level notification */
151         EFL_UTIL_NOTIFICATION_LEVEL_NORMAL, /**< normal level notification*/
152         EFL_UTIL_NOTIFICATION_LEVEL_HIGH, /**< high level notification */
153         EFL_UTIL_NOTIFICATION_LEVEL_UNKNOWN
154 } Efl_Util_Notification_Level;
155
156 /**
157  * @brief Enumerations of error code for EFL UTIL
158  */
159 typedef enum
160 {
161         EFL_UTIL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
162         EFL_UTIL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
163         EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE = TIZEN_ERROR_APPLICATION_CLASS | 0x08  /**< Not supported window type */
164 } efl_util_error_e;
165
166 // TODO: are we going to have more states than on/off shouldn't we move it to a bool in the API's
167 typedef enum _Efl_Util_Opaque_State
168 {
169         EFL_UTIL_OPAQUE_STATE_OFF = 0, /**< Transparent state */
170         EFL_UTIL_OPAQUE_STATE_ON  = 1, /**< Opaque state */
171 } Efl_Util_Opaque_State;
172
173 /**                                                 
174  * @brief Enumeration of notification window's priority level
175  * 
176  */
177 typedef enum
178 {
179         EFL_UTIL_NOTIFICATION_LEVEL_1, /**< Default notification level*/
180         EFL_UTIL_NOTIFICATION_LEVEL_2, /**< Higher notification level than default*/
181 } efl_util_notification_level_e; 
182
183 typedef enum _Efl_Util_Effect_Type
184 {
185         EFL_UTIL_EFFECT_TYPE_MAP, /**< Effect for Window's Map Notify Event */
186         EFL_UTIL_EFFECT_TYPE_UNMAP, /**< Effect for Window's UnMap Notify Event */
187         EFL_UTIL_EFFECT_TYPE_RAISEABOVE, /**< Effect for Window's Configure Notify ( RaiseAbove case ) Event */
188         EFL_UTIL_EFFECT_TYPE_ROTATION, /**< Effect for Window's Rotation Property Change Notify Event ( X Property: ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE ) */
189         EFL_UTIL_EFFECT_TYPE_FOCUSIN, /**< Effect for Window's FocusIn Event ( E17's Event: E_EVENT_BORDER_FOCUS_IN ) */
190         EFL_UTIL_EFFECT_TYPE_FOCUSOUT /**< Effect for Window's FocusOut Event ( E17's Event : E_EVENT_BORDER_FOCUS_OUT ) */
191 } Efl_Util_Effect_Type;
192
193 typedef enum _Efl_Util_Effect_Style
194 {
195         EFL_UTIL_EFFECT_STYLE_DEFAULT, /**< Default Effect Style for Effect Type */
196         EFL_UTIL_EFFECT_STYLE_NONE, /**< None of Effect Style for Effect Type */
197         EFL_UTIL_EFFECT_STYLE_CUSTOM0, /**< Custom0 Effect Style for Effect Type */
198         EFL_UTIL_EFFECT_STYLE_CUSTOM1, /**< Custom1 Effect Style for Effect Type */
199         EFL_UTIL_EFFECT_STYLE_CUSTOM2, /**< Custom2 Effect Style for Effect Type */
200         EFL_UTIL_EFFECT_STYLE_CUSTOM3, /**< Custom3 Effect Style for Effect Type */
201         EFL_UTIL_EFFECT_STYLE_CUSTOM4, /**< Custom4 Effect Style for Effect Type */
202         EFL_UTIL_EFFECT_STYLE_CUSTOM5, /**< Custom5 Effect Style for Effect Type */
203         EFL_UTIL_EFFECT_STYLE_CUSTOM6, /**< Custom6 Effect Style for Effect Type */
204         EFL_UTIL_EFFECT_STYLE_CUSTOM7, /**< Custom7 Effect Style for Effect Type */
205         EFL_UTIL_EFFECT_STYLE_CUSTOM8, /**< Custom8 Effect Style for Effect Type */
206         EFL_UTIL_EFFECT_STYLE_CUSTOM9 /**< Custom9 Effect Style for Effect Type */
207 } Efl_Util_Effect_Style;
208
209 /**
210  * @brief Sets the priority level for the specified notification window, asynchronously.
211  *
212  * @remark This API can be used for notification type window only
213  * @param [in] window EFL window 
214  * @param [in] level The notification window level
215  * @return 0 on success, otherwise a negative error value.
216  * @retval #EFL_UTIL_ERROR_NONE Successful
217  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
218  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Not supported window type
219  */
220 int efl_util_set_notification_window_level (Evas_Object *window, efl_util_notification_level_e level);
221
222
223 /**
224  * @brief Gets the priority level for the specified notification window, asynchronously.
225  *
226  * @remark This API can be used for notification type window only
227  * @param [in] window EFL window 
228  * @param [out] level The notification window level
229  * @return 0 on success, otherwise a negative error value.
230  * @retval #EFL_UTIL_ERROR_NONE Successful
231  * @retval #EFL_UTIL_ERROR_INVALID_PARAMETER Invalid parameter
232  * @retval #EFL_UTIL_ERROR_NOT_SUPPORTED_WINDOW_TYPE Not supported window type
233  */
234 int efl_util_get_notification_window_level (Evas_Object *window, efl_util_notification_level_e* level);
235
236 /** 
237  * @brief Grabs a key specfied by key_name for obj in grab_mode.
238  *
239  * @param obj The Evas_Object representing the window to set the key grab to.
240  * @param key The key of interest.
241  * @param grab_mode EXCLUSIVE_GRAB, TOP_POSITION_GRAB, SHARED_GRAB, EXCLUSIVE_GRAB
242  *
243  * @return 0 on Success, fail othrewise.
244  * @see efl_util_ungrab_key()
245  */
246 int efl_util_grab_key (Evas_Object *obj, const char* key, int grab_mode);
247
248 /** 
249  * @brief Ungrabs a key specfied by key_name for win
250  *
251  * @param obj The Evas_Object representing the window to ungrab the key.
252  * @param key The key of interest.
253  *
254  * @return 0 on Success, fail otherwise.
255  * @see efl_util_grab_key()
256  */
257 int efl_util_ungrab_key (Evas_Object *obj, const char* key);
258
259 /** 
260  * @brief Sets the priority level for the specified notification window
261  *
262  * @param obj The Evas_Object representing the window to set the notification level.
263  * @param level The notification level.
264  *
265  * @see Efl_Util_Notification_Level
266  */
267 void efl_util_set_system_notification_level (Evas_Object *obj, Efl_Util_Notification_Level level);
268
269 /** 
270  * @brief Gets the priority level for the specified notification window.
271  *
272  * @param obj The Evas_Object representing the window to get the system notification level
273  * set to.
274  *
275  * @return current notication level (EFL_UTIL_NOTIFICATION_LEVEL_LOW,
276  *         EFL_UTIL_NOTIFICATION_LEVEL_NORMAL, EFL_UTIL_NOTIFICATION_LEVEL_HIGH)
277  */
278 Efl_Util_Notification_Level efl_util_get_system_notification_level (Evas_Object *obj);
279
280 /** 
281  * @brief Set the functional type of window by sending _NET_WM_WINDOW_TYPE property to window.
282  *
283  * @param obj The Evas_Object representing the window to set the net_wm to.
284  * @param type The type to be set.
285  */
286 void efl_util_netwm_window_type_set(Evas_Object *obj, Efl_Util_Window_Type type);
287
288 /** 
289  * @brief Sets a window's effect style with effect type.
290  *
291  * @param win The window to set the style to.
292  * @param type type Specifies the window's effect type ( ex. EFL_UTIL_EFFECT_TYPE_MAP, EFL_UTIL_EFFECT_TYPE_UNMAP, etc )
293  * @param style Specifies  the window's effect style ( ex. EFL_UTIL_EFFECT_STYLE_DEFAULT, EFL_UTIL_EFFECT_STYLE_NONE, EFL_UTIL_EFFECT_STYLE_CUSTOM0, etc )
294  */
295 void efl_util_set_window_effect_style(Evas_Object *win, Efl_Util_Effect_Type type, Efl_Util_Effect_Style style);
296
297 /**
298  * @brief Sets the window's opaque state
299  *
300  * @param win The window to set the opaque state to.
301  * @param state The state (EFL_UTIL_OPAQUE_STATE_ON, EFL_UTIL_OPAQUE_STATE_OFF).
302  *
303  * @return 0 on failure
304  */
305 int efl_util_set_window_opaque_state (Evas_Object *win, Efl_Util_Opaque_State state);
306
307 /**
308  * @}
309  */
310
311 #ifdef __cplusplus
312 }
313 #endif
314 #endif                          /* __TIZEN_UI_EFL_UTIL_H__ */