Mobile & Wearable profile migration for NFC setting UI
[apps/native/ug-nfc-efl.git] / wearable / app / src / nsa-ui-widget.c
1 /*
2  * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * PROPRIETARY/CONFIDENTIAL
5  *
6  * This software is the confidential and proprietary information of
7  * SAMSUNG ELECTRONICS ("Confidential Information").
8  * You shall not disclose such Confidential Information and shall
9  * use it only in accordance with the terms of the license agreement
10  * you entered into with SAMSUNG ELECTRONICS.
11  * SAMSUNG make no representations or warranties about the suitability
12  * of the software, either express or implied, including but not
13  * limited to the implied warranties of merchantability, fitness for
14  * a particular purpose, or non-infringement.
15  * SAMSUNG shall not be liable for any damages suffered by licensee as
16  * a result of using, modifying or distributing this software or its derivatives.
17
18  */
19
20
21 #include <app.h>
22 #include "nsa-main.h"
23 #include "nsa-ui-widget.h"
24 #include "nsa-debug.h"
25 #include "nsa-util.h"
26
27
28 Evas_Object *nsa_create_main_layout(Evas_Object *parent)
29 {
30         Evas_Object *layout;
31
32         retv_if(parent == NULL, NULL);
33
34         NSA_BEGIN();
35
36         layout = elm_layout_add(parent);
37         retv_if(layout == NULL, NULL);
38
39         elm_object_focus_set(layout, EINA_FALSE);
40         elm_layout_theme_set(layout, "layout", "application", "default");
41         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
42                 EVAS_HINT_EXPAND);
43
44         evas_object_show(layout);
45
46         NSA_END();
47
48         return layout;
49 }
50
51 Evas_Object *nsa_create_theme_layout(Evas_Object *parent,
52         const char *clas, const char *group, const char *style)
53 {
54         Evas_Object *layout;
55
56         retv_if(parent == NULL, NULL);
57
58         NSA_BEGIN();
59
60         layout = elm_layout_add(parent);
61         retv_if(layout == NULL, NULL);
62
63         elm_object_focus_set(layout, EINA_FALSE);
64         elm_layout_theme_set(layout, clas, group, style);
65         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
66                 EVAS_HINT_EXPAND);
67
68         evas_object_show(layout);
69
70         NSA_END();
71
72         return layout;
73 }
74
75 Evas_Object *nsa_create_bg(Evas_Object *parent)
76 {
77         Evas_Object *bg;
78 #if defined(PROCESS_POOL)
79         Evas_Object *win;
80 #endif
81
82         retv_if(parent == NULL, NULL);
83
84         NSA_BEGIN();
85
86 #if defined(PROCESS_POOL)
87         win = (Evas_Object *)app_get_preinitialized_window(PACKAGE);
88         if (win == parent) {
89                 bg = app_get_preinitialized_background();
90                 if (bg == NULL) {
91                         NSA_DEBUG_ERR("get bg fail");
92                         bg = elm_bg_add(parent);
93                 }
94         } else {
95                 NSA_DEBUG_ERR("win is different");
96                 bg = elm_bg_add(parent);
97         }
98 #else
99         bg = elm_bg_add(parent);
100 #endif
101         retv_if(bg == NULL, NULL);
102
103         evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
104                 EVAS_HINT_EXPAND);
105         elm_win_resize_object_add(parent, bg);
106
107         evas_object_show(bg);
108
109         NSA_END();
110
111         return bg;
112 }
113
114 Evas_Object *nsa_create_conformant(Evas_Object *parent)
115 {
116         Evas_Object *conform;
117 #if defined(PROCESS_POOL)
118         Evas_Object *win;
119 #endif
120
121         retv_if(parent == NULL, NULL);
122
123         NSA_BEGIN();
124
125 #if defined(PROCESS_POOL)
126         win = (Evas_Object *)app_get_preinitialized_window(PACKAGE);
127         if (win == parent) {
128                 conform = (Evas_Object *)app_get_preinitialized_conformant();
129                 if (conform == NULL) {
130                         NSA_DEBUG_ERR("get conform fail");
131                         conform = elm_conformant_add(parent);
132                 }
133         } else {
134                 NSA_DEBUG_ERR("win is different");
135                 conform = elm_conformant_add(parent);
136         }
137 #else
138         conform = elm_conformant_add(parent);
139 #endif
140         retv_if(conform == NULL, NULL);
141
142         evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND,
143                 EVAS_HINT_EXPAND);
144         elm_win_resize_object_add(parent, conform);
145
146         evas_object_show(conform);
147
148         NSA_END();
149
150         return conform;
151 }
152
153 Evas_Object* nsa_create_edj_layout(Evas_Object* parent,
154         char *edc_path)
155 {
156         Evas_Object *layout;
157
158         NSA_BEGIN();
159
160         retv_if(parent == NULL, NULL);
161
162         layout = elm_layout_add(parent);
163         retv_if(layout == NULL, NULL);
164
165         elm_object_focus_set(layout, EINA_FALSE);
166
167         if(edc_path != NULL)
168                 elm_layout_file_set(layout, EDJ_FILE, edc_path);
169
170         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
171                 EVAS_HINT_EXPAND);
172
173         evas_object_show(layout);
174
175         NSA_END();
176
177         return layout;
178 }
179
180