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 -g `pkg-config --cflags --libs elementary` calendar_example_04.c -o calendar_example_04
13 #include <Elementary.h>
15 # include "elementary_config.h"
20 #define SECS_DAY 86400
23 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
25 Evas_Object *win, *bg, *bx, *cal, *cal2;
26 struct tm selected_time;
29 win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC);
30 elm_win_title_set(win, "Calendar Day Selection Example");
31 elm_win_autodel_set(win, EINA_TRUE);
34 elm_win_resize_object_add(win, bg);
35 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
38 bx = elm_box_add(win);
39 elm_win_resize_object_add(win, bx);
40 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
43 cal = elm_calendar_add(win);
44 evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
45 evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL);
46 elm_calendar_day_selection_enabled_set(cal, EINA_FALSE);
47 evas_object_show(cal);
48 elm_box_pack_end(bx, cal);
50 cal2 = elm_calendar_add(win);
51 evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
52 evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL);
53 current_time = time(NULL) + 2 * SECS_DAY;
54 localtime_r(¤t_time, &selected_time);
55 elm_calendar_selected_time_set(cal2, &selected_time);
56 evas_object_show(cal2);
57 elm_box_pack_end(bx, cal2);
59 evas_object_show(win);