Merge from TIZEN 2.3
[platform/core/uifw/e17.git] / src / bin / e_test.c
1 #include "e.h"
2
3 static void _e_test_internal(E_Container *con);
4
5 EAPI void
6 e_test(void)
7 {
8    Eina_List *l, *ll;
9    E_Manager *man;
10    E_Container *con;
11
12    EINA_LIST_FOREACH(e_manager_list(), l, man)
13      {
14         EINA_LIST_FOREACH(man->containers, ll, con)
15           {
16              _e_test_internal(con);
17           }
18      }
19 }
20
21 #if 0
22 static int
23 _e_test_timer(void *data)
24 {
25    E_Menu *m;
26    Eina_List *managers, *l;
27    E_Manager *man;
28
29    m = data;
30    if (m)
31      {
32         e_menu_deactivate(m);
33         e_object_del(E_OBJECT(m));
34         ecore_timer_add(0.05, _e_test_timer, NULL);
35         return 0;
36      }
37    managers = e_manager_list();
38    EINA_LIST_FOREACH(managers, l, man)
39      {
40         m = e_int_menus_main_new();
41         e_menu_activate_mouse(m,
42                               e_container_zone_number_get(e_container_current_get(man), 0),
43                               0, 0, 1, 1, E_MENU_POP_DIRECTION_DOWN, 0);
44         ecore_timer_add(0.05, _e_test_timer, m);
45         return 0;
46      }
47    return 0;
48 }
49
50 static void
51 _e_test_internal(E_Container *con)
52 {
53    _e_test_timer(NULL);
54 }
55 #elif 0
56 static void
57 _e_test_resize(E_Win *win)
58 {
59    Evas_Object *o;
60
61    o = win->data;
62    printf("RESIZE %i %i\n", win->w, win->h);
63    evas_object_resize(o, win->w, win->h);
64    evas_object_color_set(o, rand() & 0xff, rand() & 0xff, rand() & 0xff, 255);
65 }
66
67 static void
68 _e_test_delete(E_Win *win)
69 {
70    printf("DEL!\n");
71    e_object_del(E_OBJECT(win));
72 }
73
74 static void
75 _e_test_internal(E_Container *con)
76 {
77    E_Win *win;
78    Evas_Object *o;
79
80    win = e_win_new(con);
81    e_win_resize_callback_set(win, _e_test_resize);
82    e_win_delete_callback_set(win, _e_test_delete);
83    e_win_placed_set(win, 0);
84    e_win_move_resize(win, 10, 80, 400, 200);
85    e_win_name_class_set(win, "E", "_test_window");
86    e_win_title_set(win, "A test window");
87    e_win_raise(win);
88    e_win_show(win);
89
90    o = evas_object_rectangle_add(e_win_evas_get(win));
91    evas_object_color_set(o, 255, 200, 100, 255);
92    evas_object_resize(o, 400, 200);
93    evas_object_show(o);
94
95    win->data = o;
96 }
97 #elif 0
98 static int
99 _e_test_timer(void *data)
100 {
101    E_Menu *m;
102    static int y = 0;
103
104    m = data;
105    ecore_x_pointer_warp(m->evas_win, 20, y);
106    y += 10;
107    if (y > m->cur.h) y = 0;
108    return 1;
109 }
110
111 static void
112 _e_test_internal(E_Container *con)
113 {
114    E_Menu *m;
115    Eina_List *l;
116    E_Manager *man;
117
118    EINA_LIST_FOREACH(e_manager_list(), l, man)
119      {
120         m = e_int_menus_main_new();
121         e_menu_activate_mouse(m,
122                               e_container_zone_number_get(e_container_current_get(man), 0),
123                               0, 0, 1, 1, E_MENU_POP_DIRECTION_DOWN, 0);
124         ecore_timer_add(0.02, _e_test_timer, m);
125      }
126 }
127 #elif 0
128 static void
129 _e_test_dialog_del(void *obj)
130 {
131    E_Dialog *dia;
132
133    dia = obj;
134    printf("dialog delete hook!\n");
135 }
136
137 static void
138 _e_test_internal(E_Container *con)
139 {
140    E_Dialog *dia;
141
142    dia = e_dialog_new(con, "E", "_test");
143    e_object_del_attach_func_set(E_OBJECT(dia), _e_test_dialog_del);
144    e_dialog_title_set(dia, "A Test Dialog");
145    e_dialog_text_set(dia, "A Test Dialog<br>And another line<br><hilight>Hilighted Text</hilight>");
146    e_dialog_icon_set(dia, "preference-plugin", 64);
147    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
148    e_dialog_button_add(dia, "Apply", "system-restart", NULL, NULL);
149    e_dialog_button_add(dia, "Cancel", "application-exit", NULL, NULL);
150    e_win_centered_set(dia->win, 1);
151    e_dialog_show(dia);
152 }
153 #elif 0
154 static void
155 _e_test_click(void *data, Evas *e, Evas_Object *obj, void *event_info)
156 {
157 #if 1
158    double size;
159
160    size = (double)(rand() % 1000) / 999;
161    evas_object_resize(obj, size * 1024, size * 768);
162 #else
163    e_scrollframe_child_region_show(data, 1024, 768, 100, 100);
164 #endif
165 }
166
167 static void
168 _e_test_internal(E_Container *con)
169 {
170    E_Dialog *dia;
171    Evas_Object *o, *o2, *o3;
172
173    dia = e_dialog_new(con, "E", "_test");
174    e_dialog_title_set(dia, "A Test Dialog");
175
176    o = e_icon_add(dia->win->evas);
177    e_icon_file_set(o, "/home/raster/scroll.png");
178    evas_object_resize(o, 1024, 768);
179    evas_object_focus_set(o, 1);
180    evas_object_show(o);
181
182    o2 = e_scrollframe_add(dia->win->evas);
183    evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _e_test_click, o2);
184 //   e_scrollframe_custom_theme_set(o2, "base/theme/widgets", "e/widgets/scrollframe");
185    evas_object_show(o2);
186 #if 0
187    o3 = e_pan_add(dia->win->evas);
188    e_pan_child_set(o3, o);
189    e_scrollframe_extern_pan_set(o2, o3, e_pan_set, e_pan_get, e_pan_max_get, e_pan_child_size_get);
190 #else
191    e_scrollframe_child_set(o2, o);
192 #endif
193
194    e_dialog_content_set(dia, o2, 500, 300);
195    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
196    e_win_centered_set(dia->win, 1);
197    e_dialog_show(dia);
198
199    evas_object_focus_set(o, 1);
200 }
201 #elif 0
202 static E_Dialog *
203 _e_test_dia(E_Container *con)
204 {
205    E_Config_Dialog *dia;
206
207    dia = e_int_config_modules(con);
208    return dia;
209 }
210
211 static E_Container *tcon = NULL;
212
213 static int
214 _e_test_timer(void *data)
215 {
216    E_Config_Dialog *dia;
217
218    if (data == NULL)
219      {
220         dia = _e_test_dia(tcon);
221         ecore_timer_add(0.2, _e_test_timer, dia);
222      }
223    else
224      {
225         dia = data;
226         e_object_del(E_OBJECT(dia));
227         ecore_timer_add(0.2, _e_test_timer, NULL);
228      }
229    return 0;
230 }
231
232 static void
233 _e_test_internal(E_Container *con)
234 {
235    tcon = con;
236    _e_test_timer(NULL);
237 }
238 #elif 0
239
240 struct _tmp
241 {
242    Evas_Object *ilist, *scrollframe;
243 };
244
245 static struct _tmp tmp = {NULL, NULL};
246
247 static void
248 _e_test_sel(void *data, void *data2)
249 {
250    Evas_Coord x, y, w, h;
251
252    e_ilist_selected_geometry_get(tmp.ilist, &x, &y, &w, &h);
253    e_scrollframe_child_region_show(tmp.scrollframe, x, y, w, h);
254 }
255
256 static void
257 _e_test_resize(void *data, Evas *e, Evas_Object *obj, void *event_info)
258 {
259    Evas_Coord mw, mh, vw, vh, w, h;
260
261    e_scrollframe_child_viewport_size_get(obj, &vw, &vh);
262    e_ilist_size_min_get(data, &mw, &mh);
263    evas_object_geometry_get(data, NULL, NULL, &w, &h);
264    if (vw >= mw)
265      {
266         if (w != vw) evas_object_resize(data, vw, h);
267      }
268 }
269
270 static void
271 _e_test_internal(E_Container *con)
272 {
273    E_Dialog *dia;
274    Evas_Coord mw, mh, vw, vh;
275    Evas_Object *o, *o2, *o3, *o4;
276
277    dia = e_dialog_new(con, "E", "_test");
278    e_dialog_title_set(dia, "A Test Dialog");
279
280    o = e_ilist_add(dia->win->evas);
281    e_ilist_icon_size_set(o, 80, 48);
282
283    o3 = e_livethumb_add(dia->win->evas);
284    e_livethumb_vsize_set(o3, 160, 96);
285    o4 = edje_object_add(e_livethumb_evas_get(o3));
286    e_theme_edje_object_set(o4, "base/theme/borders",
287                            "e/widgets/border/default/border");
288    e_livethumb_thumb_set(o3, o4);
289    e_ilist_append(o, o3, "Item 1", 0, _e_test_sel, NULL, NULL, NULL);
290
291    o3 = e_icon_add(dia->win->evas);
292    e_icon_file_set(o3, "/home/raster/C/stuff/icons/palette.png");
293    e_ilist_append(o, o3, "Item 2 (Some really long text goes here for testing)", 0, _e_test_sel, NULL, NULL, NULL);
294
295    o3 = e_icon_add(dia->win->evas);
296    e_icon_file_set(o3, "/home/raster/C/stuff/icons/mozilla.png");
297    e_ilist_append(o, o3, "Item 3 (Medium length)", 0, _e_test_sel, NULL, NULL, NULL);
298
299    o3 = e_icon_add(dia->win->evas);
300    e_icon_file_set(o3, "/home/raster/C/stuff/icons/trash_open.png");
301    e_ilist_append(o, o3, "Item POOP", 0, _e_test_sel, NULL, NULL, NULL);
302
303    o3 = e_icon_add(dia->win->evas);
304    e_icon_file_set(o3, "/home/raster/C/stuff/icons/watch.png");
305    e_ilist_append(o, o3, "Item BLING BLING", 0, _e_test_sel, NULL, NULL, NULL);
306
307    o3 = e_icon_add(dia->win->evas);
308    e_icon_file_set(o3, "/home/raster/C/stuff/icons/quake3.png");
309    e_ilist_append(o, o3, "Sukebelinth", 0, _e_test_sel, NULL, NULL, NULL);
310
311    o3 = e_icon_add(dia->win->evas);
312    e_icon_file_set(o3, "/home/raster/C/stuff/icons/opera6.png");
313    e_ilist_append(o, o3, "A header", 1, NULL, NULL, NULL, NULL);
314
315    o3 = e_icon_add(dia->win->evas);
316    e_icon_file_set(o3, "/home/raster/C/stuff/icons/opera6.png");
317    e_ilist_append(o, o3, "Panties", 0, _e_test_sel, NULL, NULL, NULL);
318
319    o3 = e_icon_add(dia->win->evas);
320    e_icon_file_set(o3, "/home/raster/C/stuff/icons/drawer_open.png");
321    e_ilist_append(o, o3, "Flimbert the cagey", 0, _e_test_sel, NULL, NULL, NULL);
322
323    o3 = e_icon_add(dia->win->evas);
324    e_icon_file_set(o3, "/home/raster/C/stuff/icons/cd.png");
325    e_ilist_append(o, o3, "Norbert", 0, _e_test_sel, NULL, NULL, NULL);
326
327    e_ilist_size_min_get(o, &mw, &mh);
328    evas_object_resize(o, mw, mh);
329    evas_object_focus_set(o, 1);
330    evas_object_show(o);
331
332    o2 = e_scrollframe_add(dia->win->evas);
333    evas_object_event_callback_add(o2, EVAS_CALLBACK_RESIZE, _e_test_resize, o);
334    evas_object_resize(o2, mw, 150);
335    evas_object_show(o2);
336    e_scrollframe_child_set(o2, o);
337
338    e_scrollframe_child_viewport_size_get(o2, &vw, &vh);
339    e_dialog_content_set(dia, o2, 200, 150);
340    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
341    e_win_centered_set(dia->win, 1);
342    e_dialog_resizable_set(dia, 1);
343    e_dialog_show(dia);
344
345    tmp.ilist = o;
346    tmp.scrollframe = o2;
347
348    evas_object_focus_set(o, 1);
349 }
350 #elif 0
351 static void
352 _e_test_cb_e_smart_pan_changed_hook(void *data, Evas_Object *obj, void *event_info)
353 {
354    printf("VAL: %3.3f\n", e_slider_value_get(obj));
355 }
356
357 static void
358 _e_test_internal(E_Container *con)
359 {
360    E_Dialog *dia;
361    Evas_Object *o;
362    Evas_Coord mw, mh;
363
364    dia = e_dialog_new(con, "E", "_test");
365    e_dialog_title_set(dia, "A Test Dialog");
366
367    o = e_slider_add(dia->win->evas);
368    e_slider_orientation_set(o, 1);
369    e_slider_value_set(o, 0.5);
370    e_slider_value_step_count_set(o, 4);
371    e_slider_value_format_display_set(o, "%1.2f V");
372    e_slider_size_min_get(o, &mw, &mh);
373    evas_object_smart_callback_add(o, "changed", _e_test_cb_e_smart_pan_changed_hook, NULL);
374    evas_object_show(o);
375
376    e_dialog_content_set(dia, o, 240 + mw, mh);
377
378    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
379    e_win_centered_set(dia->win, 1);
380    e_dialog_show(dia);
381
382    evas_object_focus_set(o, 1);
383 }
384 #elif 0
385 static void
386 _e_test_internal(E_Container *con)
387 {
388    E_Dialog *dia;
389    Evas_Object *o;
390    Evas_Coord mw, mh;
391
392    dia = e_dialog_new(con, "E", "_test");
393    e_dialog_title_set(dia, "A Test Dialog");
394
395    o = e_widget_textblock_add(dia->win->evas);
396 #if 0
397    e_widget_textblock_markup_set(o,
398                                  "<title>A title</title>"
399                                  "This is some text<br>"
400                                  "Blah blah<br>"
401                                  "<hilight>hilighted text</hilight><br>"
402                                  "<br>"
403                                  "More lines of text<br>"
404                                  "And yet more lines of text<br>"
405                                  "A very very long line of text that SHOULD be getting word wrapped because it is so long.<br>"
406                                  "And another line<br>"
407                                  "Some more<br>"
408                                  "Smelly fish on a stick<br>"
409                                  "Whatever."
410                                  );
411 #else
412    e_widget_textblock_plain_set(o,
413                                 "And here is some plaintext\n"
414                                 "with some newlines & other special characters\n"
415                                 "that should get escaped like < and >.\n"
416                                 "\n"
417                                 "\tTabs should become 8 spaces too.\n"
418                                 );
419 #endif
420    evas_object_show(o);
421
422    e_dialog_content_set(dia, o, 160, 160);
423
424    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
425    e_win_centered_set(dia->win, 1);
426    e_dialog_show(dia);
427
428    evas_object_focus_set(o, 1);
429 }
430 #elif 0
431 static void
432 _e_test_cb_button(void *data1, void *data2)
433 {
434    e_fm2_parent_go(data1);
435 }
436
437 static void
438 _e_test_cb_changed(void *data, Evas_Object *obj, void *event_info)
439 {
440    if (!e_fm2_has_parent_get(obj)) e_widget_disabled_set(data, 1);
441    else e_widget_disabled_set(data, 0);
442 }
443
444 static void
445 _e_test_cb_favorites_selected(void *data, Evas_Object *obj, void *event_info)
446 {
447    Eina_List *selected;
448    E_Fm2_Icon_Info *ici;
449
450    printf("FAV SELECTED\n");
451    selected = e_fm2_selected_list_get(obj);
452    if (!selected) return;
453    ici = eina_list_data_get(selected);
454    if ((ici->link) && (ici->mount))
455      e_fm2_path_set(data, ici->link, "/");
456    else if (ici->link)
457      e_fm2_path_set(data, NULL, ici->link);
458 // FIXME: this should happen on the scrollframe not the fm obj
459 //   e_widget_scrollframe_child_pos_set(data, 0, 0);
460    eina_list_free(selected);
461 }
462
463 static void
464 _e_test_cb_favorites_files_changed(void *data, Evas_Object *obj, void *event_info)
465 {
466    Eina_List *icons, *l;
467    E_Fm2_Icon_Info *ici;
468    const char *realpath;
469    char *p1, *p2;
470
471    printf("FAV LIST CHANGE!\n");
472    icons = e_fm2_all_list_get(obj);
473    if (!icons) return;
474    realpath = e_fm2_real_path_get(data);
475    p1 = ecore_file_realpath(realpath);
476    if (!p1) goto done;
477    EINA_LIST_FOREACH(icons, l, ici)
478      {
479         if (ici->link)
480           {
481              p2 = ecore_file_realpath(ici->link);
482              if (!strcmp(p1, p2))
483                {
484                   e_fm2_select_set(obj, ici->file);
485                   E_FREE(p2);
486                   goto done;
487                }
488              E_FREE(p2);
489           }
490      }
491    done:
492    E_FREE(p1);
493    eina_list_free(icons);
494 }
495
496 static void
497 _e_test_cb_selected(void *data, Evas_Object *obj, void *event_info)
498 {
499    printf("SELECTED!\n");
500 }
501
502 static void
503 _e_test_internal(E_Container *con)
504 {
505    E_Dialog *dia;
506    Evas_Object *ofm, *ofm2, *of, *ob, *ot;
507    Evas_Coord mw, mh;
508    E_Fm2_Config fmc;
509
510    dia = e_dialog_new(con, "E", "_test");
511    e_dialog_title_set(dia, "A Test Dialog");
512
513    /* a table for layout */
514    ot = e_widget_table_add(dia->win->evas, 0);
515
516    /* actual files */
517    ofm = e_fm2_add(dia->win->evas);
518
519    memset(&fmc, 0, sizeof(E_Fm2_Config));
520    fmc.view.mode = E_FM2_VIEW_MODE_LIST;
521    fmc.view.open_dirs_in_place = 1;
522    fmc.view.selector = 1;
523    fmc.view.single_click = 0;
524    fmc.view.no_subdir_jump = 0;
525    fmc.icon.list.w = 24;
526    fmc.icon.list.h = 24;
527    fmc.icon.fixed.w = 1;
528    fmc.icon.fixed.h = 1;
529    fmc.icon.extension.show = 0;
530    fmc.icon.key_hint = NULL;
531    fmc.list.sort.no_case = 1;
532    fmc.list.sort.dirs.first = 1;
533    fmc.list.sort.dirs.last = 0;
534    fmc.selection.single = 1;
535    fmc.selection.windows_modifiers = 0;
536    e_fm2_config_set(ofm, &fmc);
537
538    e_fm2_path_set(ofm, "~/", "/");
539    ob = e_widget_button_add(dia->win->evas, "Up a directory", NULL,
540                            _e_test_cb_button, ofm, NULL);
541    e_widget_table_object_append(ot, ob, 1, 0, 1, 1, 0, 0, 1, 0);
542    evas_object_show(ob);
543    evas_object_smart_callback_add(ofm, "changed", _e_test_cb_changed, ob);
544    evas_object_smart_callback_add(ofm, "selected", _e_test_cb_selected, NULL);
545    of = e_widget_scrollframe_pan_add(dia->win->evas, ofm,
546                                      e_fm2_pan_set, e_fm2_pan_get,
547                                      e_fm2_pan_max_get, e_fm2_pan_child_size_get);
548    e_widget_size_min_set(of, 128, 128);
549    e_widget_table_object_append(ot, of, 1, 1, 1, 1, 1, 1, 1, 1);
550    evas_object_show(ofm);
551    evas_object_show(of);
552
553    ofm2 = ofm;
554
555    /* shortcut list */
556    ofm = e_fm2_add(dia->win->evas);
557
558    memset(&fmc, 0, sizeof(E_Fm2_Config));
559    fmc.view.mode = E_FM2_VIEW_MODE_LIST;
560    fmc.view.open_dirs_in_place = 1;
561    fmc.view.selector = 1;
562    fmc.view.single_click = 1;
563    fmc.view.no_subdir_jump = 1;
564    fmc.icon.list.w = 24;
565    fmc.icon.list.h = 24;
566    fmc.icon.fixed.w = 1;
567    fmc.icon.fixed.h = 1;
568    fmc.icon.extension.show = 0;
569    fmc.icon.key_hint = NULL;
570    fmc.list.sort.no_case = 1;
571    fmc.list.sort.dirs.first = 0;
572    fmc.list.sort.dirs.last = 0;
573    fmc.selection.single = 1;
574    fmc.selection.windows_modifiers = 0;
575    e_fm2_config_set(ofm, &fmc);
576
577    e_fm2_path_set(ofm, "favorites", "/");
578    evas_object_smart_callback_add(ofm, "files_changed", _e_test_cb_favorites_files_changed, ofm2);
579    evas_object_smart_callback_add(ofm, "selected", _e_test_cb_favorites_selected, ofm2);
580    of = e_widget_scrollframe_pan_add(dia->win->evas, ofm,
581                                      e_fm2_pan_set, e_fm2_pan_get,
582                                      e_fm2_pan_max_get, e_fm2_pan_child_size_get);
583    e_widget_size_min_set(of, 128, 128);
584    e_widget_table_object_append(ot, of, 0, 1, 1, 1, 0, 1, 0, 1);
585    evas_object_show(ofm);
586    evas_object_show(of);
587
588    /* show and pack table */
589    evas_object_show(ot);
590    e_widget_size_min_get(ot, &mw, &mh);
591    e_dialog_content_set(dia, ot, mw, mh);
592
593    /* buttons at the bottom */
594    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
595    e_dialog_resizable_set(dia, 1);
596    e_win_centered_set(dia->win, 1);
597    e_dialog_show(dia);
598    e_win_resize(dia->win, 400, 300);
599
600 }
601 #elif 0
602 static void
603 _e_test_cb_changed(void *data, Evas_Object *obj)
604 {
605 //   printf("CHANGED \"%s\"\n", e_widget_fsel_selection_path_get(obj));
606 }
607
608 static void
609 _e_test_cb_selected(void *data, Evas_Object *obj)
610 {
611    printf("SELECTED \"%s\"\n", e_widget_fsel_selection_path_get(obj));
612    e_object_del(E_OBJECT(data));
613 }
614
615 static void
616 _e_test_internal(E_Container *con)
617 {
618    E_Dialog *dia;
619    Evas_Object *o;
620    Evas_Coord mw, mh;
621
622    dia = e_dialog_new(con, "E", "_test");
623    e_dialog_title_set(dia, "A Test Dialog");
624
625    o = e_widget_fsel_add(dia->win->evas, "~/", "/tst", NULL, NULL,
626                          _e_test_cb_selected, dia,
627                          _e_test_cb_changed, dia, 0);
628    evas_object_show(o);
629    e_widget_size_min_get(o, &mw, &mh);
630    e_dialog_content_set(dia, o, mw, mh);
631
632    /* buttons at the bottom */
633    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
634    e_dialog_resizable_set(dia, 1);
635    e_win_centered_set(dia->win, 1);
636    e_dialog_show(dia);
637    e_win_resize(dia->win, 400, 300);
638
639 }
640 #elif 0
641
642 static void
643 _e_test_cb_ok(E_Color_Dialog *dia, E_Color *color, void *data)
644 {
645    printf("Current color: %d, %d, %d\n", color->r, color->g, color->b);
646 }
647
648 static void
649 _e_test_internal(E_Container *con)
650 {
651    E_Color_Dialog *d;
652
653    d = e_color_dialog_new(con, NULL, EINA_FALSE);
654    e_color_dialog_show(d);
655    e_color_dialog_select_callback_set(d, _e_test_cb_ok, NULL);
656 }
657
658 #elif 0
659 static void
660 _e_test_internal(E_Container *con)
661 {
662    E_Dialog *dia;
663    Evas_Object *o, *ob, *of;
664    Evas_Coord mw, mh;
665    int i;
666
667    dia = e_dialog_new(con, "E", "_test");
668    e_dialog_title_set(dia, "A Test Dialog");
669
670    of = e_scrollframe_add(dia->win->evas);
671
672    ob = e_box_add(dia->win->evas);
673    e_box_orientation_set(ob, 0);
674
675    for (i = 0; i < 8; i++)
676      {
677    o = e_slidesel_add(dia->win->evas);
678    e_slidesel_item_distance_set(o, 64);
679    e_slidesel_item_add(o, "blah / item 1",
680                        "/home/raster/pix/OLD/Download/Crystalline____a.jpg",
681                        NULL, NULL);
682    e_slidesel_item_add(o, "blah / smelly fish",
683                        "/home/raster/pix/OLD/Download/Reluctant_Sunrise.jpg",
684                        NULL, NULL);
685    e_slidesel_item_add(o, "blah / pong",
686                        "/home/raster/pix/OLD/Download/Soft_Wings.jpg",
687                        NULL, NULL);
688    e_slidesel_item_add(o, "blah / on a stick",
689                        "/home/raster/pix/OLD/Download/Stock_rose_1.jpg",
690                        NULL, NULL);
691    e_slidesel_item_add(o, "blah / oath",
692                        "/home/raster/pix/OLD/Download/The_Eyes_Of_A_Killer.jpg",
693                        NULL, NULL);
694    e_slidesel_item_add(o, "blah / yiiihaaaaa",
695                        "/home/raster/pix/OLD/Download/lady_bug.jpg",
696                        NULL, NULL);
697    e_slidesel_item_add(o, "blah / blah blah blah",
698                        "/home/raster/pix/OLD/Download/ocean_rocks_covered_by_ash.jpg",
699                        NULL, NULL);
700    e_slidesel_item_add(o, "blah / bing bing bing",
701                        "/home/raster/pix/OLD/Download/orange_chair_heaven_falling.jpg",
702                        NULL, NULL);
703
704    e_box_pack_end(ob, o);
705    e_box_pack_options_set(o, 1, 1, 1, 0, 0.5, 0.5, 300, 100, 300, 100);
706    evas_object_show(o);
707      }
708
709    /* fixme... more */
710    e_box_size_min_get(ob, &mw, &mh);
711    evas_object_resize(ob, mw, mh);
712
713    e_scrollframe_child_set(of, ob);
714    evas_object_show(ob);
715 //   e_widget_size_min_get(o, &mw, &mh);
716    mw = 300; mh = 300;
717    e_dialog_content_set(dia, of, mw, mh);
718    evas_object_show(of);
719
720    /* buttons at the bottom */
721    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
722    e_dialog_resizable_set(dia, 1);
723    e_win_centered_set(dia->win, 1);
724    e_dialog_show(dia);
725    e_win_resize(dia->win, 400, 400);
726
727 }
728
729 static void
730 _e_test_internal(E_Container *con)
731 {
732    ecore_timer_add(1.0, _e_test_timer, con);
733 }
734
735 #elif 0
736
737 static int
738 _e_test_timer(void *data)
739 {
740    E_Container *con;
741    E_Dialog *dia;
742    Evas_Object *o, *ic;
743    Evas_Coord mw, mh;
744
745    con = data;
746    dia = e_dialog_new(con, "E", "_test");
747    e_dialog_title_set(dia, "A Test Dialog");
748
749    o = e_widget_toolbar_add(dia->win->evas, 48, 48);
750    ic = e_icon_add(dia->win->evas);
751    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_hdd.png");
752    e_widget_toolbar_item_append(o, ic, "HDD", NULL, NULL, NULL);
753    ic = e_icon_add(dia->win->evas);
754    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_cd.png");
755    e_widget_toolbar_item_append(o, ic, "CD", NULL, NULL, NULL);
756    ic = e_icon_add(dia->win->evas);
757    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_desktop.png");
758    e_widget_toolbar_item_append(o, ic, "Desktop", NULL, NULL, NULL);
759    ic = e_icon_add(dia->win->evas);
760    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_home.png");
761    e_widget_toolbar_item_append(o, ic, "Home", NULL, NULL, NULL);
762    ic = e_icon_add(dia->win->evas);
763    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_root.png");
764    e_widget_toolbar_item_append(o, ic, "Root", NULL, NULL, NULL);
765    ic = e_icon_add(dia->win->evas);
766    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_tmp.png");
767    e_widget_toolbar_item_append(o, ic, "Temp", NULL, NULL, NULL);
768    ic = e_icon_add(dia->win->evas);
769    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_globe.png");
770    e_widget_toolbar_item_append(o, ic, "World", NULL, NULL, NULL);
771    ic = e_icon_add(dia->win->evas);
772    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_mixer.png");
773    e_widget_toolbar_item_append(o, ic, "Mixer", NULL, NULL, NULL);
774    ic = e_icon_add(dia->win->evas);
775    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_performance.png");
776    e_widget_toolbar_item_append(o, ic, "Perform", NULL, NULL, NULL);
777
778    e_widget_toolbar_scrollable_set(o, 1);
779    e_widget_toolbar_item_select(o, 1);
780
781    /* fixme... more */
782    e_widget_size_min_get(o, &mw, &mh);
783    e_dialog_content_set(dia, o, mw, mh);
784    evas_object_show(o);
785
786    /* buttons at the bottom */
787    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
788    e_dialog_resizable_set(dia, 1);
789    e_win_centered_set(dia->win, 1);
790    e_dialog_show(dia);
791    e_win_resize(dia->win, 400, 200);
792
793    return 0;
794 }
795
796 static void
797 _e_test_internal(E_Container *con)
798 {
799    ecore_timer_add(1.0, _e_test_timer, con);
800 }
801
802 #elif 0
803
804 static int
805 _e_test_timer(void *data)
806 {
807    E_Container *con;
808    E_Dialog *dia;
809    Evas_Object *o, *ic;
810    Evas_Coord mw, mh;
811
812    con = data;
813    dia = e_dialog_new(con, "E", "_test");
814    e_dialog_title_set(dia, "A Test Dialog");
815
816    o = e_widget_toolbar_add(dia->win->evas, 48, 48);
817    ic = e_icon_add(dia->win->evas);
818    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_hdd.png");
819    e_widget_toolbar_item_append(o, ic, NULL, NULL, NULL, NULL);
820    ic = e_icon_add(dia->win->evas);
821    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_cd.png");
822    e_widget_toolbar_item_append(o, ic, NULL, NULL, NULL, NULL);
823    ic = e_icon_add(dia->win->evas);
824    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_desktop.png");
825    e_widget_toolbar_item_append(o, ic, NULL, NULL, NULL, NULL);
826    ic = e_icon_add(dia->win->evas);
827    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_home.png");
828    e_widget_toolbar_item_append(o, ic, NULL, NULL, NULL, NULL);
829    ic = e_icon_add(dia->win->evas);
830    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_root.png");
831    e_widget_toolbar_item_append(o, ic, NULL, NULL, NULL, NULL);
832    ic = e_icon_add(dia->win->evas);
833    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_efm_tmp.png");
834    e_widget_toolbar_item_append(o, ic, NULL, NULL, NULL, NULL);
835    ic = e_icon_add(dia->win->evas);
836    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_globe.png");
837    e_widget_toolbar_item_append(o, ic, NULL, NULL, NULL, NULL);
838    ic = e_icon_add(dia->win->evas);
839    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_mixer.png");
840    e_widget_toolbar_item_append(o, ic, NULL, NULL, NULL, NULL);
841    ic = e_icon_add(dia->win->evas);
842    e_icon_file_set(ic, "/home/raster/C/e17/data/themes/images/icon_performance.png");
843    e_widget_toolbar_item_append(o, ic, "x", NULL, NULL, NULL);
844
845    e_widget_toolbar_scrollable_set(o, 1);
846    e_widget_toolbar_item_select(o, 1);
847
848    /* fixme... more */
849    e_widget_size_min_get(o, &mw, &mh);
850    e_dialog_content_set(dia, o, mw, mh);
851    evas_object_show(o);
852
853    /* buttons at the bottom */
854    e_dialog_button_add(dia, "OK", NULL, NULL, NULL);
855    e_dialog_resizable_set(dia, 1);
856    e_win_centered_set(dia->win, 1);
857    e_dialog_show(dia);
858    e_win_resize(dia->win, 400, 200);
859
860    return 0;
861 }
862
863 static void
864 _e_test_internal(E_Container *con)
865 {
866    ecore_timer_add(1.0, _e_test_timer, con);
867 }
868
869 #elif 0
870 static void
871 delorig(void *data, Evas *e, Evas_Object *obj, void *event_info)
872 {
873    evas_object_del(data);
874 }
875
876 static void
877 movorig(void *data, Evas *e, Evas_Object *obj, void *event_info)
878 {
879    Evas_Coord x, y;
880    evas_object_geometry_get(obj, &x, &y, NULL, NULL);
881    evas_object_move(data, x, y);
882 }
883
884 static void
885 reszorig(void *data, Evas *e, Evas_Object *obj, void *event_info)
886 {
887    Evas_Coord w, h;
888    evas_object_geometry_get(obj, NULL, NULL, &w, &h);
889    evas_object_resize(data, w / 8, h / 8);
890 }
891
892 static void
893 newwin(Evas *e, E_Manager *man, E_Manager_Comp_Source *src)
894 {
895    Evas_Object *o, *orig;
896    Evas_Coord x, y, w, h;
897
898    if (!e_manager_comp_src_image_get(man, src)) return;
899
900    orig = e_manager_comp_src_shadow_get(man, src);
901    o = e_manager_comp_src_image_mirror_add(man, src);
902    evas_object_color_set(o, 200, 200, 200, 200);
903    evas_object_event_callback_add(orig, EVAS_CALLBACK_DEL, delorig, o);
904    evas_object_event_callback_add(orig, EVAS_CALLBACK_MOVE, movorig, o);
905    evas_object_event_callback_add(orig, EVAS_CALLBACK_RESIZE, reszorig, o);
906    evas_object_geometry_get(orig, &x, &y, &w, &h);
907
908    evas_object_move(o, x, y);
909    evas_object_resize(o, w / 8, h / 8);
910
911    evas_object_show(o);
912    e_manager_comp_evas_update(man);
913 }
914
915 static void
916 setup(E_Manager *man)
917 {
918    Eina_List *list, *l;
919    E_Manager_Comp_Source *src;
920    Evas *e;
921
922    e = e_manager_comp_evas_get(man);
923    list = (Eina_List *)e_manager_comp_src_list(man);
924    EINA_LIST_FOREACH(list, l, src)
925      {
926         newwin(e, man, src);
927      }
928 }
929
930 static void
931 handler(void *data, const char *name, const char *info, int val,
932         E_Object *obj, void *msgdata)
933 {
934    E_Manager *man = (E_Manager *)obj;
935    E_Manager_Comp_Source *src = (E_Manager_Comp_Source *)msgdata;
936    Evas *e;
937
938    printf("handler... '%s' '%s'\n", name, info);
939    if (strcmp(name, "comp.manager")) return;
940
941    e = e_manager_comp_evas_get(man);
942    if (!strcmp(info, "change.comp"))
943      {
944         if (!e) printf("TTT: No comp manager\n");
945         else printf("TTT: comp canvas = %p\n", e);
946         if (e) setup(man);
947      }
948    else if (!strcmp(info, "resize.comp"))
949      {
950         printf("%s: %p | %p\n", info, man, src);
951      }
952    else if (!strcmp(info, "add.src"))
953      {
954         printf("%s: %p | %p\n", info, man, src);
955         newwin(e, man, src);
956      }
957    else if (!strcmp(info, "del.src"))
958      {
959         printf("%s: %p | %p\n", info, man, src);
960      }
961    else if (!strcmp(info, "config.src"))
962      {
963         printf("%s: %p | %p\n", info, man, src);
964      }
965    else if (!strcmp(info, "visibility.src"))
966      {
967         printf("%s: %p | %p\n", info, man, src);
968      }
969 }
970
971 static Eina_Bool
972 _e_test_timer(void *data)
973 {
974    Eina_List *list, *l, *wins;
975    E_Manager *man;
976
977    printf("shetup\n");
978    e_msg_handler_add(handler, NULL);
979    list = e_manager_list();
980    EINA_LIST_FOREACH(list, l, man)
981      {
982         Evas *e = e_manager_comp_evas_get(man);
983         if (e) setup(man);
984      }
985    return 0;
986 }
987
988 static void
989 _e_test_internal(E_Container *con)
990 {
991    ecore_timer_add(3.0, _e_test_timer, con);
992 }
993
994 #else
995 static void
996 _e_test_internal(E_Container *con __UNUSED__)
997 {
998 }
999 #endif