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, *bg, *bx, *cal, *cal2;
21 struct tm selected_time;
24 win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC);
25 elm_win_title_set(win, "Calendar Day Selection Example");
26 elm_win_autodel_set(win, EINA_TRUE);
27 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
30 elm_win_resize_object_add(win, bg);
31 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
34 bx = elm_box_add(win);
35 elm_win_resize_object_add(win, bx);
36 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
39 cal = elm_calendar_add(win);
40 evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
41 evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL);
42 elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE);
43 evas_object_show(cal);
44 elm_box_pack_end(bx, cal);
46 cal2 = elm_calendar_add(win);
47 evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
48 evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL);
49 current_time = time(NULL) + 2 * SECS_DAY;
50 localtime_r(¤t_time, &selected_time);
51 elm_calendar_selected_time_set(cal2, &selected_time);
52 evas_object_show(cal2);
53 elm_box_pack_end(bx, cal2);
55 evas_object_show(win);