2 //gcc -o popup_example_03 popup_example_03.c -g `pkg-config --cflags --libs elementary`
4 #include <Elementary.h>
6 static void _item_selected_cb(void *data, Evas_Object *obj, void *event_info);
7 static void _response_cb(void *data, Evas_Object *obj, void *event_info);
10 elm_main(int argc, char **argv)
12 Evas_Object *win, *popup, *btn1, *btn2, *icon1;
13 Elm_Object_Item *popup_it1;
16 elm_app_info_set(elm_main, "elementary", "images/logo_small.png");
17 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
19 win = elm_win_util_standard_add("popup", "Popup");
20 elm_win_autodel_set(win, EINA_TRUE);
22 popup = elm_popup_add(win);
24 icon1 = elm_icon_add(popup);
25 snprintf(buf, sizeof(buf), "%s/images/logo_small.png", elm_app_data_dir_get());
26 elm_image_file_set(icon1, buf, NULL);
28 //Seting popup title-text
29 elm_object_part_text_set(popup, "title,text", "Title");
31 //Appending popup content-items
32 elm_popup_item_append(popup, "Message", NULL, _item_selected_cb, NULL);
33 elm_popup_item_append(popup, "Email", NULL, _item_selected_cb, NULL);
34 elm_popup_item_append(popup, "Contacts", NULL, _item_selected_cb, NULL);
35 elm_popup_item_append(popup, "Video", NULL, _item_selected_cb, NULL);
36 elm_popup_item_append(popup, "Music", NULL, _item_selected_cb, NULL);
37 elm_popup_item_append(popup, "Memo", NULL, _item_selected_cb, NULL);
38 popup_it1 = elm_popup_item_append(popup, "Radio", NULL, _item_selected_cb,
41 //Changing the label of the item
42 elm_object_item_text_set(popup_it1, "FM");
43 elm_popup_item_append(popup, "Messenger", NULL, _item_selected_cb, NULL);
44 elm_popup_item_append(popup, "Settings", NULL, _item_selected_cb, NULL);
45 elm_popup_item_append(popup, "App Installer", NULL, _item_selected_cb, NULL);
46 elm_popup_item_append(popup, "Browser", NULL, _item_selected_cb, NULL);
47 elm_popup_item_append(popup, "Weather", icon1, _item_selected_cb, NULL);
48 elm_popup_item_append(popup, "News Feeds", NULL, _item_selected_cb, NULL);
50 //Seting popup title-text
51 elm_object_part_text_set(popup, "title,text", "Title");
53 // Creating the first action button
54 btn1 = elm_button_add(popup);
55 elm_object_text_set(btn1, "OK");
57 //Appending the fist action button
58 elm_object_part_content_set(popup, "button1", btn1);
59 evas_object_smart_callback_add(btn1, "clicked", _response_cb, popup);
61 //Creating the second action button
62 btn2 = elm_button_add(popup);
63 elm_object_text_set(btn2, "Cancel");
64 evas_object_smart_callback_add(btn2, "clicked", _response_cb, popup);
66 //Appending the second action button
67 elm_object_part_content_set(popup, "button2", btn2);
69 //Display the popup object
70 evas_object_show(popup);
72 evas_object_resize(win, 480, 800);
73 evas_object_show(win);
82 _item_selected_cb(void *data, Evas_Object *obj,
85 printf("popup item selected: %s\n", elm_object_item_text_get(event_info));
89 _response_cb(void *data, Evas_Object *obj,
92 evas_object_hide(data);