diff options
Diffstat (limited to 'libraries/elementary/src/examples/theme_example_02.c')
-rw-r--r-- | libraries/elementary/src/examples/theme_example_02.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/libraries/elementary/src/examples/theme_example_02.c b/libraries/elementary/src/examples/theme_example_02.c new file mode 100644 index 0000000..acab9d7 --- /dev/null +++ b/libraries/elementary/src/examples/theme_example_02.c | |||
@@ -0,0 +1,70 @@ | |||
1 | /* | ||
2 | * gcc -o theme_example_02 theme_example_02.c `pkg-config --cflags --libs elememntaru` | ||
3 | */ | ||
4 | #include <Elementary.h> | ||
5 | |||
6 | static void | ||
7 | _btn_clicked_cb(void *data, Evas_Object *obj, void *ev) | ||
8 | { | ||
9 | static int loaded = 1; | ||
10 | if (loaded) | ||
11 | elm_theme_overlay_del(NULL, "./theme_example.edj"); | ||
12 | else | ||
13 | elm_theme_overlay_add(NULL, "./theme_example.edj"); | ||
14 | loaded = 1 - loaded; | ||
15 | } | ||
16 | |||
17 | EAPI_MAIN int | ||
18 | elm_main(int argc, char *argv[]) | ||
19 | { | ||
20 | Evas_Object *win, *bg, *box, *btn; | ||
21 | |||
22 | elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); | ||
23 | |||
24 | elm_theme_overlay_add(NULL, "./theme_example.edj"); | ||
25 | |||
26 | win = elm_win_add(NULL, "Theme example", ELM_WIN_BASIC); | ||
27 | elm_win_autodel_set(win, EINA_TRUE); | ||
28 | evas_object_resize(win, 300, 320); | ||
29 | evas_object_show(win); | ||
30 | |||
31 | bg = elm_bg_add(win); | ||
32 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
33 | elm_win_resize_object_add(win, bg); | ||
34 | evas_object_show(bg); | ||
35 | |||
36 | box = elm_box_add(win); | ||
37 | evas_object_size_hint_weight_set(box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
38 | elm_win_resize_object_add(win, box); | ||
39 | evas_object_show(box); | ||
40 | |||
41 | btn = elm_button_add(win); | ||
42 | elm_object_text_set(btn, "Button 1"); | ||
43 | elm_box_pack_end(box, btn); | ||
44 | evas_object_show(btn); | ||
45 | evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL); | ||
46 | |||
47 | btn = elm_button_add(win); | ||
48 | elm_object_text_set(btn, "Button 2"); | ||
49 | elm_box_pack_end(box, btn); | ||
50 | evas_object_show(btn); | ||
51 | evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL); | ||
52 | |||
53 | btn = elm_button_add(win); | ||
54 | elm_object_text_set(btn, "Button 3"); | ||
55 | elm_box_pack_end(box, btn); | ||
56 | evas_object_show(btn); | ||
57 | evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL); | ||
58 | |||
59 | btn = elm_button_add(win); | ||
60 | elm_object_text_set(btn, "Button 4"); | ||
61 | elm_box_pack_end(box, btn); | ||
62 | evas_object_show(btn); | ||
63 | evas_object_smart_callback_add(btn, "clicked", _btn_clicked_cb, NULL); | ||
64 | |||
65 | elm_run(); | ||
66 | elm_shutdown(); | ||
67 | |||
68 | return 0; | ||
69 | } | ||
70 | ELM_MAIN() | ||