2 //gcc -g `pkg-config --cflags --libs elementary` popup_example_01.c -o popup_example_01
4 #include <Elementary.h>
6 # include "elementary_config.h"
8 # define __UNUSED__ __attribute__((unused))
9 # define PACKAGE_DATA_DIR "../../data"
12 static void _block_clicked(void *data, Evas_Object *obj, void *event_info);
13 static void _timeout(void *data, Evas_Object *obj, void *event_info);
16 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
18 Evas_Object *win, *bg, *popup, *content;
20 win = elm_win_add(NULL, "popup", ELM_WIN_BASIC);
21 elm_win_title_set(win, "Popup");
22 elm_win_autodel_set(win, EINA_TRUE);
23 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
26 elm_bg_color_set(bg, 128, 128, 128);
27 elm_win_resize_object_add(win, bg);
30 content = elm_label_add(win);
31 elm_object_text_set(content, "<align=center>Content</align>");
33 popup = elm_popup_add(win);
34 elm_popup_timeout_set(popup, 3.0);
35 evas_object_smart_callback_add(popup, "timeout", _timeout, NULL);
37 //Setting popup content
38 elm_object_content_set(popup, content);
39 //Seting popup title-text
40 elm_object_part_text_set(popup, "title,text", "Title");
41 evas_object_show(popup);
42 evas_object_smart_callback_add(popup, "block,clicked", _block_clicked, NULL);
44 evas_object_show(win);
45 evas_object_resize(win, 480, 800);
54 _block_clicked(void *data __UNUSED__, Evas_Object *obj,
55 void *event_info __UNUSED__)
57 evas_object_hide(obj);
61 _timeout(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
63 evas_object_hide(obj);