Update License
[platform/framework/web/livebox-viewer.git] / include / livebox.h
1 /*
2  * Copyright 2013  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.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://floralicense.org
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __LIVEBOX_H
18 #define __LIVEBOX_H
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 struct livebox;
25
26 /*!
27  * \note size list
28  * 172x172
29  * 348x172
30  * 348x348
31  * 700x348
32  * 700x172
33  * 700x700
34  */
35 #define DEFAULT_PERIOD -1.0f
36
37 enum content_event_type {
38         CONTENT_EVENT_MOUSE_DOWN        = 0x00000001, /*!< LB mouse down event for livebox */
39         CONTENT_EVENT_MOUSE_UP          = 0x00000002, /*!< LB mouse up event for livebox */
40         CONTENT_EVENT_MOUSE_MOVE        = 0x00000004, /*!< LB mouse move event for livebox */
41         CONTENT_EVENT_MOUSE_ENTER       = 0x00000008, /*!< LB mouse enter event for livebox */
42         CONTENT_EVENT_MOUSE_LEAVE       = 0x00000010, /*!< LB mouse leave event for livebox */
43         CONTENT_EVENT_MOUSE_SET         = 0x00000020, /*!< LB mouse set auto event for livebox */
44         CONTENT_EVENT_MOUSE_UNSET       = 0x00000040, /*!< LB mouse unset auto event for livebox */
45
46         CONTENT_EVENT_KEY_DOWN          = 0x00100000, /*!< LB key press */
47         CONTENT_EVENT_KEY_UP            = 0x00200000, /*!< LB key release */
48
49         CONTENT_EVENT_KEY_MASK          = 0x80000000,
50         CONTENT_EVENT_MOUSE_MASK        = 0x20000000,
51         CONTENT_EVENT_PD_MASK           = 0x10000000,
52         CONTENT_EVENT_LB_MASK           = 0x00000000,
53
54         LB_MOUSE_DOWN                   = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_DOWN,
55         LB_MOUSE_UP                     = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UP,
56         LB_MOUSE_MOVE                   = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_MOVE,
57         LB_MOUSE_ENTER                  = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_ENTER,
58         LB_MOUSE_LEAVE                  = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_LEAVE,
59         LB_MOUSE_SET                    = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_SET,
60         LB_MOUSE_UNSET                  = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UNSET,
61
62         PD_MOUSE_DOWN                   = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_DOWN,
63         PD_MOUSE_UP                     = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UP,
64         PD_MOUSE_MOVE                   = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_MOVE,
65         PD_MOUSE_ENTER                  = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_ENTER,
66         PD_MOUSE_LEAVE                  = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_LEAVE,
67         PD_MOUSE_SET                    = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_SET,
68         PD_MOUSE_UNSET                  = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_MOUSE_MASK | CONTENT_EVENT_MOUSE_UNSET,
69
70         LB_KEY_DOWN                     = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_DOWN,
71         LB_KEY_UP                       = CONTENT_EVENT_LB_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UP,
72
73         PD_KEY_DOWN                     = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_DOWN,
74         PD_KEY_UP                       = CONTENT_EVENT_PD_MASK | CONTENT_EVENT_KEY_MASK | CONTENT_EVENT_KEY_UP,
75
76         CONTENT_EVENT_MAX       = 0xFFFFFFFF,
77 };
78
79 enum access_event_type {
80         ACCESS_EVENT_PD_MASK            = 0x10000000,
81         ACCESS_EVENT_LB_MASK            = 0x00000000,
82
83         ACCESS_EVENT_HIGHLIGHT          = 0x00000100, /*!< LB accessibility: Hightlight a object */
84         ACCESS_EVENT_HIGHLIGHT_NEXT     = 0x00000200, /*!< LB accessibility: Set highlight to next object */
85         ACCESS_EVENT_HIGHLIGHT_PREV     = 0x00000400, /*!< LB accessibility: Set highlight to prev object */
86         ACCESS_EVENT_ACTIVATE           = 0x00000800, /*!< LB accessibility activate */
87         ACCESS_EVENT_VALUE_CHANGE       = 0x00001000, /*!< LB accessibility value changed */
88         ACCESS_EVENT_UNHIGHLIGHT        = 0x00002000, /*!< LB accessibility unhighlight */
89         ACCESS_EVENT_SCROLL_DOWN        = 0x00004000, /*!< LB accessibility scroll down */
90         ACCESS_EVENT_SCROLL_MOVE        = 0x00008000, /*!< LB accessibility scroll move */
91         ACCESS_EVENT_SCROLL_UP          = 0x00010000, /*!< LB accessibility scroll up */
92
93         LB_ACCESS_HIGHLIGHT             = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT,
94         LB_ACCESS_HIGHLIGHT_NEXT        = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT_NEXT,
95         LB_ACCESS_HIGHLIGHT_PREV        = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_HIGHLIGHT_PREV,
96         LB_ACCESS_ACTIVATE              = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_ACTIVATE,
97         LB_ACCESS_VALUE_CHANGE          = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_VALUE_CHANGE,
98         LB_ACCESS_UNHIGHLIGHT           = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_UNHIGHLIGHT,
99         LB_ACCESS_SCROLL_DOWN           = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_DOWN,
100         LB_ACCESS_SCROLL_MOVE           = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_MOVE,
101         LB_ACCESS_SCROLL_UP             = ACCESS_EVENT_LB_MASK | ACCESS_EVENT_SCROLL_UP,
102
103         PD_ACCESS_HIGHLIGHT             = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT,
104         PD_ACCESS_HIGHLIGHT_NEXT        = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT_NEXT,
105         PD_ACCESS_HIGHLIGHT_PREV        = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_HIGHLIGHT_PREV,
106         PD_ACCESS_ACTIVATE              = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_ACTIVATE,
107         PD_ACCESS_VALUE_CHANGE          = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_VALUE_CHANGE,
108         PD_ACCESS_UNHIGHLIGHT           = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_UNHIGHLIGHT,
109         PD_ACCESS_SCROLL_DOWN           = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_DOWN,
110         PD_ACCESS_SCROLL_MOVE           = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_MOVE,
111         PD_ACCESS_SCROLL_UP             = ACCESS_EVENT_PD_MASK | ACCESS_EVENT_SCROLL_UP,
112 };
113
114 /* Exported to user app */
115 enum livebox_lb_type {
116         LB_TYPE_IMAGE = 0x01, /*!< Contents of a livebox is based on the image file */
117         LB_TYPE_BUFFER = 0x02, /*!< Contents of a livebox is based on canvas buffer(shared) */
118         LB_TYPE_TEXT = 0x04, /*!< Contents of a livebox is based on formatted text file */
119         LB_TYPE_PIXMAP = 0x08, /*!< Contens of a livebox is shared by the pixmap(depends on X) */
120
121         LB_TYPE_INVALID = 0xFF,
122 };
123
124 enum livebox_pd_type {
125         PD_TYPE_BUFFER = 0x01, /*!< Contents of a PD is based on canvas buffer(shared) */
126         PD_TYPE_TEXT = 0x02, /*!< Contents of a PD is based on formatted text file */
127         PD_TYPE_PIXMAP = 0x04, /*!< Contents of a livebox is shared by the pixmap(depends on X) */
128
129         PD_TYPE_INVALID = 0xFF,
130 };
131
132 enum livebox_event_type { /*!< livebox_event_handler_set Event list */
133         LB_EVENT_LB_UPDATED, /*!< Contents of the given livebox is updated */
134         LB_EVENT_PD_UPDATED, /*!< Contents of the given pd is updated */
135
136         LB_EVENT_CREATED, /*!< A new livebox is created */
137         LB_EVENT_DELETED, /*!< A livebox is deleted */
138
139         LB_EVENT_GROUP_CHANGED, /*!< Group (Cluster/Sub-cluster) information is changed */
140         LB_EVENT_PINUP_CHANGED, /*!< PINUP status is changed */
141         LB_EVENT_PERIOD_CHANGED, /*!< Update period is changed */
142
143         LB_EVENT_LB_SIZE_CHANGED, /*!< Livebox size is changed */
144         LB_EVENT_PD_SIZE_CHANGED, /*!< PD size is changed */
145
146         LB_EVENT_PD_CREATED, /*!< If a PD is created even if you didn't call the livebox_create_pd API */
147         LB_EVENT_PD_DESTROYED, /*!< If a PD is destroyed even if you didn't call the livebox_destroy_pd API */
148
149         LB_EVENT_HOLD_SCROLL, /*!< If the screen should be freezed */
150         LB_EVENT_RELEASE_SCROLL, /*!< If the screen can be scrolled */
151
152         LB_EVENT_LB_UPDATE_BEGIN,
153         LB_EVENT_LB_UPDATE_END,
154
155         LB_EVENT_PD_UPDATE_BEGIN,
156         LB_EVENT_PD_UPDATE_END,
157
158         LB_EVENT_UPDATE_MODE_CHANGED,
159
160         LB_EVENT_IGNORED, /*!< Request is ignored */
161 };
162
163 enum livebox_fault_type {
164         LB_FAULT_DEACTIVATED, /*!< Livebox is deactivated by its fault operation */
165         LB_FAULT_PROVIDER_DISCONNECTED, /*!< Provider is disconnected */
166 };
167
168 enum livebox_visible_state { /*!< Must be sync'd with the provider */
169         LB_SHOW = 0x00, /*!< Livebox is showed. Default state */
170         LB_HIDE = 0x01, /*!< Livebox is hide, Update timer is not be freezed. but you cannot receive any updates events. you should refresh(reload) the content of a livebox when you make this show again */
171
172         LB_HIDE_WITH_PAUSE = 0x02, /*!< Livebix is hide, it will paused the update timer, but if a livebox update its contents, update event will come to you */
173
174         LB_VISIBLE_ERROR = 0xFFFFFFFF, /* To enlarge the size of this enumeration type */
175 };
176
177 /*!
178  * \note
179  * TEXT type livebox contents handling opertators.
180  */
181 struct livebox_script_operators {
182         int (*update_begin)(struct livebox *handle); /*!< Content parser is started */
183         int (*update_end)(struct livebox *handle); /*!< Content parser is stopped */
184
185         /*!
186          * \brief
187          * Listed functions will be called when parser meets each typed component
188          */
189         int (*update_text)(struct livebox *handle, const char *id, const char *part, const char *data); /*!< Update text content */
190         int (*update_image)(struct livebox *handle, const char *id, const char *part, const char *data, const char *option); /*!< Update image content */
191         int (*update_script)(struct livebox *handle, const char *id, const char *part, const char *file, const char *group); /*!< Update script content */
192         int (*update_signal)(struct livebox *handle, const char *id, const char *emission, const char *signal); /*!< Update signal */
193         int (*update_drag)(struct livebox *handle, const char *id, const char *part, double dx, double dy); /*!< Update drag info */
194         int (*update_info_size)(struct livebox *handle, const char *id, int w, int h); /*!< Update content size */
195         int (*update_info_category)(struct livebox *handle, const char *id, const char *category); /*!< Update content category info */
196 };
197
198 /*!
199  * \brief Prototype of the return callback of every async functions.
200  * \param[in] handle
201  * \param[in] ret
202  * \param[in] data
203  * \return void
204  */
205 typedef void (*ret_cb_t)(struct livebox *handle, int ret, void *data);
206
207 /*!
208  * \brief Initialize the livebox system
209  * \param[in] disp If you have X Display connection object, you can re-use it. but you should care its life cycle.
210  *                 It must be alive before call the livebox_fini
211  * \return int 0 if success or < 0 (errno)
212  * \sa livebox_fini
213  */
214 extern int livebox_init(void *disp);
215
216 /*!
217  * \brief Finalize the livebox system
218  * \return int 0 if success, -EINVAL if livebox_init is not called.
219  * \sa livebox_init
220  */
221 extern int livebox_fini(void);
222
223 /*!
224  * \brief Client is paused.
225  * \return int 0 if success, -EFAULT if it failed to send state(paused) info
226  * \sa livebox_client_resumed
227  */
228 extern int livebox_client_paused(void);
229
230 /*!
231  * \brief Client is rfesumed.
232  * \return int 0 if success, -EFAULT if it failed to send state(resumed) info
233  * \sa livebox_client_paused
234  */
235 extern int livebox_client_resumed(void);
236
237 /*!
238  * \brief Add a new livebox
239  * \param[in] pkgname Livebox Id
240  * \param[in] content Will be passed to the livebox.
241  * \param[in] cluster
242  * \param[in] category
243  * \param[in] period Update period. if you set DEFAULT_PERIOD, the provider will use the default period which is described in the manifest.
244  * \param[in] cb After send the request to the provider, its result will be passed
245  * \param[in] data
246  * \return handle
247  */
248 extern struct livebox *livebox_add(const char *pkgname, const char *content, const char *cluster, const char *category, double period, ret_cb_t cb, void *data);
249 extern struct livebox *livebox_add_with_size(const char *pkgname, const char *content, const char *cluster, const char *category, double period, int type, ret_cb_t cb, void *data);
250
251 /*!
252  * \brief Delete a livebox
253  * \param[in] handle
254  * \param[in] ret_cb_t return callback
255  * \param[in] data user data for return callback
256  * \return int
257  */
258 extern int livebox_del(struct livebox *handler, ret_cb_t cb, void *data);
259
260 /*!
261  * \brief Set a livebox events callback
262  * \param[in] cb Event handler
263  * \param[in] data User data for the event handler
264  * \return int
265  * \sa livebox_unset_event_handler
266  */
267
268 extern int livebox_set_event_handler(int (*cb)(struct livebox *handler, enum livebox_event_type event, void *data), void *data);
269
270 /*!
271  * \brief Unset the livebox event handler
272  * \param[in] cb
273  * \return void * pointer of 'data' which is registered from the livebox_event_handler_set
274  * \sa livebox_set_event_handler
275  */
276 extern void *livebox_unset_event_handler(int (*cb)(struct livebox *handler, enum livebox_event_type event, void *data));
277
278 /*!
279  * \note
280  *   argument list
281  *      event, pkgname, filename, funcname
282  *
283  * \brief Live box fault event handler registeration function
284  * \param[in] cb
285  * \param[in] data
286  * \return int
287  * \sa livebox_unset_fault_handler
288  */
289 extern int livebox_set_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *), void *data);
290
291 /*!
292  * \brief Unset the live box fault event handler
293  * \param[in] cb
294  * \return pointer of 'data'
295  * \sa livebox_set_fault_handler
296  */
297 extern void *livebox_unset_fault_handler(int (*cb)(enum livebox_fault_type, const char *, const char *, const char *, void *));
298
299 /*!
300  * \brief Activate the faulted livebox.
301  * \param[in] pkgname
302  * \param[in] cb
303  * \param[in] data
304  * \return int
305  */
306 extern int livebox_activate(const char *pkgname, ret_cb_t cb, void *data);
307
308 /*!
309  * \brief Resize the livebox
310  * \param[in] handler Handler of a livebox
311  * \param[in] type Type of a livebox size, LB_SIZE_TYPE_1x1, ...
312  * \param[in] cb Result callback of the resize operation.
313  * \param[in] data User data for return callback
314  * \return int
315  */
316 extern int livebox_resize(struct livebox *handler, int type, ret_cb_t cb, void *data);
317
318 /*!
319  * \brief Send the click event for a livebox.
320  * \param[in] handler Handler of a livebox
321  * \param[in] x Rational X of the content width.
322  * \param[in] y Rational Y of the content height.
323  * \return int
324  */
325 extern int livebox_click(struct livebox *handler, double x, double y);
326
327 /*!
328  * \brief Change the cluster/sub-cluster name of given livebox handler
329  * \param[in] handler Handler of a livebox
330  * \param[in] cluster New cluster of a livebox
331  * \param[in] category New category of a livebox
332  * \param[in] cb Result callback for changing the cluster/category of a livebox
333  * \param[in] data User data for the result callback
334  * \return int
335  */
336 extern int livebox_set_group(struct livebox *handler, const char *cluster, const char *category, ret_cb_t cb, void *data);
337
338 /*!
339  * \brief Get the cluster and category(sub-cluster) name of given livebox (It is not I18N format, only english)
340  * \param[in] handler Handler of a livebox
341  * \param[out] cluster Storage(memory) for containing the cluster name
342  * \param[out] category Storage(memory) for containing the category name
343  * \return int
344  */
345 extern int livebox_get_group(struct livebox *handler, char ** const cluster, char ** const category);
346
347 /*!
348  * \brief Get the period of this livebox handler
349  * \param[in] handler Handler of a livebox
350  * \return double Current update period of a livebox
351  */
352 extern double livebox_period(struct livebox *handler);
353
354 /*!
355  * \brief Change the update period
356  * \param[in] handler Handler of a livebox
357  * \param[in] period New update period of a livebox
358  * \param[in] cb Result callback of changing the update period of this livebox
359  * \param[in] data User data for the result callback
360  * \return int
361  */
362 extern int livebox_set_period(struct livebox *handler, double period, ret_cb_t cb, void *data);
363
364 /*!
365  * \brief Is this an text type livebox?
366  * \param[in] handler
367  * \return content_type
368  */
369 extern enum livebox_lb_type livebox_lb_type(struct livebox *handler);
370
371 /*!
372  * \brief Is this livebox is created by a user?
373  * \param[in] handler
374  * \return int
375  */
376 extern int livebox_is_user(struct livebox *handler);
377
378 /*!
379  * \brief Get the content information string of given livebox
380  * \param[in] handler
381  * \return content
382  */
383 extern const char *livebox_content(struct livebox *handler);
384
385 /*!
386  * \brief Get the sub cluster title string of given livebox
387  * \param[in] handler
388  * \return sub cluster title
389  */
390 extern const char *livebox_category_title(struct livebox *handler);
391
392 /*!
393  * \brief Get the filename of given livebox, if it is an IMAGE type livebox
394  * \param[in] handler
395  * \return filename
396  */
397 extern const char *livebox_filename(struct livebox *handler);
398
399 /*!
400  * \brief Get the package name of given livebox handler
401  * \param[in] handler
402  * \return pkgname
403  */
404 extern const char *livebox_pkgname(struct livebox *handler);
405
406 /*!
407  * \brief Get the priority of a current content.
408  * \param[in] handler
409  * \return priority
410  */
411 extern double livebox_priority(struct livebox *handler);
412
413 /*!
414  * \brief Acquire the buffer of given livebox (Only for the buffer type)
415  * \param[in] handler
416  * \return address of a FB
417  */
418 extern void *livebox_acquire_fb(struct livebox *handler);
419
420 /*!
421  * \brief Release the buffer of a livebox (Only for the buffer type)
422  * \param[in] buffer
423  * \return int
424  */
425 extern int livebox_release_fb(void *buffer);
426
427 /*!
428  * \brief Get the reference count of Livebox buffer (Only for the buffer type)
429  * \param[in] buffer
430  * \return int
431  */
432 extern int livebox_fb_refcnt(void *buffer);
433
434 /*!
435  * \brief Acquire the buffer of a PD frame (Only for the buffer type)
436  * \param[in] handler
437  * \return int
438  */
439 extern void *livebox_acquire_pdfb(struct livebox *handler);
440
441 /*!
442  * \brief Release the acquired buffer of the PD Frame (Only for the buffer type)
443  * \param[in] buffer
444  * \return int
445  */
446 extern int livebox_release_pdfb(void *buffer);
447
448 /*!
449  * \brief Reference count of given PD buffer (Only for the buffer type)
450  * \param[in] buffer
451  * \return int
452  */
453 extern int livebox_pdfb_refcnt(void *buffer);
454
455 /*!
456  * \brief Get the size of the Livebox
457  * \param[in] handler
458  * \param[out] w
459  * \param[out] h
460  * \return int
461  */
462 extern int livebox_size(struct livebox *handler);
463
464 /*!
465  * \brief Get the size of the Progressive Disclosure
466  * \param[in] handler
467  * \param[out] w
468  * \param[out] h
469  * \return int
470  */
471 extern int livebox_get_pdsize(struct livebox *handler, int *w, int *h);
472
473 /*!
474  * \brief List of supported sizes of given handler
475  * \param[in] handler
476  * \param[out] cnt
477  * \param[out] w
478  * \param[out] h
479  * \return int
480  */
481 extern int livebox_get_supported_sizes(struct livebox *handler, int *cnt, int *size_list);
482
483 /*!
484  * \brief BUFFER SIZE of the livebox if it is a buffer type
485  * \param[in] handler
486  * \return int
487  */
488 extern int livebox_lbfb_bufsz(struct livebox *handler);
489
490 /*!
491  * \brief BUFFER SIZE of the progiressive disclosure if it is a buffer type
492  * \param[in] handler
493  * \return int
494  */
495 extern int livebox_pdfb_bufsz(struct livebox *handler);
496
497 /*!
498  * \brief Send the content event (for buffer type) to provider(livebox)
499  * \param[in] handler
500  * \param[in] type
501  * \param[in] x
502  * \param[in] y
503  * \return
504  */
505 extern int livebox_content_event(struct livebox *handler, enum content_event_type type, double x, double y);
506
507 /*!
508  * \brief Send the access event(for buffer type) to provider(livebox).
509  * \param[in] handler
510  * \param[in] access_event_type
511  * \param[in] x
512  * \param[in] y
513  * \param[in] cb
514  * \param[in] data
515  * \return
516  */
517 extern int livebox_access_event(struct livebox *handler, enum access_event_type type, double x, double y, ret_cb_t cb, void *data);
518
519 /*!
520  * \brief Do pin up or not.
521  * \param[in] handler
522  * \param[in] flag
523  * \param[in] cb
524  * \param[in] data
525  * \return int
526  */
527 extern int livebox_set_pinup(struct livebox *handler, int flag, ret_cb_t cb, void *data);
528
529 /*!
530  * \brief Check the PIN-UP status of given handler
531  * \param[in] handler
532  * \return int
533  */
534 extern int livebox_is_pinned_up(struct livebox *handler);
535
536 /*!
537  * \brief Check the PINUP feature availability of the given handler
538  * \param[in] handler
539  * \return int
540  */
541 extern int livebox_has_pinup(struct livebox *handler);
542
543 /*!
544  * \brief Check the PD existence of given handler
545  * \param[in] handler
546  * \return int
547  */
548 extern int livebox_has_pd(struct livebox *handler);
549
550 /*!
551  * \brief Create the PD of given handler
552  * \param[in] handler
553  * \param[in] cb
554  * \param[in] data
555  * \return int
556  */
557 extern int livebox_create_pd(struct livebox *handler, ret_cb_t cb, void *data);
558
559 /*!
560  * \brief Create the PD of given handler with the relative position from livebox
561  * \param[in] handler
562  * \param[in] x 0.0 ~ 1.0
563  * \param[in] y 0.0 ~ 1.0
564  * \param[in] cb
565  * \param[in] data
566  * \return int
567  */
568 extern int livebox_create_pd_with_position(struct livebox *handler, double x, double y, ret_cb_t cb, void *data);
569
570 /*!
571  * \brief PD position is updated.
572  * \param[in] handler
573  * \param[in] x 0.0 ~ 1.0
574  * \param[in] y 0.0 ~ 1.0
575  * \return int 0 if succeed to send request for updating position of the PD.
576  */
577 extern int livebox_move_pd(struct livebox *handler, double x, double y);
578
579 /*!
580  * \brief Destroy the PD of given handler if it is created.
581  * \param[in] handler
582  * \param[in] cb
583  * \param[in] data
584  * \return int
585  */
586 extern int livebox_destroy_pd(struct livebox *handler, ret_cb_t cb, void *data);
587
588 /*!
589  * \brief Check the create status of given livebox handler
590  * \param[in] handler
591  * \return int
592  */
593 extern int livebox_pd_is_created(struct livebox *handler);
594
595 /*!
596  * \brief Check the content type of the progressive disclosure of given handler
597  * \param[in] handler
598  * \return int
599  */
600 extern enum livebox_pd_type livebox_pd_type(struct livebox *handler);
601
602 /*!
603  * \brief Check the existence of a livebox about given package name
604  * \param[in] pkgname
605  * \return int
606  */
607 extern int livebox_is_exists(const char *pkgname);
608
609 /*!
610  * \brief Set function table for parsing the text content of a livebox
611  * \param[in] handler
612  * \param[in] ops
613  * \return int
614  */
615 extern int livebox_set_text_handler(struct livebox *handler, struct livebox_script_operators *ops);
616
617 /*!
618  * \brief Set function table for parsing the text content of a Progressive Disclosure
619  * \param[in] handler
620  * \param[in] ops
621  * \return int
622  */
623 extern int livebox_set_pd_text_handler(struct livebox *handler, struct livebox_script_operators *ops);
624
625 /*!
626  * \brief Emit a text signal to given livebox only if it is a text type.
627  * \param[in] handler
628  * \param[in] emission
629  * \param[in] source
630  * \param[in] sx
631  * \param[in] sy
632  * \param[in] ex
633  * \param[in] ey
634  * \param[in] cb
635  * \param[in] data
636  */
637 extern int livebox_emit_text_signal(struct livebox *handler, const char *emission, const char *source, double sx, double sy, double ex, double ey, ret_cb_t cb, void *data);
638
639 /*!
640  * \brief Set a private data pointer to carry it using given handler
641  * \param[in] handler
642  * \param[in] data
643  * \return int
644  */
645 extern int livebox_set_data(struct livebox *handler, void *data);
646
647 /*!
648  * \brief Get private data pointer which is carried by given handler
649  * \param[in] handler
650  * \return int
651  */
652 extern void *livebox_get_data(struct livebox *handler);
653
654 /*!
655  * \brief Subscribe the event for liveboxes only in given cluster and sub-cluster
656  * \param[in] cluster   "*" can be used for subscribe all cluster's liveboxes event.
657  *                      If you use the "*", value in the category will be ignored.
658  * \param[in] category  "*" can be used for subscribe liveboxes events of all category(sub-cluster) in given "cluster"
659  * \return int Success 0, fails error code
660  */
661 extern int livebox_subscribe_group(const char *cluster, const char *category);
662
663 /*!
664  * \brief Unsubscribe the event for the liveboxes, but you will receive already added liveboxes event.
665  * \param[in] cluster   "*" can be used for subscribe all cluster's liveboxes event.
666  *                      If you use the "*", value in the category will be ignored.
667  * \param[in] category  "*" can be used for subscribe all sub-cluster's liveboxes event in given "cluster"
668  * \return int Success 0, fails error code
669  */
670 extern int livebox_unsubscribe_group(const char *cluster, const char *category);
671
672 /*!
673  * \brief Refresh the group(cluster/sub-cluser(aka. category))
674  * \param[in] cluster Cluster ID
675  * \param[in] category Sub-cluster ID
676  * \return int Success 0 or negative value
677  */
678 extern int livebox_refresh_group(const char *cluster, const char *category);
679
680 /*!
681  * \brief Refresh a livebox
682  * \param[in] handler
683  * \return int Success 0 or negative value
684  */
685 extern int livebox_refresh(struct livebox *handler);
686
687 /*!
688  * \brief Pixmap Id of a livebox content
689  * \param[in] handler
690  * \return int
691  * \sa livebox_pd_pixmap
692  */
693 extern int livebox_lb_pixmap(const struct livebox *handler);
694
695 /*!
696  * \brief Pixmap Id of a PD content
697  * \param[in] handler
698  * \return int
699  * \sa livebox_lb_pixmap
700  */
701 extern int livebox_pd_pixmap(const struct livebox *handler);
702
703 /*!
704  * \brief
705  * \param[in] handler
706  * \param[in] cb
707  * \param[in] data
708  * \return int
709  * \sa livebox_release_pd_pixmap
710  * \sa livebox_acquire_lb_pixmap
711  */
712 extern int livebox_acquire_pd_pixmap(struct livebox *handler, ret_cb_t cb, void *data);
713
714 /*!
715  * \brief Release the acquired pixmap ID
716  * \param[in] handler
717  * \param[in] pixmap
718  * \return int
719  * \sa livebox_acquire_pd_pixmap
720  * \sa livebox_release_lb_pixmap
721  */
722 extern int livebox_release_pd_pixmap(struct livebox *handler, int pixmap);
723
724 /*!
725  * \brief
726  * \param[in] handler
727  * \param[in] cb
728  * \param[in] data
729  * \return int
730  * \sa livebox_release_lb_pixmap
731  * \sa livebox_acquire_pd_pixmap
732  */
733 extern int livebox_acquire_lb_pixmap(struct livebox *handler, ret_cb_t cb, void *data);
734
735 /*!
736  * \brief
737  * \param[in] handler
738  * \param[in] pixmap
739  * \return int
740  * \sa livebox_acquire_lb_pixmap
741  * \sa livebox_release_pd_pixmap
742  */
743 extern int livebox_release_lb_pixmap(struct livebox *handler, int pixmap);
744
745 /*!
746  * \brief Update the visible state of a livebox
747  * \param[in] handler Handler of a livebox
748  * \param[in] state Configure the current visible state of a livebox
749  * \return int
750  */
751 extern int livebox_set_visibility(struct livebox *handler, enum livebox_visible_state state);
752
753 /*!
754  * \brief Current visible state of a livebox
755  * \param[in] handler Handler of a livebox
756  * \return enum visible state
757  */
758 extern enum livebox_visible_state livebox_visibility(struct livebox *handler);
759
760 /*!
761  * \brief Set the update mode of current livebox
762  *        if you set 1 for active update mode, you should get buffer without updated event from provider.
763  *        But is passive mode, you have to update content of a box when you get updated event.
764  *        Default is Passive mode.
765  * \param[in] handler Handler of a livebox
766  * \param[in] active_update 1 means active update, 0 means passive update (default)
767  * \param[in] cb Result callback function
768  * \param[in] data Callback data
769  * \return int
770  */
771 extern int livebox_set_update_mode(struct livebox *handler, int active_update, ret_cb_t cb, void *data);
772
773 /*!
774  * \brief Is this box in the active update mode?
775  * \param[in] handler HAndler of a livebox
776  * \return int 0 if passive mode or 1 if active mode or error code
777  */
778 extern int livebox_is_active_update(struct livebox *handler);
779
780 #ifdef __cplusplus
781 }
782 #endif
783
784 #endif
785 /* End of a file */