EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *cal; const char *weekdays[] = { "S", "M", "T", "W", "T", "F", "S" }; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_util_standard_add("calendar", "Calendar Layout Formatting Example"); elm_win_autodel_set(win, EINA_TRUE); cal = elm_calendar_add(win); evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, cal); elm_calendar_format_function_set(cal, _format_month_year); elm_calendar_weekdays_names_set(cal, weekdays); evas_object_show(cal); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *cal; win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); elm_win_title_set(win, "Calendar Creation Example"); elm_win_autodel_set(win, EINA_TRUE); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); cal = elm_calendar_add(win); elm_win_resize_object_add(win, cal); evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(cal); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bg, *bx, *cal, *cal2; struct tm selected_time; time_t current_time; win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); elm_win_title_set(win, "Calendar Day Selection Example"); elm_win_autodel_set(win, EINA_TRUE); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); bx = elm_box_add(win); elm_win_resize_object_add(win, bx); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bx); cal = elm_calendar_add(win); evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_calendar_select_mode_set(cal, ELM_CALENDAR_SELECT_MODE_NONE); evas_object_show(cal); elm_box_pack_end(bx, cal); cal2 = elm_calendar_add(win); evas_object_size_hint_weight_set(cal2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(cal2, EVAS_HINT_FILL, EVAS_HINT_FILL); current_time = time(NULL) + 2 * SECS_DAY; localtime_r(¤t_time, &selected_time); elm_calendar_selected_time_set(cal2, &selected_time); evas_object_show(cal2); elm_box_pack_end(bx, cal2); evas_object_show(win); elm_run(); elm_shutdown(); return 0; }
static void startup(void) { tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); elm_init(0, NULL); main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); evas_object_show(main_win); test_eo = elm_calendar_add(main_win); elm_calendar_min_max_year_set(test_eo, 2010, 2020); }
/** * @brief Negative test case of ug_init elm_calendar_selected_time_set() */ static void utc_UIFW_elm_calendar_selected_time_set_func_02(void) { Evas_Object *test_eo = NULL; struct tm selected_time; time_t current_time; test_eo = elm_calendar_add(main_win); current_time = time(NULL) + 34 * 84600; localtime_r(¤t_time, &selected_time); elm_calendar_selected_time_set(NULL, &selected_time); tet_infoline("elm_calendar_selected_time_set() passed in negative test case"); evas_object_del(test_eo); test_eo = NULL; tet_result(TET_PASS); }
static void startup(void) { tet_infoline("[[ TET_MSG ]]:: ============ Startup ============ "); Elm_Calendar_Mark *mark; struct tm selected_time; time_t current_time; elm_init(0, NULL); main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC); evas_object_show(main_win); test_eo = elm_calendar_add(main_win); current_time = time(NULL) + 1 * 84600; localtime_r(¤t_time, &selected_time); mark = elm_calendar_mark_add(test_eo, "checked", &selected_time, ELM_CALENDAR_UNIQUE); }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *cal; elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); win = elm_win_util_standard_add("calendar", "Calendar Min/Max Year Example"); elm_win_autodel_set(win, EINA_TRUE); cal = elm_calendar_add(win); evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, cal); elm_calendar_min_max_year_set(cal, 2020, 2022); evas_object_show(cal); evas_object_show(win); elm_run(); return 0; }
EAPI_MAIN int elm_main(int argc, char **argv) { Evas_Object *win, *bt, *bx, *cal; Elm_Calendar_Mark *mark; struct tm selected_time; time_t current_time; struct tm sunday = { 0, 0, 12, 7, 0, 0, 0, 0, -1, 0, NULL }; /* tm {sec, min, hour, mday, mon, year, wday, yday, isdst } */ /* weekdays since Sunday, range 0 to 6 */ struct tm christmas; christmas.tm_mday = 25; /* months since Jan, in the range 0 to 11 */ christmas.tm_mon = 11; win = elm_win_util_standard_add("calendar", "Calendar Marks Example"); elm_win_autodel_set(win, EINA_TRUE); elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); bx = elm_box_add(win); evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_win_resize_object_add(win, bx); evas_object_show(bx); cal = elm_calendar_add(win); evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(cal, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_box_pack_end(bx, cal); evas_object_show(cal); /* check today - we'll remove it later */ current_time = time(NULL); localtime_r(¤t_time, &selected_time); mark = elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_UNIQUE); /* check tomorrow */ current_time = time(NULL) + 1 * SECS_DAY; localtime_r(¤t_time, &selected_time); elm_calendar_mark_add(cal, "checked", &selected_time, ELM_CALENDAR_UNIQUE); /* mark christmas as holiday */ elm_calendar_mark_add(cal, "holiday", &christmas, ELM_CALENDAR_ANNUALLY); /* mark Sundays as holidays */ elm_calendar_mark_add(cal, "holiday", &sunday, ELM_CALENDAR_WEEKLY); /* ok, let's remove today's check */ elm_calendar_mark_del(mark); elm_calendar_marks_draw(cal); bt = elm_button_add(win); evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, EVAS_HINT_FILL); elm_object_text_set(bt, "Clear marks"); evas_object_smart_callback_add(bt, "clicked", _btn_clear_cb, cal); elm_box_pack_end(bx, bt); evas_object_show(bt); evas_object_show(win); elm_run(); return 0; }
void ActivityScenariosView::buttonPressed(void *data, Evas_Object *_edje, std::string emission, std::string source) { if (source == "button.calendar") { Evas_Object *table = createPaddingTable(evas, parent, 330, 300, 10, 10); calendar = elm_calendar_add(parent); elm_object_style_set(calendar, "calaos"); elm_calendar_first_day_of_week_set(calendar, ELM_DAY_MONDAY); const char *weekdays[] = { "DIM", "LUN", "MAR", "MER", "JEU", "VEN", "SAM" }; elm_calendar_weekdays_names_set(calendar, weekdays); evas_object_smart_callback_add(calendar, "changed", _calendar_cb, this); //Mark sundays struct tm sunday = { 0, 0, 12, 7, 0, 0, 6, 0, -1, 0, NULL }; elm_calendar_mark_add(calendar, "checked", &sunday, ELM_CALENDAR_WEEKLY); elm_calendar_marks_draw(calendar); evas_object_size_hint_fill_set(calendar, EVAS_HINT_FILL, EVAS_HINT_FILL); evas_object_size_hint_weight_set(calendar, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(calendar); elm_table_pack(table, calendar, 1, 1, 1, 1); Evas_Object *popup = elm_ctxpopup_add(parent); elm_object_content_set(popup, table); elm_object_style_set(popup, "calaos"); elm_ctxpopup_direction_priority_set(popup, ELM_CTXPOPUP_DIRECTION_DOWN, ELM_CTXPOPUP_DIRECTION_LEFT, ELM_CTXPOPUP_DIRECTION_RIGHT, ELM_CTXPOPUP_DIRECTION_UP); Evas_Coord x,y; evas_pointer_canvas_xy_get(evas, &x, &y); evas_object_move(popup, x, y); evas_object_show(popup); } else if (source == "button.calendar.today") { tzset(); //Force reload of timezone data time_t t = time(0); currDate = *localtime(&t); reloadCalendar(); } else if (source == "button.create") { buttonCreatePressed.emit(); } else if (source == "button.list.all") { view_mode = VIEW_MODE_ALL; loadScenarioList(); } else if (source == "button.list.light") { view_mode = VIEW_MODE_LIGHT; loadScenarioList(); } else if (source == "button.list.shutters") { view_mode = VIEW_MODE_SHUTTER; loadScenarioList(); } else if (source == "button.list.schedule") { view_mode = VIEW_MODE_SCHEDULE; loadScenarioList(); } }
# include "elementary_config.h" #else # define __UNUSED__ #endif EAPI_MAIN int elm_main(int argc __UNUSED__, char **argv __UNUSED__) { Evas_Object *win, *bg, *cal; win = elm_win_add(NULL, "calendar", ELM_WIN_BASIC); elm_win_title_set(win, "Calendar Creation Example"); elm_win_autodel_set(win, EINA_TRUE); bg = elm_bg_add(win); elm_win_resize_object_add(win, bg); evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(bg); cal = elm_calendar_add(win); elm_win_resize_object_add(win, cal); evas_object_size_hint_weight_set(cal, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); evas_object_show(cal); evas_object_show(win); elm_run(); return 0; } ELM_MAIN()