tizen 2.4 release
[apps/widget/widget-viewer.git] / widget_viewer / include / widget_viewer.h
1 /*
2  * Copyright 2013  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 #include <widget_service.h>
18 #include <widget_service_internal.h>
19
20 #ifndef __WIDGET_VIEWER_H
21 #define __WIDGET_VIEWER_H
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file widget_viewer.h
29  * @brief This file declares API of libwidget-viewer library
30  * @since_tizen 2.3.1
31  */
32
33 /**
34  * @addtogroup CAPI_WIDGET_VIEWER_MODULE
35  * @{
36  */
37
38 /**
39  * @brief Structure definition for a widget instance.
40  * @since_tizen 2.3.1
41  */
42 typedef struct widget *widget_h;
43
44 /**
45  * @internal
46  * @brief Definition for a default update period for widget (defined in the package manifest file).
47  * @since_tizen 2.3.1
48  */
49 #define WIDGET_DEFAULT_PERIOD -1.0f
50
51 #define WIDGET_VIEWER_CLICK_BUTTON_LEFT    "clicked"
52 #define WIDGET_VIEWER_CLICK_BUTTON_RIGHT   "clicked,1"
53 #define WIDGET_VIEWER_CLICK_BUTTON_CENTER  "clicked,2"
54
55 /**
56  * @internal
57  * @brief Enumeration for Mouse & Key event for buffer type widget or Glance Bar.
58  * @details Viewer should send these events to widget.
59  * @since_tizen 2.3.1
60  */
61 typedef enum widget_mouse_event_type {
62     WIDGET_MOUSE_EVENT_MASK       = 0x20000000, /**< Mask value for mouse event */
63     WIDGET_MOUSE_EVENT_GBAR_MASK  = 0x10000000, /**< Mask value for Glance Bar event */
64     WIDGET_MOUSE_EVENT_WIDGET_MASK  = 0x40000000, /**< Mask value for widget event */
65
66     WIDGET_MOUSE_EVENT_DOWN       = 0x00000001, /**< widget mouse down event for widget */
67     WIDGET_MOUSE_EVENT_UP         = 0x00000002, /**< widget mouse up event for widget */
68     WIDGET_MOUSE_EVENT_MOVE       = 0x00000004, /**< widget mouse move event for widget */
69     WIDGET_MOUSE_EVENT_ENTER      = 0x00000008, /**< widget mouse enter event for widget */
70     WIDGET_MOUSE_EVENT_LEAVE      = 0x00000010, /**< widget mouse leave event for widget */
71     WIDGET_MOUSE_EVENT_SET        = 0x00000020, /**< widget mouse set auto event for widget */
72     WIDGET_MOUSE_EVENT_UNSET      = 0x00000040, /**< widget mouse unset auto event for widget */
73
74     WIDGET_MOUSE_EVENT_ON_SCROLL  = 0x00000080, /**< widget On scrolling */
75     WIDGET_MOUSE_EVENT_ON_HOLD    = 0x00000100, /**< widget On holding */
76     WIDGET_MOUSE_EVENT_OFF_SCROLL = 0x00000200, /**< widget Stop scrolling */
77     WIDGET_MOUSE_EVENT_OFF_HOLD   = 0x00000400, /**< widget Stop holding */
78
79     WIDGET_MOUSE_ON_SCROLL        = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_ON_SCROLL, /**< Mouse event occurs while scrolling */
80     WIDGET_MOUSE_ON_HOLD          = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_ON_HOLD, /**< Mouse event occurs on holding */
81     WIDGET_MOUSE_OFF_SCROLL       = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_OFF_SCROLL, /**< Scrolling stopped */
82     WIDGET_MOUSE_OFF_HOLD         = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_OFF_HOLD, /**< Holding stopped */
83
84     WIDGET_MOUSE_DOWN             = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_DOWN, /**< Mouse down on the widget */
85     WIDGET_MOUSE_UP               = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_UP, /**< Mouse up on the widget */
86     WIDGET_MOUSE_MOVE             = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_MOVE, /**< Move move on the widget */
87     WIDGET_MOUSE_ENTER            = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_ENTER, /**< Mouse enter to the widget */
88     WIDGET_MOUSE_LEAVE            = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_LEAVE, /**< Mouse leave from the widget */
89     WIDGET_MOUSE_SET              = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_SET, /**< Mouse event, start feeding event by master */
90     WIDGET_MOUSE_UNSET            = WIDGET_MOUSE_EVENT_WIDGET_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_UNSET, /**< Mouse event, stop feeding event by master */
91
92     WIDGET_GBAR_MOUSE_ON_SCROLL   = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_ON_SCROLL, /**< Mouse event occurs while scrolling */
93     WIDGET_GBAR_MOUSE_ON_HOLD     = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_ON_HOLD, /**< Mouse event occurs on holding */
94     WIDGET_GBAR_MOUSE_OFF_SCROLL  = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_OFF_SCROLL, /**< Scrolling stopped */
95     WIDGET_GBAR_MOUSE_OFF_HOLD    = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_OFF_HOLD, /**< Holding stopped */
96
97     WIDGET_GBAR_MOUSE_DOWN        = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_DOWN, /**< Mouse down on the Glance Bar */
98     WIDGET_GBAR_MOUSE_UP          = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_UP, /**< Mouse up on the Glance Bar */
99     WIDGET_GBAR_MOUSE_MOVE        = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_MOVE, /**< Mouse move on the Glance Bar */
100     WIDGET_GBAR_MOUSE_ENTER       = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_ENTER, /**< Mouse enter to the Glance Bar */
101     WIDGET_GBAR_MOUSE_LEAVE       = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_LEAVE, /**< Mouse leave from the Glance Bar */
102     WIDGET_GBAR_MOUSE_SET         = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_SET, /**< Mouse event, start feeding event by master */
103     WIDGET_GBAR_MOUSE_UNSET       = WIDGET_MOUSE_EVENT_GBAR_MASK | WIDGET_MOUSE_EVENT_MASK | WIDGET_MOUSE_EVENT_UNSET, /**< Mouse event, stop feeding event by master */
104
105     WIDGET_MOUSE_EVENT_MAX        = 0xFFFFFFFF /**< Unknown event */
106 } widget_mouse_event_type_e;
107
108 typedef enum widget_key_event_type {
109     WIDGET_KEY_EVENT_MASK         = 0x80000000, /**< Mask value for key event */
110     WIDGET_KEY_EVENT_GBAR_MASK    = 0x10000000, /**< Mask value for Glance Bar event */
111     WIDGET_KEY_EVENT_WIDGET_MASK    = 0x40000000, /**< Mask value for widget event */
112
113     WIDGET_KEY_EVENT_DOWN         = 0x00000001, /**< widget key press */
114     WIDGET_KEY_EVENT_UP           = 0x00000002, /**< widget key release */
115     WIDGET_KEY_EVENT_FOCUS_IN     = 0x00000008, /**< widget key focused in */
116     WIDGET_KEY_EVENT_FOCUS_OUT    = 0x00000010, /**< widget key focused out */
117     WIDGET_KEY_EVENT_SET          = 0x00000020, /**< widget Key, start feeding event by master */
118     WIDGET_KEY_EVENT_UNSET        = 0x00000040, /**< widget key, stop feeding event by master */
119
120     WIDGET_KEY_DOWN               = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_WIDGET_MASK | WIDGET_KEY_EVENT_DOWN, /**< Key down on the widget */
121     WIDGET_KEY_UP                 = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_WIDGET_MASK | WIDGET_KEY_EVENT_UP, /**< Key up on the widget */
122     WIDGET_KEY_SET                = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_WIDGET_MASK | WIDGET_KEY_EVENT_SET, /**< Key event, start feeding event by master */
123     WIDGET_KEY_UNSET              = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_WIDGET_MASK | WIDGET_KEY_EVENT_UNSET, /**< Key event, stop feeding event by master */
124     WIDGET_KEY_FOCUS_IN           = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_WIDGET_MASK | WIDGET_KEY_EVENT_FOCUS_IN, /**< Key event, focus in */
125     WIDGET_KEY_FOCUS_OUT          = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_WIDGET_MASK | WIDGET_KEY_EVENT_FOCUS_OUT, /**< Key event, foucs out */
126                                                                
127     WIDGET_GBAR_KEY_DOWN          = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_GBAR_MASK | WIDGET_KEY_EVENT_DOWN, /**< Key down on the widget */
128     WIDGET_GBAR_KEY_UP            = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_GBAR_MASK | WIDGET_KEY_EVENT_UP, /**< Key up on the widget */
129     WIDGET_GBAR_KEY_SET           = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_GBAR_MASK | WIDGET_KEY_EVENT_SET, /**< Key event, start feeding event by master */
130     WIDGET_GBAR_KEY_UNSET         = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_GBAR_MASK | WIDGET_KEY_EVENT_UNSET, /**< Key event, stop feeding event by master */
131     WIDGET_GBAR_KEY_FOCUS_IN      = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_GBAR_MASK | WIDGET_KEY_EVENT_FOCUS_IN, /**< Key event, focus in */
132     WIDGET_GBAR_KEY_FOCUS_OUT     = WIDGET_KEY_EVENT_MASK | WIDGET_KEY_EVENT_GBAR_MASK | WIDGET_KEY_EVENT_FOCUS_OUT, /**< Key event, focus out */
133
134     WIDGET_KEY_EVENT_MAX          = 0xFFFFFFFF /**< Unknown event */
135 } widget_key_event_type_e;
136
137 /**
138  * @internal
139  * @brief Enumeration for Accessibility event for buffer type widget or Glance Bar.
140  * @details These events are sync'd with Tizen accessibility event set.
141  * @since_tizen 2.3.1
142  */
143 typedef enum widget_access_event_type {
144     WIDGET_ACCESS_EVENT_GBAR_MASK    = 0x10000000, /**< Glance Bar Accessibilivent mask */
145     WIDGET_ACCESS_EVENT_WIDGET_MASK    = 0x20000000, /**< widget Accessibility event mask */
146
147     WIDGET_ACCESS_EVENT_HIGHLIGHT    = 0x00000100, /**< widget accessibility: Hightlight a object, Next, Prev,Unhighlight */
148     WIDGET_ACCESS_EVENT_ACTIVATE     = 0x00000200, /**< widget accessibility activate */
149     WIDGET_ACCESS_EVENT_ACTION       = 0x00000400, /**< widget accessibility value changed, Up, Down */
150     WIDGET_ACCESS_EVENT_SCROLL       = 0x00000800, /**< widget accessibility scroll down, move, up */
151     WIDGET_ACCESS_EVENT_VALUE_CHANGE = 0x00001000, /**< LB accessibility value change */
152     WIDGET_ACCESS_EVENT_MOUSE        = 0x00002000, /**< Give mouse event to highlight object, down, move, up */
153     WIDGET_ACCESS_EVENT_BACK         = 0x00004000, /**< Go back to a previous view ex: pop naviframe item */
154     WIDGET_ACCESS_EVENT_OVER         = 0x00008000, /**< Mouse over an object */
155     WIDGET_ACCESS_EVENT_READ         = 0x00010000, /**< Highlight an object */
156     WIDGET_ACCESS_EVENT_ENABLE       = 0x00020000, /**< Disable highlight and read ability, disable, enable */
157
158     WIDGET_ACCESS_HIGHLIGHT          = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_HIGHLIGHT, /**< Access event - Highlight an object in the widget */
159     WIDGET_ACCESS_ACTIVATE           = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_ACTIVATE,  /**< Access event - Launch or activate the highlighted object */
160     WIDGET_ACCESS_ACTION             = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_ACTION,    /**< Access event - down */
161     WIDGET_ACCESS_SCROLL             = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_SCROLL,    /**< Access event - scroll down */
162     WIDGET_ACCESS_VALUE_CHANGE       = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_VALUE_CHANGE, /**< LB accessibility value change */
163     WIDGET_ACCESS_MOUSE              = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_MOUSE,  /**< Give mouse event to highlight object */
164     WIDGET_ACCESS_BACK               = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_BACK,   /**< Go back to a previous view ex: pop naviframe item */
165     WIDGET_ACCESS_OVER               = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_OVER,   /**< Mouse over an object */
166     WIDGET_ACCESS_READ               = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_READ,   /**< Highlight an object */
167     WIDGET_ACCESS_ENABLE             = WIDGET_ACCESS_EVENT_WIDGET_MASK | WIDGET_ACCESS_EVENT_ENABLE, /**< Enable highlight and read ability */
168
169     WIDGET_GBAR_ACCESS_HIGHLIGHT     = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_HIGHLIGHT, /**< Access event - Highlight an object in the Glance Bar */
170     WIDGET_GBAR_ACCESS_ACTIVATE      = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_ACTIVATE,  /**< Access event - Launch or activate the highlighted object */
171     WIDGET_GBAR_ACCESS_ACTION        = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_ACTION,    /**< Access event - down */
172     WIDGET_GBAR_ACCESS_SCROLL        = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_SCROLL,    /**< Access event - scroll down */
173     WIDGET_GBAR_ACCESS_VALUE_CHANGE  = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_VALUE_CHANGE, /**< LB accessibility value change */
174     WIDGET_GBAR_ACCESS_MOUSE         = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_MOUSE, /**< Give mouse event to highlight object */
175     WIDGET_GBAR_ACCESS_BACK          = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_BACK, /**< Go back to a previous view ex: pop naviframe item */
176     WIDGET_GBAR_ACCESS_OVER          = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_OVER, /**< Mouse over an object */
177     WIDGET_GBAR_ACCESS_READ          = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_READ, /**< Highlight an object */
178     WIDGET_GBAR_ACCESS_ENABLE        = WIDGET_ACCESS_EVENT_GBAR_MASK | WIDGET_ACCESS_EVENT_ENABLE, /**< Enable highlight and read ability */
179     WIDGET_GBAR_ACCESS_EVENT_MAX     = 0xFFFFFFFF
180 } widget_access_event_type_e;
181
182 /**
183  * @internal
184  * @brief Enumeration for widget content type.
185  * @since_tizen 2.3.1
186  */
187 typedef enum widget_type {
188     WIDGET_CONTENT_TYPE_IMAGE       = 0x01,       /**< Contents of a widget is based on the image file */
189     WIDGET_CONTENT_TYPE_BUFFER      = 0x02,       /**< Contents of a widget is based on canvas buffer(shared) */
190     WIDGET_CONTENT_TYPE_TEXT        = 0x04,       /**< Contents of a widget is based on formatted text file */
191     WIDGET_CONTENT_TYPE_RESOURCE_ID = 0x08,       /**< Contens of a widget is shared by the resource id(depends on window system) */
192     WIDGET_CONTENT_TYPE_UIFW        = 0x10,       /**< Using UI F/W resource for sharing content & event */
193     WIDGET_CONTENT_TYPE_INVALID     = 0xFF        /**< Unknown widget type */
194 } widget_type_e;
195
196 /**
197  * @brief Enumeration for widget option types.
198  * @since_tizen 2.3.1
199  */
200 typedef enum widget_option_type {
201     WIDGET_OPTION_MANUAL_SYNC,           /**< Sync frame manually */
202     WIDGET_OPTION_FRAME_DROP_FOR_RESIZE, /**< Drop frames while resizing */
203     WIDGET_OPTION_SHARED_CONTENT,        /**< Use only one real instance for multiple fake instances if user creates widget for same content */
204     WIDGET_OPTION_DIRECT_UPDATE,         /**< Use the private socket for receiving updated event */
205     WIDGET_OPTION_EXTRA_BUFFER_CNT,      /**< Extra buffer count, ReadOnly value */    
206
207     WIDGET_OPTION_ERROR = 0xFFFFFFFF     /**< To specify the size of this enumeration type */
208 } widget_option_type_e;
209
210 /**
211  * @internal
212  * @brief Reason of faults
213  * @since_tizen 2.3.1
214  */
215 typedef enum widget_fault_type {
216     WIDGET_FAULT_DEACTIVATED,                     /**< widget is deactivated by its fault operation */
217     WIDGET_FAULT_PROVIDER_DISCONNECTED,           /**< Provider is disconnected */
218     WIDGET_FAULT_MAX = 0xFF                       /**< To specify the size of this enumeration type, some compiler enjoy of this kind of notation */
219 } widget_fault_type_e;
220
221 /**
222  * @brief Enumeration for widget visible states.
223  * @details Must be sync'd with a provider.
224  * @since_tizen 2.3.1
225  */
226 typedef enum widget_visible_state {
227     WIDGET_SHOW            = 0x00,                /**< widget is shown. Default state */
228     WIDGET_HIDE            = 0x01,                /**< widget is hidden, Update timer will not be freezed. but you cannot receive any updates events. */
229
230     WIDGET_HIDE_WITH_PAUSE = 0x02,                /**< widget is hidden, it will pause the update timer, but if a widget updates its contents, update event will be triggered */
231
232     WIDGET_VISIBLE_ERROR   = 0xFF                 /**< To specify the size of this enumeration type */
233 } widget_visible_state_e;
234
235 /**
236  * @internal
237  * @brief Accessibility Event type
238  * @since_tizen 2.3.1
239  * @see widget_feed_access_event()
240  */
241 typedef enum widget_access_info_type {
242     WIDGET_ACCESS_TYPE_NONE = 0x00,           /**< Initialized */
243
244     WIDGET_ACCESS_TYPE_DOWN = 0x00,           /**< Mouse down */
245     WIDGET_ACCESS_TYPE_MOVE = 0x01,           /**< Mouse move */
246     WIDGET_ACCESS_TYPE_UP   = 0x02,           /**< Mouse up */
247
248     WIDGET_ACCESS_TYPE_HIGHLIGHT      = 0x00, /**< Highlight */
249     WIDGET_ACCESS_TYPE_HIGHLIGHT_NEXT = 0x01, /**< Highlight next */
250     WIDGET_ACCESS_TYPE_HIGHLIGHT_PREV = 0x02, /**< Highlight prev */
251     WIDGET_ACCESS_TYPE_UNHIGHLIGHT    = 0x03, /**< Unhighlight */
252
253     WIDGET_ACCESS_TYPE_DISABLE = 0x00,        /**< Disable */
254     WIDGET_ACCESS_TYPE_ENABLE  = 0x01         /**< Enable */
255 } widget_access_info_type_e;
256
257 /**
258  * @internal
259  * @brief Accessibility Event Information
260  * @since_tizen 2.3.1
261  */
262 typedef struct widget_access_event_info {
263     double x;                                   /**< X Coordinates that the event occurred */
264     double y;                                   /**< Y Coordinates that the event occurred */
265     widget_access_info_type_e type;         /**< Accessibility event type */
266     int info;                                   /**< Extra information for this event */
267 } *widget_access_event_info_s;
268
269 /**
270  * @internal
271  * @brief Damaged Region representation
272  * @since_tizen 2.3.1
273  */
274 typedef struct widget_damage_region {
275     int x;                                  /**< Coordinates X of Left-Top corner */
276     int y;                                  /**< Coordinates Y of Left-Top corner */
277     int w;                                  /**< Damage'd Width */
278     int h;                                  /**< Damage'd Height */
279 } widget_damage_region_s;
280
281 /**
282  * @internal
283  * @brief Mouse Event Information
284  * @since_tizen 2.3.1
285  */
286 typedef struct widget_mouse_event_info {
287         double x;                                   /**< X coordinates of Mouse Event */
288         double y;                                   /**< Y coordinates of Mouse Event */
289         double ratio_w;
290         double ratio_h;
291         int device;
292 } *widget_mouse_event_info_s;
293
294 /**
295  * @internal
296  * @brief Key Event Information
297  * @since_tizen 2.3.1
298  */
299 typedef struct widget_key_event_info {
300     unsigned int keycode;                       /**< Key code */
301         int device;
302 } *widget_key_event_info_s;
303
304 /**
305  * @internal
306  * @brief Structure for TEXT type widget contents handling opertators.
307  * @since_tizen 2.3.1
308  */
309 typedef struct widget_script_operators {
310     int (*update_begin)(widget_h handle); /**< Content parser is started */
311     int (*update_end)(widget_h handle); /**< Content parser is finished */
312
313     /* Listed functions will be called when parser meets each typed content */
314     int (*update_text)(widget_h handle, const char *id, const char *part, const char *data); /**< Update text content */
315     int (*update_image)(widget_h handle, const char *id, const char *part, const char *data, const char *option); /**< Update image content */
316     int (*update_script)(widget_h handle, const char *id, const char *new_id, const char *part, const char *file, const char *group); /**< Update script content */
317     int (*update_signal)(widget_h handle, const char *id, const char *signal_name, const char *signal); /**< Update signal */
318     int (*update_drag)(widget_h handle, const char *id, const char *part, double dx, double dy); /**< Update drag info */
319     int (*update_info_size)(widget_h handle, const char *id, int w, int h); /**< Update content size */
320     int (*update_info_category)(widget_h handle, const char *id, const char *category); /**< Update content category info */
321     int (*update_access)(widget_h handle, const char *id, const char *part, const char *text, const char *option); /**< Update access information */
322     int (*operate_access)(widget_h handle, const char *id, const char *part, const char *operation, const char *option); /**< Update access operation */
323     int (*update_color)(widget_h handle, const char *id, const char *part, const char *data); /**< Update color */
324 } *widget_script_operator_s;
325
326 /**
327  * @internal
328  * @brief Called for every async function.
329  * @details Prototype of the return callback of every async functions.
330  * @since_tizen 2.3.1
331  * @param[in] handle Handle of the widget instance
332  * @param[in] ret Result status of operation (WIDGET_STATUS_XXX defined from libwidget-service)
333  * @param[in] data Data for result callback
334  * @see widget_add()
335  * @see widget_del()
336  * @see widget_activate()
337  * @see widget_resize()
338  * @see widget_set_group()
339  * @see widget_set_period()
340  * @see widget_access_event()
341  * @see widget_set_pinup()
342  * @see widget_create_glance_bar()
343  * @see widget_destroy_glance_bar()
344  * @see widget_emit_text_signal()
345  * @see widget_acquire_resource_id()
346  * @see widget_set_update_mode()
347  */
348 typedef void (*widget_ret_cb)(widget_h handle, int ret, void *data);
349
350 /**
351  * @internal
352  * @brief Fault event handle
353  * @param[in] type Type of fault event.
354  * @param[in] widget_id Faulted widget Id
355  * @param[in] file faulted filename (implementation file if it is supported)
356  * @param[in] func faulted function name (if it is supported)
357  * @param[in] data Callback data
358  * @return 0 on success, otherwise a negative error value
359  * @retval @c EXIT_FAILURE delete this event callback from the event callback list
360  * @retval @c EXIT_SUCCESS successfully handled, keep this callback in the event callback list
361  */
362 typedef int (*widget_fault_handler_cb)(enum widget_fault_type type, const char *widget_id, const char *file, const char *func, void *data);
363
364 /**
365  * @brief Event handle
366  * @since_tizen 2.3.1
367  * @param[in] handle widget Event handle
368  * @param[in] event Event type for widget
369  * @param[in] data Callback Data
370  * @return 0 on success, otherwise a negative error value
371  * @return @c EXIT_FAILURE delete this event callback from the event callback list
372  * @return @c EXIT_SUCCESS successfully handled, keep this callback in the event callback list
373  */
374 typedef int (*widget_event_handler_cb)(widget_h handle, widget_event_type_e event, void *data);
375
376 /**
377  * @brief Auto launch handle
378  * @since_tizen 2.3.1
379  * @param[in] handle widget Handle
380  * @param[in] appid UI Application Id, which should be launched
381  * @param[in] data callback data
382  */
383 typedef int (*widget_auto_launch_handler_cb)(widget_h handle, const char *appid, void *data);
384
385 /**
386  * @internal
387  * @brief Initializes the widget system with some options.
388  * @details widget_init function uses environment value to initiate some configurable values.
389  *          But some applications do not want to use the env value.
390  *          For them, this API will give a chance to set default options using given arguments.
391  *          @a disp is a Display object which is used to hold a connection with a display server (eg, Xorg)
392  * @since_tizen 2.3.1
393  * @param[in] disp Display, If @a disp is @c NULL, the library will try to acquire a new connection to display server
394  * @param[in] prevent_overwrite Overwrite flag (when the content of an image type widget is updated, it will be overwriten (0) or not (1))
395  * @param[in] event_filter If the widget_feed_mouse_event() is called again in this secs, it will be ignored and the widget_feed_mouse_event() will returns WIDGET_STATUS_ERROR_BUSY status code
396  * @param[in] use_thread If this value has true, the viewer library will create a new thread to communicate with master service
397  * @privlevel platform
398  * @privilege %http://tizen.org/privilege/widget.viewer
399  * @return #WIDGET_STATUS_ERROR_NONE on success,
400  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
401  * @retval #WIDGET_STATUS_ERROR_OUT_OF_MEMORY If a memory is not enough to do this operation.
402  * @retval #WIDGET_STATUS_ERROR_IO_ERROR If fails to access widget database.
403  * @see widget_fini()
404  * @see widget_feed_mouse_event()
405  */
406 extern int widget_viewer_init(void *disp, int prevent_overwrite, double event_filter, int use_thread);
407
408 /**
409  * @internal
410  * @brief Finalizes the widget system.
411  * @since_tizen 2.3.1
412  * @privlevel platform
413  * @privilege %http://tizen.org/privilege/widget.viewer
414  * @return 0 on success, otherwise a negative error value
415  * @retval #WIDGET_STATUS_SUCCES if success
416  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER if widget_init is not called
417  * @see widget_init()
418  */
419 extern int widget_viewer_fini(void);
420
421 /**
422  * @brief Notifies the status of a client ("it is paused") to the provider.
423  * @since_tizen 2.3.1
424  * @privlevel public
425  * @privilege %http://tizen.org/privilege/widget.viewer
426  * @return #WIDGET_STATUS_ERROR_NONE on success,
427  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
428  * @retval #WIDGET_STATUS_ERROR_FAULT if it failed to send state (paused) info
429  * @see widget_client_set_resumed()
430  */
431 extern int widget_viewer_notify_paused_status_of_viewer(void);
432
433 /**
434  * @brief Notifies the status of client ("it is resumed") to the provider.
435  * @since_tizen 2.3.1
436  * @privlevel public
437  * @privilege %http://tizen.org/privilege/widget.viewer
438  * @return #WIDGET_STATUS_ERROR_NONE on success,
439  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
440  * @retval #WIDGET_STATUS_ERROR_FAULT if it failed to send state (resumed) info
441  * @see widget_client_set_paused()
442  */
443 extern int widget_viewer_notify_resumed_status_of_viewer(void);
444
445 /**
446  * @internal
447  * @brief Adds a new widget.
448  * @details If the screen size is "1280x720", the below size lists are used for default.
449  * Or you can find the default sizes in pixel from /usr/share/data-provider-master/resolution.ini.
450  * Size types are defined from the libwidget-service package (widget-service.h).
451  *
452  * Normal mode widget
453  * 1x1=175x175, #WIDGET_SIZE_TYPE_1x1
454  * 2x1=354x175, #WIDGET_SIZE_TYPE_2x1
455  * 2x2=354x354, #WIDGET_SIZE_TYPE_2x2
456  * 4x1=712x175, #WIDGET_SIZE_TYPE_4x1
457  * 4x2=712x354, #WIDGET_SIZE_TYPE_4x2
458  * 4x4=712x712, #WIDGET_SIZE_TYPE_4x4
459  *
460  * Extended sizes
461  * 4x3=712x533, #WIDGET_SIZE_TYPE_4x3
462  * 4x5=712x891, #WIDGET_SIZE_TYPE_4x5
463  * 4x6=712x1070, #WIDGET_SIZE_TYPE_4x6
464  *
465  * Easy mode widget
466  * 21x21=224x215, #WIDGET_SIZE_TYPE_EASY_1x1
467  * 23x21=680x215, #WIDGET_SIZE_TYPE_EASY_3x1
468  * 23x23=680x653, #WIDGET_SIZE_TYPE_EASY_3x3
469  *
470  * Special widget
471  * 0x0=720x1280, #WIDGET_SIZE_TYPE_FULL
472  * @since_tizen 2.3.1
473  * @remarks
474  *    This is an ASYNCHRONOUS API.
475  *    Even if you get a handle from the return value of this function, it is not a created instance.
476  *    So you have to consider it as a not initialized handle.
477  *    It can be initialized only after getting the return callback with "ret == #WIDGET_STATUS_ERROR_NONE"
478  *    This function is Asynchronous, so you will get result of add requst from @a cb, if you failed to send request to create a new widget,
479  *    This function will returns proper error code
480  *    If this returns @c NULL, you can get the reason of failure using get_last_result()
481  * @param[in] widget_id widget Id
482  * @param[in] content Contents that will be given to the widget instance
483  * @param[in] cluster Identifier to group widgets which will be decided in runtime.
484  * @param[in] category Identifier to group widgets declared in the manifest file by the widget application.
485  * @param[in] period Update period (@c WIDGET_DEFAULT_PERIOD can be used for this; this argument will be used to specify the period of updating contents of a widget)
486  * @param[in] type Size type (defined from libwidget-service package)
487  * @param[in] cb After the request is sent to the master provider, this callback will be called
488  * @param[in] data This data will be passed to the callback
489  * @privlevel platform
490  * @privilege %http://tizen.org/privilege/widget.viewer
491  * @return handle
492  * @retval Handle widget handle but not yet initialized
493  * @retval @c NULL if it fails to create a handle
494  * @see widget_ret_cb
495  */
496 extern widget_h widget_viewer_add_widget(const char *widget_id, const char *content, const char *cluster, const char *category, double period, widget_size_type_e type, widget_ret_cb cb, void *data);
497
498 /**
499  * @internal
500  * @brief Deletes a widget (will replace widget_del).
501  * @since_tizen 2.3.1
502  * @remarks
503  *    This is an ASYNCHRONOUS API.
504  *    If you call this with an uninitialized handle, the return callback will be called synchronously.
505  *    So before returning from this function, the return callback will be called first.
506  *    This function is Asynchronous, so you will get result of add requst from @a cb, if you failed to send request to create a new widget,
507  *    This function will returns proper error code
508  * @param[in] handle Handle of a widget instance
509  * @param[in] type Deletion type (WIDGET_DELETE_PERMANENTLY or WIDGET_DELETE_TEMPORARY)
510  * @param[in] cb Return callback
511  * @param[in] data User data for return callback
512  * @privlevel platform
513  * @privilege %http://tizen.org/privilege/widget.viewer
514  * @return 0 on success, otherwise a negative error value
515  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
516  * @retval #WIDGET_STATUS_ERROR_BUSY Already in process
517  * @retval #WIDGET_STATUS_ERROR_FAULT Failed to create a request packet
518  * @retval #WIDGET_STATUS_ERROR_NONE Successfully sent, return callack will be called
519  * @see widget_ret_cb
520  */
521 extern int widget_viewer_delete_widget(widget_h handle, widget_delete_type_e type, widget_ret_cb cb, void *data);
522
523 /**
524  * @internal
525  * @brief Sets a widget events callback.
526  * @details To get the event which is pushed from the provider, Register the event callback using this API.
527  *    The registered callback will be invoked if there are any events from the provider.
528  * @since_tizen 2.3.1
529  * @param[in] cb Event handle
530  * @param[in] data User data for the event handle
531  * @return 0 on success, otherwise a negative error value
532  * @retval #WIDGET_STATUS_ERROR_NONE If succeed to set event handle
533  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
534  * @retval #WIDGET_STATUS_ERROR_OUT_OF_MEMORY Not enough memory
535  * @see widget_unset_event_handler()
536  */
537 extern int widget_viewer_add_event_handler(widget_event_handler_cb cb, void *data);
538
539 /**
540  * @brief Unsets the widget event handle.
541  * @since_tizen 2.3.1
542  * @privlevel public
543  * @privilege %http://tizen.org/privilege/widget.viewer
544  * @param[in] cb Event handle
545  * @retval pointer Pointer of 'data' which is used with the widget_set_event_handler
546  * @see widget_set_event_handler()
547  */
548 extern void *widget_viewer_remove_event_handler(widget_event_handler_cb cb);
549
550 /**
551  * @internal
552  * @brief Registers the widget fault event handle.
553  * @details Argument list: event, pkgname, filename, funcname.
554  * @since_tizen 2.3.1
555  * @param[in] cb Event handle
556  * @param[in] data Event handle data
557  * @return 0 on success, otherwise a negative error value
558  * @retval #WIDGET_STATUS_ERROR_NONE If succeed to set fault event handle
559  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
560  * @retval #WIDGET_STATUS_ERROR_OUT_OF_MEMORY Not enough memory
561  * @see widget_unset_fault_handler()
562  */
563 extern int widget_viewer_add_fault_handler(widget_fault_handler_cb cb, void *data);
564
565 /**
566  * @brief Unsets the widget fault event handle.
567  * @since_tizen 2.3.1
568  * * @param[in] cb Event handle
569  * @retval pointer Pointer of 'data' which is used with the widget_set_fault_handler
570  * @see widget_set_fault_handler()
571  */
572 extern void *widget_viewer_remove_fault_handler(widget_fault_handler_cb cb);
573
574 /**
575  * @internal
576  * @brief Activates the faulted widget.
577  * @details Request result will be returned via return callback.
578  * @since_tizen 2.3.1
579  * @remarks
580  *    This is an ASYNCHRONOUS API.
581  *    Even though this function returns ERROR_NONE, it means that it just successfully sent a request to the provider.
582  *    So you have to check the return callback and its "ret" argument.
583  *    This function is Asynchronous, so you will get result of add requst from @a cb, if you failed to send request to create a new widget,
584  *    This function will returns proper error code
585  * @param[in] widget_id Package name which should be activated
586  * @param[in] cb Result callback
587  * @param[in] data Callback data
588  * @privlevel platform
589  * @privilege %http://tizen.org/privilege/widget.viewer
590  * @return #WIDGET_STATUS_ERROR_NONE on success,
591  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
592  * @retval #WIDGET_STATUS_ERROR_NONE Successfully sent a request
593  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
594  * @retval #WIDGET_STATUS_ERROR_FAULT Failed to make a request
595  * @see widget_ret_cb
596  */
597 extern int widget_viewer_activate_faulted_widget(const char *widget_id, widget_ret_cb cb, void *data);
598
599 /**
600  * @internal
601  * @brief Resizes the widget.
602  * @details
603  * Normal mode widget size
604  * 1x1=175x175, WIDGET_SIZE_TYPE_1x1
605  * 2x1=354x175, WIDGET_SIZE_TYPE_2x1
606  * 2x2=354x354, WIDGET_SIZE_TYPE_2x2
607  * 4x1=712x175, WIDGET_SIZE_TYPE_4x1
608  * 4x2=712x354, WIDGET_SIZE_TYPE_4x2
609  * 4x4=712x712, WIDGET_SIZE_TYPE_4x4
610  *
611  * Extended widget size
612  * 4x3=712x533, WIDGET_SIZE_TYPE_4x3
613  * 4x5=712x891, WIDGET_SIZE_TYPE_4x5
614  * 4x6=712x1070, WIDGET_SIZE_TYPE_4x6
615  *
616  * Easy mode widget size
617  * 21x21=224x215, WIDGET_SIZE_TYPE_EASY_1x1
618  * 23x21=680x215, WIDGET_SIZE_TYPE_EASY_3x1
619  * 23x23=680x653, WIDGET_SIZE_TYPE_EASY_3x3
620  *
621  * Special mode widget size
622  * 0x0=720x1280, WIDGET_SIZE_TYPE_FULL
623  * @since_tizen 2.3.1
624  * @privlevel public
625  * @privilege %http://tizen.org/privilege/widget.viewer
626  * @remarks
627  *    This is an ASYNCHRONOUS API.
628  *    This function is Asynchronous, so you will get result of add requst from @a cb, if you failed to send request to create a new widget,
629  *    This function will returns proper error code
630  * @param[in] handle Handle of a widget instance
631  * @param[in] type Type of a widget size (e.g., WIDGET_SIZE_TYPE_1x1, ...)
632  * @param[in] cb Result callback of the resize operation
633  * @param[in] data User data for return callback
634  * @privlevel platform
635  * @privilege %http://tizen.org/privilege/widget.viewer
636  * @return #WIDGET_STATUS_ERROR_NONE on success,
637  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
638  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
639  * @retval #WIDGET_STATUS_ERROR_BUSY Previous request of resize is in progress
640  * @retval #WIDGET_STATUS_ERROR_ALREADY Already resized, there is no differences between current size and requested size
641  * @retval #WIDGET_STATUS_ERROR_PERMISSION_DENIED Permission denied, you only have view the content of this box
642  * @retval #WIDGET_STATUS_ERROR_FAULT Failed to make a request
643  * @see widget_ret_cb
644  */
645 extern int widget_viewer_resize_widget(widget_h handle, widget_size_type_e type, widget_ret_cb cb, void *data);
646
647 /**
648  * @internal
649  * @brief Sends the click event to a widget, This is not related with mouse_event, viewer can send "clicked" event directly.
650  * @since_tizen 2.3.1
651  * @param[in] handle Handle of a widget instance
652  * @param[in] x Rational X of the content width
653  * @param[in] y Rational Y of the content height
654  * @privlevel platform
655  * @privilege %http://tizen.org/privilege/widget.viewer
656  * @return 0 on success, otherwise a negative error value
657  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
658  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
659  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
660  */
661 extern int widget_viewer_send_click_event(widget_h handle, const char *event, double x, double y);
662
663 /**
664  * @internal
665  * @brief Changes the cluster/sub-cluster name of the given widget handle.
666  * @since_tizen 2.3.1
667  * @remarks
668  *    This is an ASYNCHRONOUS API.
669  *    This function is Asynchronous, so you will get result of add requst from @a cb, if you failed to send request to create a new widget,
670  *    This function will returns proper error code
671  * @param[in] handle Handle of a widget instance
672  * @param[in] cluster New cluster of a widget
673  * @param[in] category New category of a widget
674  * @param[in] cb Result callback for changing the cluster/category of a widget
675  * @param[in] data User data for the result callback
676  * @privlevel platform
677  * @privilege %http://tizen.org/privilege/widget.viewer
678  * @return 0 on success, otherwise a negative error value
679  * @retval #WIDGET_STATUS_ERROR_NONE Request is successfully sent. the return callback will be called
680  * @retval #WIDGET_STATUS_ERROR_BUSY Previous request is not finished yet
681  * @retval #WIDGET_STATUS_ERROR_ALREADY Group name is same with current one
682  * @retval #WIDGET_STATUS_ERROR_PERMISSION_DENIED You have no permission to change property of this widget instance
683  * @retval #WIDGET_STATUS_ERROR_FAULT Failed to make a request
684  * @see widget_ret_cb
685  */
686 extern int widget_viewer_set_group(widget_h handle, const char *cluster, const char *category, widget_ret_cb cb, void *data);
687
688 /**
689  * @internal
690  * @brief Gets the cluster and category (sub-cluster) name of the given widget (it is not I18N format, only English).
691  * @since_tizen 2.3.1
692  * @remarks You have to do not release the cluster & category.
693  *    It is allocated inside of a given widget instance, so you can only read it.
694  * @param[in] handle Handle of a widget instance
695  * @param[out] cluster Storage(memory) for containing the cluster name
696  * @param[out] category Storage(memory) for containing the category name
697  * @return #WIDGET_STATUS_ERROR_NONE on success,
698  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
699  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
700  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
701  */
702 extern int widget_viewer_get_group(widget_h handle, const char **cluster, const char **category);
703
704 /**
705  * @brief Gets the update period of the widget.
706  * @since_tizen 2.3.1
707  * * @param[in] handle Handle of a widget instance
708  * @param[out] period Update period of the widget.
709  * @return #WIDGET_STATUS_ERROR_NONE on success,
710  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
711  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid parameters
712  */
713 extern int widget_viewer_get_period(widget_h handle, double *period);
714
715 /**
716  * @internal
717  * @brief Changes the update period.
718  * @since_tizen 2.3.1
719  * @remarks
720  *    This is an ASYNCHRONOUS API.
721  *    This function is Asynchronous, so you will get result of add requst from @a cb, if you failed to send request to create a new widget,
722  *    This function will returns proper error code
723  * @param[in] handle Handle of a widget instance
724  * @param[in] period New update period of a widget
725  * @param[in] cb Result callback of changing the update period of this widget
726  * @param[in] data User data for the result callback
727  * @privlevel platform
728  * @privilege %http://tizen.org/privilege/widget.viewer
729  * @return 0 on success, otherwise a negative error value
730  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
731  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
732  * @retval #WIDGET_STATUS_ERROR_BUSY
733  * @retval #WIDGET_STATUS_ERROR_ALREADY
734  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
735  * @see widget_ret_cb
736  */
737 extern int widget_viewer_set_period(widget_h handle, double period, widget_ret_cb cb, void *data);
738
739 /**
740  * @brief Checks whether the given widget is a text type or not.
741  * @remarks
742  *    If this returns WIDGET_CONTENT_TYPE_INVALID, you can get the reason of failure using get_last_result()
743  * @since_tizen 2.3.1
744  * * @param[in] handle Handle of a widget instance
745  * @param[in] gbar 1 for Glance Bar or 0
746  * @return widget_type
747  * @retval #WIDGET_CONTENT_TYPE_IMAGE Contents of a widget is based on the image file
748  * @retval #WIDGET_CONTENT_TYPE_BUFFER Contents of a widget is based on canvas buffer(shared)
749  * @retval #WIDGET_CONTENT_TYPE_TEXT Contents of a widget is based on formatted text file
750  * @retval #WIDGET_CONTENT_TYPE_RESOURCE_ID Contens of a widget is shared by the resource id (depends on the Window system, eg, Xorg)
751  * @retval #WIDGET_CONTENT_TYPE_UIFW UI F/W supported content type for widget
752  * @retval #WIDGET_CONTENT_TYPE_INVALID Invalid type
753  * @see widget_type()
754  */
755 extern int widget_viewer_get_type(widget_h handle, int gbar, widget_type_e *widget_type);
756
757 /**
758  * @brief Checks if the given widget is created by user or not.
759  * @remarks if this returns negative value, you can get the reason of failure using get_last_result()
760  * @since_tizen 2.3.1
761  * @privlevel public
762  * @privilege %http://tizen.org/privilege/widget.viewer
763  * @details If the widget instance is created by a system this will return 0.
764  * @param[in] handle Handle of a widget instance
765  * @return 0 on success, otherwise a negative error value
766  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
767  * @retval 0 Automatically created widget by the provider
768  * @retval 1 Created by user via widget_add()
769  * @see widget_add()
770  * @see widget_set_event_handler()
771  */
772 extern int widget_viewer_is_created_by_user(widget_h handle);
773
774 /**
775  * @internal
776  * @brief Gets content information string of the given widget.
777  * @remarks if this returns @c NULL, you can get the reason of failure using get_last_result()
778  * @since_tizen 2.3.1
779  * @param[in] handle Handle of a widget instance
780  * @return const char *
781  * @retval content_info widget content info that can be used again via content_info argument of widget_add()
782  * @see widget_add()
783  */
784 extern const char *widget_viewer_get_content_string(widget_h handle);
785
786 /**
787  * @brief Gets the sub cluster title string of the given widget.
788  * @details This API is now used for accessibility.
789  *  Each box should set their content as a string to be read by TTS.
790  *  So if the box has focused on the homescreen, the homescreen will read text using this API.
791  * @since_tizen 2.3.1
792  * * @remarks The title returned by this API can be read by TTS.
793  *  But it is just recomendation for the homescreen.
794  *  So, to read it or not depends on its implementation.
795  *  if this returns @c NULL, you can get the reason of failure using get_last_result()
796  * @param[in] handle Handle of a widget instance
797  * @return const char *
798  * @retval sub Cluster name
799  * @retval @c NULL
800  */
801 extern const char *widget_viewer_get_title_string(widget_h handle);
802
803 /**
804  * @internal
805  * @brief Gets the filename of the given widget, if it is an IMAGE type widget.
806  * @details If the box is developed as an image format to represent its contents, the homescreen should know its image file name.
807  * @remarks if this returns @c NULL, you can get the reason of failure using get_last_result()
808  * @since_tizen 2.3.1
809  * @param[in] handle Handle of a widget instance
810  * @return const char *
811  * @retval filename If the widget type is image this function will give you a abs-path of an image file (content is rendered)
812  * @retval @c NULL If this has no image file or type is not image file.
813  */
814 extern const char *widget_viewer_get_filename(widget_h handle);
815
816 /**
817  * @brief Gets the package name of the given widget handle.
818  * @remarks if this returns @c NULL, you can get the reason of failure using get_last_result()
819  * @since_tizen 2.3.1
820  * * @param[in] handle Handle of a widget instance
821  * @return const char *
822  * @retval pkgname Package name
823  * @retval @c NULL If the handle is not valid
824  */
825 extern const char *widget_viewer_get_pkgname(widget_h handle);
826
827 /**
828  * @brief Gets the priority of a current content.
829  * @remarks if this returns negative value, you can get the reason of failure using get_last_result()
830  * @since_tizen 2.3.1
831  * * @param[in] handle Handle of a widget instance
832  * @param[out] priority priority of the widget
833  * @return #WIDGET_STATUS_ERROR_NONE on success,
834  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
835  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid parameters
836  */
837 extern int widget_viewer_get_priority(widget_h handle, double *priority);
838
839 /**
840  * @internal
841  * @brief Acquires the buffer of a given widget (only for the buffer type).
842  * @since_tizen 2.3.1
843  * @param[in] handle Handle of a widget instance
844  * @param[in] gbar 1 for Glance Bar or 0
845  * @privlevel platform
846  * @privilege %http://tizen.org/privilege/widget.viewer
847  * @retval address Address of a Frame Buffer
848  * @retval @c NULL If it fails to get buffer address
849  */
850 extern void *widget_viewer_acquire_buffer(widget_h handle, int gbar);
851
852 /**
853  * @brief Releases the buffer of a widget (only for the buffer type).
854  * @since_tizen 2.3.1
855  * @privlevel public
856  * @privilege %http://tizen.org/privilege/widget.viewer
857  * @param[in] buffer Buffer
858  * @privlevel platform
859  * @privilege %http://tizen.org/privilege/widget.viewer
860  * @return 0 on success, otherwise a negative error value
861  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
862  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
863  * @see widget_acquire_buffer()
864  */
865 extern int widget_viewer_release_buffer(void *buffer);
866
867 /**
868  * @internal
869  * @brief Gets the reference count of widget buffer (only for the buffer type).
870  * @since_tizen 2.3.1
871  * @param[in] buffer Buffer
872  * @return 0 on success, otherwise a negative error value
873  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
874  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
875  * @retval refcnt Positive integer value including ZERO
876  */
877 extern int widget_viewer_get_buffer_reference_count(void *buffer);
878
879 /**
880  * @brief Gets the size of the widget.
881  * @remarks
882  *   If this returns WIDGET_SIZE_TYPE_UNKNOWN, you can get the reason of failure using get_last_result()
883  * @since_tizen 2.3.1
884  * @privlevel public
885  * @privilege %http://tizen.org/privilege/widget.viewer
886  * @param[in] handle Handle of a widget instance
887  * @return widget_size_type_e
888  * @retval #WIDGET_SIZE_TYPE_NxM N by M size
889  * @retval #WIDGET_SIZE_TYPE_UNKNOWN Invalid handle or size type is not defined yet
890  */
891 extern int widget_viewer_get_size_type(widget_h handle, widget_size_type_e *size_type);
892
893 /**
894  * @internal
895  * @brief Gets the size of the Glance Bar.
896  * @since_tizen 2.3.1
897  * @param[in] handle Handle of a widget instance
898  * @param[out] w Width of glance bar in pixels
899  * @param[out] h Height of glance bar in pixels
900  * @return #WIDGET_STATUS_ERROR_NONE on success,
901  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
902  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid parameters are used
903  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
904  */
905 extern int widget_viewer_get_glance_bar_size(widget_h handle, int *w, int *h);
906
907 /**
908  * @internal
909  * @brief Gets a list of the supported sizes of a given handle.
910  * @since_tizen 2.3.1
911  * @param[in] handle Handle of a widget instance
912  * @param[in] size_list Array buffer for getting the size types
913  * @param[in] cnt size of array
914  * @param[out] cnt Count of returned size types
915  * @param[out] size_list Array of size types
916  * @return #WIDGET_STATUS_ERROR_NONE on success,
917  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
918  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
919  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
920  */
921 extern int widget_viewer_get_supported_sizes(widget_h handle, int *cnt, widget_size_type_e *size_list);
922
923 /**
924  * @internal
925  * @brief Gets BUFFER SIZE of the widget if it is a buffer type.
926  * @since_tizen 2.3.1
927  * @param[in] handle Handle of a widget instance
928  * @param[in] gbar 1 for Glance Bar or 0
929  * @return 0 on success, otherwise a negative error value
930  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
931  * @retval size Size in bytes of the widget buffer
932  */
933 extern int widget_viewer_get_buffer_size(widget_h handle, int gbar);
934
935 /**
936  * @internal
937  * @brief Sends a content event (for buffer type) to the provider (widget).
938  * @since_tizen 2.3.1
939  * @param[in] handle Handle of a widget instance
940  * @param[in] type Event type
941  * @param[in] x Coordinates of X axis
942  * @param[in] y Coordinates of Y axis
943  * @privlevel platform
944  * @privilege %http://tizen.org/privilege/widget.viewer
945  * @return 0 on success, otherwise a negative error value
946  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
947  * @retval #WIDGET_STATUS_ERROR_BUSY Previous operation is not finished yet
948  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
949  * @retval #WIDGET_STATUS_ERROR_NONE Successfully sent
950  * @see widget_feed_access_event()
951  * @see widget_feed_key_event()
952  */
953 extern int widget_viewer_feed_mouse_event(widget_h handle, widget_mouse_event_type_e type, widget_mouse_event_info_s info);
954
955 /**
956  * @internal
957  * @brief Sends an access event (for buffer type) to the provider (widget).
958  * @remarks
959  *    This is an ASYNCHRONOUS API.
960  * @since_tizen 2.3.1
961  * @param[in] handle Handle of a widget instance
962  * @param[in] type Event type
963  * @param[in] x Coordinates of X axsis
964  * @param[in] y Coordinates of Y axsis
965  * @param[in] cb Result callback function
966  * @param[in] data Callback data
967  * @privlevel platform
968  * @privilege %http://tizen.org/privilege/widget.viewer
969  * @return 0 on success, otherwise a negative error value
970  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
971  * @retval #WIDGET_STATUS_ERROR_BUSY Previous operation is not finished yet
972  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
973  * @retval #WIDGET_STATUS_ERROR_NONE Successfully sent
974  * @see widget_feed_mouse_event()
975  * @see widget_feed_key_event()
976  */
977 extern int widget_viewer_feed_access_event(widget_h handle, widget_access_event_type_e type, widget_access_event_info_s info, widget_ret_cb cb, void *data);
978
979 /**
980  * @internal
981  * @brief Sends a key event (for buffer type) to the provider (widget).
982  * @remarks
983  *    This is an ASYNCHRONOUS API.
984  * @since_tizen 2.3.1
985  * @param[in] handle Handle of a widget instance
986  * @param[in] type Key event type
987  * @param[in] keycode Code of key
988  * @param[in] cb Result callback
989  * @param[in] data Callback data
990  * @privlevel platform
991  * @privilege %http://tizen.org/privilege/widget.viewer
992  * @return 0 on success, otherwise a negative error value
993  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
994  * @retval #WIDGET_STATUS_ERROR_BUSY Previous operation is not finished yet
995  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
996  * @retval #WIDGET_STATUS_ERROR_NONE Successfully sent
997  * @see widget_feed_mouse_event()
998  * @see widget_feed_access_event()
999  */
1000 extern int widget_viewer_feed_key_event(widget_h handle, widget_key_event_type_e type, widget_key_event_info_s info, widget_ret_cb cb, void *data);
1001
1002 /**
1003  * @internal
1004  * @brief Sets pin-up status of the given handle.
1005  * @details If the widget supports the pinup feature,
1006  *   you can freeze the update of the given widget.
1007  *   But it is different from pause.
1008  *   The box will be updated and it will decide wheter update its content or not when the pinup is on.
1009  * @remarks
1010  *    This is an ASYNCHRONOUS API.
1011  * @since_tizen 2.3.1
1012  * @param[in] handle Handle of a widget instance
1013  * @param[in] flag Pinup value
1014  * @param[in] cb Result callback
1015  * @param[in] data Callback data
1016  * @privlevel platform
1017  * @privilege %http://tizen.org/privilege/widget.viewer
1018  * @return 0 on success, otherwise a negative error value
1019  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid parameters
1020  * @see widget_ret_cb
1021  * @see widget_set_visibility()
1022  * @see widget_is_pinned_up()
1023  */
1024 extern int widget_viewer_set_pinup(widget_h handle, int flag, widget_ret_cb cb, void *data);
1025
1026 /**
1027  * @internal
1028  * @brief Checks the PIN-UP status of the given handle.
1029  * @since_tizen 2.3.1
1030  * @param[in] handle Handle of a widget instance
1031  * @return 0 on success, otherwise a negative error value
1032  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid parameters
1033  * @retval 1 Box is pinned up
1034  * @retval 0 Box is not pinned up
1035  * @see widget_set_pinup()
1036  */
1037 extern int widget_viewer_is_pinned_up(widget_h handle);
1038
1039 /**
1040  * @internal
1041  * @brief Checks the availability of the PIN-UP feature for the given handle.
1042  * @since_tizen 2.3.1
1043  * @param[in] handle Handle of a widget instance
1044  * @return 0 on success, otherwise a negative error value
1045  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1046  * @retval 1 If the box support Pinup feature
1047  * @retval 0 If the box does not support the Pinup feature
1048  * @see widget_is_pinned_up()
1049  * @see widget_set_pinup()
1050  */
1051 extern int widget_viewer_has_pinup(widget_h handle);
1052
1053 /**
1054  * @internal
1055  * @brief Checks the existence of Glance Bar for the given handle.
1056  * @since_tizen 2.3.1
1057  * @param[in] handle Handle of a widget instance
1058  * @return 0 on success, otherwise a negative error value
1059  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1060  * @retval 1 If the box support the Glance Bar
1061  * @retval 0 If the box has no Glance Bar
1062  */
1063 extern int widget_viewer_has_glance_bar(widget_h handle);
1064
1065 /**
1066  * @internal
1067  * @brief Creates Glance Bar of the given handle with the relative position from widget.
1068  * @remarks
1069  *    This is an ASYNCHRONOUS API.
1070  * @since_tizen 2.3.1
1071  * @param[in] handle Handle of a widget instance
1072  * @param[in] x 0.0 ~ 1.0
1073  * @param[in] y 0.0 ~ 1.0
1074  * @param[in] cb Result callback
1075  * @param[in] data Callback data
1076  * @privlevel platform
1077  * @privilege %http://tizen.org/privilege/widget.viewer
1078  * @return 0 on success, otherwise a negative error value
1079  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
1080  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1081  * @retval #WIDGET_STATUS_ERROR_BUSY Previous operation is not finished yet
1082  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1083  * @see widget_create_glance_bar()
1084  * @see widget_destroy_glance_bar()
1085  * @see widget_move_glance_bar()
1086  */
1087 extern int widget_viewer_create_glance_bar(widget_h handle, double x, double y, widget_ret_cb cb, void *data);
1088
1089 /**
1090  * @internal
1091  * @brief Updates a position of the given Glance Bar.
1092  * @since_tizen 2.3.1
1093  * @param[in] handle Handle of a widget instance
1094  * @param[in] x 0.0 ~ 1.0, 0.0 indicates the coordinate X of left of widget
1095  * @param[in] y 0.0 ~ 1.0, 0.0 indicates the coordinate Y of top of widget
1096  * @privlevel platform
1097  * @privilege %http://tizen.org/privilege/widget.viewer
1098  * @return 0 on success, otherwise a negative error value
1099  * @retval #WIDGET_STATUS_ERROR_NONE If sending a request for updating position of the Glance Bar has been done successfully
1100  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1101  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1102  */
1103 extern int widget_viewer_move_glance_bar(widget_h handle, double x, double y);
1104
1105 /**
1106  * @internal
1107  * @brief Destroys the Glance Bar of the given handle if it is created.
1108  * @remarks
1109  *    This is an ASYNCHRONOUS API.
1110  * @since_tizen 2.3.1
1111  * @param[in] handle Handle of a widget instance
1112  * @param[in] cb Callback function
1113  * @param[in] data Callback data
1114  * @privlevel platform
1115  * @privilege %http://tizen.org/privilege/widget.viewer
1116  * @return 0 on success, otherwise a negative error value
1117  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1118  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1119  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
1120  * @see widget_ret_cb
1121  */
1122 extern int widget_viewer_destroy_glance_bar(widget_h handle, widget_ret_cb cb, void *data);
1123
1124 /**
1125  * @internal
1126  * @brief Checks the create status of the given widget handle.
1127  * @since_tizen 2.3.1
1128  * @param[in] handle Handle of a widget instance
1129  * @return 0 on success, otherwise a negative error value
1130  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1131  * @retval 0 Glance Bar is not created
1132  * @retval 1 Glance Bar is created
1133  */
1134 extern int widget_viewer_glance_bar_is_created(widget_h handle);
1135
1136 /**
1137  * @internal
1138  * @brief Sets a function table for parsing the text content of a widget.
1139  * @since_tizen 2.3.1
1140  * @param[in] handle Handle of a widget instance
1141  * @param[in] gbar 1 for Glance Bar or 0
1142  * @param[in] ops
1143  * @return 0 on success, otherwise a negative error value
1144  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
1145  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1146  * @see widget_set_gbar_text_handler()
1147  */
1148 extern int widget_viewer_set_text_handler(widget_h handle, int gbar, widget_script_operator_s ops);
1149
1150 /**
1151  * @internal
1152  * @brief Emits a text signal to the given widget only if it is a text type.
1153  * @since_tizen 2.3.1
1154  * @remarks
1155  *    This is an ASYNCHRONOUS API.
1156  *    This function is Asynchronous, so you will get result of add requst from @a cb, if you failed to send request to create a new widget,
1157  *    This function will returns proper error code
1158  * @param[in] handle Handle of a widget instance
1159  * @param[in] signal_name Emission string
1160  * @param[in] source Source string
1161  * @param[in] sx Start X
1162  * @param[in] sy Start Y
1163  * @param[in] ex End X
1164  * @param[in] ey End Y
1165  * @param[in] cb Result callback
1166  * @param[in] data Callback data
1167  * @privlevel platform
1168  * @privilege %http://tizen.org/privilege/widget.viewer
1169  * @return 0 on success, otherwise a negative error value
1170  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid parameters
1171  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1172  * @retval #WIDGET_STATUS_ERROR_NONE Successfully emitted
1173  * @see widget_ret_cb
1174  */
1175 extern int widget_viewer_emit_text_signal(widget_h handle, widget_text_signal_s event_info, widget_ret_cb cb, void *data);
1176
1177 /**
1178  * @internal
1179  * @brief Sets a private data pointer to carry it using the given handle.
1180  * @since_tizen 2.3.1
1181  * @param[in] handle Handle of a widget instance
1182  * @param[in] data Data pointer
1183  * @return 0 on success, otherwise a negative error value
1184  * @retval #WIDGET_STATUS_ERROR_NONE Successfully registered
1185  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1186  * @see widget_data()
1187  */
1188 extern int widget_viewer_set_data(widget_h handle, void *data);
1189
1190 /**
1191  * @internal
1192  * @brief Gets a private data pointer which is carried by a given handle.
1193  * @since_tizen 2.3.1
1194  * @param[in] handle Handle of a widget instance
1195  * @retval data Data pointer
1196  * @retval @c NULL If there is no data
1197  * @see widget_set_data()
1198  */
1199 extern void *widget_viewer_get_data(widget_h handle);
1200
1201 /**
1202  * @internal
1203  * @brief Subscribes an event for widgetes only in a given cluster and sub-cluster.
1204  * @details If you wrote a view-only client,
1205  *   you can receive the event of specific widgetes which belong to a given cluster/category.
1206  *   But you cannot modify their attributes (such as size, ...).
1207  * @since_tizen 2.3.1
1208  * @param[in] cluster Cluster ("*" can be used for subscribe all cluster's widgetes event; If you use the "*", value in the category will be ignored)
1209  * @param[in] category Category ("*" can be used for subscribe widgetes events of all category(sub-cluster) in a given "cluster")
1210  * @privlevel platform
1211  * @privilege %http://tizen.org/privilege/widget.viewer
1212  * @return 0 on success, otherwise a negative error value
1213  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1214  * @retval #WIDGET_STATUS_ERROR_NONE Successfully requested
1215  * @see widget_unsubscribe_group()
1216  */
1217 extern int widget_viewer_subscribe_group(const char *cluster, const char *sub_cluster);
1218
1219 /**
1220  * @internal
1221  * @brief Unsubscribes an event for the widgetes, but you will receive already added widgetes events.
1222  * @since_tizen 2.3.1
1223  * @param[in] cluster Cluster("*" can be used for subscribe all cluster's widgetes event; If you use the "*", value in the category will be ignored)
1224  * @param[in] category Category ("*" can be used for subscribe all sub-cluster's widgetes event in a given "cluster")
1225  * @privlevel platform
1226  * @privilege %http://tizen.org/privilege/widget.viewer
1227  * @return 0 on success, otherwise a negative error value
1228  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1229  * @retval #WIDGET_STATUS_ERROR_NONE Successfully requested
1230  * @see widget_subscribe_group()
1231  */
1232 extern int widget_viewer_unsubscribe_group(const char *cluster, const char *sub_cluster);
1233
1234 /**
1235  * @internal
1236  * @brief Subscribe events of widgetes which is categorized by given "category" string.
1237  *        "category" is written in the XML file of each widget manifest file.
1238  *        After subscribe the category, the master will send created event for all created widgetes,
1239  *        Also it will notify client when a new widget is created.
1240  * @since_tizen 2.3.1
1241  * @param[in] category Category name
1242  * @privlevel platform
1243  * @privilege %http://developer.samsung.com/tizen/privilege/widget.viewer
1244  * @return 0 on success, otherwise a negative error value
1245  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1246  * @retval #WIDGET_STATUS_ERROR_NONE Successfully requested
1247  * @see widget_unsubscribe_category()
1248  */
1249 extern int widget_viewer_subscribe_category(const char *category);
1250
1251 /**
1252  * @internal
1253  * @brief Unsubscribe events of widgetes.
1254  * @since_tizen 2.3.1
1255  * @param[in] category Category name
1256  * @privlevel platform
1257  * @privilege %http://developer.samsung.com/tizen/privilege/widget.viewer
1258  * @return 0 on success, otherwise a negative error value
1259  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1260  * @retval #WIDGET_STATUS_ERROR_NONE Successfully requested
1261  * @see widget_subscribe_category()
1262  */
1263 extern int widget_viewer_unsubscribe_category(const char *category);
1264
1265 /**
1266  * @internal
1267  * @brief Refreshes the group (cluster/sub-cluser (aka. category)).
1268  * @details This function will trigger the update of all widgetes in a given cluster/category group.
1269  * @since_tizen 2.3.1
1270  * @remarks Basically, a default widget system doesn't use the cluster/category concept.
1271  *    But you can use it. So if you decide to use it, then you can trigger the update of all widgetes in the given group.
1272  * @param[in] cluster Cluster ID
1273  * @param[in] category Sub-cluster ID
1274  * @param[in] force 1 if the boxes should be updated even if they are paused
1275  * @privlevel platform
1276  * @privilege %http://tizen.org/privilege/widget.viewer
1277  * @return 0 on success, otherwise a negative error value
1278  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1279  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1280  * @retval #WIDGET_STATUS_ERROR_NONE Successfully requested
1281  * @see widget_refresh()
1282  */
1283 extern int widget_viewer_refresh_group(const char *cluster, const char *category, int force);
1284
1285 /**
1286  * @brief Refreshes a widget.
1287  * @since_tizen 2.3.1
1288  * @privlevel public
1289  * @privilege %http://tizen.org/privilege/widget.viewer
1290  * @param[in] handle Handle of a widget instance
1291  * @param[in] force 1 if the box should be updated even if it is paused
1292  * @privlevel platform
1293  * @privilege %http://tizen.org/privilege/widget.viewer
1294  * @return 0 on success, otherwise a negative error value
1295  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1296  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1297  * @retval #WIDGET_STATUS_ERROR_NONE Successfully requested
1298  * @see widget_refresh_group()
1299  */
1300 extern int widget_viewer_refresh(widget_h handle, int force);
1301
1302 /**
1303  * @brief Gets Resource id of a widget content.
1304  * @details This function doesn't guarantee the life-cycle of the resource id.
1305  *   If the service provider destroyed the resource id, you will not know about it.
1306  *   So you should validate it before accessing it.
1307  * @since_tizen 2.3.1
1308  * * @param[in] handle Handle of a widget instance
1309  * @param[in] gbar 1 for Glance Bar or 0
1310  * @param[out] resouce_id result resource id of the widget
1311  * @return #WIDGET_STATUS_ERROR_NONE on success,
1312  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
1313  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1314  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1315  * @see widget_get_resource_id()
1316  */
1317 extern int widget_viewer_get_resource_id(const widget_h handle, int gbar, unsigned int *resouce_id);
1318
1319 /**
1320  * @internal
1321  * @brief Gets the Resource Id of a widget.
1322  * @details Even if a render process releases the Resource Id, the Resource Id will be kept before being released by widget_release_resource_id.
1323  *   You should release the resource id manually.
1324  * @remarks
1325  *    This is an ASYNCHRONOUS API.
1326  * @since_tizen 2.3.1
1327  * @param[in] handle Handle of a widget instance
1328  * @param[in] gbar 1 for Glance Bar or 0
1329  * @param[in] cb Callback function which will be called with result of acquiring widget resource id
1330  * @param[in] data Callback data
1331  * @privlevel platform
1332  * @privilege %http://tizen.org/privilege/widget.viewer
1333  * @return 0 on success, otherwise a negative error value
1334  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1335  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1336  * @retval #WIDGET_STATUS_ERROR_NONE Successfully requested
1337  * @pre widget service system should support the ResourceId type buffer.
1338  *   The widget should be designed to use the buffer (or script).
1339  * @see widget_release_resource_id()
1340  * @see widget_ret_cb
1341  */
1342 extern int widget_viewer_acquire_resource_id(widget_h handle, int gbar, widget_ret_cb cb, void *data);
1343
1344 /**
1345  * @internal
1346  * @brief Get the Resource Id of a widget for Extra buffer
1347  * @details Even if a render process(provider) released the Resource Id, it will be kept while release it by viewer.\n
1348  *          This will prevent from unexpected resource releasing for viewer.\n
1349  *          You should release this using widget_release_resource_id()
1350  * @remarks
1351  *    This is an ASYNCHRONOUS API.
1352  * @since_tizen 2.3.1
1353  * @param[in] handle Handle of a widget instance
1354  * @param[in] gbar 1 for Glance Bar or 0
1355  * @param[in] idx Index of extra buffer, it is limited to widget configuration
1356  * @param[in] cb Callback function which will be called with result of acquiring widget resource id
1357  * @param[in] data Callback data
1358  * @privlevel platform
1359  * @privilege %http://tizen.org/privilege/widget.viewer
1360  * @return 0 on success, otherwise a negative error value
1361  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1362  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1363  * @retval #WIDGET_STATUS_ERROR_NONE Successfully requested
1364  * @pre widget service system should support the resource id type buffer.
1365  *      The widget should be designed to use the buffer (or script)
1366  * @see widget_release_resource_id()
1367  * @see widget_ret_cb
1368  */
1369 extern int widget_viewer_acquire_extra_resource_id(widget_h handle, int gbar, int idx, widget_ret_cb cb, void *data);
1370
1371 /**
1372  * @brief Releases the Resource Id of a widget.
1373  * @details After a client gets a new Resource Id or does not need to keep the current Resource Id anymore, use this function to release it.
1374  *   If there is no user for a given Resource Id, the Resource Id will be destroyed.
1375  * @since_tizen 2.3.1
1376  * @privlevel public
1377  * @privilege %http://tizen.org/privilege/widget.viewer
1378  * @param[in] handle Handle of a widget instance
1379  * @param[in] gbar 1 for Glance Bar or 0
1380  * @param[in] resource_id Resource Id of given widget handle
1381  * @privlevel platform
1382  * @privilege %http://tizen.org/privilege/widget.viewer
1383  * @return 0 on success, otherwise a negative error value
1384  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1385  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1386  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
1387  * @pre The Resource Id should be acquired by widget_acquire_resource_id
1388  * @see widget_acquire_resource_id()
1389  */
1390 extern int widget_viewer_release_resource_id(widget_h handle, int gbar, unsigned int resource_id);
1391
1392 /**
1393  * @brief Updates a visible state of the widget.
1394  * @since_tizen 2.3.1
1395  * @privlevel public
1396  * @privilege %http://tizen.org/privilege/widget.viewer
1397  * @param[in] handle Handle of a widget instance
1398  * @param[in] state Configure the current visible state of a widget
1399  * @privlevel platform
1400  * @privilege %http://tizen.org/privilege/widget.viewer
1401  * @return #WIDGET_STATUS_ERROR_NONE on success,
1402  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
1403  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1404  * @retval #WIDGET_STATUS_ERROR_PERMISSION_DENIED Permission denied
1405  * @retval #WIDGET_STATUS_ERROR_ALREADY Input state is same to existing state
1406  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1407  */
1408 extern int widget_viewer_set_visibility(widget_h handle, widget_visible_state_e state);
1409
1410 /**
1411  * @internal
1412  * @brief Gets the current visible state of a widget.
1413  * @remarks
1414  *   If this returns WIDGET_VISIBLE_ERROR, you can get the reason of failure using get_last_result()
1415  * @since_tizen 2.3.1
1416  * @param[in] handle Handle of a widget instance
1417  * @return widget_visible_state
1418  * @retval #WIDGET_SHOW widget is shown (Default state)
1419  * @retval #WIDGET_HIDE widget is hidden, Update timer is not frozen (but a user cannot receive any updated events; a user should refresh(reload) the content of a widget when a user make this show again)
1420  * @retval #WIDGET_HIDE_WITH_PAUSE widget is hidden, it will pause the update timer, but if a widget updates its contents, update event will occur
1421  * @retval #WIDGET_VISIBLE_ERROR To enlarge the size of this enumeration type
1422  */
1423 extern widget_visible_state_e widget_viewer_get_visibility(widget_h handle);
1424
1425 /**
1426  * @internal
1427  * @brief Sets an update mode of the current widget.
1428  * @details If you set 1 for active update mode, you should get a buffer without updated event from provider.
1429  *   But if it is passive mode, you have to update content of a box when you get updated events.
1430  *   Default is Passive mode.
1431  * @since_tizen 2.3.1
1432  * @remarks
1433  *    This is an ASYNCHRONOUS API.
1434  *    This function is Asynchronous, so you will get result of add requst from @a cb, if you failed to send request to create a new widget,
1435  *    This function will returns proper error code
1436  * @param[in] handle Handle of a widget instance
1437  * @param[in] active_update 1 means active update, 0 means passive update (default)
1438  * @param[in] cb Result callback function
1439  * @param[in] data Callback data
1440  * @privlevel platform
1441  * @privilege %http://tizen.org/privilege/widget.viewer
1442  * @return 0 on success, otherwise a negative error value
1443  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1444  * @retval #WIDGET_STATUS_ERROR_BUSY
1445  * @retval #WIDGET_STATUS_ERROR_PERMISSION_DENIED
1446  * @retval #WIDGET_STATUS_ERROR_ALREADY
1447  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1448  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
1449  * @see widget_ret_cb
1450  */
1451 extern int widget_viewer_set_update_mode(widget_h handle, int active_update, widget_ret_cb cb, void *data);
1452
1453 /**
1454  * @internal
1455  * @brief Checks the active update mode of the given widget.
1456  * @remarks
1457  *   If this returns negative value, you can get the reason of failure using get_last_result()
1458  * @since_tizen 2.3.1
1459  * @param[in] handle Handle of a widget instance
1460  * @return 0 on success, otherwise a negative error value
1461  * @retval 0 If passive mode
1462  * @retval 1 If active mode or error code
1463  */
1464 extern int widget_viewer_is_active_update(widget_h handle);
1465
1466 /**
1467  * @internal
1468  * @brief Syncs manually
1469  * @since_tizen 2.3.1
1470  * @param[in] handle Handle of a widget instance
1471  * @param[in] gbar 1 for Glance Bar or 0
1472  * @privlevel platform
1473  * @privilege %http://tizen.org/privilege/widget.viewer
1474  * @return 0 on success, otherwise a negative error value
1475  * @retval #WIDGET_STATUS_ERROR_NONE If success
1476  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid handle
1477  * @see widget_set_manual_sync()
1478  * @see widget_manual_sync()
1479  */
1480 extern int widget_viewer_sync_buffer(widget_h handle, int gbar);
1481
1482 /**
1483  * @internal
1484  * @brief Getting the damaged region info
1485  * @since_tizen 2.3.1
1486  * @param[in] handle Handle of a widget instance
1487  * @param[in] gbar 1 for Glance Bar or 0
1488  * @param[out] region Readonly information for damaged area
1489  * @return 0 on success, otherwise a negative error value
1490  * @retval #WIDGET_STATUS_ERROR_NONE if success
1491  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid handle
1492  */
1493 extern int widget_viewer_get_damaged_region(widget_h handle, int gbar, const widget_damage_region_s *region);
1494
1495 /**
1496  * @internal
1497  * @brief Gets an alternative icon of the given widget instance.
1498  * @details If the box should be represented as a shortcut icon, this function will get the alternative icon.
1499  * @remarks
1500  *   If this returns @c NULL, you can get the reason of failure using get_last_result()
1501  * @since_tizen 2.3.1
1502  * @param[in] handle Handle of a widget instance
1503  * @return const char *
1504  * @retval address Absolute path of an alternative icon file
1505  * @retval @c NULL widget has no alternative icon file
1506  * @see widget_alt_name()
1507  */
1508 extern const char *widget_viewer_get_alternative_icon(widget_h handle);
1509
1510 /**
1511  * @internal
1512  * @brief Gets an alternative name of the given widget instance.
1513  * @details If the box should be represented as a shortcut name, this function will get the alternative name.
1514  * @remarks
1515  *   If this returns @c NULL, you can get the reason of failure using get_last_result()
1516  * @since_tizen 2.3.1
1517  * @param[in] handle Handle of a widget instance
1518  * @return const char *
1519  * @retval name Alternative name of a widget
1520  * @retval @c NULL widget has no alternative name
1521  * @see widget_alt_icon()
1522  */
1523 extern const char *widget_viewer_get_alternative_name(widget_h handle);
1524
1525 /**
1526  * @internal
1527  * @brief Gets a lock for a frame buffer.
1528  * @details This function should be used to prevent from rendering to the frame buffer while reading it.
1529  *   And the locking area should be short and must be released ASAP, or the render thread will be hanged.
1530  * @since_tizen 2.3.1
1531  * @param[in] handle Handle of a widget instance
1532  * @param[in] gbar 1 for Glance Bar or 0
1533  * @privlevel platform
1534  * @privilege %http://tizen.org/privilege/widget.viewer
1535  * @return 0 on success, otherwise a negative error value
1536  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1537  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1538  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
1539  * @see widget_release_buffer_lock()
1540  */
1541 extern int widget_viewer_acquire_buffer_lock(widget_h handle, int gbar);
1542
1543 /**
1544  * @internal
1545  * @brief Releases a lock of the frame buffer.
1546  * @details This function should be called ASAP after acquiring a lock of FB, or the render process will be blocked.
1547  * @since_tizen 2.3.1
1548  * @param[in] handle Handle of a widget instance
1549  * @param[in] gbar 1 for Glance Bar or 0
1550  * @privlevel platform
1551  * @privilege %http://tizen.org/privilege/widget.viewer
1552  * @return 0 on success, otherwise a negative error value
1553  * @retval #WIDGET_STATUS_ERROR_FAULT Unrecoverable error occurred
1554  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid argument
1555  * @retval #WIDGET_STATUS_ERROR_NONE Successfully done
1556  * @see widget_acquire_buffer_lock()
1557  */
1558 extern int widget_viewer_release_buffer_lock(widget_h handle, int gbar);
1559
1560 /**
1561  * @brief Sets options for controlling a widget sub-system.
1562  * @details
1563  *   #WIDGET_OPTION_FRAME_DROP_FOR_RESIZE
1564  *       While resizing the box, viewer doesn't want to know the updated frames of an old size content anymore.
1565  *       In that case, turn this on, the provider will not send the updated event to the viewer about an old content.
1566  *       So the viewer can reduce its burden to update unnecessary frames.
1567  *   #WIDGET_OPTION_MANUAL_SYNC
1568  *       If you don't want to update frames automatically, or you want only reload the frames by your hands, (manually)
1569  *       Turn this on.
1570  *       After turnning it on, you should sync it using widget_sync_buffer().
1571  *   #WIDGET_OPTION_SHARED_CONTENT
1572  *       If this option is turnned on, even though you create a new widget,
1573  *       if there are already added same instances that have same contents, the instance will not be created again.
1574  *       Instead of creating a new instance, a viewer will provide an old instance with a new handle.
1575  * @since_tizen 2.3.1
1576  * * @param[in] option Option which will be affected by this call
1577  * @param[in] state New value for given option
1578  * @return 0 on success, otherwise a negative error value
1579  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Unknown option
1580  * @retval #WIDGET_STATUS_ERROR_FAULT Failed to change the state of option
1581  * @retval #WIDGET_STATUS_ERROR_NONE Successfully changed
1582  * @see widget_get_option()
1583  * @see widget_sync_buffer()
1584  */
1585 extern int widget_viewer_set_option(widget_option_type_e option, int state);
1586
1587 /**
1588  * @internal
1589  * @brief Gets options of a widget sub-system.
1590  * @remarks
1591  *   If this returns negative value, you can get the reason of failure using get_last_result()
1592  * @since_tizen 2.3.1
1593  * @param[in] option Type of option
1594  * @return 0 on success, otherwise a negative error value
1595  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Invalid option
1596  * @retval #WIDGET_STATUS_ERROR_FAULT Failed to get option
1597  * @retval >=0 Value of given option (must be >=0)
1598  * @see widget_set_option()
1599  */
1600 extern int widget_viewer_get_option(widget_option_type_e option);
1601
1602 /**
1603  * @internal
1604  * @brief Set a handle for launching an app by auto-launch feature
1605  * @details If a user clicks a box, which box enabled auto-launch option, the launcher_handler will be called.
1606  *          From that callback, you should launch an app using given ui-app id.
1607  * @since_tizen 2.3.1
1608  * @param[in] launch_handler Handle for launching an app manually
1609  * @param[in] data Callback data which will be given a data for launch_handler
1610  * @return #WIDGET_STATUS_ERROR_NONE on success,
1611  *          otherwise an error code (see #WIDGET_STATUS_ERROR_XXX) on failure
1612  * @retval #WIDGET_STATUS_ERROR_NONE Succeed to set new handle. there is no other cases
1613  */
1614 extern int widget_viewer_set_auto_launch_handler(widget_auto_launch_handler_cb cb, void *data);
1615
1616 /**
1617  * @internal
1618  * @brief Get the last extra buffer index and its id.
1619  * @details
1620  *   If there is an event of #WIDGET_EVENT_WIDGET_EXTRA_BUFFER_CREATED or #WIDGET_EVENT_GBAR_EXTRA_BUFFER_CREATED,
1621  *                           #WIDGET_EVENT_WIDGET_EXTRA_BUFFER_DESTROYED or #WIDGET_EVENT_GBAR_EXTRA_BUFFER_DESTROYED
1622  *   you can use this to get the last created buffer info
1623  * @since_tizen 2.3.1
1624  * @param[in] handle widget handle
1625  * @param[in] gbar 1 if you want get the glance bar's info or 0
1626  * @param[out] idx Index of buffer
1627  * @param[out] resource_id Resource Id
1628  * @return status
1629  * @retval #WIDGET_STATUS_ERROR_NONE Successfully get
1630  * @retval #WIDGET_STATUS_ERROR_INVALID_PARAMETER Handle is not valid
1631  * @retval #WIDGET_STATUS_ERROR_NOT_EXIST There is no extra buffer
1632  */
1633 extern int widget_viewer_get_affected_extra_buffer(widget_h handle, int gbar, int *idx, unsigned int *resource_id);
1634
1635 extern int widget_viewer_get_instance_id(widget_h handle, char **instance_id);
1636
1637 extern int widget_viewer_notify_orientation_of_viewer(int orientation);
1638
1639 /**
1640  * @}
1641  */
1642
1643 #ifdef __cplusplus
1644 }
1645 #endif
1646
1647 #endif