29616ab8317ba0632983bdc97afea7ede3c98f5f
[platform/core/security/ode.git] / tools / apps / ode / src / ode-app-widget.c
1 /*
2  *
3  * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4  *
5  * Licensed under the Apache License, Version 2.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
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
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.
16  *
17  */
18
19 #include "ode-app.h"
20
21 Evas_Object* dpm_encryption_create_layout(Evas_Object* parent, const char* file, const char* group)
22 {
23         Evas_Object* layout = NULL;
24
25         if (parent == NULL) {
26                 dlog_print(DLOG_ERROR, LOG_TAG, "parent is null");
27                 return NULL;
28         }
29
30         layout = elm_layout_add(parent);
31         if (layout == NULL) {
32                 dlog_print(DLOG_ERROR, LOG_TAG, "Cannot add layout");
33                 return NULL;
34         }
35
36         if ((file != NULL) && (group != NULL))
37                 elm_layout_file_set(layout, file, group);
38         else
39                 elm_layout_theme_set(layout, "layout", "application", "default");
40
41         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
42         evas_object_show(layout);
43
44         return layout;
45 }
46
47 Evas_Object* dpm_encryption_create_navigation(Evas_Object* parent)
48 {
49         Evas_Object* navi_bar = NULL;
50
51         if (parent == NULL) {
52                 dlog_print(DLOG_ERROR, LOG_TAG, "parent is null");
53                 return NULL;
54         }
55
56         navi_bar = elm_naviframe_add(parent);
57         eext_object_event_callback_add(navi_bar, EEXT_CALLBACK_BACK, eext_naviframe_back_cb, NULL);
58         elm_object_part_content_set(parent, "elm.swallow.content", navi_bar);
59         evas_object_show(navi_bar);
60
61         return navi_bar;
62 }
63
64 Evas_Object* dpm_encryption_create_button(Evas_Object* parent, const char* text, const char* style)
65 {
66         Evas_Object* btn = elm_button_add(parent);
67
68         evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
69         elm_object_text_set(btn, text);
70
71         if (style != NULL)
72                 elm_object_style_set(btn, style);
73
74         evas_object_show(btn);
75
76         return btn;
77 }
78
79 Evas_Object* dpm_encryption_create_textblock(Evas_Object* parent, const char* text, Evas_Textblock_Style* style)
80 {
81         Evas_Object* txt = evas_object_textblock_add(parent);
82
83         if (style != NULL)
84                 evas_object_textblock_style_set(txt, style);
85         evas_object_textblock_text_markup_set(txt, text);
86         evas_object_show(txt);
87
88         return txt;
89
90 }