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