1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 _cb_size_radio_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
10 Evas_Object *o_bg = data;
12 size = elm_radio_value_get((Evas_Object *)obj);
13 elm_bg_load_size_set(o_bg, size, size);
17 _cb_radio_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
19 Evas_Object *o_bg = data;
21 elm_bg_option_set(o_bg, elm_radio_value_get((Evas_Object *)obj));
25 _cb_overlay_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
27 Evas_Object *o_bg = data;
29 if (elm_check_state_get(obj))
31 Evas_Object *parent, *over;
34 snprintf(buff, sizeof(buff), "%s/objects/test.edj", elm_app_data_dir_get());
35 parent = elm_object_parent_widget_get(o_bg);
36 over = edje_object_add(evas_object_evas_get(parent));
37 edje_object_file_set(over, buff, "bg_overlay");
38 elm_object_part_content_set(o_bg, "overlay", over);
41 elm_object_part_content_set(o_bg, "overlay", NULL);
45 _cb_color_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
47 Evas_Object *o_bg = data;
50 val = elm_spinner_value_get(obj);
52 elm_bg_color_set(o_bg, 255, 255, 255);
54 elm_bg_color_set(o_bg, 255, 0, 0);
56 elm_bg_color_set(o_bg, 0, 0, 255);
58 elm_bg_color_set(o_bg, 0, 255, 0);
62 test_bg_plain(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
64 Evas_Object *win, *bg;
66 win = elm_win_add(NULL, "bg-plain", ELM_WIN_BASIC);
67 elm_win_title_set(win, "Bg Plain");
68 elm_win_autodel_set(win, EINA_TRUE);
71 /* allow bg to expand in x & y */
72 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
73 elm_win_resize_object_add(win, bg);
76 /* set size hints. a minimum size for the bg. this should propagate back
77 * to the window thus limiting its size based off the bg as the bg is one
78 * of the window's resize objects. */
79 evas_object_size_hint_min_set(bg, 160, 160);
80 /* and set a maximum size. not needed very often. normally used together
81 * with evas_object_size_hint_min_set() at the same size to make a
82 * window not resizable */
83 evas_object_size_hint_max_set(bg, 640, 640);
84 /* and now just resize the window to a size you want. normally widgets
85 * will determine the initial size though */
86 evas_object_resize(win, 320, 320);
87 /* and show the window */
88 evas_object_show(win);
92 test_bg_image(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
94 Evas_Object *win, *bg;
95 Evas_Object *box, *hbox, *o_bg;
96 Evas_Object *rd, *rdg;
99 win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC);
100 elm_win_title_set(win, "Bg Image");
101 elm_win_autodel_set(win, EINA_TRUE);
103 bg = elm_bg_add(win);
104 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
105 elm_win_resize_object_add(win, bg);
106 evas_object_show(bg);
108 box = elm_box_add(win);
109 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
110 elm_win_resize_object_add(win, box);
111 evas_object_show(box);
113 o_bg = elm_bg_add(win);
114 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
115 elm_bg_file_set(o_bg, buf, NULL);
116 evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
117 evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
118 elm_box_pack_end(box, o_bg);
120 hbox = elm_box_add(win);
121 elm_box_horizontal_set(hbox, EINA_TRUE);
122 evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
123 evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
125 rd = elm_radio_add(win);
126 elm_radio_state_value_set(rd, 50);
127 elm_object_text_set(rd, "50 x 50");
128 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
129 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg);
130 elm_box_pack_end(hbox, rd);
131 evas_object_show(rd);
134 rd = elm_radio_add(win);
135 elm_radio_state_value_set(rd, 100);
136 elm_radio_group_add(rd, rdg);
137 elm_object_text_set(rd, "100 x 100");
138 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
139 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg);
140 elm_box_pack_end(hbox, rd);
141 evas_object_show(rd);
143 rd = elm_radio_add(win);
144 elm_radio_state_value_set(rd, 200);
145 elm_radio_group_add(rd, rdg);
146 elm_object_text_set(rd, "200 x 200");
147 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
148 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, o_bg);
149 elm_box_pack_end(hbox, rd);
150 evas_object_show(rd);
152 elm_radio_value_set(rdg, 200);
154 elm_box_pack_end(box, hbox);
155 evas_object_show(hbox);
157 evas_object_show(o_bg);
158 evas_object_size_hint_min_set(bg, 160, 160);
159 evas_object_size_hint_max_set(bg, 640, 640);
160 evas_object_resize(win, 320, 320);
161 evas_object_show(win);
165 test_bg_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
167 Evas_Object *win, *bg;
168 Evas_Object *box, *hbox, *o_bg;
169 Evas_Object *rd, *rdg;
172 win = elm_win_add(NULL, "bg-options", ELM_WIN_BASIC);
173 elm_win_title_set(win, "Bg Options");
174 elm_win_autodel_set(win, EINA_TRUE);
176 bg = elm_bg_add(win);
177 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
178 elm_win_resize_object_add(win, bg);
179 evas_object_show(bg);
181 box = elm_box_add(win);
182 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
183 elm_win_resize_object_add(win, box);
184 evas_object_show(box);
186 o_bg = elm_bg_add(win);
187 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", elm_app_data_dir_get());
188 elm_bg_file_set(o_bg, buf, NULL);
189 evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
190 evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
191 elm_box_pack_end(box, o_bg);
192 evas_object_show(o_bg);
194 hbox = elm_box_add(win);
195 elm_box_horizontal_set(hbox, EINA_TRUE);
196 evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
197 evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
199 rd = elm_radio_add(win);
200 elm_radio_state_value_set(rd, ELM_BG_OPTION_CENTER);
201 elm_object_text_set(rd, "Center");
202 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
203 evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
204 elm_box_pack_end(hbox, rd);
205 evas_object_show(rd);
208 rd = elm_radio_add(win);
209 elm_radio_state_value_set(rd, ELM_BG_OPTION_SCALE);
210 elm_radio_group_add(rd, rdg);
211 elm_object_text_set(rd, "Scale");
212 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
213 evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
214 elm_box_pack_end(hbox, rd);
215 evas_object_show(rd);
217 rd = elm_radio_add(win);
218 elm_radio_state_value_set(rd, ELM_BG_OPTION_STRETCH);
219 elm_radio_group_add(rd, rdg);
220 elm_object_text_set(rd, "Stretch");
221 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
222 evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
223 elm_box_pack_end(hbox, rd);
224 evas_object_show(rd);
226 rd = elm_radio_add(win);
227 elm_radio_state_value_set(rd, ELM_BG_OPTION_TILE);
228 elm_radio_group_add(rd, rdg);
229 elm_object_text_set(rd, "Tile");
230 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
231 evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
232 elm_box_pack_end(hbox, rd);
233 evas_object_show(rd);
235 elm_radio_value_set(rdg, ELM_BG_OPTION_SCALE);
237 rd = elm_check_add(win);
238 elm_object_text_set(rd, "Show Overlay");
239 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
240 evas_object_smart_callback_add(rd, "changed", _cb_overlay_changed, o_bg);
241 elm_box_pack_end(hbox, rd);
242 evas_object_show(rd);
244 /* color choices ... this is ghetto, but we don't have a 'colorpicker'
246 rd = elm_spinner_add(win);
247 elm_object_style_set(rd, "vertical");
248 elm_spinner_min_max_set(rd, 1, 4);
249 elm_spinner_label_format_set(rd, "%.0f");
250 elm_spinner_editable_set(rd, EINA_FALSE);
251 elm_spinner_special_value_add(rd, 1, "White");
252 elm_spinner_special_value_add(rd, 2, "Red");
253 elm_spinner_special_value_add(rd, 3, "Blue");
254 elm_spinner_special_value_add(rd, 4, "Green");
255 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
256 evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL);
257 evas_object_smart_callback_add(rd, "changed", _cb_color_changed, o_bg);
258 elm_box_pack_end(hbox, rd);
259 evas_object_show(rd);
261 elm_box_pack_end(box, hbox);
262 evas_object_show(hbox);
264 evas_object_size_hint_min_set(bg, 160, 160);
265 evas_object_size_hint_max_set(bg, 640, 640);
266 evas_object_resize(win, 320, 320);
267 evas_object_show(win);