elm bin: Use convenient utility function elm_win_util_standard_add() instead of elm_w...
[framework/uifw/elementary.git] / src / bin / test_thumb.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_thumb(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
8 {
9    Evas_Object *win, *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_util_standard_add("thumb", "Thumb");
30    elm_win_autodel_set(win, EINA_TRUE);
31
32    tb = elm_table_add(win);
33    evas_object_size_hint_weight_set(tb, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
34
35    n = 0;
36    for (j = 0; j < 12; j++)
37      {
38         for (i = 0; i < 12; i++)
39           {
40              th = elm_thumb_add(win);
41              snprintf(buf, sizeof(buf), "%s/images/%s", elm_app_data_dir_get(),
42                       img[n]);
43              n = (n + 1) % 11;
44              elm_thumb_file_set(th, buf, img[n]);
45              evas_object_size_hint_weight_set(th, EVAS_HINT_EXPAND,
46                                               EVAS_HINT_EXPAND);
47              evas_object_size_hint_align_set(th, EVAS_HINT_FILL,
48                                              EVAS_HINT_FILL);
49              elm_table_pack(tb, th, i, j, 1, 1);
50              elm_thumb_editable_set(th, EINA_TRUE);
51              evas_object_show(th);
52           }
53      }
54
55    sc = elm_scroller_add(win);
56    evas_object_size_hint_weight_set(sc, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
57    elm_win_resize_object_add(win, sc);
58
59    elm_object_content_set(sc, tb);
60    evas_object_show(tb);
61    evas_object_show(sc);
62
63    evas_object_resize(win, 600, 600);
64    evas_object_show(win);
65 }
66 #endif