
\begin{DoxyCodeInclude}

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

\textcolor{comment}{/* Callback function when a day is clicked. */}
\textcolor{keyword}{static} \textcolor{keywordtype}{void} \_changed\_cb(\textcolor{keywordtype}{void}* data, Evas\_Object* obj, \textcolor{keywordtype}{void}* event\_info)
\{
   \textcolor{keywordtype}{char} buf[256];
   Elm_Dayselector_Day day;
   Eina\_Bool selected;

   \textcolor{comment}{/* get which day's state is changed */}
   day = (Elm_Dayselector_Day) event\_info;
   \textcolor{comment}{/* get the state of corresponding day's check object */}
   selected = elm_dayselector_day_selected_get(obj, day);
   \textcolor{keywordflow}{switch}(day)
     \{
      \textcolor{keywordflow}{case} ELM_DAYSELECTOR_SUN: snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s"}, \textcolor{stringliteral}{"Sun"});   \textcolor{keywordflow}{break};
      \textcolor{keywordflow}{case} ELM_DAYSELECTOR_MON: snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s"}, \textcolor{stringliteral}{"Mon"});   \textcolor{keywordflow}{break};
      \textcolor{keywordflow}{case} ELM_DAYSELECTOR_TUE: snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s"}, \textcolor{stringliteral}{"Tue"});   \textcolor{keywordflow}{break};
      \textcolor{keywordflow}{case} ELM_DAYSELECTOR_WED: snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s"}, \textcolor{stringliteral}{"Wed"});   \textcolor{keywordflow}{break};
      \textcolor{keywordflow}{case} ELM_DAYSELECTOR_THU: snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s"}, \textcolor{stringliteral}{"Thu"});   \textcolor{keywordflow}{break};
      \textcolor{keywordflow}{case} ELM_DAYSELECTOR_FRI: snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s"}, \textcolor{stringliteral}{"Fri"});   \textcolor{keywordflow}{break};
      \textcolor{keywordflow}{case} ELM_DAYSELECTOR_SAT: snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s"}, \textcolor{stringliteral}{"Sat"});   \textcolor{keywordflow}{break};
      \textcolor{keywordflow}{default}: snprintf(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%s"}, \textcolor{stringliteral}{"???"}); \textcolor{keywordflow}{break};
     \}
   fprintf(stderr, \textcolor{stringliteral}{"%s state is %d\(\backslash\)n"}, buf, selected);
\}
\textcolor{comment}{/* End of clicked callback */}

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   Evas\_Object *win, *bx, *dayselector;

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"dayselector"}, \textcolor{stringliteral}{"Dayselector Example"});
   elm_win_autodel_set(win, EINA\_TRUE);

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

   \textcolor{comment}{/* add a dayselector widget showing weekdays starting from Sunday */}
   dayselector = elm_dayselector_add(win);
   evas\_object\_size\_hint\_weight\_set(dayselector, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(dayselector, EVAS\_HINT\_FILL, 0.5);
   evas\_object\_smart\_callback\_add(dayselector, \textcolor{stringliteral}{"dayselector,changed"}, \_changed\_cb, NULL);
   elm_box_pack_end(bx, dayselector);
   evas\_object\_show(dayselector);

   \textcolor{comment}{/* add a dayselector widget showing weekdays starting from Monday */}
   dayselector = elm_dayselector_add(win);
   evas\_object\_size\_hint\_weight\_set(dayselector, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   evas\_object\_size\_hint\_align\_set(dayselector, EVAS\_HINT\_FILL, 0.5);
   evas\_object\_smart\_callback\_add(dayselector, \textcolor{stringliteral}{"dayselector,changed"}, \_changed\_cb, NULL);
   elm_object_style_set(dayselector, \textcolor{stringliteral}{"mon\_first"});
   elm_box_pack_end(bx, dayselector);
   evas\_object\_show(dayselector);

   evas\_object\_resize(win, 350, 120);
   evas\_object\_show(win);

   elm_run();

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