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 extern 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 extern int attach_panel_destroy(attach_panel_h attach_panel);
338 * @brief Adds a content category in the attach panel.
341 * @remarks The caller app has to check the return value of this function.\n
342 * Content categories will be shown as the sequence of using @a attach_panel_add_content_category.\n
343 * Some contents need time to load it all.\n
344 * So, it is needed to use this before the mainloop of attach_panel_show().\n
346 * %http://tizen.org/privilege/camera, for using ATTACH_PANEL_CONTENT_CATEGORY_CAMERA\n
347 * %http://tizen.org/privilege/recorder, for using ATTACH_PANEL_CONTENT_CATEGORY_VOICE\n
348 * %http://tizen.org/privilege/appmanager.launch, for adding content categories on the More tab\n
349 * Deliver more information to the callee with a bundle if you need.\n
350 * %http://tizen.org/appcontrol/data/total_count\n
351 * %http://tizen.org/appcontrol/data/total_size
353 * @param[in] attach_panel Attach panel handler
354 * @param[in] content_category The content_category to be added in the @a attach_panel.
355 * @param[in] The attach panel send some information using @a bundle.
356 * @return #ATTACH_PANEL_ERROR_NONE on success,
357 * otherwise a negative error value
358 * @retval #ATTACH_PANEL_ERROR_NONE Successful
359 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
360 * @retval #ATTACH_PANEL_ERROR_PERMISSION_DENIED permission denied
361 * @retval #ATTACH_PANEL_ERROR_NOT_INITIALIZED not initialized
362 * @retval #ATTACH_PANEL_ERROR_UNSUPPORTED_CONTENT_CATEGORY not supported content category
363 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
365 * @pre Call attach_panel_create() before calling this function.
366 * @see attach_panel_create()
367 * @see attach_panel_destroy()
368 * @see attach_panel_remove_content_category()
369 * @see attach_panel_set_result_cb()
370 * @see attach_panel_unset_result_cb()
371 * @see attach_panel_show()
372 * @see attach_panel_hide()
373 * @see attach_panel_get_visibility()
374 * @see ATTACH_PANEL_CONTENT_CATEGORY_IMAGE
375 * @see ATTACH_PANEL_CONTENT_CATEGORY_CAMERA
376 * @see ATTACH_PANEL_CONTENT_CATEGORY_VOICE
377 * @see ATTACH_PANEL_CONTENT_CATEGORY_VIDEO
378 * @see ATTACH_PANEL_CONTENT_CATEGORY_AUDIO
379 * @see ATTACH_PANEL_CONTENT_CATEGORY_CALENDAR
380 * @see ATTACH_PANEL_CONTENT_CATEGORY_CONTACT
381 * @see ATTACH_PANEL_CONTENT_CATEGORY_MYFILES
385 * #include <attach_panel.h>
388 * Evas_Object *attach_panel;
389 * Evas_Object *conformant;
392 * 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)
394 * char **select = NULL;
397 * int ret = APP_CONTROL_ERROR_NONE;
403 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
407 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
408 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
412 * for (; i < length; i++) {
413 * printf("path is %s, %d\n", select[i], length);
420 * static int app_control(void *data)
422 * struct appdata *ad = data;
423 * bundle *extra_data = NULL;
424 * int ret = ATTACH_PANEL_ERROR_NONE;
430 * if (!ad->conformant) {
434 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
435 * if (ATTACH_PANEL_ERROR_NONE != ret) {
439 * extra_data = bundle_create();
444 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
445 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
447 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
448 * if (ATTACH_PANEL_ERROR_NONE != ret) {
452 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
453 * if (ATTACH_PANEL_ERROR_NONE != ret) {
457 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
458 * if (ATTACH_PANEL_ERROR_NONE != ret) {
462 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
463 * if (ATTACH_PANEL_ERROR_NONE != ret) {
467 * ret = attach_panel_show(ad->attach_panel);
468 * if (ATTACH_PANEL_ERROR_NONE != ret) {
472 * bundle_free(extra_data);
479 extern int attach_panel_add_content_category(attach_panel_h attach_panel, attach_panel_content_category_e content_category, bundle *extra_data);
482 * @brief Removes the content category from the attach panel.
484 * @remarks The caller app has to check the return value of this function.\n
486 * @param[in] attach_panel Attach panel handler
487 * @param[in] content_category The content_category adding in the @a attach_panel.
488 * @return #ATTACH_PANEL_ERROR_NONE on success,
489 * otherwise a negative error value
490 * @retval #ATTACH_PANEL_ERROR_NONE Successful
491 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
492 * @retval #ATTACH_PANEL_ERROR_NOT_INITIALIZED not initialized
493 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
495 * @pre Call attach_panel_create() before calling this function.
496 * @see attach_panel_create()
497 * @see attach_panel_destroy()
498 * @see attach_panel_add_content_category()
499 * @see attach_panel_set_extra_data()
500 * @see attach_panel_set_result_cb()
501 * @see attach_panel_unset_result_cb()
502 * @see attach_panel_show()
503 * @see attach_panel_hide()
504 * @see attach_panel_get_visibility()
505 * @see ATTACH_PANEL_CONTENT_CATEGORY_IMAGE
506 * @see ATTACH_PANEL_CONTENT_CATEGORY_CAMERA
507 * @see ATTACH_PANEL_CONTENT_CATEGORY_VOICE
508 * @see ATTACH_PANEL_CONTENT_CATEGORY_VIDEO
509 * @see ATTACH_PANEL_CONTENT_CATEGORY_AUDIO
510 * @see ATTACH_PANEL_CONTENT_CATEGORY_CALENDAR
511 * @see ATTACH_PANEL_CONTENT_CATEGORY_CONTACT
512 * @see ATTACH_PANEL_CONTENT_CATEGORY_MYFILES
516 * #include <attach_panel.h>
519 * Evas_Object *attach_panel;
520 * Evas_Object *conformant;
523 * static int app_terminate(void *data)
525 * struct appdata *ad = data;
532 * if (!ad->attach_panel) {
536 * ret = attach_panel_hide(ad->attach_panel);
537 * if (ATTACH_PANEL_ERROR_NONE != ret) {
541 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
542 * if (ATTACH_PANEL_ERROR_NONE != ret) {
546 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
547 * if (ATTACH_PANEL_ERROR_NONE != ret) {
551 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
552 * if (ATTACH_PANEL_ERROR_NONE != ret) {
556 * ret = attach_panel_unset_result_cb(ad->attach_panel);
557 * if (ATTACH_PANEL_ERROR_NONE != ret) {
561 * ret = attach_panel_destroy(ad->attach_panel);
562 * if (ATTACH_PANEL_ERROR_NONE != ret) {
565 * ad->attach_panel = NULL;
572 extern int attach_panel_remove_content_category(attach_panel_h attach_panel, attach_panel_content_category_e content_category);
575 * @brief Sets extra data to send to the content category using a bundle.
578 * @remarks The caller app has to check the return value of this function.\n
579 * extra data will be changed using @a attach_panel_set_extra_data.\n
580 * %http://tizen.org/appcontrol/data/total_count\n
581 * %http://tizen.org/appcontrol/data/total_size
583 * @param[in] attach_panel Attach panel handler
584 * @param[in] content_category The content_category to be set the some information in the @a attach_panel.
585 * @param[in] The attach panel set some information using @a bundle.
586 * @return #ATTACH_PANEL_ERROR_NONE on success,
587 * otherwise a negative error value
588 * @retval #ATTACH_PANEL_ERROR_NONE Successful
589 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
590 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
591 * @retval #ATTACH_PANEL_ERROR_OUT_OF_MEMORY Fail to set the extra data
593 * @pre Call attach_panel_create() before calling this function.
594 * @see attach_panel_create()
595 * @see attach_panel_destroy()
596 * @see attach_panel_add_content_category()
597 * @see attach_panel_remove_content_category()
598 * @see attach_panel_set_result_cb()
599 * @see attach_panel_unset_result_cb()
600 * @see attach_panel_show()
601 * @see attach_panel_hide()
602 * @see attach_panel_get_visibility()
603 * @see ATTACH_PANEL_CONTENT_CATEGORY_IMAGE
604 * @see ATTACH_PANEL_CONTENT_CATEGORY_CAMERA
605 * @see ATTACH_PANEL_CONTENT_CATEGORY_VOICE
606 * @see ATTACH_PANEL_CONTENT_CATEGORY_VIDEO
607 * @see ATTACH_PANEL_CONTENT_CATEGORY_AUDIO
608 * @see ATTACH_PANEL_CONTENT_CATEGORY_CALENDAR
609 * @see ATTACH_PANEL_CONTENT_CATEGORY_CONTACT
610 * @see ATTACH_PANEL_CONTENT_CATEGORY_MYFILES
614 * #include <attach_panel.h>
617 * Evas_Object *attach_panel;
618 * Evas_Object *conformant;
621 * 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)
623 * char **select = NULL;
626 * int ret = APP_CONTROL_ERROR_NONE;
632 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
636 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
637 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
641 * for (; i < length; i++) {
642 * printf("path is %s, %d\n", select[i], length);
649 * static void _reset_bundle_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
651 * struct appdata *ad = data;
652 * bundle *extra_data = NULL;
653 * int ret = APP_CONTROL_ERROR_NONE;
659 * extra_data = bundle_create();
664 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "5");
665 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "20480000");
667 * ret = attach_panel_set_extra_data(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
668 * if (ATTACH_PANEL_ERROR_NONE != ret) {
672 * ret = attach_panel_set_extra_data(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
673 * if (ATTACH_PANEL_ERROR_NONE != ret) {
677 * ret = attach_panel_set_extra_data(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
678 * if (ATTACH_PANEL_ERROR_NONE != ret) {
682 * bundle_free(extra_data);
685 * static int app_control(void *data)
687 * struct appdata *ad = data;
688 * bundle *extra_data = NULL;
689 * int ret = ATTACH_PANEL_ERROR_NONE;
695 * if (!ad->conformant) {
699 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
700 * if (ATTACH_PANEL_ERROR_NONE != ret) {
704 * extra_data = bundle_create();
709 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
710 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
712 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
713 * if (ATTACH_PANEL_ERROR_NONE != ret) {
717 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
718 * if (ATTACH_PANEL_ERROR_NONE != ret) {
722 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
723 * if (ATTACH_PANEL_ERROR_NONE != ret) {
727 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
728 * if (ATTACH_PANEL_ERROR_NONE != ret) {
732 * ret = attach_panel_show(ad->attach_panel);
733 * if (ATTACH_PANEL_ERROR_NONE != ret) {
737 * bundle_free(extra_data);
744 extern int attach_panel_set_extra_data(attach_panel_h attach_panel, attach_panel_content_category_e content_category, bundle *extra_data);
747 * @brief Sets the result callback that will be called when an user selects and confirms something to attach in the attach panel.
749 * @remarks The caller app has to check the return value of this function.\n
750 * We can set only one callback function with this API.\n
751 * If you set multiple callbacks with this API,\n
752 * the last one is registered only.
754 * @param[in] attach_panel Attach panel handler
755 * @param[in] result_cb Attach panel result callback
756 * @param[in] user_data User data
757 * @return #ATTACH_PANEL_ERROR_NONE on success,
758 * otherwise a negative error value
759 * @retval #ATTACH_PANEL_ERROR_NONE Successful
760 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
761 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
763 * @pre Call attach_panel_create() before calling this function.
764 * @post The result_cb set with attach_panel_set_result_cb() will be called after an user select something to attach.
765 * @see attach_panel_create()
766 * @see attach_panel_destroy()
767 * @see attach_panel_add_content_category()
768 * @see attach_panel_remove_content_category()
769 * @see attach_panel_set_extra_data()
770 * @see attach_panel_unset_result_cb()
771 * @see attach_panel_show()
772 * @see attach_panel_hide()
773 * @see attach_panel_get_visibility()
774 * @see attach_panel_result_cb
778 * #include <attach_panel.h>
781 * Evas_Object *attach_panel;
782 * Evas_Object *conformant;
785 * 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)
787 * char **select = NULL;
790 * int ret = APP_CONTROL_ERROR_NONE;
796 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
800 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
801 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
805 * for (; i < length; i++) {
806 * printf("path is %s, %d\n", select[i], length);
813 * static int app_control(void *data)
815 * struct appdata *ad = data;
816 * bundle *extra_data = NULL;
817 * int ret = ATTACH_PANEL_ERROR_NONE;
823 * if (!ad->conformant) {
827 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
828 * if (ATTACH_PANEL_ERROR_NONE != ret) {
832 * extra_data = bundle_create();
837 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
838 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
840 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
841 * if (ATTACH_PANEL_ERROR_NONE != ret) {
845 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
846 * if (ATTACH_PANEL_ERROR_NONE != ret) {
850 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
851 * if (ATTACH_PANEL_ERROR_NONE != ret) {
855 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
856 * if (ATTACH_PANEL_ERROR_NONE != ret) {
860 * ret = attach_panel_show(ad->attach_panel);
861 * if (ATTACH_PANEL_ERROR_NONE != ret) {
865 * bundle_free(extra_data);
872 extern int attach_panel_set_result_cb(attach_panel_h attach_panel, attach_panel_result_cb result_cb, void *user_data);
875 * @brief Unsets the result callback that will be called when an user selects and confirms something to attach in the attach panel.
877 * @remarks The caller app has to check the return value of this function.\n
879 * @param[in] attach_panel Attach panel handler
880 * @return #ATTACH_PANEL_ERROR_NONE on success,
881 * otherwise a negative error value
882 * @retval #ATTACH_PANEL_ERROR_NONE Successful
883 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
884 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
886 * @pre Call attach_panel_create() before calling this function.
887 * @see attach_panel_create()
888 * @see attach_panel_destroy()
889 * @see attach_panel_add_content_category()
890 * @see attach_panel_remove_content_category()
891 * @see attach_panel_set_extra_data()
892 * @see attach_panel_set_result_cb()
893 * @see attach_panel_show()
894 * @see attach_panel_hide()
895 * @see attach_panel_get_visibility()
899 * #include <attach_panel.h>
902 * Evas_Object *attach_panel;
903 * Evas_Object *conformant;
906 * static int app_terminate(void *data)
908 * struct appdata *ad = data;
915 * if (!ad->attach_panel) {
919 * ret = attach_panel_hide(ad->attach_panel);
920 * if (ATTACH_PANEL_ERROR_NONE != ret) {
924 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
925 * if (ATTACH_PANEL_ERROR_NONE != ret) {
929 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
930 * if (ATTACH_PANEL_ERROR_NONE != ret) {
934 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
935 * if (ATTACH_PANEL_ERROR_NONE != ret) {
939 * ret = attach_panel_unset_result_cb(ad->attach_panel);
940 * if (ATTACH_PANEL_ERROR_NONE != ret) {
944 * ret = attach_panel_destroy(ad->attach_panel);
945 * if (ATTACH_PANEL_ERROR_NONE != ret) {
948 * ad->attach_panel = NULL;
955 extern int attach_panel_unset_result_cb(attach_panel_h attach_panel);
958 * @brief Sets the event callback that will be called when reserved events are published from the panel-side.
960 * @remarks The caller app has to check the return value of this function.\n
961 * We can set only one callback function with this API.\n
962 * If you set multiple callbacks with this API,\n
963 * the last one is registered only.
965 * @param[in] attach_panel Attach panel handler
966 * @param[in] event_cb Attach panel event callback
967 * @param[in] user_data User data
968 * @return #ATTACH_PANEL_ERROR_NONE on success,
969 * otherwise a negative error value
970 * @retval #ATTACH_PANEL_ERROR_NONE Successful
971 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
972 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
974 * @pre Call attach_panel_create() before calling this function.
975 * @post The event_cb set with attach_panel_set_event_cb() will be called after publishing reserved events.
976 * @see attach_panel_create()
977 * @see attach_panel_destroy()
978 * @see attach_panel_show()
979 * @see attach_panel_hide()
980 * @see attach_panel_get_visibility()
981 * @see attach_panel_unset_event_cb()
982 * @see attach_panel_event_cb
986 * #include <attach_panel.h>
989 * Evas_Object *attach_panel;
990 * Evas_Object *conformant;
993 * static void _event_cb(attach_panel_h attach_panel, attach_panel_event_e event, void *event_info, void *data)
996 * case ATTACH_PANEL_EVENT_SHOW_START:
999 * case ATTACH_PANEL_EVENT_SHOW_FINISH:
1002 * case ATTACH_PANEL_EVENT_HIDE_START:
1005 * case ATTACH_PANEL_EVENT_HIDE_FINISH:
1014 * static int app_control(void *data)
1016 * struct appdata *ad = data;
1017 * int ret = ATTACH_PANEL_ERROR_NONE;
1023 * if (!ad->conformant) {
1027 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
1028 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1032 * ret = attach_panel_set_event_cb(ad->attach_panel, _event_cb, ad);
1033 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1044 extern int attach_panel_set_event_cb(attach_panel_h attach_panel, attach_panel_event_cb event_cb, void *user_data);
1047 * @brief Unsets the event callback
1049 * @remarks The caller app has to check the return value of this function.
1051 * @param[in] attach_panel Attach panel handler
1052 * @param[in] result_cb Attach panel result callback
1053 * @return #ATTACH_PANEL_ERROR_NONE on success,
1054 * otherwise a negative error value
1055 * @retval #ATTACH_PANEL_ERROR_NONE Successful
1056 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
1057 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
1059 * @pre Call attach_panel_create() before calling this function.
1060 * @see attach_panel_create()
1061 * @see attach_panel_destroy()
1062 * @see attach_panel_show()
1063 * @see attach_panel_hide()
1064 * @see attach_panel_get_visibility()
1065 * @see attach_panel_set_event_cb()
1069 * #include <attach_panel.h>
1072 * Evas_Object *attach_panel;
1073 * Evas_Object *conformant;
1076 * static int app_terminate(void *data)
1078 * struct appdata *ad = data;
1085 * if (!ad->attach_panel) {
1089 * ret = attach_panel_unset_event_cb(ad->attach_panel);
1090 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1094 * ret = attach_panel_destroy(ad->attach_panel);
1095 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1098 * ad->attach_panel = NULL;
1105 extern int attach_panel_unset_event_cb(attach_panel_h attach_panel);
1108 * @brief Shows the attach panel, asynchronously.
1110 * @remarks The caller app has to check the return value of this function.\n
1112 * @param[in] attach_panel Attach panel handler
1113 * @return #ATTACH_PANEL_ERROR_NONE on success,
1114 * otherwise a negative error value
1115 * @retval #ATTACH_PANEL_ERROR_NONE Successful
1116 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
1117 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
1119 * @pre Call attach_panel_create() before calling this function.
1120 * @see attach_panel_create()
1121 * @see attach_panel_destroy()
1122 * @see attach_panel_add_content_category()
1123 * @see attach_panel_remove_content_category()
1124 * @see attach_panel_set_extra_data()
1125 * @see attach_panel_set_result_cb()
1126 * @see attach_panel_unset_result_cb()
1127 * @see attach_panel_hide()
1128 * @see attach_panel_get_visibility()
1132 * #include <attach_panel.h>
1135 * Evas_Object *attach_panel;
1136 * Evas_Object *conformant;
1139 * 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)
1141 * char **select = NULL;
1144 * int ret = APP_CONTROL_ERROR_NONE;
1150 * if (APP_CONTROL_RESULT_SUCCEEDED != result_code) {
1154 * ret = app_control_get_extra_data_array(result, "http://tizen.org/appcontrol/data/selected", &select, &length);
1155 * if (APP_CONTROL_ERROR_NONE != ret || !select) {
1159 * for (; i < length; i++) {
1160 * printf("path is %s, %d\n", select[i], length);
1167 * static int app_control(void *data)
1169 * struct appdata *ad = data;
1170 * bundle *extra_data = NULL;
1171 * int ret = ATTACH_PANEL_ERROR_NONE;
1177 * if (!ad->conformant) {
1181 * ret = attach_panel_create(ad->conformant, &ad->attach_panel);
1182 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1186 * extra_data = bundle_create();
1187 * if (!extra_data) {
1191 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_count", "3");
1192 * bundle_add_str(extra_data, "http://tizen.org/appcontrol/data/total_size", "10240000");
1194 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE, extra_data);
1195 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1199 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA, extra_data);
1200 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1204 * ret = attach_panel_add_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE, extra_data);
1205 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1209 * ret = attach_panel_set_result_cb(ad->attach_panel, _result_cb, NULL);
1210 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1214 * ret = attach_panel_show(ad->attach_panel);
1215 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1219 * bundle_free(extra_data);
1226 extern int attach_panel_show(attach_panel_h attach_panel);
1229 * @brief Hides the attach panel, asynchronously.
1231 * @remarks The caller app has to check the return value of this function.\n
1233 * @param[in] attach_panel Attach panel handler
1234 * @return #ATTACH_PANEL_ERROR_NONE on success,
1235 * otherwise a negative error value
1236 * @retval #ATTACH_PANEL_ERROR_NONE Successful
1237 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
1238 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
1240 * @pre Call attach_panel_create() before calling this function.
1241 * @see attach_panel_create()
1242 * @see attach_panel_destroy()
1243 * @see attach_panel_add_content_category()
1244 * @see attach_panel_remove_content_category()
1245 * @see attach_panel_set_extra_data()
1246 * @see attach_panel_set_result_cb()
1247 * @see attach_panel_unset_result_cb()
1248 * @see attach_panel_show()
1249 * @see attach_panel_get_visibility()
1253 * #include <attach_panel.h>
1256 * Evas_Object *attach_panel;
1257 * Evas_Object *conformant;
1260 * static int app_terminate(void *data)
1262 * struct appdata *ad = data;
1269 * if (!ad->attach_panel) {
1273 * ret = attach_panel_hide(ad->attach_panel);
1274 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1278 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
1279 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1283 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
1284 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1288 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
1289 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1293 * ret = attach_panel_unset_result_cb(ad->attach_panel);
1294 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1298 * ret = attach_panel_destroy(ad->attach_panel);
1299 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1302 * ad->attach_panel = NULL;
1309 extern int attach_panel_hide(attach_panel_h attach_panel);
1312 * @brief Gets a value that indicates whether the attach_panel is visible.
1314 * @remarks The caller app has to check the return value of this function.\n
1316 * @param[in] attach_panel Attach panel handler
1317 * @param[out] visible value of attach_panel state
1318 * @return #ATTACH_PANEL_ERROR_NONE on success,
1319 * otherwise a negative error value
1320 * @retval #ATTACH_PANEL_ERROR_NONE Successful
1321 * @retval #ATTACH_PANEL_ERROR_INVALID_PARAMETER Invalid parameter
1322 * @retval #ATTACH_PANEL_ERROR_ALREADY_DESTROYED already removed
1324 * @pre Call attach_panel_create() before calling this function.
1325 * @see attach_panel_create()
1326 * @see attach_panel_destroy()
1327 * @see attach_panel_add_content_category()
1328 * @see attach_panel_remove_content_category()
1329 * @see attach_panel_set_extra_data()
1330 * @see attach_panel_set_result_cb()
1331 * @see attach_panel_unset_result_cb()
1332 * @see attach_panel_show()
1333 * @see attach_panel_hide()
1337 * #include <attach_panel.h>
1340 * Evas_Object *attach_panel;
1341 * Evas_Object *conformant;
1344 * static int app_terminate(void *data)
1346 * struct appdata *ad = data;
1347 * bool vislble = false;
1354 * if (!ad->attach_panel) {
1358 * ret = attach_panel_get_visibility(ad->attach_panel, &visible);
1359 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1364 * ret = attach_panel_hide(ad->attach_panel);
1365 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1370 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_IMAGE);
1371 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1375 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_CAMERA);
1376 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1380 * ret = attach_panel_remove_content_category(ad->attach_panel, ATTACH_PANEL_CONTENT_CATEGORY_VOICE);
1381 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1385 * ret = attach_panel_unset_result_cb(ad->attach_panel);
1386 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1390 * ret = attach_panel_destroy(ad->attach_panel);
1391 * if (ATTACH_PANEL_ERROR_NONE != ret) {
1394 * ad->attach_panel = NULL;
1401 extern int attach_panel_get_visibility(attach_panel_h attach_panel, bool *visible);
1410 #endif // __TIZEN_ATTACH_PANEL_H__