Move function definition to aul header
[platform/core/appfw/aul-1.git] / include / aul_window.h
1 /*
2  * Copyright (c) 2017 - 2021 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 #pragma once
18
19 #include <stdbool.h>
20
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24
25 typedef void *aul_window_info_h;
26 typedef void *aul_window_stack_h;
27
28 /**
29  * @par Description:
30  *      This API creates the window stack handle.
31  * @par Purpose:
32  *      To get information of windows, the stack handle is needed.
33  *
34  * @param[out]  handle  Handle for the window stack
35  * @return      0 if success, negative value(<0) if fail
36  *
37  * @see
38  *      aul_window_stack_del
39  * @remark
40  *      It should be freed by aul_window_stack_del function.
41 */
42 int aul_window_stack_get(aul_window_stack_h *handle);
43
44 /**
45  * @par Description:
46  *      This API destroy the window stack handle.
47  *
48  * @param[in]   handle  Handle for the window stack
49  * @return      0 if success, negative value(<0) if fail
50  *
51  * @see
52  *      aul_window_stack_get
53 */
54 int aul_window_stack_del(aul_window_stack_h handle);
55
56 /**
57  * @par Description:
58  *      This API invokes iterator function for each window.
59  *
60  * @param[in]   handle  Handle for the window stack
61  * @param[in]   iter_cb The iteration callback
62  * @param[in]   data    The data which will be sent to the iterator
63  * @return      0 if success, negative value(<0) if fail
64  *
65 */
66 int aul_window_stack_foreach(aul_window_stack_h handle,
67                 void (*iter_cb)(aul_window_info_h info, void *data), void *data);
68
69 /**
70  * @par Description:
71  *      This API gets the global resource ID from the window handle.
72  *
73  * @param[in]   info    Handle for the window
74  * @param[out]  rid     Global resource ID
75  *
76  * @return      0 if success, negative value(<0) if fail
77  *
78 */
79 int aul_window_stack_info_get_resource_id(aul_window_info_h info, unsigned int *rid);
80
81 /**
82  * @par Description:
83  *      This API gets the process ID from the window handle.
84  *
85  * @param[in]   info    Handle for the window
86  * @param[out]  pid     Process ID
87  *
88  * @return      0 if success, negative value(<0) if fail
89  *
90 */
91 int aul_window_info_get_pid(aul_window_info_h info, int *pid);
92
93 /**
94  * @par Description:
95  *      This API gets the process ID for its parent window from the window handle.
96  *
97  * @param[in]   info    Handle for the window
98  * @param[out]  pid     Process ID
99  *
100  * @return      0 if success, negative value(<0) if fail
101  *
102  * @remark
103  *      pid will be -1 when the parent window is not exist
104  *
105 */
106 int aul_window_info_get_parent_pid(aul_window_info_h info, int *ppid);
107
108 /**
109  * @par Description:
110  *      This API gets the process ID for its ancestor window from the window handle.
111  *
112  * @param[in]   info    Handle for the window
113  * @param[out]  pid     Process ID
114  *
115  * @return      0 if success, negative value(<0) if fail
116  *
117  * @remark
118  *      pid will be -1 when the ancestor window is not exist
119  *
120 */
121 int aul_window_info_get_ancestor_pid(aul_window_info_h info, int *apid);
122
123 /**
124  * @par Description:
125  *      This API gets the window visibility from the window handle.
126  *
127  * @param[in]   info    Handle for the window
128  * @param[out]  visibility      visibility
129  *              0       Fully visible state
130  *              1       Partially visible state
131  *              2       Invisible state by other window
132  *              -1      Invisible state
133  *
134  * @return      0 if success, negative value(<0) if fail
135  *
136 */
137 int aul_window_info_get_visibility(aul_window_info_h info, int *visibility);
138
139 /**
140  * @par Description:
141  *      This API gets the flag value of supporting alpha blending.
142  *
143  * @param[in]   info    Handle for the window
144  * @param[out]  alpha   The flag value of supporting alpha blending
145  *
146  * @return      0 if success, negative value(<0) if fail
147  *
148 */
149 int aul_window_info_has_alpha(aul_window_info_h info, bool *alpha);
150
151 /**
152  * @par Description:
153  *      This API gets the flag value of the focused state.
154  *
155  * @param[in]   info    Handle for the window
156  * @param[out]  focused The flag value of the focused state
157  *
158  * @return      0 if success, negative value(<0) if fail
159  *
160 */
161 int aul_window_info_is_focused(aul_window_info_h info, bool *focused);
162
163 typedef enum _aul_window_notification_level_e {
164         AUL_WINDOW_NOTIFICATION_LEVEL_NONE = 0,
165         AUL_WINDOW_NOTIFICATION_LEVEL_DEFAULT = 10,
166         AUL_WINDOW_NOTIFICATION_LEVEL_MEDIUM = 20,
167         AUL_WINDOW_NOTIFICATION_LEVEL_HIGH = 30,
168         AUL_WINDOW_NOTIFICATION_LEVEL_TOP = 40,
169         AUL_WINDOW_NOTIFICATION_LEVEL_PRIVILEGE = 99,
170 } aul_window_notification_level_e;
171
172 /**
173  * @par Description:
174  *      This API gets the window notification level from the window handle.
175  *
176  * @param[in]   info    Handle for the window
177  * @param[out]  level   Notification level
178  * @return      0 if success, negative value(<0) if fail
179  *
180 */
181 int aul_window_info_get_notification_level(aul_window_info_h info,
182                 aul_window_notification_level_e *level);
183
184 /**
185  * @par Description:
186  *      This API gets the location and the size from window handle.
187  *
188  * @param[in]   info    Handle for the window
189  * @param[out]  x       Position x
190  * @param[out]  y       Position y
191  * @param[out]  w       Width
192  * @param[out]  h       Height
193  *
194  * @return      0 if success, negative value(<0) if fail
195  *
196 */
197 int aul_window_info_get_geometry(aul_window_info_h info, int *x, int *y, int *w, int *h);
198
199
200 /**
201  * @par Description:
202  *      This API gets pid for the focused window.
203  *
204  * @param[out]  pid     focused pid
205  *
206  * @return      0 if success, negative value(<0) if fail
207  *
208 */
209 int aul_window_get_focused_pid(pid_t *pid);
210
211 /*
212  * This API is only for Appfw internally.
213  */
214 int aul_window_attach(const char *parent_appid, const char *child_appid);
215
216 /*
217  * This API is only for Appfw internally.
218  */
219 int aul_window_detach(const char *child_appid);
220
221 /**
222  * @par Description:
223  *      This API gets the flag value of the opaque state.
224  *
225  * @param[in]   info    Handle for the window
226  * @param[out]  opaque  The flag value of the opaque state.
227  *
228  * @return      0 on success, otherwise a negative error value.
229  */
230 int aul_window_info_get_opaque(aul_window_info_h info, bool *opaque);
231
232 /**
233  * @brief Attach the window below the window of the parent application.
234  * @since_tizen 6.5
235  * @remarks This function is only available for platform level signed applications.
236  *
237  * @param[in]   parent_appid    The application ID of the parent
238  * @param[in]   child_appid     The application ID of the child
239  * @return @c 0 on success,
240  *         otherwise a negative error value
241  * @remarks This function is only for App Framework internally.
242  */
243 int aul_window_attach_below(const char *parent_appid, const char *child_appid);
244
245 /**
246  * @brief Called when the window of the application is appeared.
247  * @since_tizen 6.5
248  * @details When the window is appeared, the event_name is "Appeared".
249  *
250  * @param[in]   event_name      The event name
251  * @param[in]   appid           The application ID
252  * @param[in]   wid             The window ID
253  * @param[in]   pid             The process ID
254  * @param[in]   user_data       The user data passed from the registration function
255  * @see aul_window_register_event_cb()
256  * @see aul_window_deregister_event_cb()
257  */
258 typedef void (*aul_window_event_cb)(const char *event_name, const char *appid, int wid, int pid, void *user_data);
259
260 /**
261  * @brief Registers the window event callback function.
262  * @since_tizen 6.5
263  *
264  * @param[in]   callback        The callback function
265  * @param[in]   user_data       The user data to be passed to the callback function
266  * @return      @c 0 on success,
267  *              otherwise a negative error value
268  */
269 int aul_window_register_event_cb(aul_window_event_cb callback, void *user_data);
270
271 /**
272  * @brief Deregisters the window event callback function.
273  * @since_tizen 6.5
274  */
275 void aul_window_deregister_event_cb(void);
276
277 #ifdef __cplusplus
278 }
279 #endif