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