1 #include <Elementary.h>
3 # include "elementary_config.h"
5 #ifndef ELM_LIB_QUICKLAUNCH
7 my_bt_go_300_300(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
9 elm_scroller_region_bring_in((Evas_Object *)data, 300, 300, 318, 318);
13 my_bt_go_900_300(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
15 elm_scroller_region_bring_in((Evas_Object *)data, 900, 300, 318, 318);
19 my_bt_go_300_900(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
21 elm_scroller_region_bring_in((Evas_Object *)data, 300, 900, 318, 318);
25 my_bt_go_900_900(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
27 elm_scroller_region_bring_in((Evas_Object *)data, 900, 900, 318, 318);
31 test_scroller(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
33 Evas_Object *win, *bg2, *tb, *tb2, *bg, *sc, *bt;
49 win = elm_win_add(NULL, "scroller", ELM_WIN_BASIC);
50 elm_win_title_set(win, "Scroller");
51 elm_win_autodel_set(win, EINA_TRUE);
54 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
55 elm_win_resize_object_add(win, bg);
58 tb = elm_table_add(win);
59 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
62 for (j = 0; j < 12; j++)
64 for (i = 0; i < 12; i++)
66 bg2 = elm_bg_add(win);
67 snprintf(buf, sizeof(buf), "%s/images/%s",
68 elm_app_data_dir_get(), img[n]);
71 elm_bg_file_set(bg2, buf, NULL);
72 evas_object_size_hint_weight_set(bg2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
73 evas_object_size_hint_align_set(bg2, EVAS_HINT_FILL, EVAS_HINT_FILL);
74 evas_object_size_hint_min_set(bg2, 318, 318);
75 elm_table_pack(tb, bg2, i, j, 1, 1);
76 evas_object_show(bg2);
80 sc = elm_scroller_add(win);
81 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
82 elm_win_resize_object_add(win, sc);
84 elm_object_content_set(sc, tb);
87 elm_scroller_page_relative_set(sc, 1.0, 1.0);
90 tb2 = elm_table_add(win);
91 evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
92 elm_win_resize_object_add(win, tb2);
94 bt = elm_button_add(win);
95 elm_object_text_set(bt, "to 300 300");
96 evas_object_smart_callback_add(bt, "clicked", my_bt_go_300_300, sc);
97 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
98 evas_object_size_hint_align_set(bt, 0.1, 0.1);
99 elm_table_pack(tb2, bt, 0, 0, 1, 1);
100 evas_object_show(bt);
102 bt = elm_button_add(win);
103 elm_object_text_set(bt, "to 900 300");
104 evas_object_smart_callback_add(bt, "clicked", my_bt_go_900_300, sc);
105 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
106 evas_object_size_hint_align_set(bt, 0.9, 0.1);
107 elm_table_pack(tb2, bt, 1, 0, 1, 1);
108 evas_object_show(bt);
110 bt = elm_button_add(win);
111 elm_object_text_set(bt, "to 300 900");
112 evas_object_smart_callback_add(bt, "clicked", my_bt_go_300_900, sc);
113 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
114 evas_object_size_hint_align_set(bt, 0.1, 0.9);
115 elm_table_pack(tb2, bt, 0, 1, 1, 1);
116 evas_object_show(bt);
118 bt = elm_button_add(win);
119 elm_object_text_set(bt, "to 900 900");
120 evas_object_smart_callback_add(bt, "clicked", my_bt_go_900_900, sc);
121 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
122 evas_object_size_hint_align_set(bt, 0.9, 0.9);
123 elm_table_pack(tb2, bt, 1, 1, 1, 1);
124 evas_object_show(bt);
126 evas_object_show(tb2);
128 evas_object_resize(win, 320, 320);
129 evas_object_show(win);
133 click_through(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
135 printf("click went through on %p\n", obj);
139 test_scroller2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
141 Evas_Object *win, *bt, *bx, *bx2, *bg, *sc, *tb, *tb2, *rc;
144 win = elm_win_add(NULL, "scroller2", ELM_WIN_BASIC);
145 elm_win_title_set(win, "Scroller 2");
146 elm_win_autodel_set(win, EINA_TRUE);
148 bg = elm_bg_add(win);
149 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
150 elm_win_resize_object_add(win, bg);
151 evas_object_show(bg);
153 bx = elm_box_add(win);
154 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
155 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0);
158 for (i = 0; i < 3; i++)
160 bt = elm_button_add(win);
161 elm_object_text_set(bt, "Vertical");
162 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
163 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
164 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
165 elm_box_pack_end(bx, bt);
166 evas_object_show(bt);
171 sc = elm_scroller_add(win);
172 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0.0);
173 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, 0.5);
174 elm_scroller_bounce_set(sc, 1, 0);
175 elm_scroller_content_min_limit(sc, 0, 1);
176 elm_box_pack_end(bx, sc);
177 evas_object_show(sc);
179 bx2 = elm_box_add(win);
180 elm_box_horizontal_set(bx2, EINA_TRUE);
182 for (i = 0; i < 10; i++)
184 bt = elm_button_add(win);
185 elm_object_text_set(bt, "... Horizontal scrolling ...");
186 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
187 elm_box_pack_end(bx2, bt);
188 evas_object_show(bt);
191 elm_object_content_set(sc, bx2);
192 evas_object_show(bx2);
196 for (i = 0; i < 3; i++)
198 bt = elm_button_add(win);
199 elm_object_text_set(bt, "Vertical");
200 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
201 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
202 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
203 elm_box_pack_end(bx, bt);
204 evas_object_show(bt);
209 tb = elm_table_add(win);
210 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
211 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
212 elm_box_pack_end(bx, tb);
213 evas_object_show(tb);
215 rc = evas_object_rectangle_add(evas_object_evas_get(win));
216 evas_object_size_hint_min_set(rc, 200, 120);
217 elm_table_pack(tb, rc, 0, 0, 1, 1);
219 sc = elm_scroller_add(win);
220 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
221 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
222 elm_table_pack(tb, sc, 0, 0, 1, 1);
223 evas_object_show(sc);
225 tb2 = elm_table_add(win);
227 for (j = 0; j < 16; j++)
229 for (i = 0; i < 16; i++)
231 bt = elm_button_add(win);
232 elm_object_text_set(bt, "Both");
233 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
234 elm_table_pack(tb2, bt, i, j, 1, 1);
235 evas_object_show(bt);
239 elm_object_content_set(sc, tb2);
240 evas_object_show(tb2);
243 for (i = 0; i < 24; i++)
245 bt = elm_button_add(win);
246 elm_object_text_set(bt, "Vertical");
247 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
248 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
249 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
250 elm_box_pack_end(bx, bt);
251 evas_object_show(bt);
254 sc = elm_scroller_add(win);
255 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
256 elm_scroller_bounce_set(sc, 0, 1);
257 elm_win_resize_object_add(win, sc);
258 elm_object_content_set(sc, bx);
259 evas_object_show(bx);
260 evas_object_show(sc);
262 evas_object_resize(win, 320, 480);
263 evas_object_show(win);