0d3d9dbf0c8d7bad9851a16d1fff10b4c0a16751
[platform/framework/web/livebox-viewer.git] / include / livebox_internal.h
1 /*
2  * Copyright 2012  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 extern int lb_set_group(struct livebox *handler, const char *cluster, const char *category);
18 extern void lb_set_size(struct livebox *handler, int w, int h);
19 extern void lb_set_pdsize(struct livebox *handler, int w, int h);
20 extern void lb_invoke_event_handler(struct livebox *handler, enum livebox_event_type event);
21 extern void lb_invoke_fault_handler(enum livebox_fault_type type, const char *pkgname, const char *filename, const char *function);
22 extern int lb_set_content(struct livebox *handler, const char *content);
23 extern int lb_set_title(struct livebox *handler, const char *title);
24 extern void lb_set_auto_launch(struct livebox *handler, const char *auto_launch);
25 extern struct livebox *lb_find_livebox(const char *pkgname, const char *filename);
26 extern struct livebox *lb_new_livebox(const char *pkgname, const char *filename, double timestamp);
27 extern struct livebox *lb_find_livebox_by_timestamp(double timestamp);
28 extern void lb_set_id(struct livebox *handler, const char *id);
29 extern void lb_set_size_list(struct livebox *handler, int size_list);
30 extern void lb_set_priority(struct livebox *handler, double priority);
31 extern int lb_set_lb_fb(struct livebox *handler, const char *filename);
32 extern int lb_set_pd_fb(struct livebox *handler, const char *filename);
33 extern struct fb_info *lb_get_pd_fb(struct livebox *handler);
34 extern struct fb_info *lb_get_lb_fb(struct livebox *handler);
35 extern void lb_set_user(struct livebox *handler, int user);
36 extern void lb_set_pinup(struct livebox *handler, int pinup);
37 extern void lb_set_text_lb(struct livebox *handler);
38 extern void lb_set_text_pd(struct livebox *handler);
39 extern int lb_text_lb(struct livebox *handler);
40 extern int lb_text_pd(struct livebox *handler);
41 extern void lb_set_period(struct livebox *handler, double period);
42 extern struct livebox *lb_ref(struct livebox *handler);
43 extern struct livebox *lb_unref(struct livebox *handler);
44 extern int lb_send_delete(struct livebox *handler, ret_cb_t cb, void *data);
45 extern int lb_delete_all(void);
46
47 enum lb_type { /*!< Must have to be sync with data-provider-master */
48         _LB_TYPE_NONE = 0x0,
49         _LB_TYPE_SCRIPT,
50         _LB_TYPE_FILE,
51         _LB_TYPE_TEXT,
52         _LB_TYPE_BUFFER,
53 };
54
55 enum pd_type { /*!< Must have to be sync with data-provider-master */
56         _PD_TYPE_NONE = 0x0,
57         _PD_TYPE_SCRIPT,
58         _PD_TYPE_TEXT,
59         _PD_TYPE_BUFFER,
60 };
61
62 struct livebox {
63         int refcnt;
64         enum {
65                 CREATE = 0xBEEFbeef,
66                 DELETE = 0xDEADdead, /* Delete only for this client */
67                 DESTROYED = 0x00DEAD00,
68         } state;
69
70         char *cluster;
71         char *category;
72
73         char *pkgname;
74         char *id;
75         char *content;
76         char *title;
77         char *filename;
78
79         double timestamp;
80
81         enum livebox_visible_state visible;
82
83         int is_user;
84         int is_pd_created;
85         int is_pinned_up;
86
87         struct {
88                 enum lb_type type;
89                 union {
90                         struct fb_info *fb;
91                         struct livebox_script_operators ops;
92                 } data;
93
94                 int size_list;
95
96                 int width;
97                 int height;
98                 double priority;
99
100                 char *auto_launch;
101                 double period;
102                 int pinup_supported;
103                 int mouse_event;
104
105                 /* For the filtering event */
106                 double x;
107                 double y;
108         } lb;
109
110         struct {
111                 enum pd_type type;
112                 union {
113                         struct fb_info *fb;
114                         struct livebox_script_operators ops;
115                 } data;
116
117                 int width;
118                 int height;
119
120                 /* For the filtering event */
121                 double x;
122                 double y;
123         } pd;
124
125         int nr_of_sizes;
126
127         void *data;
128
129         ret_cb_t created_cb;
130         void *created_cbdata;
131
132         ret_cb_t deleted_cb;
133         void *deleted_cbdata;
134
135         ret_cb_t pinup_cb;
136         void *pinup_cbdata;
137
138         ret_cb_t group_changed_cb;
139         void *group_cbdata;
140
141         ret_cb_t period_changed_cb;
142         void *period_cbdata;
143
144         ret_cb_t pd_created_cb;
145         void *pd_created_cbdata;
146
147         ret_cb_t pd_destroyed_cb;
148         void *pd_destroyed_cbdata;
149 };
150
151 /* End of a file */