2 * Elementary's <b>calendar widget</b> example, illustrating smart callback
3 * registry and getters usage.
5 * See stdout/stderr for output. Compile with:
8 * gcc -g `pkg-config --cflags --libs elementary` calendar_example_05.c -o calendar_example_05
12 #include <Elementary.h>
14 # include "elementary_config.h"
20 _print_cal_info_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
22 int year_min, year_max;
23 Eina_Bool sel_enabled;
28 if (!elm_calendar_selected_time_get(obj, &stime))
31 interval = elm_calendar_interval_get(obj);
32 elm_calendar_min_max_year_get(obj, &year_min, &year_max);
33 sel_enabled = !elm_calendar_day_selection_disabled_get(obj);
34 wds = elm_calendar_weekdays_names_get(obj);
36 printf("Day: %i, Mon: %i, Year %i, WeekDay: %i<br>\n"
37 "Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i<br>\n"
38 "Weekdays: %s, %s, %s, %s, %s, %s, %s<br>\n\n",
39 stime.tm_mday, stime.tm_mon, stime.tm_year + 1900, stime.tm_wday,
40 interval, year_min, year_max, sel_enabled,
41 wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]);
45 elm_main(int argc __UNUSED__, char **argv __UNUSED__)
47 Evas_Object *win, *bg, *cal;
49 win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC);
50 elm_win_title_set(win, "Calendar Getters Example");
51 elm_win_autodel_set(win, EINA_TRUE);
54 elm_win_resize_object_add(win, bg);
55 evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
58 cal = elm_calendar_add(win);
59 elm_win_resize_object_add(win, cal);
60 evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
61 /* Add callback to display calendar information every time user
62 * selects a new date */
63 evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, NULL);
64 evas_object_show(cal);
66 evas_object_show(win);