2 # include "elementary_config.h"
4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
11 // aligned to top of box
16 fac_unrealize(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
18 // setting factory content to null deletes it
19 printf("--------DELETE for factory %p [f: %p]\n", elm_object_content_get(obj), obj);
20 elm_object_content_set(obj, NULL);
24 fac_realize_end(void *data, Evas_Object *obj, void *event_info __UNUSED__)
26 Evas_Object *win = data;
30 bx = elm_box_add(win);
31 printf(" ADD lv 3 = %p [%i]\n", bx, (BLOK * (int)(long)evas_object_data_get(obj, "num")));
33 elm_box_homogeneous_set(bx, EINA_TRUE);
36 elm_box_align_set(bx, 0.0, 0.0);
39 for (i = 0; i < BLOK; i++)
43 snprintf(buf, sizeof(buf), "%i",
44 (i + (BLOK * (int)(long)evas_object_data_get(obj, "num"))));
46 bt = elm_button_add(win);
47 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
49 elm_object_text_set(bt, buf);
50 elm_box_pack_end(bx, bt);
54 elm_object_content_set(obj, bx);
59 fac_realize2(void *data, Evas_Object *obj, void *event_info __UNUSED__)
61 Evas_Object *win = data;
65 bx = elm_box_add(win);
66 printf(" ADD lv 2 = %p [%i]\n", bx, (BLOK * (int)(long)evas_object_data_get(obj, "num")));
68 elm_box_homogeneous_set(bx, EINA_TRUE);
71 elm_box_align_set(bx, 0.0, 0.0);
74 for (i = 0; i < BLOK; i++)
76 fc = elm_factory_add(win);
77 elm_factory_maxmin_mode_set(fc, EINA_TRUE);
78 // initial height per factory of DEFSZ
79 // scrollbar will be wrong until enough
80 // children have been realized and the
82 evas_object_data_set(fc, "num", (void *)(long)(i + (BLOK * (int)(long)evas_object_data_get(obj, "num"))));
83 evas_object_size_hint_min_set(fc, 0, DEFSZ);
84 evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
85 evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL);
86 evas_object_smart_callback_add(fc, "realize", fac_realize_end, win);
87 evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win);
88 elm_box_pack_end(bx, fc);
92 elm_object_content_set(obj, bx);
97 fac_realize1(void *data, Evas_Object *obj, void *event_info __UNUSED__)
99 Evas_Object *win = data;
100 Evas_Object *bx, *fc;
103 bx = elm_box_add(win);
104 printf(" ADD lv 1 = %p [%i]\n", bx, (BLOK * (int)(long)evas_object_data_get(obj, "num")));
106 elm_box_homogeneous_set(bx, EINA_TRUE);
109 elm_box_align_set(bx, 0.0, 0.0);
112 for (i = 0; i < BLOK; i++)
114 fc = elm_factory_add(win);
115 elm_factory_maxmin_mode_set(fc, EINA_TRUE);
116 // initial height per factory of DEFSZ
117 // scrollbar will be wrong until enough
118 // children have been realized and the
119 // real size is known
120 evas_object_data_set(fc, "num", (void *)(long)(i + (BLOK * (int)(long)evas_object_data_get(obj, "num"))));
121 evas_object_size_hint_min_set(fc, 0, DEFSZ);
122 evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
123 evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL);
124 evas_object_smart_callback_add(fc, "realize", fac_realize2, win);
125 // evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win);
126 elm_box_pack_end(bx, fc);
127 evas_object_show(fc);
130 elm_object_content_set(obj, bx);
131 evas_object_show(bx);
135 test_factory(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
137 Evas_Object *win, *bx, *sc, *fc;
140 win = elm_win_util_standard_add("factory", "Factory");
141 elm_win_autodel_set(win, EINA_TRUE);
143 bx = elm_box_add(win);
145 elm_box_homogeneous_set(bx, EINA_TRUE);
148 elm_box_align_set(bx, 0.0, 0.0);
150 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, 0.0);
152 for (i = 0; i < BLOK; i++)
154 fc = elm_factory_add(win);
155 elm_factory_maxmin_mode_set(fc, EINA_TRUE);
156 // initial height per factory of DEFSZ
157 // scrollbar will be wrong until enough
158 // children have been realized and the
159 // real size is known
160 evas_object_data_set(fc, "num", (void *)(long)i);
161 evas_object_size_hint_min_set(fc, 0, DEFSZ);
162 evas_object_size_hint_weight_set(fc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
163 evas_object_size_hint_align_set(fc, EVAS_HINT_FILL, EVAS_HINT_FILL);
164 evas_object_smart_callback_add(fc, "realize", fac_realize1, win);
165 // evas_object_smart_callback_add(fc, "unrealize", fac_unrealize, win);
166 elm_box_pack_end(bx, fc);
167 evas_object_show(fc);
170 sc = elm_scroller_add(win);
171 elm_scroller_bounce_set(sc, EINA_FALSE, EINA_TRUE);
172 evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
173 elm_win_resize_object_add(win, sc);
175 elm_object_content_set(sc, bx);
176 evas_object_show(bx);
178 evas_object_show(sc);
180 evas_object_resize(win, 320, 480);
181 evas_object_show(win);