3 * Copyright 2012 Samsung Electronics Co., Ltd
5 * Licensed under the Flora License, Version 1.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
9 * http://floralicense.org/license/
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.
21 #include <system_info.h>
24 #include "_util_log.h"
26 Ecore_X_Window _add_input_window(void)
28 Ecore_X_Window win = 0;
29 win = ecore_x_window_input_new(0, 0, 0, 1, 1);
31 ecore_x_event_mask_unset(win, ECORE_X_EVENT_MASK_NONE);
32 ecore_x_icccm_title_set(win, "volumekey-input-window");
33 ecore_x_netwm_name_set(win, "volumekey-input-window");
34 ecore_x_netwm_pid_set(win, getpid());
38 _E("%s() is failed\n", __func__);
43 Evas_Object *_add_window(const char *name)
45 Evas_Object *eo = NULL;
47 eo = elm_win_add(NULL, name, ELM_WIN_NOTIFICATION);
49 elm_win_title_set(eo, name);
50 elm_win_borderless_set(eo, EINA_TRUE);
51 elm_win_alpha_set(eo, EINA_TRUE);
52 system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_WIDTH, &w);
53 system_info_get_value_int(SYSTEM_INFO_KEY_SCREEN_HEIGHT, &h);
54 if(w == -1 || h == -1){
55 _E("ecore_x_window_seiz_get() is failed\n");
58 evas_object_resize(eo, w, h);
63 Evas_Object *_add_slider(Evas_Object *parent, int min, int max, int val)
65 Evas_Object *sl = NULL;
66 sl = elm_slider_add(parent);
67 retvm_if(sl == NULL, NULL, "Failed to add slider\n");
68 elm_slider_horizontal_set(sl, EINA_TRUE);
69 elm_slider_indicator_show_set(sl, EINA_TRUE);
70 elm_slider_indicator_format_set(sl, "%.0f");
71 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
72 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
73 elm_slider_min_max_set(sl, min, max);
74 elm_slider_value_set(sl, val);
78 Evas_Object *_add_layout(Evas_Object *parent, const char *file,
81 Evas_Object *eo = NULL;
84 retvm_if(parent == NULL, NULL, "Invalid argument: parent is NULL\n");
85 retvm_if(file == NULL, NULL, "Invalid argument: file is NULL\n");
86 retvm_if(group == NULL, NULL, "Invalid argument: group is NULL\n");
88 eo = elm_layout_add(parent);
89 retvm_if(eo == NULL, NULL, "Failed to add layout\n");
91 r = elm_layout_file_set(eo, file, group);
93 _E("Failed to set file[%s]\n", file);
98 evas_object_size_hint_weight_set(eo,
99 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
100 evas_object_show(eo);
104 Evas_Object *_add_button(Evas_Object *parent, const char *style, const char *text)
106 Evas_Object *bt = NULL;
107 bt = elm_button_add(parent);
108 retvm_if(bt == NULL, NULL, "Failed to add button\n");
109 if (style) elm_object_style_set(bt, style);
110 elm_object_focus_set(bt, EINA_FALSE);
111 elm_object_text_set(bt, text);
112 evas_object_show(bt);
116 Evas_Object *_add_popup(Evas_Object *parent, const char *style)
118 Evas_Object *pu = NULL;
119 pu = elm_popup_add(parent);
120 retvm_if(pu == NULL, NULL, "[Error] Failed to add popup\n");
121 evas_object_size_hint_weight_set(pu, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
122 if (style) elm_object_style_set(pu, style);
123 evas_object_show(pu);
126 Evas_Object *_add_label(Evas_Object *parent, const char *style, const char *text)
128 Evas_Object *lb = NULL;
129 lb = elm_label_add(parent);
130 retvm_if(lb == NULL, NULL, "Failed to add label\n");
131 elm_object_style_set(lb, style);
132 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
133 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, EVAS_HINT_FILL);
134 elm_label_line_wrap_set(lb, ELM_WRAP_MIXED);
135 elm_object_text_set(lb, text);