Add TIME_CHANGED event
[apps/livebox/livebox.git] / include / livebox.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 #ifndef __LIVEBOX_HELPER_H
18 #define __LIVEBOX_HELPER_H
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 struct livebox_buffer; /* Defined by provider */
25
26 /*!
27  * \brief
28  * Return values of livebox programming interfaces.
29  */
30 extern const int DONE; /*!< Operation is successfully done */
31 extern const int NEED_TO_SCHEDULE; /*!< Need to call the livebox_need_to_update and livebox_update_content */
32 extern const int OUTPUT_UPDATED; /*!< Contents is updated */
33 extern const int NEED_TO_CREATE; /*!< Need to create a new instance */
34 extern const int NEED_TO_DESTROY; /*!< Need to destroy this instance */
35
36 extern const int LB_SYS_EVENT_FONT_CHANGED; /*!< System font is changed */
37 extern const int LB_SYS_EVENT_LANG_CHANGED; /*!< System language is changed */
38 extern const int LB_SYS_EVENT_TIME_CHANGED; /*!< System time is changed */
39 extern const int LB_SYS_EVENT_PAUSED;
40 extern const int LB_SYS_EVENT_RESUMED;
41
42 #define LB_DESC_TYPE_TEXT "text"
43 #define LB_DESC_TYPE_IMAGE "image"
44 #define LB_DESC_TYPE_SIGNAL "signal"
45 #define LB_DESC_TYPE_INFO "info"
46 #define LB_DESC_TYPE_DRAG "drag"
47 #define LB_DESC_TYPE_SCRIPT "script"
48
49 /*!
50  * \brief
51  * Extra event informatino for livebox_content_event interface function
52  */
53 #ifndef __PROVIDER_H
54 struct event_info {
55         struct {
56                 double x;
57                 double y;
58                 int down;
59         } pointer; /*!< Down/Up state and mouse position */
60
61         struct {
62                 double sx;
63                 double sy;
64                 double ex;
65                 double ey;
66         } part; /*!< Geometry of event received part */
67 };
68 #endif
69
70 struct livebox_desc;
71
72 /*!
73  * \brief Update a description file.
74  * \param[in] filename
75  * \param[in] for_pd
76  * \return handle
77  */
78 extern struct livebox_desc *livebox_desc_open(const char *filename, int for_pd);
79
80 /*!
81  * \brief Complete the description file updating
82  * \param[in] handle
83  * \return int
84  */
85 extern int livebox_desc_close(struct livebox_desc *handle);
86
87 /*!
88  * \brief Set the category information of current description data
89  * \param[in] handle
90  * \param[in] id
91  * \param[in] category
92  * \return int
93  */
94 extern int livebox_desc_set_category(struct livebox_desc *handle, const char *id, const char *category);
95
96 /*!
97  * \brief Set the content size
98  * \param[in] handle
99  * \param[in] id
100  * \param[in] w
101  * \param[in] h
102  * \return int
103  */
104 extern int livebox_desc_set_size(struct livebox_desc *handle, const char *id, int w, int h);
105
106 /*!
107  * \breif Set the target id of given block
108  *        Only available for the script block
109  * \param[in] handle
110  * \param[in] idx
111  * \param[in] id
112  * \return ret
113  */
114 extern int livebox_desc_set_id(struct livebox_desc *handle, int idx, const char *id);
115
116 /*!
117  * \brief Add a new block
118  * \param[in] handle
119  * \param[in] id ID of source script object
120  * \param[in] type image|text|script|signal|...
121  * \param[in] part target part to update with given content(data)
122  * \param[in] data content for specified part
123  * \param[in] group script group name
124  * \return idx Index of current description block
125  */
126 extern int livebox_desc_add_block(struct livebox_desc *handle, const char *id, const char *type, const char *part, const char *data, const char *group);
127
128 /*!
129  * \brief Delete a added block
130  * \param[in] handle
131  * \param[in] idx Index of added block
132  * \return int
133  */
134 extern int livebox_desc_del_block(struct livebox_desc *handle, int idx);
135
136 /*!
137  * \brief Replace '\n' with '<br>'
138  * \param[in] str Source string
139  * \return char* allocated string
140  */
141 extern char *livebox_util_nl2br(const char *str);
142
143
144 /*!
145  * Interfaces for direct buffer management (Available only for the PD area)
146  */
147
148
149 #ifndef __PROVIDER_BUFFER_H
150 /*!
151  * \NOTE
152  * This enumeration value should be sync'd with provider
153  */
154 enum buffer_event {
155         BUFFER_EVENT_ENTER, /*!< */
156         BUFFER_EVENT_LEAVE, /*!< */
157         BUFFER_EVENT_DOWN, /*!< */
158         BUFFER_EVENT_MOVE, /*!< */
159         BUFFER_EVENT_UP, /*!< */
160 };
161 #endif
162
163 /*!
164  * \brief
165  * \param[in] filename
166  * \param[in] width
167  * \param[in] height
168  * \param[in] handler
169  * \param[in] data
170  * \return handler
171  */
172 extern struct livebox_buffer *livebox_acquire_buffer(const char *filename, int is_pd, int width, int height, int (*handler)(struct livebox_buffer *, enum buffer_event, double, double, double, void *), void *data);
173
174 /*!
175  * \param[in] filename
176  * \return pixmap ID
177  */
178 extern unsigned long livebox_pixmap_id(struct livebox_buffer *handle);
179
180 /*!
181  * \brief
182  * \param[in] handle
183  * \return int
184  */
185 extern int livebox_release_buffer(struct livebox_buffer *handle);
186
187 /*!
188  * \brief
189  * \param[in] handle
190  * \return void* buffer
191  */
192 extern void *livebox_ref_buffer(struct livebox_buffer *handle);
193
194 /*!
195  * \brief
196  * \param[in] buffer
197  * \return int
198  */
199 extern int livebox_unref_buffer(void *buffer);
200
201 /*!
202  * \brief
203  * \param[in] handler
204  * \return int
205  */
206 extern int livebox_sync_buffer(struct livebox_buffer *handle);
207
208 /*!
209  * \brief
210  * \param[in] filename
211  * \return int
212  */
213 extern int livebox_request_update(const char *filename);
214
215 #ifdef __cplusplus
216 }
217 #endif
218
219 #endif
220 /* End of a file */