This code places two Elementary dayselector widgets on a window, each of them exemplifying the different widget styles.

The first of them is the dayselector in default style\+:  
\begin{DoxyCodeInclude}
   \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);

\end{DoxyCodeInclude}


As you see, the default style displays the weekdays starting from Sunday.

One can select/unselect a day just by clicking on the day object. The selection toggles once it is being pressed.

For showing weekdays starting from Monday, see the second dayselector\+:  
\begin{DoxyCodeInclude}
   \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);

\end{DoxyCodeInclude}


The following code exemplifies the selection A\+P\+Is of Dayselector\+:  
\begin{DoxyCodeInclude}
\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 */}

\end{DoxyCodeInclude}


See the full \hyperlink{dayselector_example_8c-example}{example}, whose window should look like this picture\+:

 
\begin{DoxyImageNoCaption}
  \mbox{\includegraphics[width=\textwidth]{screenshots/dayselector_example}}
\end{DoxyImageNoCaption}


See the full \hyperlink{dayselector_example_c}{source code} for this example. 