diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/elementary/src/examples/hover_example_01.c | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/libraries/elementary/src/examples/hover_example_01.c b/libraries/elementary/src/examples/hover_example_01.c new file mode 100644 index 0000000..e426200 --- /dev/null +++ b/libraries/elementary/src/examples/hover_example_01.c | |||
@@ -0,0 +1,80 @@ | |||
1 | //Compile with: | ||
2 | //gcc -o hover_example_01 hover_example_01.c -g `pkg-config --cflags --libs elementary` | ||
3 | |||
4 | #include <Elementary.h> | ||
5 | |||
6 | static void | ||
7 | _show_hover(void *data, Evas_Object *obj, void *event_info) | ||
8 | { | ||
9 | evas_object_show(data); | ||
10 | } | ||
11 | |||
12 | static void | ||
13 | _hide_hover(void *data, Evas_Object *obj, void *event_info) | ||
14 | { | ||
15 | evas_object_hide(data); | ||
16 | } | ||
17 | |||
18 | EAPI_MAIN int | ||
19 | elm_main(int argc, char **argv) | ||
20 | { | ||
21 | Evas_Object *win, *bg, *bt, *bt2, *rect, *rect2, *rect3, *hover; | ||
22 | |||
23 | win = elm_win_add(NULL, "hover", ELM_WIN_BASIC); | ||
24 | elm_win_title_set(win, "Hover"); | ||
25 | elm_win_autodel_set(win, EINA_TRUE); | ||
26 | elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); | ||
27 | |||
28 | bg = elm_bg_add(win); | ||
29 | evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); | ||
30 | elm_win_resize_object_add(win, bg); | ||
31 | evas_object_show(bg); | ||
32 | |||
33 | rect = evas_object_rectangle_add(evas_object_evas_get(win)); | ||
34 | evas_object_size_hint_min_set(rect, 25, 25); | ||
35 | evas_object_color_set(rect, 255, 0, 0, 255); | ||
36 | evas_object_show(rect); | ||
37 | |||
38 | rect2 = evas_object_rectangle_add(evas_object_evas_get(win)); | ||
39 | evas_object_size_hint_min_set(rect2, 25, 25); | ||
40 | evas_object_color_set(rect2, 0, 255, 0, 255); | ||
41 | evas_object_show(rect2); | ||
42 | |||
43 | rect3 = evas_object_rectangle_add(evas_object_evas_get(win)); | ||
44 | evas_object_size_hint_min_set(rect3, 25, 25); | ||
45 | evas_object_color_set(rect3, 0, 0, 255, 255); | ||
46 | evas_object_show(rect3); | ||
47 | |||
48 | bt = elm_button_add(win); | ||
49 | elm_object_text_set(bt, "Show hover"); | ||
50 | evas_object_move(bt, 60, 90); | ||
51 | evas_object_resize(bt, 80, 20); | ||
52 | evas_object_show(bt); | ||
53 | |||
54 | bt2 = elm_button_add(win); | ||
55 | elm_object_text_set(bt2, "Hide hover"); | ||
56 | evas_object_show(bt2); | ||
57 | |||
58 | hover = elm_hover_add(win); | ||
59 | elm_hover_parent_set(hover, win); | ||
60 | elm_hover_target_set(hover, bt); | ||
61 | |||
62 | elm_object_style_set(hover, "popout"); | ||
63 | |||
64 | elm_object_part_content_set(hover, "left", rect); | ||
65 | elm_object_part_content_set(hover, "top", rect2); | ||
66 | elm_object_part_content_set(hover, "right", rect3); | ||
67 | elm_object_part_content_set(hover, "middle", bt2); | ||
68 | |||
69 | evas_object_smart_callback_add(bt, "clicked", _show_hover, hover); | ||
70 | evas_object_smart_callback_add(bt2, "clicked", _hide_hover, hover); | ||
71 | |||
72 | evas_object_resize(win, 200, 200); | ||
73 | evas_object_show(win); | ||
74 | |||
75 | elm_run(); | ||
76 | elm_shutdown(); | ||
77 | |||
78 | return 0; | ||
79 | } | ||
80 | ELM_MAIN() | ||