[elm_thumb] efl-upgrade for dnd
[framework/uifw/elementary.git] / src / bin / test_thumb.c
1 #include <Elementary.h>
2 #ifndef ELM_LIB_QUICKLAUNCH
3 void
4 test_thumb(void *data, Evas_Object *obj, void *event_info)
5 {
6    Evas_Object *win, *bg, *sc, *tb, *th;
7    int i, j, n;
8    char buf[PATH_MAX];
9    const char *img[9] =
10      {
11         "panel_01.jpg",
12         "plant_01.jpg",
13         "rock_01.jpg",
14         "rock_02.jpg",
15         "sky_01.jpg",
16         "sky_02.jpg",
17         "sky_03.jpg",
18         "sky_04.jpg",
19         "wood_01.jpg",
20      };
21
22    elm_need_ethumb();
23
24    win = elm_win_add(NULL, "thumb", ELM_WIN_BASIC);
25    elm_win_title_set(win, "Thumb");
26    elm_win_autodel_set(win, 1);
27
28    bg = elm_bg_add(win);
29    evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
30    elm_win_resize_object_add(win, bg);
31    evas_object_show(bg);
32
33    tb = elm_table_add(win);
34    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
35
36    n = 0;
37    for (j = 0; j < 12; j++)
38      {
39         for (i = 0; i < 12; i++)
40           {
41              th = elm_thumb_add(win);
42              snprintf(buf, sizeof(buf), "%s/images/%s", PACKAGE_DATA_DIR,
43                       img[n]);
44              n = (n + 1) % 9;
45              elm_thumb_file_set(th, buf, img[n]);
46              evas_object_size_hint_weight_set(th, EVAS_HINT_EXPAND,
47                                               EVAS_HINT_EXPAND);
48              evas_object_size_hint_align_set(th, EVAS_HINT_FILL,
49                                              EVAS_HINT_FILL);
50              elm_table_pack(tb, th, i, j, 1, 1);
51              elm_thumb_editable_set(th, EINA_TRUE);
52              evas_object_show(th);
53           }
54      }
55
56    sc = elm_scroller_add(win);
57    evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
58    elm_win_resize_object_add(win, sc);
59
60    elm_scroller_content_set(sc, tb);
61    evas_object_show(tb);
62    evas_object_show(sc);
63
64    evas_object_resize(win, 600, 600);
65    evas_object_show(win);
66 }
67 #endif