2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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 #include <ui-gadget.h>
20 #include <supplement.h>
24 static void _ug_layout_cb(struct ui_gadget *ug, enum ug_mode mode, void *priv)
26 Evas_Object *base, *win;
27 base = (Evas_Object *)ug_get_layout(ug);
32 win = ug_get_window();
34 case UG_MODE_FULLVIEW:
35 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
36 elm_win_resize_object_add(win, base);
38 //ug_disable_effect(ug);
39 evas_object_show(base);
46 static void _ug_result_cb(ui_gadget_t *ug, bundle *result, void *priv)
51 static void _ug_destroy_cb(struct ui_gadget *ug, void *priv)
62 * This is a basic function which designed to invoke any ui gadget.
64 * @param[in] bd a bundle type which will send to ug directly
65 * @param[in] ug_name UG name marco defined in memo_ug.h
68 void ug_launch_common(bundle *bd, char *ug_name)
72 cbs.layout_cb = _ug_layout_cb;
73 cbs.destroy_cb = _ug_destroy_cb;
74 cbs.result_cb = _ug_result_cb;
77 ug_create(NULL, ug_name, UG_MODE_FULLVIEW, bd, &cbs);
82 * ug_launch_common_var
85 * This function supply a variadic version of ug_launch_common_var.
86 * The first and only required variable is the ug_name.
87 * Its type is string, but the caller should use the macro name which defined in memo_ug.h
88 * The other variables are optional, it should appear for key-value pair
89 * The end of optional variables must be NULL.
91 * @param[in] ug_name UG name marco defined in memo_ug.h
92 * @param[in] ... pair of key and value, end with NULL
95 void ug_launch_common_var(char *ug_name, ...)
99 bundle *bd = bundle_create();
102 va_start(ap, ug_name);
104 key = va_arg(ap, char *);
105 val = va_arg(ap, char *);
107 if (key == NULL || val == NULL) {
110 bundle_add(bd, key, val);
114 ug_launch_common(bd, ug_name);