2 //gcc -g -DPACKAGE_DATA_DIR="\"<directory>\"" `pkg-config --cflags --libs elementary` bg_example_02.c -o bg_example_02
3 // where directory is the a path where images/plant_01.jpg can be found.
5 #include <Elementary.h>
8 on_done(void *data, Evas_Object *obj, void *event_info)
10 /* quit the mainloop (elm_run) */
15 elm_main(int argc, char **argv)
17 Evas_Object *win, *bg;
20 win = elm_win_add(NULL, "bg-image", ELM_WIN_BASIC);
21 elm_win_title_set(win, "Bg Image");
22 evas_object_smart_callback_add(win, "delete,request", on_done, NULL);
23 elm_win_autodel_set(win, 1);
26 elm_bg_option_set(bg, ELM_BG_OPTION_CENTER);
27 snprintf(buf, sizeof(buf), "%s/images/plant_01.jpg", PACKAGE_DATA_DIR);
28 elm_bg_file_set(bg, buf, NULL);
29 elm_bg_load_size_set(bg, 20, 20);
30 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
31 elm_win_resize_object_add(win, bg);
34 evas_object_size_hint_min_set(bg, 160, 160);
35 evas_object_size_hint_max_set(bg, 640, 640);
36 evas_object_resize(win, 320, 320);
37 evas_object_show(win);