\section{thumb\-\_\-example\-\_\-01.\-c}

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

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

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_generation\_started\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *o, \textcolor{keywordtype}{void} *event\_info)
\{
   printf(\textcolor{stringliteral}{"thumbnail generation started.\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_generation\_finished\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *o, \textcolor{keywordtype}{void} *event\_info)
\{
   printf(\textcolor{stringliteral}{"thumbnail generation finished.\(\backslash\)n"});
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
\_generation\_error\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *o, \textcolor{keywordtype}{void} *event\_info)
\{
   printf(\textcolor{stringliteral}{"thumbnail generation error.\(\backslash\)n"});
\}

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   Evas\_Object *win;
   Evas\_Object *thumb;
   \textcolor{keywordtype}{char} buf[PATH\_MAX];

   elm_need_ethumb();

   elm_app_info_set(elm\_main, \textcolor{stringliteral}{"elementary"}, \textcolor{stringliteral}{"images/plant\_01.jpg"});
   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

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

   thumb = elm_thumb_add(win);

   evas\_object\_smart\_callback\_add(thumb, \textcolor{stringliteral}{"generate,start"}, \_generation\_started\_cb, NULL);
   evas\_object\_smart\_callback\_add(thumb, \textcolor{stringliteral}{"generate,stop"}, \_generation\_finished\_cb, NULL);
   evas\_object\_smart\_callback\_add(thumb, \textcolor{stringliteral}{"generate,error"}, \_generation\_error\_cb, NULL);

   elm_thumb_size_set(thumb, 160, 160);
   elm_thumb_editable_set(thumb, EINA\_FALSE);
   snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s/images/plant\_01.jpg"}, elm_app_data_dir_get());
   elm_thumb_file_set(thumb, buf, NULL);
   elm_thumb_reload(thumb);

   evas\_object\_size\_hint\_weight\_set(thumb, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   elm_win_resize_object_add(win, thumb);
   evas\_object\_show(thumb);

   evas\_object\_resize(win, 320, 320);
   evas\_object\_show(win);

   elm_run(); \textcolor{comment}{/* and run the program now, starting to handle all}
\textcolor{comment}{               * events, etc. */}
   elm_shutdown(); \textcolor{comment}{/* clean up and shut down */}
   \textcolor{comment}{/* exit code */}
   \textcolor{keywordflow}{return} 0;
\}
ELM_MAIN()
\end{DoxyCodeInclude}
 