3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.0 (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://www.tizenopensource.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.
25 #include "external-ug.h"
27 static void __cal_ug_destroy_callback(struct ui_gadget *ug, void *priv)
29 c_retm_if(!ug, "ug is null");
34 static void __cal_ug_layout_callback(struct ui_gadget *ug, enum ug_mode mode, void *priv)
36 c_retm_if(!ug, "ug is null");
37 c_retm_if(mode != UG_MODE_FULLVIEW, "mode is invaild");
39 Evas_Object *base = ug_get_layout(ug);
41 ERR("ug_get_layout() returned null");
47 case UG_MODE_FULLVIEW:
48 evas_object_size_hint_weight_set(base, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
49 elm_win_resize_object_add(ug_get_window(), base);
50 evas_object_show(base);
57 static void __cal_ug_result_callback(struct ui_gadget *ug, bundle *res, void *priv)
59 c_retm_if(!ug, "ug is null");
62 void cal_launch_ug(bundle *bd, char *ug_name, struct ug_cbs *cbs)
66 c_retm_if(!bd, "bd is null");
67 c_retm_if(!ug_name, "ug_name is null");
73 uc.destroy_cb = __cal_ug_destroy_callback;
74 uc.layout_cb = __cal_ug_layout_callback;
75 uc.result_cb = __cal_ug_result_callback;
78 if (NULL == cbs->destroy_cb)
79 uc.destroy_cb = __cal_ug_destroy_callback;
81 uc.destroy_cb = cbs->destroy_cb;
83 if (NULL == cbs->layout_cb)
84 uc.layout_cb = __cal_ug_layout_callback;
86 uc.layout_cb = cbs->layout_cb;
88 if (NULL == cbs->result_cb)
89 uc.result_cb = __cal_ug_result_callback;
91 uc.result_cb = cbs->result_cb;
93 if (NULL == cbs->priv)
99 ug = ug_create(NULL, ug_name, UG_MODE_FULLVIEW, bd, &uc);
101 ERR("ug create error");
104 void cal_launch_ug_with_var(char *ug_name, struct ug_cbs *cbs,...)
108 c_retm_if(!ug_name, "ug_name is null");
112 bundle *bd = bundle_create();
113 c_retm_if(!bd, "bd is null");
118 key = va_arg(ap, char *);
119 val = va_arg(ap, char *);
126 bundle_add(bd, key, val);
131 cal_launch_ug(bd, ug_name, cbs);