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