Typedefs | Functions
Calendar

Typedefs

typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark
 Item handle for a calendar mark. More...
 
typedef char *(* Elm_Calendar_Format_Cb) (struct tm *stime)
 This callback type is used to format the string that will be used to display month and year. More...
 

Functions

void elm_calendar::selected_time_set (struct tm *selected_time_) const
 Set selected date to be highlighted on calendar. More...
 
bool elm_calendar::selected_time_get (struct tm *selected_time_) const
 Get selected date. More...
 
Elm_Calendar_Markelm_calendar::mark_add (std::string mark_type_, struct tm *mark_time_, Elm_Calendar_Mark_Repeat_Type repeat_) const
 Add a new mark to the calendar. More...
 
void elm_calendar::marks_clear () const
 Remove all calendar's marks. More...
 
void elm_calendar::marks_draw () const
 Draw calendar marks. More...
 
bool elm_calendar::displayed_time_get (struct tm *displayed_time_) const
 Get the current time displayed in the widget. More...
 
Elm_Calendar_Weekday elm_calendar::first_day_of_week_get () const
 Get the first day of week, who are used on calendar widgets'. More...
 
void elm_calendar::first_day_of_week_set (Elm_Calendar_Weekday day_) const
 Get the first day of week, who are used on calendar widgets'. More...
 
Elm_Calendar_Selectable elm_calendar::selectable_get () const
 Get how elm_calendar_selected_time_set manage a date. More...
 
void elm_calendar::selectable_set (Elm_Calendar_Selectable selectable_) const
 Get how elm_calendar_selected_time_set manage a date. More...
 
double elm_calendar::interval_get () const
 Get the interval on time updates for an user mouse button hold on calendar widgets' month/year selection. More...
 
void elm_calendar::interval_set (double interval_) const
 Get the interval on time updates for an user mouse button hold on calendar widgets' month/year selection. More...
 
const char ** elm_calendar::weekdays_names_get () const
 Get weekdays names displayed by the calendar. More...
 
void elm_calendar::weekdays_names_set (const char **weekdays_) const
 Get weekdays names displayed by the calendar. More...
 
Elm_Calendar_Select_Mode elm_calendar::select_mode_get () const
 Get the select day mode used. More...
 
void elm_calendar::select_mode_set (Elm_Calendar_Select_Mode mode_) const
 Get the select day mode used. More...
 
void elm_calendar::min_max_year_get (int *min_, int *max_) const
 Get the minimum and maximum values for the year. More...
 
void elm_calendar::min_max_year_set (int min_, int max_) const
 Get the minimum and maximum values for the year. More...
 
const Eina_List * elm_calendar::marks_get () const
 Get a list of all the calendar marks. More...
 
void elm_calendar_mark_del (Elm_Calendar_Mark *mark)
 Delete mark from the calendar. More...
 
Evas_Object * elm_calendar_add (Evas_Object *parent)
 Add a new calendar widget to the given parent Elementary (container) object. More...
 
EINA_DEPRECATED void elm_calendar_text_saturday_color_set (Evas_Object *obj, int pos)
 Set a day text color to the same that represents Saturdays. More...
 
EINA_DEPRECATED void elm_calendar_text_sunday_color_set (Evas_Object *obj, int pos)
 Set a day text color to the same that represents Sundays. More...
 
EINA_DEPRECATED void elm_calendar_text_weekday_color_set (Evas_Object *obj, int pos)
 Set a day text color to the same that represents Weekdays. More...
 

Detailed Description

calendar_inheritance_tree.png

This is a calendar widget. It helps applications to flexibly display a calender with day of the week, date, year and month. Applications are able to set specific dates to be reported back, when selected, in the smart callbacks of the calendar widget. The API of this widget lets the applications perform other functions, like:

This widget inherits from the Layout one, so that all the functions acting on it also work for calendar objects.

This widget emits the following signals, besides the ones sent from Layout:

Supported elm_object common APIs.

Here is some sample code using it:

Typedef Documentation

typedef char*(* Elm_Calendar_Format_Cb) (struct tm *stime)

This callback type is used to format the string that will be used to display month and year.

Parameters
stimeStruct representing time.
Returns
String representing time that will be set to calendar's text.
See also
elm_calendar_format_function_set()
typedef struct _Elm_Calendar_Mark Elm_Calendar_Mark

Item handle for a calendar mark.

Created with elm_calendar_mark_add() and deleted with elm_calendar_mark_del().

Function Documentation

bool elm_calendar::displayed_time_get ( struct tm *  displayed_time_) const
inline

Get the current time displayed in the widget.

Returns
EINA_FALSE means an error occurred. If it's an error the returned time is zero filled.
Since
1.8
Parameters
[in,out]displayed_timeA tm struct to point to displayed date
Evas_Object* elm_calendar_add ( Evas_Object *  parent)

Add a new calendar widget to the given parent Elementary (container) object.

Parameters
parentThe parent object.
Returns
a new calendar widget handle or NULL, on errors.

This function inserts a new calendar widget on the canvas.

Calendar - Simple creation.

void elm_calendar_mark_del ( Elm_Calendar_Mark mark)

Delete mark from the calendar.

Parameters
markThe mark to be deleted.

If deleting all calendar marks is required, elm_calendar_marks_clear() should be used instead of getting marks list and deleting each one.

See also
elm_calendar_mark_add()

Calendar - Calendar marks.

EINA_DEPRECATED void elm_calendar_text_saturday_color_set ( Evas_Object *  obj,
int  pos 
)

Set a day text color to the same that represents Saturdays.

Parameters
objThe calendar object.
posThe text position. Position is the cell counter, from left to right, up to down. It starts on 0 and ends on 41.
Deprecated:
use elm_calendar_mark_add() instead like:
1 struct tm t = { 0, 0, 12, 6, 0, 0, 6, 6, -1 };
2 elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY);
See also
elm_calendar_mark_add()
EINA_DEPRECATED void elm_calendar_text_sunday_color_set ( Evas_Object *  obj,
int  pos 
)

Set a day text color to the same that represents Sundays.

Parameters
objThe calendar object.
posThe text position. Position is the cell counter, from left to right, up to down. It starts on 0 and ends on 41.
Deprecated:
use elm_calendar_mark_add() instead like:
1 struct tm t = { 0, 0, 12, 7, 0, 0, 0, 0, -1 };
2 elm_calendar_mark_add(obj, "sat", &t, ELM_CALENDAR_WEEKLY);
See also
elm_calendar_mark_add()
EINA_DEPRECATED void elm_calendar_text_weekday_color_set ( Evas_Object *  obj,
int  pos 
)

Set a day text color to the same that represents Weekdays.

Parameters
objThe calendar object
posThe text position. Position is the cell counter, from left to right, up to down. It starts on 0 and ends on 41.
Deprecated:
use elm_calendar_mark_add() instead like:
1 struct tm t = { 0, 0, 12, 1, 0, 0, 0, 0, -1 };
2 
3 elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // monday
4 t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
5 elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // tuesday
6 t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
7 elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // wednesday
8 t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
9 elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // thursday
10 t.tm_tm_mday++; t.tm_wday++; t.tm_yday++;
11 elm_calendar_mark_add(obj, "week", &t, ELM_CALENDAR_WEEKLY); // friday
See also
elm_calendar_mark_add()
Elm_Calendar_Weekday elm_calendar::first_day_of_week_get ( ) const
inline

Get the first day of week, who are used on calendar widgets'.

Returns
An int which correspond to the first day of the week (Sunday = 0, Monday = 1, ..., Saturday = 6)
See also
elm_calendar_first_day_of_week_set() for more details
Parameters
dayAn int which correspond to the first day of the week (Sunday = 0, Monday = 1, ..., Saturday = 6)
void elm_calendar::first_day_of_week_set ( Elm_Calendar_Weekday  day_) const
inline

Get the first day of week, who are used on calendar widgets'.

Returns
An int which correspond to the first day of the week (Sunday = 0, Monday = 1, ..., Saturday = 6)
See also
elm_calendar_first_day_of_week_set() for more details
Parameters
dayAn int which correspond to the first day of the week (Sunday = 0, Monday = 1, ..., Saturday = 6)
double elm_calendar::interval_get ( ) const
inline

Get the interval on time updates for an user mouse button hold on calendar widgets' month/year selection.

Returns
The (first) interval value, in seconds, set on it
See also
elm_calendar_interval_set() for more details
Parameters
intervalThe (first) interval value in seconds
void elm_calendar::interval_set ( double  interval_) const
inline

Get the interval on time updates for an user mouse button hold on calendar widgets' month/year selection.

Returns
The (first) interval value, in seconds, set on it
See also
elm_calendar_interval_set() for more details
Parameters
intervalThe (first) interval value in seconds
Elm_Calendar_Mark* elm_calendar::mark_add ( std::string  mark_type_,
struct tm *  mark_time_,
Elm_Calendar_Mark_Repeat_Type  repeat_ 
) const
inline

Add a new mark to the calendar.

Returns
The created mark or NULL upon failure.

Add a mark that will be drawn in the calendar respecting the insertion time and periodicity. It will emit the type as signal to the widget theme. Default theme supports "holiday" and "checked", but it can be extended.

It won't immediately update the calendar, drawing the marks. For this, call elm_calendar_marks_draw(). However, when user selects next or previous month calendar forces marks drawn.

Marks created with this method can be deleted with elm_calendar_mark_del().

Example

struct tm selected_time;
time_t current_time;
current_time = time(NULL) + 5 * (24 * 60 * 60);
localtime_r(&current_time, &selected_time);
elm_calendar_mark_add(cal, "holiday", selected_time,
ELM_CALENDAR_ANNUALLY);
current_time = time(NULL) + 1 * (24 * 60 * 60);
localtime_r(&current_time, &selected_time);
elm_calendar_mark_add(cal, "checked", selected_time, ELM_CALENDAR_UNIQUE);
elm_calendar_marks_draw(cal);
See also
elm_calendar_marks_draw()
elm_calendar_mark_del()

Calendar - Calendar marks.

Parameters
mark_typeA string used to define the type of mark. It will be emitted to the theme, that should display a related modification on these days representation.
mark_timeA time struct to represent the date of inclusion of the mark. For marks that repeats it will just be displayed after the inclusion date in the calendar.
repeatRepeat the event following this periodicity. Can be a unique mark (that don't repeat), daily, weekly, monthly or annually.
void elm_calendar::marks_clear ( ) const
inline

Remove all calendar's marks.

See also
elm_calendar_mark_add()
elm_calendar_mark_del()
void elm_calendar::marks_draw ( ) const
inline

Draw calendar marks.

Should be used after adding, removing or clearing marks. It will go through the entire marks list updating the calendar. If lots of marks will be added, add all the marks and then call this function.

When the month is changed, i.e. user selects next or previous month, marks will be drawn.

See also
elm_calendar_mark_add()
elm_calendar_mark_del()
elm_calendar_marks_clear()

Calendar - Calendar marks.

const Eina_List* elm_calendar::marks_get ( ) const
inline

Get a list of all the calendar marks.

Returns
An Eina_List of calendar marks objects, or NULL on failure.
See also
elm_calendar_mark_add()
elm_calendar_mark_del()
elm_calendar_marks_clear()
void elm_calendar::min_max_year_get ( int *  min_,
int *  max_ 
) const
inline

Get the minimum and maximum values for the year.

Default values are 1902 and -1.

See also
elm_calendar_min_max_year_set() for more details.

Calendar - Signal callback and getters.

Parameters
minThe minimum year, greater than 1901;
maxThe maximum year;
void elm_calendar::min_max_year_set ( int  min_,
int  max_ 
) const
inline

Get the minimum and maximum values for the year.

Default values are 1902 and -1.

See also
elm_calendar_min_max_year_set() for more details.

Calendar - Signal callback and getters.

Parameters
minThe minimum year, greater than 1901;
maxThe maximum year;
Elm_Calendar_Select_Mode elm_calendar::select_mode_get ( ) const
inline

Get the select day mode used.

Returns
the selected mode

Get the day selection mode used.

See also
elm_calendar_select_mode_set() for more details
Parameters
modeThe select mode to use.
void elm_calendar::select_mode_set ( Elm_Calendar_Select_Mode  mode_) const
inline

Get the select day mode used.

Returns
the selected mode

Get the day selection mode used.

See also
elm_calendar_select_mode_set() for more details
Parameters
modeThe select mode to use.
Elm_Calendar_Selectable elm_calendar::selectable_get ( ) const
inline

Get how elm_calendar_selected_time_set manage a date.

Returns
The flag used to manage a date with a elm_calendar_selected_time_set
See also
elm_calendar_selectable_set
elm_calendar_selected_time_set
Since
1.8
Parameters
selectableA bitmask of Elm_Calendar_Selectable
void elm_calendar::selectable_set ( Elm_Calendar_Selectable  selectable_) const
inline

Get how elm_calendar_selected_time_set manage a date.

Returns
The flag used to manage a date with a elm_calendar_selected_time_set
See also
elm_calendar_selectable_set
elm_calendar_selected_time_set
Since
1.8
Parameters
selectableA bitmask of Elm_Calendar_Selectable
bool elm_calendar::selected_time_get ( struct tm *  selected_time_) const
inline

Get selected date.

Returns
EINA_FALSE means an error occurred and returned time shouldn't be considered.

Get date selected by the user or set by function elm_calendar_selected_time_set(). Selected date changes when the user goes to next/previous month or select a day pressing over it on calendar.

See also
elm_calendar_selected_time_get()

Calendar - Signal callback and getters.

Parameters
[in,out]selected_timeA tm struct to point to selected date
void elm_calendar::selected_time_set ( struct tm *  selected_time_) const
inline

Set selected date to be highlighted on calendar.

Set the selected date, changing the displayed month if needed. Selected date changes when the user goes to next/previous month or select a day pressing over it on calendar.

See also
elm_calendar_selected_time_get()

Calendar - Days selection.

Parameters
selected_timeA tm struct to represent the selected date.
const char** elm_calendar::weekdays_names_get ( ) const
inline

Get weekdays names displayed by the calendar.

Returns
Array of seven strings to be used as weekday names.

By default, weekdays abbreviations get from system are displayed: E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat" The first string is related to Sunday, the second to Monday...

See also
elm_calendar_weekdays_name_set()

Calendar - Signal callback and getters.

Parameters
weekdaysArray of seven strings to be used as weekday names.
Warning
It must have 7 elements, or it will access invalid memory.
The strings must be NULL terminated ('\0').
void elm_calendar::weekdays_names_set ( const char **  weekdays_) const
inline

Get weekdays names displayed by the calendar.

Returns
Array of seven strings to be used as weekday names.

By default, weekdays abbreviations get from system are displayed: E.g. for an en_US locale: "Sun, Mon, Tue, Wed, Thu, Fri, Sat" The first string is related to Sunday, the second to Monday...

See also
elm_calendar_weekdays_name_set()

Calendar - Signal callback and getters.

Parameters
weekdaysArray of seven strings to be used as weekday names.
Warning
It must have 7 elements, or it will access invalid memory.
The strings must be NULL terminated ('\0').