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.
18 #include "_util_log.h"
20 Evas_Object *_add_window(const char *name)
25 eo = elm_win_add(NULL, name, ELM_WIN_NOTIFICATION);
27 elm_win_title_set(eo, name);
28 elm_win_borderless_set(eo, EINA_TRUE);
29 elm_win_alpha_set(eo, EINA_TRUE);
30 ecore_x_window_size_get(
31 ecore_x_window_root_first_get(),
33 evas_object_resize(eo, w, h);
39 Evas_Object *_add_naviframe(Evas_Object *parent)
43 nv = elm_naviframe_add(parent);
45 fprintf(stderr, "[Error] Failed to add naviframe\n");
49 elm_object_part_content_set(parent, "elm.swallow.content", nv);
50 evas_object_size_hint_weight_set(nv, EVAS_HINT_EXPAND,
56 Evas_Object *_add_bg(Evas_Object *parent, char *style)
60 bg = elm_bg_add(parent);
61 retvm_if(bg == NULL, NULL, "Failed to add bg\n");
62 if (style) elm_object_style_set(bg, style);
63 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND,
69 Evas_Object *_add_layout_main(Evas_Object *parent,
70 Eina_Bool content, Eina_Bool transparent)
74 ly = elm_layout_add(parent);
75 retvm_if(ly == NULL, NULL, "Failed to add main layout\n");
77 elm_layout_theme_set(ly, "layout", "application", "default");
78 evas_object_size_hint_weight_set(ly, EVAS_HINT_EXPAND,
80 elm_win_resize_object_add(parent, ly);
82 elm_object_signal_emit(ly, "elm,state,show,content", "elm");
84 elm_object_signal_emit(ly, "elm,bg,show,transparent", "elm");
91 Evas_Object *_add_layout(Evas_Object *parent, const char *file,
97 retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n");
98 retvm_if(file == NULL, NULL, "Invalid argument: file is NULL\n");
99 retvm_if(group == NULL, NULL, "Invalid argument: group is NULL\n");
101 eo = elm_layout_add(parent);
102 retvm_if(eo == NULL, NULL, "Failed to add layout\n");
104 r = elm_layout_file_set(eo, file, group);
106 _E("Failed to set file[%s]\n", file);
111 evas_object_size_hint_weight_set(eo,
112 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
113 evas_object_show(eo);
117 Evas_Object *_add_controlbar(Evas_Object *parent, const char *style)
121 cb = elm_toolbar_add(parent);
122 retvm_if(cb == NULL, NULL, "Failed to add toolbar\n");
123 elm_toolbar_shrink_mode_set(cb, ELM_TOOLBAR_SHRINK_EXPAND);
124 elm_toolbar_select_mode_set(cb, ELM_OBJECT_SELECT_MODE_ALWAYS);
125 elm_toolbar_homogeneous_set(cb, EINA_TRUE);
126 if (style) elm_object_style_set(cb, style);
127 evas_object_show(cb);
132 Evas_Object *_add_scroller(Evas_Object *parent,
133 Eina_Bool h_bounce, Eina_Bool v_bounce)
137 sc = elm_scroller_add(parent);
138 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND,
140 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
141 elm_scroller_bounce_set(sc, h_bounce, v_bounce);
142 elm_scroller_policy_set(sc,
143 h_bounce ? ELM_SCROLLER_POLICY_AUTO :
144 ELM_SCROLLER_POLICY_OFF,
145 v_bounce ? ELM_SCROLLER_POLICY_AUTO :
146 ELM_SCROLLER_POLICY_OFF);
147 evas_object_show(sc);
151 Evas_Object *_add_genlist(Evas_Object *parent)
155 eo = elm_genlist_add(parent);
156 elm_genlist_homogeneous_set(eo, EINA_TRUE);
158 printf("[Error] Cannot add genlist\n");
162 evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND,
164 evas_object_size_hint_align_set(eo, EVAS_HINT_FILL, EVAS_HINT_FILL);
170 Evas_Object *_add_button(Evas_Object *parent, const char *style)
173 bt = elm_button_add(parent);
174 retvm_if(bt == NULL, NULL, "Failed to add button\n");
175 elm_object_style_set(bt, style);
176 elm_object_focus_set(bt, EINA_FALSE);
177 evas_object_show(bt);
181 Evas_Object *_add_popup(Evas_Object *parent)
185 pu = elm_popup_add(parent);
187 fprintf(stderr, "[Error] Failed to add popup\n");
190 evas_object_size_hint_weight_set(pu,
191 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
192 evas_object_show(pu);
197 Evas_Object *_add_progressbar(Evas_Object *parent, const char *style)
201 pb = elm_progressbar_add(parent);
202 if(style) elm_object_style_set(pb, style);
203 evas_object_size_hint_weight_set(pb,
204 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
205 evas_object_show(pb);
210 Evas_Object *_add_label(Evas_Object *parent, char *text)
214 lb = elm_label_add(parent);
215 retvm_if(lb == NULL, NULL, "Failed to add label\n");
216 elm_object_text_set(lb, text);
217 evas_object_size_hint_weight_set(lb,
218 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
219 evas_object_show(lb);