2 //gcc -g `pkg-config --cflags --libs elementary` popup_example_02.c -o popup_example_02
4 #include <Elementary.h>
6 # include "elementary_config.h"
8 # define __UNUSED__ __attribute__((unused))
9 # define PACKAGE_DATA_DIR "../../data"
12 static void _response_cb(void *data, Evas_Object *obj, void *event_info);
15 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
17 Evas_Object *win, *bg, *popup, *btn1, *btn2, *btn3, *icon1;
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_win_resize_object_add(win, bg);
29 popup = elm_popup_add(win);
31 // Setting popup content-text
32 elm_object_text_set(popup, "This is the Content-Text for popup. The wrap"
33 "for the content-text is character wrapping");
34 // Setting the wrapping type to character wrapping
35 elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR);
37 // Seting popup title-text
38 elm_object_part_text_set(popup, "title,text", "Title");
40 icon1 = elm_icon_add(popup);
41 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
42 elm_icon_file_set(icon1, buf, NULL);
43 //Setting popup title-icon
44 elm_object_part_content_set(popup, "title,icon", icon1);
46 // Creating the first action button
47 btn1 = elm_button_add(popup);
48 elm_object_text_set(btn1, "OK");
50 // Setting the fist action button
51 elm_object_part_content_set(popup, "button1", btn1);
52 evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
54 // Creating the second action button
55 btn2 = elm_button_add(popup);
56 elm_object_text_set(btn2, "Cancel");
58 // Setting the second action button
59 elm_object_part_content_set(popup, "button2", btn2);
60 evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
62 btn3 = elm_button_add(popup);
63 elm_object_text_set(btn3, "Close");
64 // Setting this action button
65 elm_object_part_content_set(popup, "button3", btn3);
66 // Setting the orientation of popup to Top
67 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
68 // Display the popup object
69 evas_object_show(popup);
71 evas_object_resize(win, 480, 800);
72 evas_object_show(win);
80 _response_cb(void *data, Evas_Object *obj __UNUSED__,
81 void *event_info __UNUSED__)
83 evas_object_del(data);