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, 1);
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 PACKAGE_DATA_DIR, 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_scroller_content_set(sc, tb);
87 elm_scroller_page_relative_set(sc, 1.0, 1.0);
88 // elm_scroller_page_size_set(sc, 200, 200);
91 tb2 = elm_table_add(win);
92 evas_object_size_hint_weight_set(tb2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
93 elm_win_resize_object_add(win, tb2);
95 bt = elm_button_add(win);
96 elm_button_label_set(bt, "to 300 300");
97 evas_object_smart_callback_add(bt, "clicked", my_bt_go_300_300, sc);
98 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
99 evas_object_size_hint_align_set(bt, 0.1, 0.1);
100 elm_table_pack(tb2, bt, 0, 0, 1, 1);
101 evas_object_show(bt);
103 bt = elm_button_add(win);
104 elm_button_label_set(bt, "to 900 300");
105 evas_object_smart_callback_add(bt, "clicked", my_bt_go_900_300, sc);
106 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
107 evas_object_size_hint_align_set(bt, 0.9, 0.1);
108 elm_table_pack(tb2, bt, 1, 0, 1, 1);
109 evas_object_show(bt);
111 bt = elm_button_add(win);
112 elm_button_label_set(bt, "to 300 900");
113 evas_object_smart_callback_add(bt, "clicked", my_bt_go_300_900, sc);
114 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
115 evas_object_size_hint_align_set(bt, 0.1, 0.9);
116 elm_table_pack(tb2, bt, 0, 1, 1, 1);
117 evas_object_show(bt);
119 bt = elm_button_add(win);
120 elm_button_label_set(bt, "to 900 900");
121 evas_object_smart_callback_add(bt, "clicked", my_bt_go_900_900, sc);
122 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
123 evas_object_size_hint_align_set(bt, 0.9, 0.9);
124 elm_table_pack(tb2, bt, 1, 1, 1, 1);
125 evas_object_show(bt);
127 evas_object_show(tb2);
129 evas_object_resize(win, 320, 320);
130 evas_object_show(win);
134 click_through(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
136 printf("click went through on %p\n", obj);
140 test_scroller2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
142 Evas_Object *win, *bt, *bx, *bx2, *bg, *sc, *tb, *tb2, *rc;
145 win = elm_win_add(NULL, "scroller2", ELM_WIN_BASIC);
146 elm_win_title_set(win, "Scroller 2");
147 elm_win_autodel_set(win, 1);
149 bg = elm_bg_add(win);
150 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
151 elm_win_resize_object_add(win, bg);
152 evas_object_show(bg);
154 bx = elm_box_add(win);
155 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
156 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, 0.0);
159 for (i = 0; i < 3; i++)
161 bt = elm_button_add(win);
162 elm_button_label_set(bt, "Vertical");
163 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
164 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
165 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
166 elm_box_pack_end(bx, bt);
167 evas_object_show(bt);
172 sc = elm_scroller_add(win);
173 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, 0.0);
174 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, 0.5);
175 elm_scroller_bounce_set(sc, 1, 0);
176 elm_scroller_content_min_limit(sc, 0, 1);
177 elm_box_pack_end(bx, sc);
178 evas_object_show(sc);
180 bx2 = elm_box_add(win);
181 elm_box_horizontal_set(bx2, 1);
183 for (i = 0; i < 10; i++)
185 bt = elm_button_add(win);
186 elm_button_label_set(bt, "... Horizontal scrolling ...");
187 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
188 elm_box_pack_end(bx2, bt);
189 evas_object_show(bt);
192 elm_scroller_content_set(sc, bx2);
193 evas_object_show(bx2);
197 for (i = 0; i < 3; i++)
199 bt = elm_button_add(win);
200 elm_button_label_set(bt, "Vertical");
201 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
202 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
203 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
204 elm_box_pack_end(bx, bt);
205 evas_object_show(bt);
210 tb = elm_table_add(win);
211 evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
212 evas_object_size_hint_align_set(tb, EVAS_HINT_FILL, EVAS_HINT_FILL);
213 elm_box_pack_end(bx, tb);
214 evas_object_show(tb);
216 rc = evas_object_rectangle_add(evas_object_evas_get(win));
217 evas_object_size_hint_min_set(rc, 200, 120);
218 elm_table_pack(tb, rc, 0, 0, 1, 1);
220 sc = elm_scroller_add(win);
221 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
222 evas_object_size_hint_align_set(sc, EVAS_HINT_FILL, EVAS_HINT_FILL);
223 elm_table_pack(tb, sc, 0, 0, 1, 1);
224 evas_object_show(sc);
226 tb2 = elm_table_add(win);
228 for (j = 0; j < 16; j++)
230 for (i = 0; i < 16; i++)
232 bt = elm_button_add(win);
233 elm_button_label_set(bt, "Both");
234 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
235 elm_table_pack(tb2, bt, i, j, 1, 1);
236 evas_object_show(bt);
240 elm_scroller_content_set(sc, tb2);
241 evas_object_show(tb2);
244 for (i = 0; i < 24; i++)
246 bt = elm_button_add(win);
247 elm_button_label_set(bt, "Vertical");
248 evas_object_smart_callback_add(bt, "clicked", click_through, NULL);
249 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
250 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
251 elm_box_pack_end(bx, bt);
252 evas_object_show(bt);
255 sc = elm_scroller_add(win);
256 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
257 elm_scroller_bounce_set(sc, 0, 1);
258 elm_win_resize_object_add(win, sc);
259 elm_scroller_content_set(sc, bx);
260 evas_object_show(bx);
261 evas_object_show(sc);
263 evas_object_resize(win, 320, 480);
264 evas_object_show(win);