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

\begin{DoxyCodeInclude}
\textcolor{comment}{/*}
\textcolor{comment}{ * gcc -o theme\_example\_01 theme\_example\_01.c `pkg-config --cflags --libs elementary`}
\textcolor{comment}{ */}
\textcolor{preprocessor}{#include <Elementary.h>}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
btn\_extension\_click\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *btn, \textcolor{keywordtype}{void} *ev)
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *lbl = elm\_object\_text\_get(btn);

   \textcolor{keywordflow}{if} (!strncmp(lbl, \textcolor{stringliteral}{"Load"}, 4))
     \{
        elm_theme_extension_add(NULL, \textcolor{stringliteral}{"./theme\_example.edj"});
        elm\_object\_text\_set(btn, \textcolor{stringliteral}{"Unload extension"});
     \}
   \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (!strncmp(lbl, \textcolor{stringliteral}{"Unload"}, 6))
     \{
        elm_theme_extension_del(NULL, \textcolor{stringliteral}{"./theme\_example.edj"});
        elm\_object\_text\_set(btn, \textcolor{stringliteral}{"Load extension"});
     \}
\}

\textcolor{keyword}{static} \textcolor{keywordtype}{void}
btn\_style\_click\_cb(\textcolor{keywordtype}{void} *data, Evas\_Object *btn, \textcolor{keywordtype}{void} *ev)
\{
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *styles[] = \{
        \textcolor{stringliteral}{"chucknorris"},
        \textcolor{stringliteral}{"default"},
        \textcolor{stringliteral}{"anchor"}
   \};
   \textcolor{keyword}{static} \textcolor{keywordtype}{int} sel\_style = 0;

   sel\_style = (sel\_style + 1) % 3;
   elm_object_style_set(btn, styles[sel\_style]);
\}

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} *argv[])
\{
   Evas\_Object *win, *box, *btn;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   elm_theme_extension_add(NULL, \textcolor{stringliteral}{"./theme\_example.edj"});

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"theme"}, \textcolor{stringliteral}{"Theme example"});
   elm_win_autodel_set(win, EINA\_TRUE);
   evas\_object\_resize(win, 300, 320);
   evas\_object\_show(win);

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

   btn = elm_button_add(win);
   elm\_object\_text\_set(btn, \textcolor{stringliteral}{"Unload extension"});
   elm_box_pack_end(box, btn);
   evas\_object\_show(btn);
   evas\_object\_smart\_callback\_add(btn, \textcolor{stringliteral}{"clicked"}, btn\_extension\_click\_cb, NULL);

   btn = elm_button_add(win);
   elm\_object\_text\_set(btn, \textcolor{stringliteral}{"Switch style"});
   elm_object_style_set(btn, \textcolor{stringliteral}{"chucknorris"});
   elm_box_pack_end(box, btn);
   evas\_object\_show(btn);
   evas\_object\_smart\_callback\_add(btn, \textcolor{stringliteral}{"clicked"}, btn\_style\_click\_cb, NULL);

   elm_run();
   elm_shutdown();

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