2011-07-14 08:45:44 -07:00
|
|
|
/**
|
|
|
|
* Elementary's <b>calendar widget</b> example, illustrating smart callback
|
|
|
|
* registry and getters usage.
|
|
|
|
*
|
|
|
|
* See stdout/stderr for output. Compile with:
|
|
|
|
*
|
|
|
|
* @verbatim
|
2012-03-19 05:58:07 -07:00
|
|
|
* gcc -o calendar_example_05 calendar_example_05.c -g `pkg-config --cflags --libs elementary`
|
2011-07-14 08:45:44 -07:00
|
|
|
* @endverbatim
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <Elementary.h>
|
|
|
|
|
|
|
|
static void
|
2012-03-28 01:42:20 -07:00
|
|
|
_print_cal_info_cb(void *data, Evas_Object *obj, void *event_info)
|
2011-07-14 08:45:44 -07:00
|
|
|
{
|
|
|
|
int year_min, year_max;
|
|
|
|
Eina_Bool sel_enabled;
|
|
|
|
const char **wds;
|
2012-03-26 16:46:53 -07:00
|
|
|
struct tm sel_time;
|
2011-07-14 08:45:44 -07:00
|
|
|
double interval;
|
|
|
|
|
2012-03-26 16:46:53 -07:00
|
|
|
if (!elm_calendar_selected_time_get(obj, &sel_time))
|
2011-07-14 08:45:44 -07:00
|
|
|
return;
|
|
|
|
|
|
|
|
interval = elm_calendar_interval_get(obj);
|
|
|
|
elm_calendar_min_max_year_get(obj, &year_min, &year_max);
|
2012-06-27 11:09:12 -07:00
|
|
|
sel_enabled = (elm_calendar_select_mode_get(obj) != ELM_CALENDAR_SELECT_MODE_NONE);
|
2011-07-14 08:45:44 -07:00
|
|
|
wds = elm_calendar_weekdays_names_get(obj);
|
|
|
|
|
|
|
|
printf("Day: %i, Mon: %i, Year %i, WeekDay: %i<br>\n"
|
|
|
|
"Interval: %0.2f, Year_Min: %i, Year_Max %i, Sel Enabled : %i<br>\n"
|
|
|
|
"Weekdays: %s, %s, %s, %s, %s, %s, %s<br>\n\n",
|
2012-03-26 16:46:53 -07:00
|
|
|
sel_time.tm_mday, sel_time.tm_mon, sel_time.tm_year + 1900, sel_time.tm_wday,
|
2011-07-14 08:45:44 -07:00
|
|
|
interval, year_min, year_max, sel_enabled,
|
|
|
|
wds[0], wds[1], wds[2], wds[3], wds[4], wds[5], wds[6]);
|
|
|
|
}
|
|
|
|
|
2011-08-28 21:16:18 -07:00
|
|
|
EAPI_MAIN int
|
2012-03-28 01:42:20 -07:00
|
|
|
elm_main(int argc, char **argv)
|
2011-07-14 08:45:44 -07:00
|
|
|
{
|
2013-06-25 20:06:34 -07:00
|
|
|
Evas_Object *win, *cal;
|
2011-07-14 08:45:44 -07:00
|
|
|
|
2013-06-25 20:06:34 -07:00
|
|
|
win = elm_win_util_standard_add("calendar", "Calendar Getters Example");
|
2011-07-14 08:45:44 -07:00
|
|
|
elm_win_autodel_set(win, EINA_TRUE);
|
2012-03-19 05:58:07 -07:00
|
|
|
elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
|
2011-07-14 08:45:44 -07:00
|
|
|
|
|
|
|
cal = elm_calendar_add(win);
|
|
|
|
evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
2013-06-26 16:26:42 -07:00
|
|
|
elm_win_resize_object_add(win, cal);
|
2011-07-14 08:45:44 -07:00
|
|
|
/* Add callback to display calendar information every time user
|
|
|
|
* selects a new date */
|
|
|
|
evas_object_smart_callback_add(cal, "changed", _print_cal_info_cb, NULL);
|
|
|
|
evas_object_show(cal);
|
|
|
|
|
|
|
|
evas_object_show(win);
|
|
|
|
|
|
|
|
elm_run();
|
2012-03-27 23:04:36 -07:00
|
|
|
|
2011-07-14 08:45:44 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
ELM_MAIN()
|