summaryrefslogtreecommitdiff
path: root/src/examples/notify_example_01.c
diff options
context:
space:
mode:
authorJonas M. Gastal <jgastal@profusion.mobi>2011-07-27 13:40:30 +0000
committerJonas M. Gastal <jgastal@profusion.mobi>2011-07-27 13:40:30 +0000
commit80aa6b63500bdfac0db21df3f138efb6c51bd471 (patch)
treed070686072fbddd68ed40246263bc7bc34774fd9 /src/examples/notify_example_01.c
parent22cdc1da7a5c76f0e577290fbd39a05dd8fa3a91 (diff)
Elementary: notify documentation.
SVN revision: 61807
Diffstat (limited to 'src/examples/notify_example_01.c')
-rw-r--r--src/examples/notify_example_01.c80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/examples/notify_example_01.c b/src/examples/notify_example_01.c
new file mode 100644
index 0000000..16cf3a5
--- /dev/null
+++ b/src/examples/notify_example_01.c
@@ -0,0 +1,80 @@
1//Compile with:
2//gcc -g `pkg-config --cflags --libs elementary` notify_example_01.c -o notify_example_01
3
4#include <Elementary.h>
5#ifdef HAVE_CONFIG_H
6# include "elementary_config.h"
7#endif
8
9static void _hide(void *data, Evas_Object *obj, void *event_info);
10
11EAPI int
12elm_main(int argc, char **argv)
13{
14 Evas_Object *win, *bg, *bx, *notify, *content;
15
16 win = elm_win_add(NULL, "notify", ELM_WIN_BASIC);
17 elm_win_title_set(win, "Notify");
18 elm_win_autodel_set(win, EINA_TRUE);
19 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
20
21 bg = elm_bg_add(win);
22 elm_win_resize_object_add(win, bg);
23 evas_object_show(bg);
24
25 bx = elm_box_add(win);
26 elm_box_horizontal_set(bx, EINA_FALSE);
27 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
28 evas_object_size_hint_align_set(bx, EVAS_HINT_FILL, EVAS_HINT_FILL);
29 elm_win_resize_object_add(win, bx);
30 evas_object_show(bx);
31
32 content = elm_label_add(win);
33 elm_object_text_set(content, "default");
34 evas_object_show(content);
35
36 notify = elm_notify_add(win);
37 elm_notify_repeat_events_set(notify, EINA_FALSE);
38 elm_notify_timeout_set(notify, 5);
39 elm_notify_content_set(notify, content);
40 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
41 evas_object_show(notify);
42 elm_box_pack_end(bx, notify);
43 evas_object_smart_callback_add(notify, "block,clicked", _hide, NULL);
44
45 content = elm_label_add(win);
46 elm_object_text_set(content, "bottom");
47 evas_object_show(content);
48
49 notify = elm_notify_add(win);
50 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_BOTTOM);
51 elm_notify_content_set(notify, content);
52 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
53 evas_object_show(notify);
54 elm_box_pack_end(bx, notify);
55
56 content = elm_label_add(win);
57 elm_object_text_set(content, "center");
58 evas_object_show(content);
59
60 notify = elm_notify_add(win);
61 elm_notify_orient_set(notify, ELM_NOTIFY_ORIENT_CENTER);
62 elm_notify_content_set(notify, content);
63 evas_object_size_hint_weight_set(notify, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
64 evas_object_show(notify);
65 elm_box_pack_end(bx, notify);
66
67 evas_object_resize(win, 100, 200);
68 evas_object_show(win);
69
70 elm_run();
71
72 return 0;
73}
74ELM_MAIN()
75
76static void
77_hide(void *data, Evas_Object *obj, void *event_info)
78{
79 evas_object_hide(obj);
80} \ No newline at end of file