Sync with the latest one
[platform/framework/web/livebox-viewer.git] / include / livebox_internal.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 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 void lb_set_update_mode(struct livebox *handler, int active_mode);
44 extern struct livebox *lb_ref(struct livebox *handler);
45 extern struct livebox *lb_unref(struct livebox *handler);
46 extern int lb_send_delete(struct livebox *handler, int type, ret_cb_t cb, void *data);
47 extern int lb_delete_all(void);
48 extern void lb_set_filename(struct livebox *handler, const char *filename);
49 extern void lb_set_alt_info(struct livebox *handler, const char *icon, const char *name);
50 extern int lb_destroy_lock_file(struct livebox *info, int is_pd);
51 extern int lb_create_lock_file(struct livebox *info, int is_pd);
52
53 enum lb_type { /*!< Must have to be sync with data-provider-master */
54         _LB_TYPE_NONE = 0x0,
55         _LB_TYPE_SCRIPT,
56         _LB_TYPE_FILE,
57         _LB_TYPE_TEXT,
58         _LB_TYPE_BUFFER
59 };
60
61 enum pd_type { /*!< Must have to be sync with data-provider-master */
62         _PD_TYPE_NONE = 0x0,
63         _PD_TYPE_SCRIPT,
64         _PD_TYPE_TEXT,
65         _PD_TYPE_BUFFER
66 };
67
68 struct livebox {
69         int refcnt;
70         enum {
71                 CREATE = 0xBEEFbeef,
72                 DELETE = 0xDEADdead, /* Delete only for this client */
73                 DESTROYED = 0x00DEAD00
74         } state;
75
76         char *cluster;
77         char *category;
78
79         char *pkgname;
80         char *id;
81         char *content;
82         char *title;
83         char *filename;
84         char *icon;
85         char *name;
86
87         double timestamp;
88
89         enum livebox_visible_state visible;
90         enum livebox_delete_type delete_type;
91
92         int is_user;
93         int is_pd_created;
94         int is_pinned_up;
95         int is_active_update;
96
97         struct {
98                 enum lb_type type;
99                 union {
100                         struct fb_info *fb;
101                         struct livebox_script_operators ops;
102                 } data;
103
104                 int size_list;
105
106                 int width;
107                 int height;
108                 double priority;
109
110                 char *auto_launch;
111                 double period;
112                 int pinup_supported;
113                 int mouse_event;
114
115                 /* For the filtering event */
116                 double x;
117                 double y;
118                 char *lock;
119                 int lock_fd;
120         } lb;
121
122         struct {
123                 enum pd_type type;
124                 union {
125                         struct fb_info *fb;
126                         struct livebox_script_operators ops;
127                 } data;
128
129                 int width;
130                 int height;
131
132                 int default_width;
133                 int default_height;
134
135                 /* For the filtering event */
136                 double x;
137                 double y;
138                 char *lock;
139                 int lock_fd;
140         } pd;
141
142         int nr_of_sizes;
143
144         void *data;
145
146         ret_cb_t created_cb;
147         void *created_cbdata;
148
149         ret_cb_t deleted_cb;
150         void *deleted_cbdata;
151
152         ret_cb_t pinup_cb;
153         void *pinup_cbdata;
154
155         ret_cb_t group_changed_cb;
156         void *group_cbdata;
157
158         ret_cb_t period_changed_cb;
159         void *period_cbdata;
160
161         ret_cb_t size_changed_cb;
162         void *size_cbdata;
163
164         ret_cb_t pd_created_cb;
165         void *pd_created_cbdata;
166
167         ret_cb_t pd_destroyed_cb;
168         void *pd_destroyed_cbdata;
169
170         ret_cb_t update_mode_cb;
171         void *update_mode_cbdata;
172
173         ret_cb_t access_event_cb;
174         void *access_event_cbdata;
175
176         ret_cb_t key_event_cb;
177         void *key_event_cbdata;
178 };
179
180 /* End of a file */