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.
22 #include "_util_log.h"
24 Evas_Object *_add_window(const char *name)
28 eo = elm_win_add(NULL, name, ELM_WIN_NOTIFICATION);
30 elm_win_title_set(eo, name);
31 elm_win_borderless_set(eo, EINA_TRUE);
32 elm_win_alpha_set(eo, EINA_TRUE);
33 ecore_x_window_size_get(
34 ecore_x_window_root_first_get(),
36 evas_object_resize(eo, w, h);
41 Evas_Object *_add_slider(Evas_Object *parent, int min, int max, int val)
44 sl = elm_slider_add(parent);
45 retvm_if(sl == NULL, NULL, "Failed to add slider\n");
46 elm_slider_horizontal_set(sl, EINA_TRUE);
47 elm_slider_indicator_show_set(sl, EINA_TRUE);
48 elm_slider_indicator_format_set(sl, "%.0f");
49 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
50 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
51 elm_slider_min_max_set(sl, min, max);
52 elm_slider_value_set(sl, val);
56 Evas_Object *_add_layout(Evas_Object *parent, const char *file,
62 retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n");
63 retvm_if(file == NULL, NULL, "Invalid argument: file is NULL\n");
64 retvm_if(group == NULL, NULL, "Invalid argument: group is NULL\n");
66 eo = elm_layout_add(parent);
67 retvm_if(eo == NULL, NULL, "Failed to add layout\n");
69 r = elm_layout_file_set(eo, file, group);
71 _E("Failed to set file[%s]\n", file);
76 evas_object_size_hint_weight_set(eo,
77 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
82 Evas_Object *_add_button(Evas_Object *parent, const char *style, const char *text)
85 bt = elm_button_add(parent);
86 retvm_if(bt == NULL, NULL, "Failed to add button\n");
87 if (style) elm_object_style_set(bt, style);
88 elm_object_focus_set(bt, EINA_FALSE);
89 elm_object_text_set(bt, text);
94 Evas_Object *_add_popup(Evas_Object *parent, const char *style)
97 pu = elm_popup_add(parent);
98 retvm_if(pu == NULL, NULL, "[Error] Failed to add popup\n");
99 evas_object_size_hint_weight_set(pu, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
100 if (style) elm_object_style_set(pu, style);
101 evas_object_show(pu);
104 Evas_Object *_add_label(Evas_Object *parent, const char *style, const char *text)
107 lb = elm_label_add(parent);
108 retvm_if(lb == NULL, NULL, "Failed to add label\n");
109 elm_object_style_set(lb, style);
110 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
111 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
112 elm_label_line_wrap_set(lb, ELM_WRAP_MIXED);
113 elm_object_text_set(lb, text);