Calendar
This feature is supported in mobile applications only.
The calendar component displays and manipulates month views.
For more information, see the Calendar API.
Figure: Calendar component
Figure: Calendar hierarchy
Adding a Calendar Component
Create the calendar component with the elm_calendar_add() function. The following example shows how to create a calendar component and set the current time to display the current month.
Evas_Object *calendar, *parent; time_t the_time; time(&the_time); // Get the current time calendar = elm_calendar_add(parent); elm_calendar_selected_time_set(calendar, gmtime(&the_time));
Manipulating the Month View
To modify the month view:
-
Change the first day of the week. By default, the first day of the week is Sunday. To change it to Monday:
elm_calendar_first_day_of_week_set(calendar, ELM_DAY_MONDAY);
-
Modify the names of the weekdays using the elm_calendar_weekdays_names_set() function:
const char *weekname[7] = {"A", "B", "C", "D", "E", "F", "G"}; elm_calendar_weekdays_names_set(calendar, &weekname);
- Mark holidays with the elm_calendar_mark_add() function. The following example shows how to mark a Sunday as holiday.
struct tm *sunday = gmtime(&the_time); sunday->tm_mday -= sunday->tm_wday; sunday->tm_wday = 0; elm_calendar_mark_add(calendar, "holiday", sunday, ELM_CALENDAR_WEEKLY);
Using the Calendar Callbacks
The calendar component emits the "changed" signal when the selected date is changed. You can register a callback to this signal. The event_info parameter is NULL.
{ evas_object_smart_callback_add(calendar, "changed", changed_cb, data); } // Callback function for the "changed" signal // This callback is called when the selected date is changed void changed_cb(void *data, Evas_Object *obj, void *event_info) { dlog_print(DLOG_INFO, LOG_TAG, "Calendar is changed. \n"); }
Note |
---|
Except as noted, this content is licensed under LGPLv2.1+. |