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