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