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

\begin{DoxyCodeInclude}

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

\textcolor{keyword}{static} \textcolor{keywordtype}{char} *
\_format\_month\_year(\textcolor{keyword}{struct} tm *format\_time)
\{
   \textcolor{keywordtype}{char} buf[32];
   \textcolor{comment}{/* abbreviates month and year */}
   \textcolor{keywordflow}{if} (!strftime(buf, \textcolor{keyword}{sizeof}(buf), \textcolor{stringliteral}{"%b %y"}, format\_time)) \textcolor{keywordflow}{return} NULL;
   \textcolor{keywordflow}{return} strdup(buf);
\}

EAPI\_MAIN \textcolor{keywordtype}{int}
elm\_main(\textcolor{keywordtype}{int} argc, \textcolor{keywordtype}{char} **argv)
\{
   Evas\_Object *win, *cal;
   \textcolor{keyword}{const} \textcolor{keywordtype}{char} *weekdays[] =
     \{
        \textcolor{stringliteral}{"S"}, \textcolor{stringliteral}{"M"}, \textcolor{stringliteral}{"T"}, \textcolor{stringliteral}{"W"}, \textcolor{stringliteral}{"T"}, \textcolor{stringliteral}{"F"}, \textcolor{stringliteral}{"S"}
     \};

   elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);

   win = elm_win_util_standard_add(\textcolor{stringliteral}{"calendar"}, \textcolor{stringliteral}{"Calendar Layout Formatting Example"});
   elm_win_autodel_set(win, EINA\_TRUE);

   cal = elm_calendar_add(win);
   evas\_object\_size\_hint\_weight\_set(cal, EVAS\_HINT\_EXPAND, EVAS\_HINT\_EXPAND);
   elm_win_resize_object_add(win, cal);

   elm_calendar_format_function_set(cal, \_format\_month\_year);
   elm_calendar_weekdays_names_set(cal, weekdays);

   evas\_object\_show(cal);

   evas\_object\_show(win);

   elm_run();
   elm_shutdown();

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