summaryrefslogtreecommitdiff
path: root/src/examples/elementary/popup_example_04.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples/elementary/popup_example_04.c')
-rw-r--r--src/examples/elementary/popup_example_04.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/examples/elementary/popup_example_04.c b/src/examples/elementary/popup_example_04.c
new file mode 100644
index 0000000000..9cff6991ee
--- /dev/null
+++ b/src/examples/elementary/popup_example_04.c
@@ -0,0 +1,61 @@
1//Compile with:
2//gcc -o popup_example_04 popup_example_04.c -g `pkg-config --cflags --libs elementary`
3
4#include <Elementary.h>
5
6static void _response_cb(void *data, Evas_Object *obj, void *event_info);
7static void _block_clicked(void *data, Evas_Object *obj, void *event_info);
8
9EAPI_MAIN int
10elm_main(int argc, char **argv)
11{
12 Evas_Object *win, *popup, *content, *btn1, *btn2;
13
14 win = elm_win_util_standard_add("popup", "Popup");
15 elm_win_autodel_set(win, EINA_TRUE);
16 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
17
18 content = elm_label_add(win);
19 elm_object_text_set(content, "<align=center>Content</align>");
20
21 popup = elm_popup_add(win);
22
23 //Setting popup content
24 elm_object_content_set(popup, content);
25 //Seting popup title-text
26 elm_object_part_text_set(popup, "title,text", "Title");
27 evas_object_show(popup);
28 evas_object_smart_callback_add(popup, "block,clicked", _block_clicked, NULL);
29
30 btn1 = elm_button_add(popup);
31 elm_object_text_set(btn1, "access on/off");
32 elm_object_part_content_set(popup, "button1", btn1);
33 evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
34
35 evas_object_resize(win, 480, 800);
36 evas_object_show(win);
37
38 elm_run();
39
40 return 0;
41}
42ELM_MAIN()
43
44static void
45_response_cb(void *data, Evas_Object *obj,
46 void *event_info)
47{
48 Evas_Object *access;
49
50 elm_config_access_set(!elm_config_access_get());
51
52 access = elm_object_part_access_object_get(data, "access.title");
53 printf("access object of popup title: %p (access mode: %d)\n", access, elm_config_access_get());
54}
55
56static void
57_block_clicked(void *data, Evas_Object *obj,
58 void *event_info)
59{
60 evas_object_hide(obj);
61}