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