2 * Elementary's <b>calendar widget</b> example, regarding date selection.
3 * Shows how to disable day selection by user and how to select a date.
4 * It selects two days from current day.
6 * See stdout/stderr for output. Compile with:
9 * gcc -o calendar_example_04 calendar_example_04.c -g `pkg-config --cflags --libs elementary`
13 #include <Elementary.h>
15 #define SECS_DAY 86400
18 elm_main(int argc, char **argv)
20 Evas_Object *win, *bx, *cal, *cal2;
21 struct tm selected_time;
24 win = elm_win_util_standard_add("calendar", "Calendar Day Selection Example");
25 elm_win_autodel_set(win, EINA_TRUE);
26 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
28 bx = elm_box_add(win);
29 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
30 elm_win_resize_object_add(win, bx);
33 cal = elm_calendar_add(win);
34 evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
35 evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL);
36 elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);
37 evas_object_show(cal);
38 elm_box_pack_end(bx, cal);
40 cal2 = elm_calendar_add(win);
41 evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
42 evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL);
43 current_time = time(NULL) + 2 * SECS_DAY;
44 localtime_r(¤t_time, &selected_time);
45 elm_calendar_selected_time_set(cal2, &selected_time);
46 evas_object_show(cal2);
47 elm_box_pack_end(bx, cal2);
49 evas_object_show(win);