2 * gcc -o theme_example_01 theme_example_01.c `pkg-config --cflags --libs elementary`
4 #include <Elementary.h>
7 btn_extension_click_cb(void *data, Evas_Object *btn, void *ev)
9 const char *lbl = elm_object_text_get(btn);
11 if (!strncmp(lbl, "Load", 4))
13 elm_theme_extension_add(NULL, "./theme_example.edj");
14 elm_object_text_set(btn, "Unload extension");
16 else if (!strncmp(lbl, "Unload", 6))
18 elm_theme_extension_del(NULL, "./theme_example.edj");
19 elm_object_text_set(btn, "Load extension");
24 btn_style_click_cb(void *data, Evas_Object *btn, void *ev)
26 const char *styles[] = {
31 static int sel_style = 0;
33 sel_style = (sel_style + 1) % 3;
34 elm_object_style_set(btn, styles[sel_style]);
38 elm_main(int argc, char *argv[])
40 Evas_Object *win, *box, *btn;
42 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
44 elm_theme_extension_add(NULL, "./theme_example.edj");
46 win = elm_win_util_standard_add("theme", "Theme example");
47 elm_win_autodel_set(win, EINA_TRUE);
49 box = elm_box_add(win);
50 evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
51 elm_win_resize_object_add(win, box);
52 evas_object_show(box);
54 btn = elm_button_add(win);
55 elm_object_text_set(btn, "Unload extension");
56 elm_box_pack_end(box, btn);
57 evas_object_show(btn);
58 evas_object_smart_callback_add(btn, "clicked", btn_extension_click_cb, NULL);
60 btn = elm_button_add(win);
61 elm_object_text_set(btn, "Switch style");
62 elm_object_style_set(btn, "chucknorris");
63 elm_box_pack_end(box, btn);
64 evas_object_show(btn);
65 evas_object_smart_callback_add(btn, "clicked", btn_style_click_cb, NULL);
67 evas_object_resize(win, 300, 320);
68 evas_object_show(win);