summaryrefslogtreecommitdiff
path: root/include/ui-gadget-module.h
blob: 452827be52ec84b4c253027f9cb110bedceb6118 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/*
 *  UI Gadget
 *
 * Copyright (c) 2000 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
 *
 * Contact: Jayoun Lee <airjany@samsung.com>, Jinwoo Nam <jwoo.nam@samsung.com>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

#ifndef __UI_GADGET_MODULE_H__
#define __UI_GADGET_MODULE_H__

/**
 * @defgroup	UI_Gadget_For_Developer Developer API Reference Guide
 * @ingroup	UI_Gadget
 * @brief	A module to develop a UI gadget. Callees (UI gadgets) uses this modules and APIs. (callee -> caller)
 *
 * @section Header To Use Them:
 * @code
 * #include <ui-gadget-module.h>
 * @endcode
 */

/**
 * @addtogroup UI_Gadget_For_Developer
 * @{
 */

#include "ui-gadget.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * UI gadget module operation type
 * @see @ref lifecycle_sec
 */
struct ug_module_ops {
	/** create operation */
	void *(*create) (ui_gadget_h ug, enum ug_mode mode, service_h service,
					void *priv);
	/** start operation */
	void (*start) (ui_gadget_h ug, service_h service, void *priv);
	/** pause operation */
	void (*pause) (ui_gadget_h ug, service_h service, void *priv);
	/** resume operation */
	void (*resume) (ui_gadget_h ug, service_h service, void *priv);
	/** destroy operation */
	void (*destroy) (ui_gadget_h ug, service_h service, void *priv);
	/** message operation */
	void (*message) (ui_gadget_h ug, service_h msg, service_h service, void *priv);
	/** event operation */
	void (*event) (ui_gadget_h ug, enum ug_event event, service_h service,
				void *priv);
	/** key event operation */
	void (*key_event) (ui_gadget_h ug, enum ug_key_event event,
					service_h service, void *priv);
	/** destroying operation */
	void (*destroying) (ui_gadget_h ug, service_h service, void *priv);
	/** reserved operations */
	void *reserved[3];

	/** private data */
	void *priv;

	/** option */
	enum ug_option opt;
};

/**
 * \par Description:
 * This function makes a request that caller of the given UI gadget instance destroys the instance.
 * It just makes a request, but not destroys UI gadget
 *
 * \par Purpose:
 * This function is used for sending a request that caller of the given UI gadget instance destroys the instance.
 *
 * \par Typical use case:
 * UI gadget developer who want to send a request that caller of the given UI gadget instance destroys the instance could use the function.
 *
 * \par Method of function operation:
 * Destroy callback which is registered by caller with ug_create() is invoked.
 *
 * \par Context of function:
 * This function supposed to be called in the created UI gadget.
 *
 * @param[in] ug the UI gadget
 * @return 0 on success, -1 on error
 *
 * \pre None
 * \post None
 * \see None
 * \remarks The API just makes a request, but not destroys UI gadget
 *
 * \par Sample code:
 * \code
 * #include <ui-gadget-module.h>
 * ...
 * // send a "destroy me" request
 * ug_destroy_me(ug);
 * ...
 * \endcode
 */
int ug_destroy_me(ui_gadget_h ug);

/**
 * \par Description:
 * This function sends result to caller of the given UI gadget instance.
 *
 * \par Purpose:
 * This function is used for sending result to caller of the given UI gadget instance. The result have to be composed with service handle.
 *
 * \par Typical use case:
 * UI gadget developer who want to send result to caller of the given UI gadget instance could use the function.
 *
 * \par Method of function operation:
 * Result callback which is registered by caller with ug_create() is invoked.
 *
 * \par Context of function:
 * This function supposed to be called in the created UI gadget.
 *
 * @param[in] ug the UI gadget
 * @param[in] result the result, which is service type (see \ref service_PG "Tizen managed api reference guide")
 * @return 0 on success, -1 on error
 *
 * \pre None
 * \post None
 * \see None
 * \remarks After send your message, you have to release it using service_destroy()
 *
 * \par Sample code:
 * \code
 * #include <ui-gadget-module.h>
 * ...
 * // make a result with service
 * service_h result;
 * service_create(&result);
 * service_add_extra_data(result, "Content", "Hello");
 *
 * // send the result
 * ug_send_result(ug, result);
 *
 * // release the result
 * service_destroy(result);
 * ...
 * \endcode
 */
int ug_send_result(ui_gadget_h ug, service_h result);

#ifdef __cplusplus
}
#endif
/**
 * @}
 */
#endif				/* __UI_GADGET_MODULE_H__ */