1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
8 _cb_radio_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
10 Evas_Object *o_bg = data;
12 elm_bg_option_set(o_bg, elm_radio_value_get((Evas_Object *)obj));
16 _cb_overlay_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
18 Evas_Object *o_bg = data;
20 if (elm_check_state_get(obj))
22 Evas_Object *parent, *over;
25 snprintf(buff, sizeof(buff), "%s/objects/test.edj", PACKAGE_DATA_DIR);
26 parent = elm_object_parent_widget_get(o_bg);
27 over = edje_object_add(evas_object_evas_get(parent));
28 edje_object_file_set(over, buff, "bg_overlay");
29 elm_bg_overlay_set(o_bg, over);
32 elm_bg_overlay_set(o_bg, NULL);
36 _cb_color_changed(void *data, Evas_Object *obj, void *event __UNUSED__)
38 Evas_Object *o_bg = data;
41 val = elm_spinner_value_get(obj);
43 elm_bg_color_set(o_bg, 255, 255, 255);
45 elm_bg_color_set(o_bg, 255, 0, 0);
47 elm_bg_color_set(o_bg, 0, 0, 255);
49 elm_bg_color_set(o_bg, 0, 255, 0);
53 test_bg_plain(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
55 Evas_Object *win, *bg;
57 win = elm_win_add(NULL, "bg-plain", ELM_WIN_BASIC);
58 elm_win_title_set(win, "Bg Plain");
59 elm_win_autodel_set(win, 1);
62 /* allow bg to expand in x & y */
63 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
64 elm_win_resize_object_add(win, bg);
67 /* set size hints. a minimum size for the bg. this should propagate back
68 * to the window thus limiting its size based off the bg as the bg is one
69 * of the window's resize objects. */
70 evas_object_size_hint_min_set(bg, 160, 160);
71 /* and set a maximum size. not needed very often. normally used together
72 * with evas_object_size_hint_min_set() at the same size to make a
73 * window not resizable */
74 evas_object_size_hint_max_set(bg, 640, 640);
75 /* and now just resize the window to a size you want. normally widgets
76 * will determine the initial size though */
77 evas_object_resize(win, 320, 320);
78 /* and show the window */
79 evas_object_show(win);
83 test_bg_image(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
85 Evas_Object *win, *bg;
88 win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC);
89 elm_win_title_set(win, "Bg Image");
90 elm_win_autodel_set(win, 1);
93 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
94 elm_bg_file_set(bg, buf, NULL);
95 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
96 elm_win_resize_object_add(win, bg);
99 evas_object_size_hint_min_set(bg, 160, 160);
100 evas_object_size_hint_max_set(bg, 640, 640);
101 evas_object_resize(win, 320, 320);
102 evas_object_show(win);
106 test_bg_options(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
108 Evas_Object *win, *bg;
109 Evas_Object *box, *hbox, *o_bg;
110 Evas_Object *rd, *rdg;
113 win = elm_win_add(NULL, "bg-options", ELM_WIN_BASIC);
114 elm_win_title_set(win, "Bg Options");
115 elm_win_autodel_set(win, 1);
117 bg = elm_bg_add(win);
118 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
119 elm_win_resize_object_add(win, bg);
120 evas_object_show(bg);
122 box = elm_box_add(win);
123 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
124 elm_win_resize_object_add(win, box);
125 evas_object_show(box);
127 o_bg = elm_bg_add(win);
128 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
129 elm_bg_file_set(o_bg, buf, NULL);
130 evas_object_size_hint_weight_set(o_bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
131 evas_object_size_hint_align_set(o_bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
132 elm_box_pack_end(box, o_bg);
133 evas_object_show(o_bg);
135 hbox = elm_box_add(win);
136 elm_box_horizontal_set(hbox, EINA_TRUE);
137 evas_object_size_hint_weight_set(hbox, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
138 evas_object_size_hint_align_set(hbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
140 rd = elm_radio_add(win);
141 elm_radio_state_value_set(rd, ELM_BG_OPTION_CENTER);
142 elm_radio_label_set(rd, "Center");
143 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
144 evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
145 elm_box_pack_end(hbox, rd);
146 evas_object_show(rd);
149 rd = elm_radio_add(win);
150 elm_radio_state_value_set(rd, ELM_BG_OPTION_SCALE);
151 elm_radio_group_add(rd, rdg);
152 elm_radio_label_set(rd, "Scale");
153 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
154 evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
155 elm_box_pack_end(hbox, rd);
156 evas_object_show(rd);
158 rd = elm_radio_add(win);
159 elm_radio_state_value_set(rd, ELM_BG_OPTION_STRETCH);
160 elm_radio_group_add(rd, rdg);
161 elm_radio_label_set(rd, "Stretch");
162 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
163 evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
164 elm_box_pack_end(hbox, rd);
165 evas_object_show(rd);
167 rd = elm_radio_add(win);
168 elm_radio_state_value_set(rd, ELM_BG_OPTION_TILE);
169 elm_radio_group_add(rd, rdg);
170 elm_radio_label_set(rd, "Tile");
171 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
172 evas_object_smart_callback_add(rd, "changed", _cb_radio_changed, o_bg);
173 elm_box_pack_end(hbox, rd);
174 evas_object_show(rd);
176 elm_radio_value_set(rdg, ELM_BG_OPTION_SCALE);
178 rd = elm_check_add(win);
179 elm_check_label_set(rd, "Show Overlay");
180 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
181 evas_object_smart_callback_add(rd, "changed", _cb_overlay_changed, o_bg);
182 elm_box_pack_end(hbox, rd);
183 evas_object_show(rd);
185 /* color choices ... this is ghetto, but we don't have a 'colorpicker'
187 rd = elm_spinner_add(win);
188 elm_object_style_set(rd, "vertical");
189 elm_spinner_min_max_set(rd, 1, 4);
190 elm_spinner_label_format_set(rd, "%.0f");
191 elm_spinner_editable_set(rd, EINA_FALSE);
192 elm_spinner_special_value_add(rd, 1, "White");
193 elm_spinner_special_value_add(rd, 2, "Red");
194 elm_spinner_special_value_add(rd, 3, "Blue");
195 elm_spinner_special_value_add(rd, 4, "Green");
196 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
197 evas_object_size_hint_align_set(rd, EVAS_HINT_FILL, EVAS_HINT_FILL);
198 evas_object_smart_callback_add(rd, "changed", _cb_color_changed, o_bg);
199 elm_box_pack_end(hbox, rd);
200 evas_object_show(rd);
202 elm_box_pack_end(box, hbox);
203 evas_object_show(hbox);
205 evas_object_size_hint_min_set(bg, 160, 160);
206 evas_object_size_hint_max_set(bg, 640, 640);
207 evas_object_resize(win, 320, 320);
208 evas_object_show(win);