\section{popup\-\_\-example\-\_\-02.\-c}

\begin{DoxyCodeInclude}
\textcolor{comment}{//Compile with:}
\textcolor{comment}{//gcc -o popup\_example\_02 popup\_example\_02.c -g `pkg-config --cflags --libs elementary`}

\textcolor{preprocessor}{#include <Elementary.h>}

\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_response\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *obj, \textcolor{keywordtype}{void} *event\_info);

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   Evas\_Object *win, *popup, *btn1, *btn2, *btn3, *icon1;
   \textcolor{keywordtype}{char} buf[256];

   elm_app_info_set(elm\_main, \textcolor{stringliteral}{"elementary"}, \textcolor{stringliteral}{"images/logo\_small.png"});
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"popup"}, \textcolor{stringliteral}{"Popup"});
   elm_win_autodel_set(win, EINA\_TRUE);

   popup = elm_popup_add(win);

   \textcolor{comment}{// Setting popup content-text}
   elm\_object\_text\_set(popup, \textcolor{stringliteral}{"This is the Content-Text for popup. The wrap"}
                       \textcolor{stringliteral}{"for the content-text is character wrapping"});
   \textcolor{comment}{// Setting the wrapping type to character wrapping}
   elm_popup_content_text_wrap_type_set(popup, ELM\_WRAP\_CHAR);

   \textcolor{comment}{// Seting popup title-text}
   elm_object_part_text_set(popup, \textcolor{stringliteral}{"title,text"}, \textcolor{stringliteral}{"Title"});

   icon1 = elm_icon_add(popup);
   snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s/images/logo\_small.png"}, elm_app_data_dir_get());
   elm_image_file_set(icon1, buf, NULL);
   \textcolor{comment}{//Setting popup title-icon}
   elm_object_part_content_set(popup, \textcolor{stringliteral}{"title,icon"}, icon1);

   \textcolor{comment}{// Creating the first action button}
   btn1 = elm_button_add(popup);
   elm\_object\_text\_set(btn1, \textcolor{stringliteral}{"OK"});

   \textcolor{comment}{// Setting the fist action button}
   elm_object_part_content_set(popup, \textcolor{stringliteral}{"button1"}, btn1);
   evas\_object\_smart\_callback\_add(btn1, \textcolor{stringliteral}{"clicked"}, \_response\_cb, popup);

   \textcolor{comment}{// Creating the second action button}
   btn2 = elm_button_add(popup);
   elm\_object\_text\_set(btn2, \textcolor{stringliteral}{"Cancel"});

   \textcolor{comment}{// Setting the second action button}
   elm_object_part_content_set(popup, \textcolor{stringliteral}{"button2"}, btn2);
   evas\_object\_smart\_callback\_add(btn2, \textcolor{stringliteral}{"clicked"}, \_response\_cb, popup);

   btn3 = elm_button_add(popup);
   elm\_object\_text\_set(btn3, \textcolor{stringliteral}{"Close"});
   \textcolor{comment}{// Setting this action button}
   elm_object_part_content_set(popup, \textcolor{stringliteral}{"button3"}, btn3);
   evas\_object\_smart\_callback\_add(btn3, \textcolor{stringliteral}{"clicked"}, \_response\_cb, popup);
   \textcolor{comment}{// Setting the orientation of popup to Top}
   elm_popup_orient_set(popup, ELM_POPUP_ORIENT_TOP);
   \textcolor{comment}{// Display the popup object}
   evas\_object\_show(popup);

   evas\_object\_resize(win, 480, 800);
   evas\_object\_show(win);

   elm_run();
   elm_shutdown();

   \textcolor{keywordflow}{return} 0;
\}
ELM_MAIN()

static \textcolor{keywordtype}{void}
\_response\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *obj,
             \textcolor{keywordtype}{void} *event\_info)
\{
   evas\_object\_del(data);
\}

\end{DoxyCodeInclude}
 