2 //gcc -o popup_example_02 popup_example_02.c -g `pkg-config --cflags --libs elementary`
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 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
27 elm_win_resize_object_add(win, bg);
30 popup = elm_popup_add(win);
32 // Setting popup content-text
33 elm_object_text_set(popup, "This is the Content-Text for popup. The wrap"
34 "for the content-text is character wrapping");
35 // Setting the wrapping type to character wrapping
36 elm_popup_content_text_wrap_type_set(popup, ELM_WRAP_CHAR);
38 // Seting popup title-text
39 elm_object_part_text_set(popup, "title,text", "Title");
41 icon1 = elm_icon_add(popup);
42 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", PACKAGE_DATA_DIR);
43 elm_icon_file_set(icon1, buf, NULL);
44 //Setting popup title-icon
45 elm_object_part_content_set(popup, "title,icon", icon1);
47 // Creating the first action button
48 btn1 = elm_button_add(popup);
49 elm_object_text_set(btn1, "OK");
51 // Setting the fist action button
52 elm_object_part_content_set(popup, "button1", btn1);
53 evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
55 // Creating the second action button
56 btn2 = elm_button_add(popup);
57 elm_object_text_set(btn2, "Cancel");
59 // Setting the second action button
60 elm_object_part_content_set(popup, "button2", btn2);
61 evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
63 btn3 = elm_button_add(popup);
64 elm_object_text_set(btn3, "Close");
65 // Setting this action button
66 elm_object_part_content_set(popup, "button3", btn3);
67 // Setting the orientation of popup to Top
68 elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
69 // Display the popup object
70 evas_object_show(popup);
72 evas_object_resize(win, 480, 800);
73 evas_object_show(win);
83 _response_cb(void *data, Evas_Object *obj __UNUSED__,
84 void *event_info __UNUSED__)
86 evas_object_del(data);