tizen 2.4 release
[apps/home/minicontrol.git] / include / minicontrol-viewer.h
1 /*
2  * Copyright (c)  2013-2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
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 #ifndef _MINICTRL_VIEWER_H_
18 #define _MINICTRL_VIEWER_H_
19
20 #include <Evas.h>
21 #include <bundle.h>
22 #include "minicontrol-error.h"
23 #include "minicontrol-type.h"
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 /**
30  * @file minicontrol-viewer.h
31  * @brief This minicontrol viewer library used to display minicontrol which created by the minicontrol provider.\n
32  *         This library is providing functions for attach a minicontrol viewer to a parent evas object and sending some requests to a minicontrol provider.\n
33  *         The minicontrol viewer places a space which will be used by the minicontrol provider to draw minicontrol.
34  */
35
36 /**
37  * @addtogroup MINICONTROL_VIEWER_MODULE
38  * @{
39  */
40
41 /**
42  * @brief Adds minicontrol named as "minicontrol_name" to a given parent evas object and returns it.
43  * @since_tizen 2.4
44  * @param[in] parent Minicontrol object will be added to this parent evas object
45  * @param[in] minicontrol_name Name of minicontrol
46  * @return Evas object of minicontrol.  @c NULL failed to add, get_last_result() will returns reason of failure.
47  */
48 Evas_Object *minicontrol_viewer_add(Evas_Object *parent, const char *minicontrol_name);
49
50 /**
51  * @brief Sends a event to the provider.
52  * @since_tizen 2.4
53  * @param[in] minicontrol_name The name of the minicontrol window
54  * @param[in] event Type of the event
55  * @param[in] event_arg A bundle of arguments
56  * @return #MINICONTROL_ERROR_NONE on success,
57  *          otherwise an error code (see #MINICONTROL_ERROR_XXX) on failure
58  * @retval #MINICONTROL_ERROR_INVALID_PARAMETER  Invalid argument
59  * @see #minicontrol_viewer_event_e
60  */
61 int minicontrol_viewer_send_event(const char *minicontrol_name, minicontrol_viewer_event_e event, bundle *event_arg);
62
63 /**
64  * @brief Called when a event comes from the provider
65  * @since_tizen 2.4
66  * @param[in] event The type of fired event
67  * @param[in] minicontrol_name The name of the minicontrol window
68  * @param[in] event_arg A bundle of arguments
69  * @param[in] data User data
70  * @see #minicontrol_viewer_set_event_cb
71  */
72 typedef void (*minicontrol_viewer_event_cb) (minicontrol_event_e event, const char *minicontrol_name, bundle *event_arg, void *data);
73
74 /**
75  * @brief Registers a callback for events originated by minicontrol provider.
76  * @since_tizen 2.4
77  * @param[in] callback Callback function
78  * @param[in] user_data User data
79  * @return #MINICONTROL_ERROR_NONE on success,
80  *         otherwise an error code (see #MINICONTROL_ERROR_XXX) on failure
81  * @retval #MINICONTROL_ERROR_INVALID_PARAMETER  Invalid argument
82  * @retval #MINICONTROL_ERROR_IPC_FAILURE IPC failure
83  * @retval #MINICONTROL_ERROR_OUT_OF_MEMORY out of memory
84  * @see #minicontrol_viewer_unset_event_cb
85  * @see #minicontrol_viewer_event_cb
86  */
87 int minicontrol_viewer_set_event_cb(minicontrol_viewer_event_cb callback, void *user_data);
88
89 /**
90  * @brief Unregisters a callback for events originated by minicontrol provider.
91  * @since_tizen 2.4
92  * @return #MINICONTROL_ERROR_NONE if success, other value if failure
93  * @see #minicontrol_viewer_set_event_cb
94  */
95 int minicontrol_viewer_unset_event_cb(void);
96
97 /**
98  * @}
99  */
100
101 #ifdef __cplusplus
102 }
103 #endif
104 #endif /* _MINICTRL_VIEWER_H_ */
105