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