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)
26 Evas_Object *eo = NULL;
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 if(w == -1 || h == -1){
37 _E("ecore_x_window_seiz_get() is failed\n");
40 evas_object_resize(eo, w, h);
45 Evas_Object *_add_slider(Evas_Object *parent, int min, int max, int val)
47 Evas_Object *sl = NULL;
48 sl = elm_slider_add(parent);
49 retvm_if(sl == NULL, NULL, "Failed to add slider\n");
50 elm_slider_horizontal_set(sl, EINA_TRUE);
51 elm_slider_indicator_show_set(sl, EINA_TRUE);
52 elm_slider_indicator_format_set(sl, "%.0f");
53 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
54 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
55 elm_slider_min_max_set(sl, min, max);
56 elm_slider_value_set(sl, val);
60 Evas_Object *_add_layout(Evas_Object *parent, const char *file,
63 Evas_Object *eo = NULL;
66 retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n");
67 retvm_if(file == NULL, NULL, "Invalid argument: file is NULL\n");
68 retvm_if(group == NULL, NULL, "Invalid argument: group is NULL\n");
70 eo = elm_layout_add(parent);
71 retvm_if(eo == NULL, NULL, "Failed to add layout\n");
73 r = elm_layout_file_set(eo, file, group);
75 _E("Failed to set file[%s]\n", file);
80 evas_object_size_hint_weight_set(eo,
81 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
86 Evas_Object *_add_button(Evas_Object *parent, const char *style, const char *text)
88 Evas_Object *bt = NULL;
89 bt = elm_button_add(parent);
90 retvm_if(bt == NULL, NULL, "Failed to add button\n");
91 if (style) elm_object_style_set(bt, style);
92 elm_object_focus_set(bt, EINA_FALSE);
93 elm_object_text_set(bt, text);
98 Evas_Object *_add_popup(Evas_Object *parent, const char *style)
100 Evas_Object *pu = NULL;
101 pu = elm_popup_add(parent);
102 retvm_if(pu == NULL, NULL, "[Error] Failed to add popup\n");
103 evas_object_size_hint_weight_set(pu, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
104 if (style) elm_object_style_set(pu, style);
105 evas_object_show(pu);
108 Evas_Object *_add_label(Evas_Object *parent, const char *style, const char *text)
110 Evas_Object *lb = NULL;
111 lb = elm_label_add(parent);
112 retvm_if(lb == NULL, NULL, "Failed to add label\n");
113 elm_object_style_set(lb, style);
114 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
115 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
116 elm_label_line_wrap_set(lb, ELM_WRAP_MIXED);
117 elm_object_text_set(lb, text);