3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.1 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
9 * http://floralicense.org/license/
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
18 #include <ui-gadget.h>
21 #include <supplement.h>
25 static void _ug_layout_cb(ui_gadget_h ug, enum ug_mode mode, void *priv)
27 Evas_Object *base, *win;
28 base = (Evas_Object *)ug_get_layout(ug);
33 win = ug_get_window();
35 case UG_MODE_FULLVIEW:
36 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
37 elm_win_resize_object_add(win, base);
39 //ug_disable_effect(ug);
40 evas_object_show(base);
47 static void _ug_result_cb(ui_gadget_h ug, service_h service, void *priv)
49 service_dump(service);
52 static void _ug_destroy_cb(ui_gadget_h ug, void *priv)
63 * This is a basic function which designed to invoke any ui gadget.
65 * @param[in] service a service type which will send to ug directly
66 * @param[in] ug_name UG name marco defined in memo_ug.h
69 void ug_launch_common(service_h service, char *ug_name)
73 cbs.layout_cb = _ug_layout_cb;
74 cbs.destroy_cb = _ug_destroy_cb;
75 cbs.result_cb = _ug_result_cb;
78 ug_create(NULL, ug_name, UG_MODE_FULLVIEW, service, &cbs);
79 service_destroy(service);
83 * ug_launch_common_var
86 * This function supply a variadic version of ug_launch_common_var.
87 * The first and only required variable is the ug_name.
88 * Its type is string, but the caller should use the macro name which defined in memo_ug.h
89 * The other variables are optional, it should appear for key-value pair
90 * The end of optional variables must be NULL.
92 * @param[in] ug_name UG name marco defined in memo_ug.h
93 * @param[in] ... pair of key and value, end with NULL
96 void ug_launch_common_var(char *ug_name, ...)
100 service_h service = NULL;
101 service_create(&service);
104 va_start(ap, ug_name);
106 key = va_arg(ap, char *);
107 val = va_arg(ap, char *);
109 if (key == NULL || val == NULL) {
112 service_add_extra_data(service, key, val);
116 ug_launch_common(service, ug_name);