summaryrefslogtreecommitdiff
path: root/include/livebox.h
blob: c17c2224f7e8f9202e872eeec7560801f866020b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
/*
 * Copyright 2012  Samsung Electronics Co., Ltd
 *
 * Licensed under the Flora License, Version 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.tizenopensource.org/license
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __LIVEBOX_HELPER_H
#define __LIVEBOX_HELPER_H

#ifdef __cplusplus
extern "C" {
#endif

struct livebox_buffer; /* Defined by provider */

/*!
 * \brief
 * Return values of livebox programming interfaces.
 */
extern const int DONE; /*!< Operation is successfully done */
extern const int NEED_TO_SCHEDULE; /*!< Need to call the livebox_need_to_update and livebox_update_content */
extern const int OUTPUT_UPDATED; /*!< Contents is updated */
extern const int NEED_TO_CREATE; /*!< Need to create a new instance */
extern const int NEED_TO_DESTROY; /*!< Need to destroy this instance */

extern const int LB_SYS_EVENT_FONT_CHANGED; /*!< System font is changed */
extern const int LB_SYS_EVENT_LANG_CHANGED; /*!< System language is changed */
extern const int LB_SYS_EVENT_PAUSED;
extern const int LB_SYS_EVENT_RESUMED;

#define LB_DESC_TYPE_TEXT "text"
#define LB_DESC_TYPE_IMAGE "image"
#define LB_DESC_TYPE_SIGNAL "signal"
#define LB_DESC_TYPE_INFO "info"
#define LB_DESC_TYPE_DRAG "drag"
#define LB_DESC_TYPE_SCRIPT "script"

/*!
 * \brief
 * Extra event informatino for livebox_content_event interface function
 */
#ifndef __PROVIDER_H
struct event_info {
	struct {
		double x;
		double y;
		int down;
	} pointer; /*!< Down/Up state and mouse position */

	struct {
		double sx;
		double sy;
		double ex;
		double ey;
	} part; /*!< Geometry of event received part */
};
#endif

struct livebox_desc;

/*!
 * \brief Update a description file.
 * \param[in] filename
 * \param[in] for_pd
 * \return handle
 */
extern struct livebox_desc *livebox_desc_open(const char *filename, int for_pd);

/*!
 * \brief Complete the description file updating
 * \param[in] handle
 * \return int
 */
extern int livebox_desc_close(struct livebox_desc *handle);

/*!
 * \brief Set the category information of current description data
 * \param[in] handle
 * \param[in] id
 * \param[in] category
 * \return int
 */
extern int livebox_desc_set_category(struct livebox_desc *handle, const char *id, const char *category);

/*!
 * \brief Set the content size
 * \param[in] handle
 * \param[in] id
 * \param[in] w
 * \param[in] h
 * \return int
 */
extern int livebox_desc_set_size(struct livebox_desc *handle, const char *id, int w, int h);

/*!
 * \breif Set the target id of given block
 *        Only available for the script block
 * \param[in] handle
 * \param[in] idx
 * \param[in] id
 * \return ret
 */
extern int livebox_desc_set_id(struct livebox_desc *handle, int idx, const char *id);

/*!
 * \brief Add a new block
 * \param[in] handle
 * \param[in] id ID of source script object
 * \param[in] type image|text|script|signal|...
 * \param[in] part target part to update with given content(data)
 * \param[in] data content for specified part
 * \param[in] group script group name
 * \return idx Index of current description block
 */
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);

/*!
 * \brief Delete a added block
 * \param[in] handle
 * \param[in] idx Index of added block
 * \return int
 */
extern int livebox_desc_del_block(struct livebox_desc *handle, int idx);

/*!
 * \brief Replace '\n' with '<br>'
 * \param[in] str Source string
 * \return char* allocated string
 */
extern char *livebox_util_nl2br(const char *str);


/*!
 * Interfaces for direct buffer management (Available only for the PD area)
 */


#ifndef __PROVIDER_BUFFER_H
/*!
 * \NOTE
 * This enumeration value should be sync'd with provider
 */
enum buffer_event {
	BUFFER_EVENT_ENTER, /*!< */
	BUFFER_EVENT_LEAVE, /*!< */
	BUFFER_EVENT_DOWN, /*!< */
	BUFFER_EVENT_MOVE, /*!< */
	BUFFER_EVENT_UP, /*!< */
};
#endif

/*!
 * \brief
 * \param[in] filename
 * \param[in] width
 * \param[in] height
 * \param[in] handler
 * \param[in] data
 * \return handler
 */
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);

/*!
 * \param[in] filename
 * \return pixmap ID
 */
extern unsigned long livebox_pixmap_id(struct livebox_buffer *handle);

/*!
 * \brief
 * \param[in] handle
 * \return int
 */
extern int livebox_release_buffer(struct livebox_buffer *handle);

/*!
 * \brief
 * \param[in] handle
 * \return void* buffer
 */
extern void *livebox_ref_buffer(struct livebox_buffer *handle);

/*!
 * \brief
 * \param[in] buffer
 * \return int
 */
extern int livebox_unref_buffer(void *buffer);

/*!
 * \brief
 * \param[in] handler
 * \return int
 */
extern int livebox_sync_buffer(struct livebox_buffer *handle);

/*!
 * \brief
 * \param[in] filename
 * \return int
 */
extern int livebox_request_update(const char *filename);

#ifdef __cplusplus
}
#endif

#endif
/* End of a file */