fd14c0f359d00eb83720007de298f8eb5764f82d
[apps/native/widget/widget.git] / include / widget_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 /**
18  * Export by widget_service
19  */
20 #include <widget_buffer.h>
21 #include <widget_script.h>
22
23 #ifndef __WIDGET_UILITY_INTERNAL_H
24 #define __WIDGET_UILITY_INTERNAL_H
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 /**
31  * @file widget_internal.h
32  * @brief This file declares API of libwidget library
33  * @since_tizen 2.3.1
34  */
35
36 /**
37  * @addtogroup CAPI_WIDGET_UTILITY_MODULE
38  * @{
39  */
40
41 /**
42  * @internal
43  * @brief Definition for COLOR BLOCK.
44  * @since_tizen 2.3.1
45  */
46 #define WIDGET_DESC_TYPE_COLOR "color"
47
48 /**
49  * @internal
50  * @brief Definition for TEXT BLOCK.
51  * @since_tizen 2.3.1
52  */
53 #define WIDGET_DESC_TYPE_TEXT "text"
54
55 /**
56  * @internal
57  * @brief Definition for IMAGE BLOCK.
58  * @since_tizen 2.3.1
59  */
60 #define WIDGET_DESC_TYPE_IMAGE "image"
61
62 /**
63  * @internal
64  * @brief Definition for SIGNAL BLOCK.
65  * @since_tizen 2.3.1
66  */
67 #define WIDGET_DESC_TYPE_SIGNAL "signal"
68
69 /**
70  * @internal
71  * @brief Definition for INFO BLOCK.
72  * @since_tizen 2.3.1
73  */
74 #define WIDGET_DESC_TYPE_INFO "info"
75
76 /**
77  * @internal
78  * @brief Definition for DRAG BLOCK.
79  * @since_tizen 2.3.1
80  */
81 #define WIDGET_DESC_TYPE_DRAG "drag"
82
83 /**
84  * @internal
85  * @brief Definition for SCRIPT SCRIPT.
86  * @since_tizen 2.3.1
87  */
88 #define WIDGET_DESC_TYPE_SCRIPT "script"
89
90 /**
91  * @internal
92  * @brief Definition for ACCESSIBILITY INFORMATION BLOCK.
93  * @since_tizen 2.3.1
94  */
95 #define WIDGET_DESC_TYPE_ACCESS "access"
96
97 /**
98  * @internal
99  * @brief Definition for accessibility operation.
100  * @since_tizen 2.3.1
101  */
102 #define WIDGET_DESC_TYPE_ACCESS_OPERATION "access,operation"
103
104 /**
105  * @internal
106  * @brief Definition for set highlight on specified part.
107  * @since_tizen 2.3.1
108  */
109 #define WIDGET_DESC_DATA_ACCESS_OPERATION_HL_SET "set,hl"
110
111 /**
112  * @internal
113  * @brief Definition for remove highlight from specified part.
114  * @since_tizen 2.3.1
115  */
116 #define WIDGET_DESC_DATA_ACCESS_OPERATION_HL_UNSET "unset,hl"
117
118 /**
119  * @internal
120  * @brief Definition for move the highlight to next part.
121  * @since_tizen 2.3.1
122  */
123 #define WIDGET_DESC_DATA_ACCESS_OPERATION_HL_NEXT "next,hl"
124
125 /**
126  * @internal
127  * @brief Definition for move the highlight to previous part.
128  * @since_tizen 2.3.1
129  */
130 #define WIDGET_DESC_DATA_ACCESS_OPERATION_HL_PREV "prev,hl"
131
132 /**
133  * @internal
134  * @brief Definition for reset the chain of accessibility highlight list.
135  * @since_tizen 2.3.1
136  */
137 #define WIDGET_DESC_DATA_ACCESS_OPERATION_RESET "reset,focus"
138
139 /**
140  * @internal
141  * @brief Definition for specify the highlight move option.
142  * @details If the highlight list reaches to the last object, move back to the first object.
143  * @since_tizen 2.3.1
144  */
145 #define WIDGET_DESC_OPTION_ACCESS_HL_LOOP "cycle"
146
147 /**
148  * @internal
149  * @brief Definition for specify the highlight move option.
150  * @details If the highlight list reaches to the last object(or the first object),
151  * the "prev,hl", "next,hl" will be failed.
152  * @since_tizen 2.3.1
153  */
154 #define WIDGET_DESC_OPTION_ACCESS_HL_NOLOOP "no,cycle"
155
156 /**
157  * @internal
158  * @brief Return values of widget programming interfaces for the plug-in type widgets
159  * @since_tizen 2.3.1
160  */
161 typedef enum widget_api_result {
162         WIDGET_DONE = 0x00, /**< Operation is successfully done. */
163         WIDGET_OUTPUT_UPDATED = 0x01,  /**< Contents are updated. */
164         WIDGET_NEED_TO_SCHEDULE = 0x02, /**< Need to call the widget_need_to_update and widget_update_content. */
165         WIDGET_NEED_TO_CREATE = 0x04, /**< Need to create a new instance. */
166         WIDGET_NEED_TO_DESTROY = 0x08, /**< Need to destroy this instance. */
167         WIDGET_FORCE_TO_SCHEDULE = 0x10, /**< Need to do force update. */
168 } widget_api_result_e;
169
170 /**
171  * @internal
172  * @brief System event type for the plug-in type widgets
173  * @since_tizen 2.3.1
174  */
175 typedef enum widget_system_event {
176         WIDGET_SYS_EVENT_FONT_CHANGED = 0x01, /**< System font is changed. */
177         WIDGET_SYS_EVENT_LANG_CHANGED = 0x02, /**< System language is changed. */
178         WIDGET_SYS_EVENT_TIME_CHANGED = 0x04, /**< System time is changed. */
179         WIDGET_SYS_EVENT_REGION_CHANGED = 0x08, /**< Region changed. */
180         WIDGET_SYS_EVENT_TTS_CHANGED = 0x10, /**< Accessibility mode changed. */
181         WIDGET_SYS_EVENT_PAUSED = 0x0100, /**< widget is paused. */
182         WIDGET_SYS_EVENT_RESUMED = 0x0200, /**< widget is resumed. */
183         WIDGET_SYS_EVENT_MMC_STATUS_CHANGED = 0x0400, /**< MMC Status change event. */
184         WIDGET_SYS_EVENT_DELETED = 0x0800, /**< widget instance is removed from a viewer. */
185         WIDGET_SYS_EVENT_ORIENTATION_CHANGED = 0x01000, /**< Orientation is changed */
186 } widget_system_event_e;
187
188 /**
189  * @internal
190  * @brief widget description data handle.
191  * @since_tizen 2.3.1
192  */
193 typedef struct widget_desc *widget_desc_h;
194
195 /**
196  * @internal
197  * @brief Flush Callback for snapshot window
198  * @since_tizen 2.3.1
199  */
200 typedef void (*widget_flush_cb)(void *snapshot_window, const char *id, int status, void *data);
201
202 /**
203  * @internal
204  * @brief Updates a description file.
205  * @since_tizen 2.3.1
206  * @remarks Must be used only by Inhouse widget.
207  * @param[in] id widget Instance Id
208  * @param[in] gbar 1 for Glance Bar or 0
209  * @privlevel public
210  * @privilege %http://tizen.org/privilege/widget.provider
211  * @return Handle of desc instance
212  * @retval @c NULL Failed to create a desc instance, get_last_result() will returns reason of failure
213  * @pre Should be loaded by data-provider-slave.
214  * @post Should be destroyed(flushed) using widget_desc_close() API.
215  * @see widget_desc_close()
216  */
217 extern widget_desc_h widget_desc_open(const char *id, int gbar);
218
219 /**
220  * @internal
221  * @brief Completes the description file update.
222  * @details Only if this API is called, the description data will be applied to the content of widget (or GBar).
223  * @since_tizen 2.3.1
224  * @remarks Must be used only by Inhouse widget.
225  * @param[in] handle Handle which is created by widget_desc_open() function
226  * @privlevel public
227  * @privilege %http://tizen.org/privilege/widget.provider
228  * @return 0 on success, otherwise a negative error value
229  * @retval #WIDGET_ERROR_NONE If the flushing description data is successfully done
230  * @retval #WIDGET_ERROR_INVALID_PARAMETER If the given handle is not valid
231  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
232  * @pre Handle must be created by widget_desc_open()
233  * @post Handle must not be used after return from this function.
234  * @see widget_desc_open()
235  */
236 extern int widget_desc_close(widget_desc_h handle);
237
238 /**
239  * @internal
240  * @brief Sets the category information of current description data.
241  * @details Creates a new description block for updating category information of layout object.
242  * @since_tizen 2.3.1
243  * @param[in] handle Handle which is created by widget_desc_open() function
244  * @param[in] id Id string of target object
245  * @param[in] category Category string that will be used by layout object
246  * @return 0 on success, otherwise a negative error value
247  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid handle
248  * @retval #WIDGET_ERROR_OUT_OF_MEMORY Memory is not enough to add this block
249  * @retval index Index(>=0) of added block, which can be used by widget_desc_set_id()
250  * @pre Must be called after create a handle using widget_desc_open()
251  * @see widget_desc_set_id()
252  */
253 extern int widget_desc_set_category(widget_desc_h handle, const char *id, const char *category);
254
255 /**
256  * @internal
257  * @brief Sets the content size.
258  * @details Sets the content size of layout.
259  * @since_tizen 2.3.1
260  * @param[in] handle Handle which is created by widget_desc_open() function
261  * @param[in] id Id string of target object
262  * @param[in] w Width in pixel
263  * @param[in] h Height in pixel
264  * @return 0 on success, otherwise a negative error value
265  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
266  * @retval #WIDGET_ERROR_OUT_OF_MEMORY Not enough memory to add a new block
267  * @retval index Index(>=0) of added block Successfully added
268  * @see widget_desc_open()
269  * @see widget_desc_set_id()
270  */
271 extern int widget_desc_set_size(widget_desc_h handle, const char *id, int w, int h);
272
273 /**
274  * @internal
275  * @brief Sets the target id of the given block.
276  * @details Only available for the script block.
277  * @since_tizen 2.3.1
278  * @param[in] handle Handle which is created by widget_desc_open() function
279  * @param[in] idx Index of target block
280  * @param[in] id Id String which will be used by other widget_desc_XXX functions
281  * @return 0 on success, otherwise a negative error value
282  * @retval #WIDGET_ERROR_NONE Id is successfully updated for given idx of desc block
283  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
284  * @retval #WIDGET_ERROR_NOT_EXIST Given index of desc block is not exists
285  * @pre Desc block should be exists which has given index "idx".
286  * @post Specified Id string("id") can be used by other widget_desc_XXXX functions.
287  * @see widget_desc_open()
288  * @see widget_desc_set_id()
289  */
290 extern int widget_desc_set_id(widget_desc_h handle, int idx, const char *id);
291
292 /**
293  * @internal
294  * @brief Adds a new block.
295  * @since_tizen 2.3.1
296  * @param[in] handle Handle which is created by the widget_desc_open() function
297  * @param[in] id ID of source script object
298  * @param[in] type Type (image|text|script|signal|.. etc)
299  * @param[in] part Target part to update with given content(data)
300  * @param[in] data Content for specified part
301  * @param[in] option Option for the block. (script: group, image: option, ...)
302  * @return Index of current description block
303  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
304  * @retval #WIDGET_ERROR_OUT_OF_MEMORY Not enough memory to add a new desc block
305  * @retval index Index(>=0) of added desc block
306  * @pre Handle must be created using widget_desc_open.
307  * @see widget_desc_set_id()
308  * @see widget_desc_del_block()
309  */
310 extern int widget_desc_add_block(widget_desc_h handle, const char *id, const char *type, const char *part, const char *data, const char *option);
311
312 /**
313  * @internal
314  * @brief Deletes an added block.
315  * @since_tizen 2.3.1
316  * @details If you discard the added desc block, use this API and the index of the created desc block.
317  * @param[in] handle Handle which is created by widget_desc_open() function
318  * @param[in] idx Index of added block, returned from widget_desc_add_block(), widget_desc_set_size(), widget_desc_set_category(), etc
319  * @return 0 on success, otherwise a negative error value
320  * @retval #WIDGET_ERROR_NONE Successfully deleted
321  * @retval #WIDGET_ERROR_NOT_EXIST Given index of desc block is not exists
322  * @pre Index must be exists.
323  * @see widget_desc_add_block()
324  * @see widget_desc_open()
325  */
326 extern int widget_desc_del_block(widget_desc_h handle, int idx);
327
328 /**
329  * @internal
330  * @brief Structure for a widget buffer defined by a provider.
331  * @since_tizen 2.3.1
332  */
333 typedef struct widget_buffer *widget_buffer_h;
334
335 /**
336  * @internal
337  * @brief Return values of widget programming interfaces: Using network.
338  * @since_tizen 2.3.1
339  */
340 extern const int WIDGET_USE_NET;
341
342 /**
343  * @internal
344  * @brief Notifies the updated content to the provider.
345  * @details Forcedly notifies the updated contents.
346  *    This function can be used from async callback function to notify the updated content.
347  * @since_tizen 2.3.1
348  * @param[in] id Instance Id which is passed to you via the first parameter of every widget_XXXX interface functions
349  * @param[in] gbar 1 for updating content of Glance Bar or 0(for content of widget)
350  * @return 0 on success, otherwise a negative error value
351  * @retval #WIDGET_ERROR_OUT_OF_MEMORY Not enough memory
352  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
353  * @retval #WIDGET_ERROR_IO_ERROR I/O failed, Cannot access given resource file(id)
354  * @retval #WIDGET_ERROR_NONE Successfully notified
355  * @pre This API only can be used after loaded into the data-provider-slave process.
356  */
357 extern int widget_content_is_updated(const char *id, int gbar);
358
359 /**
360  * @internal
361  * @brief Acquires a buffer for GBar or widget, currently only the GBar is supported.
362  * @since_tizen 2.3.1
363  * @param[in] id Instance Id which is passed to you via the first parameter of every widget_XXXX interface functions
364  * @param[in] gbar 1 for Glance Bar or 0 for widget
365  * @param[in] width Width in pixel
366  * @param[in] height Height in pixel
367  * @param[in] pixels Size of a pixel in bytes
368  * @param[in] handler Event handling callback
369  * @param[in] data User data for event handling callback
370  * @privlevel public
371  * @privilege %http://tizen.org/privilege/widget.provider
372  * @return Buffer handle
373  * @retval @c NULL Failed to acquire buffer, get_last_result() will returns reason of failure.
374  * @retval handler Handle object
375  * @pre Given instance must be specify its type as buffer. or this API will be fail.
376  * @post Allocated buffer object must be released via widget_release_buffer().
377  * @see widget_release_buffer()
378  */
379 extern widget_buffer_h widget_create_buffer(const char *id, int gbar, int auto_align, int (*handler)(widget_buffer_h, widget_buffer_event_data_t, void *), void *data);
380
381 /**
382  * @internal
383  * @brief Acquire a buffer for GBar or widget.
384  * @since_tizen 2.3.1
385  * @param[in] handle Buffer handle
386  * @param[in] idx Index of a buffer, WIDGET_PRIMARY_BUFFER is used for accessing primary buffer
387  * @param[in] width Width of a buffer
388  * @param[in] height Height of a buffer
389  * @param[in] pixels Pixel size in byte
390  * @privlevel public
391  * @privilege %http://tizen.org/privilege/widget.provider
392  * @return 0 on success, otherwise a negative error value
393  * @retval #WIDGET_ERROR_NONE Successfully allocated
394  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
395  * @retval #WIDGET_ERROR_FAULT Unrecoverable error occurred
396  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
397  * @pre widget_create_buffer() must be called
398  * @see widget_create_buffer()
399  * @see widget_release_buffer()
400  */
401 extern int widget_viewer_acquire_buffer(widget_buffer_h handle, int idx, int width, int height, int pixels);
402
403 /**
404  * @internal
405  * @brief Acquires the Id of Resource (window system).
406  * @details Only if the provider uses Resource for providing render buffer.
407  * @since_tizen 2.3.1
408  * @remarks Pixmap Id can be destroyed if you call the widget_release_buffer(). Then this Resource Id is not guaranteed to use.
409  * @param[in] handle Buffer handle
410  * @param[in] idx Index of a buffer, #c WIDGET_PRIMARY_BUFFER is used for accessing the primary buffer
411  * @return unsigned int Resource Id
412  * @retval >0 Resource Id
413  * @retval 0 Failed to get Resource Id
414  * @pre The system must be set to use the Resource Id method for content sharing.
415  * @see widget_acquire_buffer()
416  */
417 extern unsigned int widget_viewer_get_resource_id(widget_buffer_h handle, int idx);
418
419 /**
420  * @internal
421  * @brief Releases the buffer of widget.
422  * @since_tizen 2.3.1
423  * @param[in] handle Buffer handle
424  * @param[in] idx Index of a buffer, #c WIDGET_PRIMARY_BUFFER is used for accessing the primary buffer
425  * @privlevel public
426  * @privilege %http://tizen.org/privilege/widget.provider
427  * @return 0 on success, otherwise a negative error value
428  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
429  * @retval #WIDGET_ERROR_NONE Successfully released
430  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
431  * @pre Handle must be created using widget_acquire_buffer().
432  * @see widget_acquire_buffer()
433  */
434 extern int widget_viewer_release_buffer(widget_buffer_h handle, int idx);
435
436 /**
437  * @internal
438  * @brief Destroy a buffer of widget
439  * @since_tizen 2.3.1
440  * @param[in] handle buffer handle
441  * @privlevel public
442  * @privilege %http://tizen.org/privilege/widget.provider
443  * @return 0 on success, otherwise a negative error value
444  * @retval #WIDGET_ERROR_INVALID_PARAMTER Invalid argument
445  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
446  * @retval #WIDGET_ERROR_NONE Successfully destroyed
447  * @see widget_create_buffer()
448  */
449 extern int widget_destroy_buffer(widget_buffer_h handle);
450
451 /**
452  * @internal
453  * @brief Gets the address of buffer for S/W rendering.
454  * @details If you try to use this, after widget_create_hw_buffer(), you will get @c NULL.
455  *          This API only be used for primary buffer. you cannot access the extra buffer
456  * @since_tizen 2.3.1
457  * @param[in] handle Buffer handle
458  * @privlevel public
459  * @privilege %http://tizen.org/privilege/widget.provider
460  * @retval @c NULL If it falis to get buffer address, get_last_result() will returns reason of failure.
461  * @retval address If it succeed to get the buffer address
462  * @see widget_unref_buffer()
463  */
464 extern void *widget_ref_buffer(widget_buffer_h handle);
465
466 /**
467  * @internal
468  * @brief Releases the S/W render buffer.
469  * @since_tizen 2.3.1
470  * @param[in] buffer Address of render buffer
471  * @privlevel public
472  * @privilege %http://tizen.org/privilege/widget.provider
473  * @return 0 on success, otherwise a negative error value
474  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid handle
475  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
476  * @retval #WIDGET_ERROR_NONE Successfully unreference
477  * @pre widget_ref_buffer() must be called.
478  * @see widget_ref_buffer()
479  */
480 extern int widget_unref_buffer(void *buffer);
481
482 /**
483  * @internal
484  * @brief Synchronizes the updated buffer.
485  * @details This is only needed for non-H/W accelerated buffer.
486  *          This API is only supported for primary buffer (#c WIDGET_PRIMARY_BUFFER)
487  * @since_tizen 2.3.1
488  * @param[in] handle Buffer handle
489  * @privlevel public
490  * @privilege %http://tizen.org/privilege/widget.provider
491  * @return 0 on success, otherwise a negative error value
492  * @retval #WIDGET_ERROR_NONE Successfully sync'd
493  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
494  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
495  * @see widget_acquire_buffer()
496  */
497 extern int widget_viewer_sync_buffer(widget_buffer_h handle);
498
499 /**
500  * @internal
501  * @brief Checks whether the widget supports H/W acceleration or not.
502  *        This API is only supported for primary buffer (#c WIDGET_PRIMARY_BUFFER)
503  * @since_tizen 2.3.1
504  * @param[in] handle Buffer handle
505  * @return int type
506  * @retval 1 If the buffer handle support the H/W acceleration buffer
507  * @retval 0 If it doesn not supported
508  * @see widget_acquire_buffer()
509  */
510 extern int widget_support_hw_buffer(widget_buffer_h handle);
511
512 /**
513  * @internal
514  * @brief Creates the H/W accelerated buffer.
515  *        This API is only supported for primary buffer (#c WIDGET_PRIMARY_BUFFER)
516  * @since_tizen 2.3.1
517  * @param[in] handle Buffer handle
518  * @privlevel public
519  * @privilege %http://tizen.org/privilege/widget.provider
520  * @return 0 on success, otherwise a negative error value
521  * @retval #WIDGET_ERROR_ALREADY_EXIST H/W buffer is already created
522  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
523  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
524  * @retval #WIDGET_ERROR_NONE Successfully created
525  * @pre Must be checked whether the H/W buffer is supported or not.
526  * @post Must be destroyed if it is not necessary.
527  * @see widget_support_hw_buffer()
528  */
529 extern int widget_create_hw_buffer(widget_buffer_h handle);
530
531 /**
532  * @internal
533  * @brief Destroys the H/W accelerated buffer.
534  *        This API is only supported for primary buffer (#c WIDGET_PRIMARY_BUFFER)
535  * @since_tizen 2.3.1
536  * @param[in] handle Buffer handle
537  * @privlevel public
538  * @privilege %http://tizen.org/privilege/widget.provider
539  * @return 0 on success, otherwise a negative error value
540  * @retval #WIDGET_ERROR_NONE Successfully destroyed
541  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
542  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
543  * @pre Must be created h/w buffer using widget_create_hw_buffer.
544  * @see widget_create_hw_buffer()
545  */
546 extern int widget_destroy_hw_buffer(widget_buffer_h handle);
547
548 /**
549  * @internal
550  * @brief Gets the address of the accelerated H/W buffer.
551  *        This API is only supported for primary buffer (#c WIDGET_PRIMARY_BUFFER)
552  * @since_tizen 2.3.1
553  * @param[in] handle Buffer handle
554  * @privlevel public
555  * @privilege %http://tizen.org/privilege/widget.provider
556  * @retval @c NULL Failed to get H/W accelerated buffer address, get_last_result() will returns reason of failure.
557  * @retval addr H/W accelerated buffer address
558  * @see widget_create_hw_buffer()
559  */
560 extern void *widget_buffer_hw_buffer(widget_buffer_h handle);
561
562 /**
563  * @internal
564  * @brief Get the stride information from the buffer info
565  *        This API is only supported for primary buffer (#c WIDGET_PRIMARY_BUFFER)
566  * @since_tizen 2.3.1
567  * @param[in] handle Buffer handle
568  * @return int stride size
569  * @retval positive_value length of stride
570  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter
571  * @retval #WIDGET_ERROR_FAULT Unrecoverable error
572  * @see widget_create_hw_buffer()
573  */
574 extern int widget_buffer_stride(widget_buffer_h handle);
575
576 /**
577  * @internal
578  * @brief Pre-processes for rendering content.
579  * @details This is only needed for accessing H/W accelerated buffer.
580  * @since_tizen 2.3.1
581  * @param[in] handle Buffer handle
582  * @privlevel public
583  * @privilege %http://tizen.org/privilege/widget.provider
584  * @return 0 on success, otherwise a negative error value
585  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid handle
586  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
587  * @retval #WIDGET_ERROR_NONE Successfully done
588  * @post widget_buffer_post_render must be called after the rendering (accessing buffer) is completed.
589  * @see widget_support_hw_buffer()
590  * @see widget_buffer_post_render()
591  */
592 extern int widget_buffer_pre_render(widget_buffer_h handle);
593
594 /**
595  * @internal
596  * @brief Post-processes for rendering content.
597  * @since_tizen 2.3.1
598  * @param[in] handle Buffer handle
599  * @privlevel public
600  * @privilege %http://tizen.org/privilege/widget.provider
601  * @return 0 on success, otherwise a negative error value
602  * @retval #WIDGET_ERROR_NONE If succeed
603  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
604  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument
605  * @pre widget_buffer_pre_render must be called.
606  * @see widget_support_hw_buffer()
607  * @see widget_buffer_pre_render()
608  */
609 extern int widget_buffer_post_render(widget_buffer_h handle);
610
611 /**
612  * @internal
613  * @brief Sends a request to the viewer (homescreen) to close the GBar.
614  * @details Even though you call this function. the homescreen can ignore it.
615  * @since_tizen 2.3.1
616  * @param[in] widgetid widget Package Id
617  * @param[in] id Instance Id which is passed to you via the first parameter of every widget_XXXX interface functions
618  * @param[in] reason #WIDGET_ERROR_NONE(0)
619  * @privlevel public
620  * @privilege %http://tizen.org/privilege/widget.provider
621  * @return 0 on success, otherwise a negative error value
622  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
623  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameters
624  * @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory
625  * @retval #WIDGET_ERROR_FAULT Failed to send a request
626  * @retval #WIDGET_ERROR_NONE Successfully requested
627  */
628 extern int widget_request_close_glance_bar(const char *widgetid, const char *id, int reason);
629
630 /**
631  * @internal
632  * @brief Create a snapshot window
633  * @details
634  *         If you want create a snapshot image of contents, create this snapshot window
635  *         But it will not renders object asynchronously,
636  *         So you have to render the objects immediately, the delayed rendering object will not be on the canvas
637  *         After flush it to a file.
638  * @since_tizen 2.3.1
639  * @param[in] id
640  * @param[in] size_type
641  * @retval @c NULL failed to create a snapshot window, get_last_result() will returns reason of failure.
642  * @retval Object window object (ex, elementary window)
643  * @see widget_snapshot_window_flush()
644  */
645 extern void *widget_snapshot_window_add(const char *id, int size_type);
646
647 /**
648  * @internal
649  * @brief Flush to a file for snapshot window
650  * @since_tizen 2.3.1
651  * @param[in] snapshot_win Snapshot window
652  * @param[in] timeout After this, the image file will be created
653  * @param[in] flush_cb Right after flush an image file, this callback will be called
654  * @param[in] data Callback data for flush_cb
655  * @return 0 on success, otherwise a negative error value
656  * @retval #WIDGET_ERROR_NONE Successfully flushed (flush timer added)
657  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid paramter
658  * @retval #WIDGET_ERROR_FAULT Failed to create a flush timer
659  * @see widget_snapshot_window_add()
660  */
661 extern int widget_snapshot_window_flush(void *snapshot_win, double timeout, widget_flush_cb flush_cb, void *data);
662
663 /**
664  * @internal
665  * @brief Sending the updated event to the viewer
666  * @since_tizen 2.3.1
667  * @param[in] handle widget Buffer Handle
668  * @param[in] idx Index of a buffer
669  * @privlevel public
670  * @privilege %http://tizen.org/privilege/widget.provider
671  * @return 0 on success, otherwise a negative error value
672  * @retval #WIDGET_ERROR_NONE Successfully sent
673  */
674 extern int widget_send_updated_by_idx(widget_buffer_h handle, int idx);
675
676 /**
677  * @internal
678  * @brief Set extra information for updated content.
679  * @details
680  *      If the provider should give some hints to the viewer,
681  *      such as title, icon and name, this function can set them.
682  *      provider will send those information to the viewer when the
683  *      content is updated.
684  * @since_tizen 2.3.1
685  * * @remarks This function only works with the buffer type inhouse provider.
686  * @param[in] id widget Instance Id
687  * @param[in] content Content string that will pass to a widget via widget_create interface when it is re-created.
688  * @param[in] title Human readable text for accessibility, summarized text for representing the content of a box.
689  * @param[in] icon Path of icon image file - alternative image content
690  * @param[in] name Name of a box - alternative text content
691  * @return 0 on success, otherwise a negative error value
692  * @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory
693  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameters
694  * @retval #WIDGET_ERROR_FAULT Unrecoverable error
695  * @retval #WIDGET_ERROR_NONE Successfully sent
696  * TODO: plug-in type
697  */
698 extern int widget_set_extra_info(const char *id, const char *content, const char *title, const char *icon, const char *name);
699
700 /**
701  * @internal
702  * @brief Send a freeze request to the viewer (homescreen)
703  * @details
704  *        The viewer will get this request via event callback.
705  *        Then it should freeze its scroller or stop moving the widget.
706  * @since_tizen 2.3.1
707  * @remarks If the viewer doesn't care this request, this will has no effect.
708  * @param[in] widgetid widget Package Id
709  * @param[in] id Instance Id which is passed to you via the first parameter of every widget_XXXX interface functions
710  * @privlevel public
711  * @privilege %http://tizen.org/privilege/widget.provider
712  * @return 0 on success, otherwise a negative error value
713  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameters
714  * @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory
715  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
716  * @retval #WIDGET_ERROR_FAULT Failed to send requet
717  * @retval #WIDGET_ERROR_NONE Successfully requested
718  * @see widget_release_scroller()
719  * TODO: plug-in type
720  */
721 extern int widget_freeze_scroller(const char *widgetid, const char *id);
722
723 /**
724  * @inernal
725  * @brief Send a release request to the viewer (homescreen)
726  * @details
727  *        The viewer will get this request via event callback.
728  *        Then it should release its scroller or continue moving the widget.
729  * @since_tizen 2.3.1
730  * @remarks If the viewer doesn't care this request, this will has no effect.
731  * @param[in] widgetid widget Package Id
732  * @param[in] id Instance Id which is passed to you via the first parameter of every widget_XXXX interface functions
733  * @privlevel public
734  * @privilege %http://tizen.org/privilege/widget.provider
735  * @return 0 on success, otherwise a negative error value
736  * @retval #WIDGET_ERROR_PERMISSION_DENIED Permission denied
737  * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameters
738  * @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory
739  * @retval #WIDGET_ERROR_FAULT Failed to send requet
740  * @retval #WIDGET_ERROR_NONE Successfully requested
741  * @see widget_freeze_scroller()
742  * TODO: plug-in type
743  */
744 extern int widget_thaw_scroller(const char *widgetid, const char *id);
745
746 /**
747  */
748 extern int widget_del_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data);
749
750 /**
751  */
752 extern int widget_add_pre_callback(widget_pre_callback_e type, widget_pre_callback_t cb, void *data);
753
754 /**
755  */
756 extern int widget_get_orientation(const char *id);
757
758 /**
759  * @}
760  */
761
762 #ifdef __cplusplus
763 }
764 #endif
765
766 #endif
767 /* End of a file */