5df7275923491c58db3485ab5d18d98bd709623f
[platform/core/security/krate.git] / tools / apps / kaskit / src / widget.c
1 /*
2  * Tizen Krate Setup-Wizard application
3  *
4  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #include "widget.h"
21
22 static void __win_delete_request_cb(void *data , Evas_Object *obj , void *event_info)
23 {
24         ui_app_exit();
25 }
26
27 Evas_Object *_create_win(const char *package)
28 {
29         Evas_Object *win;
30
31         elm_app_base_scale_set(1.8);
32
33         win  = elm_win_add(NULL, package, ELM_WIN_BASIC);
34         elm_win_conformant_set(win, EINA_TRUE);
35         elm_win_autodel_set(win, EINA_TRUE);
36         elm_win_alpha_set(win, EINA_TRUE);
37
38         evas_object_smart_callback_add(win, "delete,request", __win_delete_request_cb, NULL);
39
40         return win;
41 }
42
43 Evas_Object *_create_conformant(Evas_Object *parent)
44 {
45         Evas_Object *conform = elm_conformant_add(parent);
46
47         evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48         elm_win_resize_object_add(parent, conform);
49
50         evas_object_show(conform);
51
52         return conform;
53 }
54
55 Evas_Object *_create_layout(Evas_Object *parent, char *file, const char *group)
56 {
57         Evas_Object *layout = elm_layout_add(parent);
58
59         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
60
61         if (file == NULL)
62                 elm_layout_theme_set(layout, "layout", "application", "default");
63         else
64                 elm_layout_file_set(layout, file, group);
65
66         evas_object_show(layout);
67
68         return layout;
69 }