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