summaryrefslogtreecommitdiff
path: root/src/examples/elementary/hover_example_01.c
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-03-23 12:56:14 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-03-23 13:24:41 -0700
commitc2a1c49ab2042f559b28e840e54feb8494888e0e (patch)
treec6eb110b7c479499854eede9d0c3ab0a80c9a11a /src/examples/elementary/hover_example_01.c
parent9340855597e7e465435c69b6278650346688da14 (diff)
elementary: move all legacy files to their expected new location.
Diffstat (limited to 'src/examples/elementary/hover_example_01.c')
-rw-r--r--src/examples/elementary/hover_example_01.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/examples/elementary/hover_example_01.c b/src/examples/elementary/hover_example_01.c
new file mode 100644
index 0000000..f4a7622
--- /dev/null
+++ b/src/examples/elementary/hover_example_01.c
@@ -0,0 +1,74 @@
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
6static void
7_show_hover(void *data, Evas_Object *obj, void *event_info)
8{
9 evas_object_show(data);
10}
11
12static void
13_hide_hover(void *data, Evas_Object *obj, void *event_info)
14{
15 evas_object_hide(data);
16}
17
18EAPI_MAIN int
19elm_main(int argc, char **argv)
20{
21 Evas_Object *win, *bt, *bt2, *rect, *rect2, *rect3, *hover;
22
23 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
24
25 win = elm_win_util_standard_add("hover", "Hover");
26 elm_win_autodel_set(win, EINA_TRUE);
27
28 rect = evas_object_rectangle_add(evas_object_evas_get(win));
29 evas_object_size_hint_min_set(rect, 25, 25);
30 evas_object_color_set(rect, 255, 0, 0, 255);
31 evas_object_show(rect);
32
33 rect2 = evas_object_rectangle_add(evas_object_evas_get(win));
34 evas_object_size_hint_min_set(rect2, 25, 25);
35 evas_object_color_set(rect2, 0, 255, 0, 255);
36 evas_object_show(rect2);
37
38 rect3 = evas_object_rectangle_add(evas_object_evas_get(win));
39 evas_object_size_hint_min_set(rect3, 25, 25);
40 evas_object_color_set(rect3, 0, 0, 255, 255);
41 evas_object_show(rect3);
42
43 bt = elm_button_add(win);
44 elm_object_text_set(bt, "Show hover");
45 evas_object_move(bt, 60, 90);
46 evas_object_resize(bt, 80, 20);
47 evas_object_show(bt);
48
49 bt2 = elm_button_add(win);
50 elm_object_text_set(bt2, "Hide hover");
51 evas_object_show(bt2);
52
53 hover = elm_hover_add(win);
54 elm_hover_parent_set(hover, win);
55 elm_hover_target_set(hover, bt);
56
57 elm_object_style_set(hover, "popout");
58
59 elm_object_part_content_set(hover, "left", rect);
60 elm_object_part_content_set(hover, "top", rect2);
61 elm_object_part_content_set(hover, "right", rect3);
62 elm_object_part_content_set(hover, "middle", bt2);
63
64 evas_object_smart_callback_add(bt, "clicked", _show_hover, hover);
65 evas_object_smart_callback_add(bt2, "clicked", _hide_hover, hover);
66
67 evas_object_resize(win, 200, 200);
68 evas_object_show(win);
69
70 elm_run();
71
72 return 0;
73}
74ELM_MAIN()