\hypertarget{calendar_example_06_8c-example}{}\doxysection{calendar\+\_\+example\+\_\+06.\+c}

\begin{DoxyCodeInclude}{0}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#include <Elementary.h>}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{preprocessor}{\#define SECS\_DAY 86400}}
\DoxyCodeLine{}
\DoxyCodeLine{\textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\_btn\_clear\_cb(\textcolor{keywordtype}{void} *data, \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *btn \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{void} *ev \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *cal = data;}
\DoxyCodeLine{   elm\_calendar\_marks\_clear(cal);}
\DoxyCodeLine{   elm\_calendar\_marks\_draw(cal);}
\DoxyCodeLine{\}}
\DoxyCodeLine{}
\DoxyCodeLine{EAPI\_MAIN \textcolor{keywordtype}{int}}
\DoxyCodeLine{elm\_main(\textcolor{keywordtype}{int} argc \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}}, \textcolor{keywordtype}{char} **argv \mbox{\hyperlink{group__Eina__Types__Group_ga82d751be730f849719ca292f9558be87}{EINA\_UNUSED}})}
\DoxyCodeLine{\{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga9e19e6dd1f517a0ba437c0114d3e7c97}{Evas\_Object}} *win, *bt, *bx, *cal;}
\DoxyCodeLine{   \mbox{\hyperlink{struct__Elm__Calendar__Mark}{Elm\_Calendar\_Mark}} *mark;}
\DoxyCodeLine{   \textcolor{keyword}{struct }tm selected\_time;}
\DoxyCodeLine{   time\_t current\_time;}
\DoxyCodeLine{   \textcolor{keyword}{struct }tm sunday;}
\DoxyCodeLine{   \textcolor{keyword}{struct }tm christmas;}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/*}}
\DoxyCodeLine{\textcolor{comment}{    * At least on Windows, tm has 9 fields.}}
\DoxyCodeLine{\textcolor{comment}{    * As a workaround, set sunday to 0 and set}}
\DoxyCodeLine{\textcolor{comment}{    * th needed fields to correct value}}
\DoxyCodeLine{\textcolor{comment}{    */}}
\DoxyCodeLine{   memset(\&sunday, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} tm));}
\DoxyCodeLine{   sunday.tm\_hour = 12;}
\DoxyCodeLine{   sunday.tm\_mday = 7;}
\DoxyCodeLine{   sunday.tm\_isdst = -\/1;}
\DoxyCodeLine{}
\DoxyCodeLine{   memset(\&christmas, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} tm));}
\DoxyCodeLine{   christmas.tm\_mday = 25;}
\DoxyCodeLine{   christmas.tm\_mon = 11;}
\DoxyCodeLine{}
\DoxyCodeLine{   win = \mbox{\hyperlink{group__Elm__Win__Group_gac75d7752662fab73d6420706ce5be996}{elm\_win\_util\_standard\_add}}(\textcolor{stringliteral}{"{}calendar"{}}, \textcolor{stringliteral}{"{}Calendar Marks Example"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win__Group_ga9a16a2f8c9fd5b6e9203ed9dcb53ea8b}{elm\_win\_autodel\_set}}(win, \mbox{\hyperlink{group__Eina__Types__Group_ga05c12dacc8b4058994df842b41be85fc}{EINA\_TRUE}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_ga7a05f37fd3a019da5e26c5fc91fcd937}{elm\_policy\_set}}(\mbox{\hyperlink{group__Elm__General_ggaa16f3378ecdbf660fa378402e3c5a0a9a02fadb6faada04b19d0fa42c11a8d32a}{ELM\_POLICY\_QUIT}}, \mbox{\hyperlink{group__Elm__General_gga46af37e6ac2c406321060be827117196abbe0962d88ae12afe1a173da881f56cd}{ELM\_POLICY\_QUIT\_LAST\_WINDOW\_CLOSED}});}
\DoxyCodeLine{}
\DoxyCodeLine{   bx = \mbox{\hyperlink{group__Elm__Box__Group_ga3d0998b60ada633bacfa8869a921cfd7}{elm\_box\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga2af897b00f32bebf08705929276386f5}{evas\_object\_size\_hint\_weight\_set}}(bx, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Win__Group_ga505d6bd217e5ee01e82b548ec35986eb}{elm\_win\_resize\_object\_add}}(win, bx);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bx);}
\DoxyCodeLine{}
\DoxyCodeLine{   cal = \mbox{\hyperlink{group__Elm__Calendar_gae893c6a3465db10d322ff937be4b0854}{elm\_calendar\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga2af897b00f32bebf08705929276386f5}{evas\_object\_size\_hint\_weight\_set}}(cal, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga44b67b368e5cda723129c2852bd81ead}{evas\_object\_size\_hint\_align\_set}}(cal, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx, cal);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(cal);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* check today -\/ we'll remove it later */}}
\DoxyCodeLine{   current\_time = time(NULL);}
\DoxyCodeLine{   localtime\_r(\&current\_time, \&selected\_time);}
\DoxyCodeLine{   mark = elm\_calendar\_mark\_add(cal, \textcolor{stringliteral}{"{}checked"{}}, \&selected\_time,}
\DoxyCodeLine{                                ELM\_CALENDAR\_UNIQUE);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* check tomorrow */}}
\DoxyCodeLine{   current\_time = time(NULL) + 1 * SECS\_DAY;}
\DoxyCodeLine{   localtime\_r(\&current\_time, \&selected\_time);}
\DoxyCodeLine{   elm\_calendar\_mark\_add(cal, \textcolor{stringliteral}{"{}checked"{}}, \&selected\_time, ELM\_CALENDAR\_UNIQUE);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* mark christmas as holiday */}}
\DoxyCodeLine{   elm\_calendar\_mark\_add(cal, \textcolor{stringliteral}{"{}holiday"{}}, \&christmas, ELM\_CALENDAR\_ANNUALLY);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* mark Sundays as holidays */}}
\DoxyCodeLine{   elm\_calendar\_mark\_add(cal, \textcolor{stringliteral}{"{}holiday"{}}, \&sunday, ELM\_CALENDAR\_WEEKLY);}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{comment}{/* ok, let's remove today's check */}}
\DoxyCodeLine{   elm\_calendar\_mark\_del(mark);}
\DoxyCodeLine{}
\DoxyCodeLine{   elm\_calendar\_marks\_draw(cal);}
\DoxyCodeLine{}
\DoxyCodeLine{   bt = \mbox{\hyperlink{group__Elm__Button_ga0021b9d86d822367035843ed18bc6ea9}{elm\_button\_add}}(win);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga2af897b00f32bebf08705929276386f5}{evas\_object\_size\_hint\_weight\_set}}(bt, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}}, \mbox{\hyperlink{Evas__Common_8h_aa47c85083d3dae0111c21ec49359306a}{EVAS\_HINT\_EXPAND}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group_ga44b67b368e5cda723129c2852bd81ead}{evas\_object\_size\_hint\_align\_set}}(bt, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}}, \mbox{\hyperlink{Evas__Common_8h_aecbac710f36d52911fc34dcdaf8e729c}{EVAS\_HINT\_FILL}});}
\DoxyCodeLine{   elm\_object\_text\_set(bt, \textcolor{stringliteral}{"{}Clear marks"{}});}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Smart__Object__Group_ga18a8b179f94d21b2b09e19db11741061}{evas\_object\_smart\_callback\_add}}(bt, \textcolor{stringliteral}{"{}clicked"{}}, \_btn\_clear\_cb, cal);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__Box__Group_ga66a10dd861578521af2ab7b8c2ca65c5}{elm\_box\_pack\_end}}(bx, bt);}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(bt);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Evas__Object__Group__Basic_ga9cbc13661584e49fb9d9cdab514a1eeb}{evas\_object\_show}}(win);}
\DoxyCodeLine{}
\DoxyCodeLine{   \mbox{\hyperlink{group__Elm__General_gadf2553f83e6b0b9c7fbe054019a664a1}{elm\_run}}();}
\DoxyCodeLine{}
\DoxyCodeLine{   \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\}}
\DoxyCodeLine{\mbox{\hyperlink{group__Elm__General_ga50fe52d513f7e89c9c770afd76de7ad9}{ELM\_MAIN}}()}

\end{DoxyCodeInclude}
 