[Entry] Fix scrolling issue with cnp, magnifier
[framework/uifw/elementary.git] / src / bin / test_table.c
1 #ifdef HAVE_CONFIG_H
2 # include "elementary_config.h"
3 #endif
4 #include <Elementary.h>
5 #ifndef ELM_LIB_QUICKLAUNCH
6 void
7 test_table(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
8 {
9    Evas_Object *win, *tb, *bt;
10
11    win = elm_win_util_standard_add("table", "Table");
12    elm_win_autodel_set(win, EINA_TRUE);
13
14    tb = elm_table_add(win);
15    elm_win_resize_object_add(win, tb);
16    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
17    evas_object_show(tb);
18
19    bt = elm_button_add(win);
20    elm_object_text_set(bt, "Button 1");
21    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
22    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
23    elm_table_pack(tb, bt, 0, 0, 1, 1);
24    evas_object_show(bt);
25
26    bt = elm_button_add(win);
27    elm_object_text_set(bt, "Button 2");
28    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
29    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
30    elm_table_pack(tb, bt, 1, 0, 1, 1);
31    evas_object_show(bt);
32
33    bt = elm_button_add(win);
34    elm_object_text_set(bt, "Button 3");
35    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
36    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
37    elm_table_pack(tb, bt, 2, 0, 1, 1);
38    evas_object_show(bt);
39
40    bt = elm_button_add(win);
41    elm_object_text_set(bt, "Button 4");
42    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
43    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
44    elm_table_pack(tb, bt, 0, 1, 2, 1);
45    evas_object_show(bt);
46
47    bt = elm_button_add(win);
48    elm_object_text_set(bt, "Button 5");
49    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
50    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
51    elm_table_pack(tb, bt, 2, 1, 1, 2);
52    evas_object_show(bt);
53
54    bt = elm_button_add(win);
55    elm_object_text_set(bt, "Button a");
56    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
57    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
58    elm_table_pack(tb, bt, 0, 2, 2, 1);
59    evas_object_show(bt);
60
61    evas_object_show(win);
62 }
63
64 void
65 test_table2(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
66 {
67    Evas_Object *win, *tb, *bt;
68
69    win = elm_win_util_standard_add("table2", "Table Homogeneous");
70    elm_win_autodel_set(win, EINA_TRUE);
71
72    tb = elm_table_add(win);
73    elm_table_homogeneous_set(tb, EINA_TRUE);
74    elm_win_resize_object_add(win, tb);
75    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
76    evas_object_show(tb);
77
78    bt = elm_button_add(win);
79    elm_object_text_set(bt, "A");
80    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
81    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
82    elm_table_pack(tb, bt, 1, 1, 2, 2);
83    evas_object_show(bt);
84
85    bt = elm_button_add(win);
86    elm_object_text_set(bt, "Blah blah blah");
87    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
88    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
89    elm_table_pack(tb, bt, 3, 0, 2, 3);
90    evas_object_show(bt);
91
92    bt = elm_button_add(win);
93    elm_object_text_set(bt, "Hallow");
94    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
95    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
96    elm_table_pack(tb, bt, 0, 3, 10, 1);
97    evas_object_show(bt);
98
99    bt = elm_button_add(win);
100    elm_object_text_set(bt, "B");
101    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
102    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
103    elm_table_pack(tb, bt, 2, 5, 2, 1);
104    evas_object_show(bt);
105
106    bt = elm_button_add(win);
107    elm_object_text_set(bt, "C");
108    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
109    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
110    elm_table_pack(tb, bt, 8, 8, 1, 1);
111    evas_object_show(bt);
112
113    bt = elm_button_add(win);
114    elm_object_text_set(bt, "Wide");
115    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
116    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
117    elm_table_pack(tb, bt, 1, 7, 7, 2);
118    evas_object_show(bt);
119
120    evas_object_show(win);
121 }
122
123 static void
124 my_tb_ch(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
125 {
126    Evas_Object *win = data;
127    Evas_Object *tb = evas_object_data_get(win, "tb");
128    Evas_Object *b2 = evas_object_data_get(win, "b2");
129
130    elm_table_unpack(tb, b2);
131    elm_table_pack(tb, b2, 1, 0, 1, 2);
132 }
133
134 void
135 test_table3(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
136 {
137    Evas_Object *win, *tb, *bt;
138
139    win = elm_win_util_standard_add("table3", "Table 3");
140    elm_win_autodel_set(win, EINA_TRUE);
141
142    tb = elm_table_add(win);
143    elm_win_resize_object_add(win, tb);
144    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
145    evas_object_data_set(win, "tb", tb);
146    evas_object_show(tb);
147
148    bt = elm_button_add(win);
149    elm_object_text_set(bt, "Button 1");
150    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
151    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
152    elm_table_pack(tb, bt, 0, 0, 1, 1);
153    evas_object_data_set(win, "b1", bt);
154    evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win);
155    evas_object_show(bt);
156
157    bt = elm_button_add(win);
158    elm_object_text_set(bt, "Button 2");
159    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
160    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
161    elm_table_pack(tb, bt, 1, 0, 1, 1);
162    evas_object_data_set(win, "b2", bt);
163    evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win);
164    evas_object_show(bt);
165
166    bt = elm_button_add(win);
167    elm_object_text_set(bt, "Button 3");
168    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, 0.0);
169    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
170    elm_table_pack(tb, bt, 0, 1, 1, 1);
171    evas_object_data_set(win, "b3", bt);
172    evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win);
173    evas_object_show(bt);
174
175    evas_object_show(win);
176 }
177
178 void
179 test_table4(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
180 {
181    Evas_Object *win, *tb, *bt;
182
183    win = elm_win_util_standard_add("table4", "Table 4");
184    elm_win_autodel_set(win, EINA_TRUE);
185
186    tb = elm_table_add(win);
187    elm_win_resize_object_add(win, tb);
188    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
189    evas_object_data_set(win, "tb", tb);
190    evas_object_show(tb);
191
192    bt = elm_button_add(win);
193    elm_object_text_set(bt, "Button 1");
194    evas_object_size_hint_weight_set(bt, 0.25, 0.25);
195    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
196    elm_table_pack(tb, bt, 0, 0, 1, 1);
197    evas_object_data_set(win, "b1", bt);
198    evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win);
199    evas_object_show(bt);
200
201    bt = elm_button_add(win);
202    elm_object_text_set(bt, "Button 2");
203    evas_object_size_hint_weight_set(bt, 0.75, 0.25);
204    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
205    elm_table_pack(tb, bt, 1, 0, 1, 1);
206    evas_object_data_set(win, "b2", bt);
207    evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win);
208    evas_object_show(bt);
209
210    bt = elm_button_add(win);
211    elm_object_text_set(bt, "Button 3");
212    evas_object_size_hint_weight_set(bt, 0.25, 0.75);
213    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
214    elm_table_pack(tb, bt, 0, 1, 1, 1);
215    evas_object_data_set(win, "b3", bt);
216    evas_object_smart_callback_add(bt, "clicked", my_tb_ch, win);
217    evas_object_show(bt);
218
219    evas_object_show(win);
220 }
221
222 void
223 test_table5(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
224 {
225    Evas_Object *win, *tb, *bt;
226
227    win = elm_win_util_standard_add("table5", "Table 5");
228    elm_win_autodel_set(win, EINA_TRUE);
229
230    tb = elm_table_add(win);
231    elm_table_homogeneous_set(tb, EINA_TRUE);
232    elm_win_resize_object_add(win, tb);
233    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
234    evas_object_show(tb);
235
236    bt = elm_button_add(win);
237    elm_object_text_set(bt, "A");
238    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
239    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
240    elm_table_pack(tb, bt, 33, 0, 34, 33);
241    evas_object_show(bt);
242
243    bt = elm_button_add(win);
244    elm_object_text_set(bt, "B");
245    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
246    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
247    elm_table_pack(tb, bt, 67, 33, 33, 34);
248    evas_object_show(bt);
249
250    bt = elm_button_add(win);
251    elm_object_text_set(bt, "C");
252    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
253    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
254    elm_table_pack(tb, bt, 33, 67, 34, 33);
255    evas_object_show(bt);
256
257    bt = elm_button_add(win);
258    elm_object_text_set(bt, "D");
259    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
260    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
261    elm_table_pack(tb, bt, 0, 33, 33, 34);
262    evas_object_show(bt);
263
264    bt = elm_button_add(win);
265    elm_object_text_set(bt, "X");
266    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
267    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
268    elm_table_pack(tb, bt, 33, 33, 34, 34);
269    evas_object_show(bt);
270
271    evas_object_show(win);
272 }
273
274 void
275 test_table6(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
276 {
277    Evas_Object *win, *tb, *bt;
278
279    win = elm_win_util_standard_add("table6", "Table 6");
280    elm_win_autodel_set(win, EINA_TRUE);
281
282    tb = elm_table_add(win);
283    elm_table_homogeneous_set(tb, EINA_TRUE);
284    elm_win_resize_object_add(win, tb);
285    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
286    evas_object_show(tb);
287
288    bt = elm_button_add(win);
289    elm_object_text_set(bt, "C");
290    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
291    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
292    elm_table_pack(tb, bt, 1, 1, 2, 2);
293    evas_object_show(bt);
294
295    bt = elm_button_add(win);
296    elm_object_text_set(bt, "A");
297    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
298    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
299    elm_table_pack(tb, bt, 1, 1, 2, 2);
300    evas_object_show(bt);
301
302    bt = elm_button_add(win);
303    elm_object_text_set(bt, "Blah blah blah");
304    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
305    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
306    elm_table_pack(tb, bt, 3, 0, 2, 3);
307    evas_object_show(bt);
308
309    bt = elm_button_add(win);
310    elm_object_text_set(bt, "Hallow");
311    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
312    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
313    elm_table_pack(tb, bt, 0, 3, 10, 1);
314    evas_object_show(bt);
315
316    bt = elm_button_add(win);
317    elm_object_text_set(bt, "B");
318    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
319    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
320    elm_table_pack(tb, bt, 1, 1, 1, 1);
321    evas_object_show(bt);
322
323    bt = elm_button_add(win);
324    elm_object_text_set(bt, "Wide");
325    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
326    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
327    elm_table_pack(tb, bt, 1, 7, 7, 2);
328    evas_object_show(bt);
329
330    evas_object_show(win);
331 }
332
333 void
334 test_table7(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
335 {
336    Evas_Object *win, *tb, *bt;
337
338    win = elm_win_util_standard_add("table7", "Table 7");
339    elm_win_autodel_set(win, EINA_TRUE);
340
341    tb = elm_table_add(win);
342    elm_table_padding_set(tb, 10, 20);
343    elm_win_resize_object_add(win, tb);
344    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
345    evas_object_show(tb);
346
347    bt = elm_button_add(win);
348    elm_object_text_set(bt, "C");
349    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
350    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
351    elm_table_pack(tb, bt, 1, 1, 2, 2);
352    evas_object_show(bt);
353
354    bt = elm_button_add(win);
355    elm_object_text_set(bt, "A");
356    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
357    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
358    elm_table_pack(tb, bt, 1, 1, 2, 2);
359    evas_object_show(bt);
360
361    bt = elm_button_add(win);
362    elm_object_text_set(bt, "Blah blah blah");
363    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
364    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
365    elm_table_pack(tb, bt, 3, 0, 2, 3);
366    evas_object_show(bt);
367
368    bt = elm_button_add(win);
369    elm_object_text_set(bt, "Hallow");
370    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
371    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
372    elm_table_pack(tb, bt, 0, 3, 10, 1);
373    evas_object_show(bt);
374
375    bt = elm_button_add(win);
376    elm_object_text_set(bt, "B");
377    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
378    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
379    elm_table_pack(tb, bt, 1, 1, 1, 1);
380    evas_object_show(bt);
381
382    bt = elm_button_add(win);
383    elm_object_text_set(bt, "Wide");
384    evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
385    evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL);
386    elm_table_pack(tb, bt, 1, 7, 7, 2);
387    evas_object_show(bt);
388
389    evas_object_show(win);
390 }
391
392 #endif