2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __TIZEN_ATTACH_PANEL_H__
18 #define __TIZEN_ATTACH_PANEL_H__
20 #include <Elementary.h>
21 #include <tizen_error.h>
22 #include <app_control.h>
30 * @file attach_panel.h
31 * @brief Declares the API of the libattach-panel library.
35 * @addtogroup CAPI_PANEL_ATTACH_MODULE
40 * @brief Enumeration for content categories
42 * @see attach_panel_add_content_category()
43 * @see attach_panel_remove_content_category()
45 typedef enum attach_panel_content_category {
46 ATTACH_PANEL_CONTENT_CATEGORY_IMAGE = 1, /**< Attaching images from the gallery */
47 ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, /**< Taking pictures to attach */
48 ATTACH_PANEL_CONTENT_CATEGORY_VOICE, /**< Taking a voice clip to attach */
49 ATTACH_PANEL_CONTENT_CATEGORY_VIDEO, /**< Attaching video from the gallery */
50 ATTACH_PANEL_CONTENT_CATEGORY_AUDIO, /**< Attaching audio from my files */
51 ATTACH_PANEL_CONTENT_CATEGORY_CALENDAR, /**< Attaching calendar data from the calendar */
52 ATTACH_PANEL_CONTENT_CATEGORY_CONTACT, /**< Attaching contact data from the contacts */
53 ATTACH_PANEL_CONTENT_CATEGORY_MYFILES, /**< Attaching files data from my files */
54 ATTACH_PANEL_CONTENT_CATEGORY_VIDEO_RECORDER, /**< Taking a video clip to attach */
55 } attach_panel_content_category_e;
58 * @brief Enumeration for events
60 * @see attach_panel_set_event_cb()
61 * @see attach_panel_unset_event_cb()
63 typedef enum attach_panel_event {
64 ATTACH_PANEL_EVENT_SHOW_START = 1, /**< Attach panel starts the effect to show */
65 ATTACH_PANEL_EVENT_SHOW_FINISH, /**< Attach panel finishes the effect to show */
66 ATTACH_PANEL_EVENT_HIDE_START, /**< Attach panel starts the effect to hide the panel */
67 ATTACH_PANEL_EVENT_HIDE_FINISH, /**< Attach panel finishes the effect to hide the panel */
68 } attach_panel_event_e;
71 * @brief Attach panel handle.
74 typedef struct _attach_panel *attach_panel_h;
77 * @brief Called when an user selects and confirms something to attach on the caller app.
80 * @param[in] attach_panel Attach panel handler
81 * @param[in] content_category results are from the content category
82 * @param[in] result app_control handler.\n
83 * The caller app has to use app_control_get_extra_data_array() to get received data.\n
84 * http://tizen.org/appcontrol/data/selected\n
85 * @param[in] result_code result of app_control
86 * @param[in] user_data user data
87 * @pre The callback must be registered using attach_panel_set_result_cb()\n
88 * attach_panel_add_content_category() and attach_panel_show() must be called to invoke this callback.
90 * @see @ref CAPI_APP_CONTROL_MODULE API app_control_get_extra_data_array()
91 * @see attach_panel_set_result_cb()
92 * @see attach_panel_unset_result_cb()
94 typedef void (*attach_panel_result_cb)(attach_panel_h attach_panel, attach_panel_content_category_e content_category, app_control_h result, app_control_result_e result_code, void *user_data);
97 * @brief Called when reserved events are published from the panel-side.
100 * @param[in] attach_panel Attach panel handler
101 * @param[in] event Attach panel event
102 * @param[in] event_info additional event information.\n
103 * This can be NULL if there are no necessary information.
104 * @param[in] user_data user data
105 * @pre The callback must be registered using attach_panel_set_event_cb()
107 * @see attach_panel_set_event_cb()
108 * @see attach_panel_unset_event_cb()
110 typedef void (*attach_panel_event_cb)(attach_panel_h attach_panel, attach_panel_event_e event, void *event_info, void *user_data);
113 * @brief Enumeration for values of attach-panel response types.
116 typedef enum attach_panel_error {
117 ATTACH_PANEL_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successfully handled */
118 ATTACH_PANEL_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Request is not valid, invalid parameter or invalid argument value */
119 ATTACH_PANEL_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Memory is not enough to handle a new request */
120 ATTACH_PANEL_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Has no permission to attach contents */
121 ATTACH_PANEL_ERROR_ALREADY_EXISTS = TIZEN_ERROR_PANEL | 0x01, /**< There is already a panel in the conformant */
122 ATTACH_PANEL_ERROR_NOT_INITIALIZED = TIZEN_ERROR_PANEL | 0x02, /**< The panel is not initialized yet */
123 ATTACH_PANEL_ERROR_UNSUPPORTED_CONTENT_CATEGORY = TIZEN_ERROR_PANEL | 0x03, /**< Not supported content category */
124 ATTACH_PANEL_ERROR_ALREADY_DESTROYED = TIZEN_ERROR_PANEL | 0x05, /**< The panel is already removed */
125 } attach_panel_error_e;
128 * @brief Creates an attach panel.
130 * @remarks The caller app has to check the return value of this function.\n
131 * A conformant object can have only one @a attach_panel_h.\n
132 * If a caller app try to add more than one attach-panel, it fails to add it.
134 * @param[in] conformant The caller's conformant
135 * @param[out] attach_panel Attach panel handler
136 * @return #ATTACH_PANEL_ERROR_NONE on success,
137 * otherwise a negative error value
138 * @retval #ATTACH_PANEL_ERROR_NONE Successful
139 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
140 * @retval #ATTACH_PANEL_ERROR_OUT_OF_MEMORY Out of memory
141 * @retval #ATTACH_PANEL_ERROR_ALREADY_EXISTS Already exists
143 * @see attach_panel_destroy()
144 * @see attach_panel_add_content_category()
145 * @see attach_panel_remove_content_category()
146 * @see attach_panel_set_extra_data()
147 * @see attach_panel_set_result_cb()
148 * @see attach_panel_unset_result_cb()
149 * @see attach_panel_set_event_cb()
150 * @see attach_panel_unset_event_cb()
151 * @see attach_panel_show()
152 * @see attach_panel_hide()
153 * @see attach_panel_get_visibility()
157 * #include <attach_panel.h>
160 * Evas_Object *attach_panel;
161 * Evas_Object *conformant;
164 * static void _result_cb(attach_panel_h attach_panel, attach_panel_content_category_e content_category, app_control_h result, app_control_result_e result_code, void *data)
166 * char **select = NULL;
169 * int ret = APP_CONTROL_ERROR_NONE;
175 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
179 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
180 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
184 * for (; i < length; i++) {
185 * printf("path is %s, %d\n", select[i], length);
192 * static int app_control(void *data)
194 * struct appdata *ad = data;
195 * bundle *extra_data = NULL;
196 * int ret = ATTACH_PANEL_ERROR_NONE;
202 * if (!ad->conformant) {
206 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
207 * if (ATTACH_PANEL_ERROR_NONE != ret) {
211 * extra_data = bundle_create();
216 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
217 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
219 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
220 * if (ATTACH_PANEL_ERROR_NONE != ret) {
224 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
225 * if (ATTACH_PANEL_ERROR_NONE != ret) {
229 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
230 * if (ATTACH_PANEL_ERROR_NONE != ret) {
234 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
235 * if (ATTACH_PANEL_ERROR_NONE != ret) {
239 * ret = attach_panel_show(ad->attach_panel);
240 * if (ATTACH_PANEL_ERROR_NONE != ret) {
244 * bundle_free(extra_data);
251 int attach_panel_create(Evas_Object *conformant, attach_panel_h *attach_panel);
254 * @brief Destroys the attach panel.
256 * @remarks The caller app has to check the return value of this function.\n
258 * @param[in] attach_panel Attach panel handler
259 * @return #ATTACH_PANEL_ERROR_NONE on success,
260 * otherwise a negative error value
261 * @retval #ATTACH_PANEL_ERROR_NONE Successful
262 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
263 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
265 * @see attach_panel_create()
266 * @see attach_panel_add_content_category()
267 * @see attach_panel_remove_content_category()
268 * @see attach_panel_set_extra_data()
269 * @see attach_panel_set_result_cb()
270 * @see attach_panel_unset_result_cb()
271 * @see attach_panel_set_event_cb()
272 * @see attach_panel_unset_event_cb()
273 * @see attach_panel_show()
274 * @see attach_panel_hide()
275 * @see attach_panel_get_visibility()
279 * #include <attach_panel.h>
282 * Evas_Object *attach_panel;
283 * Evas_Object *conformant;
286 * static int app_terminate(void *data)
288 * struct appdata *ad = data;
295 * if (!ad->attach_panel) {
299 * ret = attach_panel_hide(ad->attach_panel);
300 * if (ATTACH_PANEL_ERROR_NONE != ret) {
304 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
305 * if (ATTACH_PANEL_ERROR_NONE != ret) {
309 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
310 * if (ATTACH_PANEL_ERROR_NONE != ret) {
314 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
315 * if (ATTACH_PANEL_ERROR_NONE != ret) {
319 * ret = attach_panel_unset_result_cb(ad->attach_panel);
320 * if (ATTACH_PANEL_ERROR_NONE != ret) {
324 * ret = attach_panel_destroy(ad->attach_panel);
325 * if (ATTACH_PANEL_ERROR_NONE != ret) {
328 * ad->attach_panel = NULL;
335 int attach_panel_destroy(attach_panel_h attach_panel);
338 * @brief Adds a content category in the attach panel.
341 * @privilege %http://tizen.org/privilege/mediastorage
342 * @privilege %http://tizen.org/privilege/camera
343 * @privilege %http://tizen.org/privilege/recorder
344 * @privilege %http://tizen.org/privilege/appmanager.launch
345 * @remarks The caller app has to check the return value of this function.\n
346 * Content categories will be shown as the sequence of using @a attach_panel_add_content_category.\n
347 * Some contents need time to load it all.\n
348 * So, it is needed to use this before the mainloop of attach_panel_show().\n
350 * %http://tizen.org/privilege/mediastorage, for using ATTACH_PANEL_CONTENT_CATEGORY_IMAGE or ATTACH_PANEL_CONTENT_CATEGORY_CAMERA\n
351 * %http://tizen.org/privilege/camera, for using ATTACH_PANEL_CONTENT_CATEGORY_CAMERA\n
352 * %http://tizen.org/privilege/recorder, for using ATTACH_PANEL_CONTENT_CATEGORY_VOICE\n
353 * %http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab\n
354 * Deliver more information to the callee with a bundle if you need.\n
355 * %http://tizen.org/appcontrol/data/total_count\n
356 * %http://tizen.org/appcontrol/data/total_size
358 * @param[in] attach_panel Attach panel handler
359 * @param[in] content_category The content_category to be added in the @a attach_panel.
360 * @param[in] extra_data The attach panel send some information using @a bundle.
361 * @return #ATTACH_PANEL_ERROR_NONE on success,
362 * otherwise a negative error value
363 * @retval #ATTACH_PANEL_ERROR_NONE Successful
364 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
365 * @retval #ATTACH_PANEL_ERROR_PERMISSION_DENIED permission denied
366 * @retval #ATTACH_PANEL_ERROR_NOT_INITIALIZED not initialized
367 * @retval #ATTACH_PANEL_ERROR_UNSUPPORTED_CONTENT_CATEGORY not supported content category
368 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
370 * @pre Call attach_panel_create() before calling this function.
371 * @see attach_panel_create()
372 * @see attach_panel_destroy()
373 * @see attach_panel_remove_content_category()
374 * @see attach_panel_set_result_cb()
375 * @see attach_panel_unset_result_cb()
376 * @see attach_panel_show()
377 * @see attach_panel_hide()
378 * @see attach_panel_get_visibility()
379 * @see ATTACH_PANEL_CONTENT_CATEGORY_IMAGE
380 * @see ATTACH_PANEL_CONTENT_CATEGORY_CAMERA
381 * @see ATTACH_PANEL_CONTENT_CATEGORY_VOICE
382 * @see ATTACH_PANEL_CONTENT_CATEGORY_VIDEO
383 * @see ATTACH_PANEL_CONTENT_CATEGORY_AUDIO
384 * @see ATTACH_PANEL_CONTENT_CATEGORY_CALENDAR
385 * @see ATTACH_PANEL_CONTENT_CATEGORY_CONTACT
386 * @see ATTACH_PANEL_CONTENT_CATEGORY_MYFILES
390 * #include <attach_panel.h>
393 * Evas_Object *attach_panel;
394 * Evas_Object *conformant;
397 * static void _result_cb(attach_panel_h attach_panel, attach_panel_content_category_e content_category, app_control_h result, app_control_result_e result_code, void *data)
399 * char **select = NULL;
402 * int ret = APP_CONTROL_ERROR_NONE;
408 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
412 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
413 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
417 * for (; i < length; i++) {
418 * printf("path is %s, %d\n", select[i], length);
425 * static int app_control(void *data)
427 * struct appdata *ad = data;
428 * bundle *extra_data = NULL;
429 * int ret = ATTACH_PANEL_ERROR_NONE;
435 * if (!ad->conformant) {
439 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
440 * if (ATTACH_PANEL_ERROR_NONE != ret) {
444 * extra_data = bundle_create();
449 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
450 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
452 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
453 * if (ATTACH_PANEL_ERROR_NONE != ret) {
457 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
458 * if (ATTACH_PANEL_ERROR_NONE != ret) {
462 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
463 * if (ATTACH_PANEL_ERROR_NONE != ret) {
467 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
468 * if (ATTACH_PANEL_ERROR_NONE != ret) {
472 * ret = attach_panel_show(ad->attach_panel);
473 * if (ATTACH_PANEL_ERROR_NONE != ret) {
477 * bundle_free(extra_data);
484 int attach_panel_add_content_category(attach_panel_h attach_panel, attach_panel_content_category_e content_category, bundle *extra_data);
487 * @brief Removes the content category from the attach panel.
489 * @remarks The caller app has to check the return value of this function.\n
491 * @param[in] attach_panel Attach panel handler
492 * @param[in] content_category The content_category adding in the @a attach_panel.
493 * @return #ATTACH_PANEL_ERROR_NONE on success,
494 * otherwise a negative error value
495 * @retval #ATTACH_PANEL_ERROR_NONE Successful
496 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
497 * @retval #ATTACH_PANEL_ERROR_NOT_INITIALIZED not initialized
498 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
500 * @pre Call attach_panel_create() before calling this function.
501 * @see attach_panel_create()
502 * @see attach_panel_destroy()
503 * @see attach_panel_add_content_category()
504 * @see attach_panel_set_extra_data()
505 * @see attach_panel_set_result_cb()
506 * @see attach_panel_unset_result_cb()
507 * @see attach_panel_show()
508 * @see attach_panel_hide()
509 * @see attach_panel_get_visibility()
510 * @see ATTACH_PANEL_CONTENT_CATEGORY_IMAGE
511 * @see ATTACH_PANEL_CONTENT_CATEGORY_CAMERA
512 * @see ATTACH_PANEL_CONTENT_CATEGORY_VOICE
513 * @see ATTACH_PANEL_CONTENT_CATEGORY_VIDEO
514 * @see ATTACH_PANEL_CONTENT_CATEGORY_AUDIO
515 * @see ATTACH_PANEL_CONTENT_CATEGORY_CALENDAR
516 * @see ATTACH_PANEL_CONTENT_CATEGORY_CONTACT
517 * @see ATTACH_PANEL_CONTENT_CATEGORY_MYFILES
521 * #include <attach_panel.h>
524 * Evas_Object *attach_panel;
525 * Evas_Object *conformant;
528 * static int app_terminate(void *data)
530 * struct appdata *ad = data;
537 * if (!ad->attach_panel) {
541 * ret = attach_panel_hide(ad->attach_panel);
542 * if (ATTACH_PANEL_ERROR_NONE != ret) {
546 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
547 * if (ATTACH_PANEL_ERROR_NONE != ret) {
551 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
552 * if (ATTACH_PANEL_ERROR_NONE != ret) {
556 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
557 * if (ATTACH_PANEL_ERROR_NONE != ret) {
561 * ret = attach_panel_unset_result_cb(ad->attach_panel);
562 * if (ATTACH_PANEL_ERROR_NONE != ret) {
566 * ret = attach_panel_destroy(ad->attach_panel);
567 * if (ATTACH_PANEL_ERROR_NONE != ret) {
570 * ad->attach_panel = NULL;
577 int attach_panel_remove_content_category(attach_panel_h attach_panel, attach_panel_content_category_e content_category);
580 * @brief Sets extra data to send to the content category using a bundle.
583 * @remarks The caller app has to check the return value of this function.\n
584 * extra data will be changed using @a attach_panel_set_extra_data.\n
585 * %http://tizen.org/appcontrol/data/total_count\n
586 * %http://tizen.org/appcontrol/data/total_size
588 * @param[in] attach_panel Attach panel handler
589 * @param[in] content_category The content_category to be set the some information in the @a attach_panel.
590 * @param[in] extra_data The attach panel set some information using @a bundle.
591 * @return #ATTACH_PANEL_ERROR_NONE on success,
592 * otherwise a negative error value
593 * @retval #ATTACH_PANEL_ERROR_NONE Successful
594 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
595 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
596 * @retval #ATTACH_PANEL_ERROR_OUT_OF_MEMORY Fail to set the extra data
598 * @pre Call attach_panel_create() before calling this function.
599 * @see attach_panel_create()
600 * @see attach_panel_destroy()
601 * @see attach_panel_add_content_category()
602 * @see attach_panel_remove_content_category()
603 * @see attach_panel_set_result_cb()
604 * @see attach_panel_unset_result_cb()
605 * @see attach_panel_show()
606 * @see attach_panel_hide()
607 * @see attach_panel_get_visibility()
608 * @see ATTACH_PANEL_CONTENT_CATEGORY_IMAGE
609 * @see ATTACH_PANEL_CONTENT_CATEGORY_CAMERA
610 * @see ATTACH_PANEL_CONTENT_CATEGORY_VOICE
611 * @see ATTACH_PANEL_CONTENT_CATEGORY_VIDEO
612 * @see ATTACH_PANEL_CONTENT_CATEGORY_AUDIO
613 * @see ATTACH_PANEL_CONTENT_CATEGORY_CALENDAR
614 * @see ATTACH_PANEL_CONTENT_CATEGORY_CONTACT
615 * @see ATTACH_PANEL_CONTENT_CATEGORY_MYFILES
619 * #include <attach_panel.h>
622 * Evas_Object *attach_panel;
623 * Evas_Object *conformant;
626 * static void _result_cb(attach_panel_h attach_panel, attach_panel_content_category_e content_category, app_control_h result, app_control_result_e result_code, void *data)
628 * char **select = NULL;
631 * int ret = APP_CONTROL_ERROR_NONE;
637 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
641 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
642 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
646 * for (; i < length; i++) {
647 * printf("path is %s, %d\n", select[i], length);
654 * static void _reset_bundle_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
656 * struct appdata *ad = data;
657 * bundle *extra_data = NULL;
658 * int ret = APP_CONTROL_ERROR_NONE;
664 * extra_data = bundle_create();
669 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "5");
670 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "20480000");
672 * ret = attach_panel_set_extra_data(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
673 * if (ATTACH_PANEL_ERROR_NONE != ret) {
677 * ret = attach_panel_set_extra_data(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
678 * if (ATTACH_PANEL_ERROR_NONE != ret) {
682 * ret = attach_panel_set_extra_data(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
683 * if (ATTACH_PANEL_ERROR_NONE != ret) {
687 * bundle_free(extra_data);
690 * static int app_control(void *data)
692 * struct appdata *ad = data;
693 * bundle *extra_data = NULL;
694 * int ret = ATTACH_PANEL_ERROR_NONE;
700 * if (!ad->conformant) {
704 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
705 * if (ATTACH_PANEL_ERROR_NONE != ret) {
709 * extra_data = bundle_create();
714 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
715 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
717 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
718 * if (ATTACH_PANEL_ERROR_NONE != ret) {
722 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
723 * if (ATTACH_PANEL_ERROR_NONE != ret) {
727 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
728 * if (ATTACH_PANEL_ERROR_NONE != ret) {
732 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
733 * if (ATTACH_PANEL_ERROR_NONE != ret) {
737 * ret = attach_panel_show(ad->attach_panel);
738 * if (ATTACH_PANEL_ERROR_NONE != ret) {
742 * bundle_free(extra_data);
749 int attach_panel_set_extra_data(attach_panel_h attach_panel, attach_panel_content_category_e content_category, bundle *extra_data);
752 * @brief Sets the result callback that will be called when an user selects and confirms something to attach in the attach panel.
754 * @remarks The caller app has to check the return value of this function.\n
755 * We can set only one callback function with this API.\n
756 * If you set multiple callbacks with this API,\n
757 * the last one is registered only.
759 * @param[in] attach_panel Attach panel handler
760 * @param[in] result_cb Attach panel result callback
761 * @param[in] user_data User data
762 * @return #ATTACH_PANEL_ERROR_NONE on success,
763 * otherwise a negative error value
764 * @retval #ATTACH_PANEL_ERROR_NONE Successful
765 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
766 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
768 * @pre Call attach_panel_create() before calling this function.
769 * @post The result_cb set with attach_panel_set_result_cb() will be called after an user select something to attach.
770 * @see attach_panel_create()
771 * @see attach_panel_destroy()
772 * @see attach_panel_add_content_category()
773 * @see attach_panel_remove_content_category()
774 * @see attach_panel_set_extra_data()
775 * @see attach_panel_unset_result_cb()
776 * @see attach_panel_show()
777 * @see attach_panel_hide()
778 * @see attach_panel_get_visibility()
779 * @see attach_panel_result_cb
783 * #include <attach_panel.h>
786 * Evas_Object *attach_panel;
787 * Evas_Object *conformant;
790 * static void _result_cb(attach_panel_h attach_panel, attach_panel_content_category_e content_category, app_control_h result, app_control_result_e result_code, void *data)
792 * char **select = NULL;
795 * int ret = APP_CONTROL_ERROR_NONE;
801 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
805 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
806 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
810 * for (; i < length; i++) {
811 * printf("path is %s, %d\n", select[i], length);
818 * static int app_control(void *data)
820 * struct appdata *ad = data;
821 * bundle *extra_data = NULL;
822 * int ret = ATTACH_PANEL_ERROR_NONE;
828 * if (!ad->conformant) {
832 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
833 * if (ATTACH_PANEL_ERROR_NONE != ret) {
837 * extra_data = bundle_create();
842 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
843 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
845 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
846 * if (ATTACH_PANEL_ERROR_NONE != ret) {
850 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
851 * if (ATTACH_PANEL_ERROR_NONE != ret) {
855 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
856 * if (ATTACH_PANEL_ERROR_NONE != ret) {
860 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
861 * if (ATTACH_PANEL_ERROR_NONE != ret) {
865 * ret = attach_panel_show(ad->attach_panel);
866 * if (ATTACH_PANEL_ERROR_NONE != ret) {
870 * bundle_free(extra_data);
877 int attach_panel_set_result_cb(attach_panel_h attach_panel, attach_panel_result_cb result_cb, void *user_data);
880 * @brief Unsets the result callback that will be called when an user selects and confirms something to attach in the attach panel.
882 * @remarks The caller app has to check the return value of this function.\n
884 * @param[in] attach_panel Attach panel handler
885 * @return #ATTACH_PANEL_ERROR_NONE on success,
886 * otherwise a negative error value
887 * @retval #ATTACH_PANEL_ERROR_NONE Successful
888 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
889 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
891 * @pre Call attach_panel_create() before calling this function.
892 * @see attach_panel_create()
893 * @see attach_panel_destroy()
894 * @see attach_panel_add_content_category()
895 * @see attach_panel_remove_content_category()
896 * @see attach_panel_set_extra_data()
897 * @see attach_panel_set_result_cb()
898 * @see attach_panel_show()
899 * @see attach_panel_hide()
900 * @see attach_panel_get_visibility()
904 * #include <attach_panel.h>
907 * Evas_Object *attach_panel;
908 * Evas_Object *conformant;
911 * static int app_terminate(void *data)
913 * struct appdata *ad = data;
920 * if (!ad->attach_panel) {
924 * ret = attach_panel_hide(ad->attach_panel);
925 * if (ATTACH_PANEL_ERROR_NONE != ret) {
929 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
930 * if (ATTACH_PANEL_ERROR_NONE != ret) {
934 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
935 * if (ATTACH_PANEL_ERROR_NONE != ret) {
939 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
940 * if (ATTACH_PANEL_ERROR_NONE != ret) {
944 * ret = attach_panel_unset_result_cb(ad->attach_panel);
945 * if (ATTACH_PANEL_ERROR_NONE != ret) {
949 * ret = attach_panel_destroy(ad->attach_panel);
950 * if (ATTACH_PANEL_ERROR_NONE != ret) {
953 * ad->attach_panel = NULL;
960 int attach_panel_unset_result_cb(attach_panel_h attach_panel);
963 * @brief Sets the event callback that will be called when reserved events are published from the panel-side.
965 * @remarks The caller app has to check the return value of this function.\n
966 * We can set only one callback function with this API.\n
967 * If you set multiple callbacks with this API,\n
968 * the last one is registered only.
970 * @param[in] attach_panel Attach panel handler
971 * @param[in] panel_event_cb Attach panel event callback
972 * @param[in] user_data User data
973 * @return #ATTACH_PANEL_ERROR_NONE on success,
974 * otherwise a negative error value
975 * @retval #ATTACH_PANEL_ERROR_NONE Successful
976 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
977 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
979 * @pre Call attach_panel_create() before calling this function.
980 * @post The event_cb set with attach_panel_set_event_cb() will be called after publishing reserved events.
981 * @see attach_panel_create()
982 * @see attach_panel_destroy()
983 * @see attach_panel_show()
984 * @see attach_panel_hide()
985 * @see attach_panel_get_visibility()
986 * @see attach_panel_unset_event_cb()
987 * @see attach_panel_event_cb
991 * #include <attach_panel.h>
994 * Evas_Object *attach_panel;
995 * Evas_Object *conformant;
998 * static void _event_cb(attach_panel_h attach_panel, attach_panel_event_e event, void *event_info, void *data)
1001 * case ATTACH_PANEL_EVENT_SHOW_START:
1004 * case ATTACH_PANEL_EVENT_SHOW_FINISH:
1007 * case ATTACH_PANEL_EVENT_HIDE_START:
1010 * case ATTACH_PANEL_EVENT_HIDE_FINISH:
1019 * static int app_control(void *data)
1021 * struct appdata *ad = data;
1022 * int ret = ATTACH_PANEL_ERROR_NONE;
1028 * if (!ad->conformant) {
1032 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
1033 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1037 * ret = attach_panel_set_event_cb(ad->attach_panel, _event_cb, ad);
1038 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1049 int attach_panel_set_event_cb(attach_panel_h attach_panel, attach_panel_event_cb panel_event_cb, void *user_data);
1052 * @brief Unsets the event callback
1054 * @remarks The caller app has to check the return value of this function.
1056 * @param[in] attach_panel Attach panel handler
1057 * @param[in] result_cb Attach panel result callback
1058 * @return #ATTACH_PANEL_ERROR_NONE on success,
1059 * otherwise a negative error value
1060 * @retval #ATTACH_PANEL_ERROR_NONE Successful
1061 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
1062 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
1064 * @pre Call attach_panel_create() before calling this function.
1065 * @see attach_panel_create()
1066 * @see attach_panel_destroy()
1067 * @see attach_panel_show()
1068 * @see attach_panel_hide()
1069 * @see attach_panel_get_visibility()
1070 * @see attach_panel_set_event_cb()
1074 * #include <attach_panel.h>
1077 * Evas_Object *attach_panel;
1078 * Evas_Object *conformant;
1081 * static int app_terminate(void *data)
1083 * struct appdata *ad = data;
1090 * if (!ad->attach_panel) {
1094 * ret = attach_panel_unset_event_cb(ad->attach_panel);
1095 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1099 * ret = attach_panel_destroy(ad->attach_panel);
1100 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1103 * ad->attach_panel = NULL;
1110 int attach_panel_unset_event_cb(attach_panel_h attach_panel);
1113 * @brief Shows the attach panel, asynchronously.
1115 * @remarks The caller app has to check the return value of this function.\n
1117 * @param[in] attach_panel Attach panel handler
1118 * @return #ATTACH_PANEL_ERROR_NONE on success,
1119 * otherwise a negative error value
1120 * @retval #ATTACH_PANEL_ERROR_NONE Successful
1121 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
1122 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
1124 * @pre Call attach_panel_create() before calling this function.
1125 * @see attach_panel_create()
1126 * @see attach_panel_destroy()
1127 * @see attach_panel_add_content_category()
1128 * @see attach_panel_remove_content_category()
1129 * @see attach_panel_set_extra_data()
1130 * @see attach_panel_set_result_cb()
1131 * @see attach_panel_unset_result_cb()
1132 * @see attach_panel_hide()
1133 * @see attach_panel_get_visibility()
1137 * #include <attach_panel.h>
1140 * Evas_Object *attach_panel;
1141 * Evas_Object *conformant;
1144 * static void _result_cb(attach_panel_h attach_panel, attach_panel_content_category_e content_category, app_control_h result, app_control_result_e result_code, void *data)
1146 * char **select = NULL;
1149 * int ret = APP_CONTROL_ERROR_NONE;
1155 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
1159 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
1160 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
1164 * for (; i < length; i++) {
1165 * printf("path is %s, %d\n", select[i], length);
1172 * static int app_control(void *data)
1174 * struct appdata *ad = data;
1175 * bundle *extra_data = NULL;
1176 * int ret = ATTACH_PANEL_ERROR_NONE;
1182 * if (!ad->conformant) {
1186 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
1187 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1191 * extra_data = bundle_create();
1192 * if (!extra_data) {
1196 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
1197 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
1199 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
1200 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1204 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
1205 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1209 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
1210 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1214 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
1215 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1219 * ret = attach_panel_show(ad->attach_panel);
1220 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1224 * bundle_free(extra_data);
1231 int attach_panel_show(attach_panel_h attach_panel);
1234 * @brief Hides the attach panel, asynchronously.
1236 * @remarks The caller app has to check the return value of this function.\n
1238 * @param[in] attach_panel Attach panel handler
1239 * @return #ATTACH_PANEL_ERROR_NONE on success,
1240 * otherwise a negative error value
1241 * @retval #ATTACH_PANEL_ERROR_NONE Successful
1242 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
1243 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
1245 * @pre Call attach_panel_create() before calling this function.
1246 * @see attach_panel_create()
1247 * @see attach_panel_destroy()
1248 * @see attach_panel_add_content_category()
1249 * @see attach_panel_remove_content_category()
1250 * @see attach_panel_set_extra_data()
1251 * @see attach_panel_set_result_cb()
1252 * @see attach_panel_unset_result_cb()
1253 * @see attach_panel_show()
1254 * @see attach_panel_get_visibility()
1258 * #include <attach_panel.h>
1261 * Evas_Object *attach_panel;
1262 * Evas_Object *conformant;
1265 * static int app_terminate(void *data)
1267 * struct appdata *ad = data;
1274 * if (!ad->attach_panel) {
1278 * ret = attach_panel_hide(ad->attach_panel);
1279 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1283 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
1284 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1288 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
1289 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1293 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
1294 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1298 * ret = attach_panel_unset_result_cb(ad->attach_panel);
1299 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1303 * ret = attach_panel_destroy(ad->attach_panel);
1304 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1307 * ad->attach_panel = NULL;
1314 int attach_panel_hide(attach_panel_h attach_panel);
1317 * @brief Gets a value that indicates whether the attach_panel is visible.
1319 * @remarks The caller app has to check the return value of this function.\n
1321 * @param[in] attach_panel Attach panel handler
1322 * @param[out] visible value of attach_panel state
1323 * @return #ATTACH_PANEL_ERROR_NONE on success,
1324 * otherwise a negative error value
1325 * @retval #ATTACH_PANEL_ERROR_NONE Successful
1326 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
1327 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
1329 * @pre Call attach_panel_create() before calling this function.
1330 * @see attach_panel_create()
1331 * @see attach_panel_destroy()
1332 * @see attach_panel_add_content_category()
1333 * @see attach_panel_remove_content_category()
1334 * @see attach_panel_set_extra_data()
1335 * @see attach_panel_set_result_cb()
1336 * @see attach_panel_unset_result_cb()
1337 * @see attach_panel_show()
1338 * @see attach_panel_hide()
1342 * #include <attach_panel.h>
1345 * Evas_Object *attach_panel;
1346 * Evas_Object *conformant;
1349 * static int app_terminate(void *data)
1351 * struct appdata *ad = data;
1352 * bool vislble = false;
1359 * if (!ad->attach_panel) {
1363 * ret = attach_panel_get_visibility(ad->attach_panel, &visible);
1364 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1369 * ret = attach_panel_hide(ad->attach_panel);
1370 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1375 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
1376 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1380 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
1381 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1385 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
1386 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1390 * ret = attach_panel_unset_result_cb(ad->attach_panel);
1391 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1395 * ret = attach_panel_destroy(ad->attach_panel);
1396 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1399 * ad->attach_panel = NULL;
1406 int attach_panel_get_visibility(attach_panel_h attach_panel, bool *visible);
1415 #endif // __TIZEN_ATTACH_PANEL_H__