On this example marks management will be explained. Functions elm_calendar_mark_add(), elm_calendar_mark_del() and elm_calendar_marks_clear() will be covered.
To add a mark, will be required to choose three things:
Style defines the kind of mark will be displayed over marked day, on calendar. Default theme supports holiday and checked. If more is required, is possible to set a new theme to calendar widget using elm_object_style_set(), and use the signal that will be used by such marks.
Date is a
struct tm , as defined by
time.h. More can be read on
ctime manpage. If a date relative from current is required, this struct can be set as:
Or if it's an absolute date, you can just declare the struct like:
Periodicity is how frequently the mark will be displayed over the calendar. Can be a unique mark (that don't repeat), or it can repeat daily, weekly, monthly or annually. It's enumerated by
So let's add some marks to our calendar. We will add christmas holiday, set Sundays as holidays, and check current day and day after that.
We kept the return of first mark add, because we don't really won't it to be checked, so let's remove it:
After all marks are added and removed, is required to draw them:
Finally, to clear all marks, let's set a callback for our button:
This callback will receive our calendar object, and should clear it:
Our example will look like this:
See the full source code calendar_example_06.c here.