diff --git a/lv_objx/lv_calendar.c b/lv_objx/lv_calendar.c index 327ac75150..9dd042234c 100644 --- a/lv_objx/lv_calendar.c +++ b/lv_objx/lv_calendar.c @@ -99,8 +99,8 @@ lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy) ext->showed_date.day = 1; ext->pressed_date.year = 0; - ext->pressed_date.month = 0 - ext->pressed_date.day = 0 + ext->pressed_date.month = 0; + ext->pressed_date.day = 0; ext->highlighted_dates = NULL; ext->highlighted_dates_num = 0; diff --git a/lv_objx/lv_calendar.h b/lv_objx/lv_calendar.h index 2b1d4984c7..3eecccdcf9 100644 --- a/lv_objx/lv_calendar.h +++ b/lv_objx/lv_calendar.h @@ -108,6 +108,13 @@ lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy); * Setter functions *====================*/ +/** + * Set a function to call when a calendar event happens + * @param calendar pointer to a calendar object + * @param action type of event form 'lv_action_t' (press, release, long press, long press repeat) + */ +void lv_calendar_set_action(lv_obj_t * calendar, lv_calendar_action_t type, lv_action_t action); + /** * Set the today's date * @param calendar pointer to a calendar object @@ -130,7 +137,6 @@ void lv_calendar_set_showed_date(lv_obj_t * calendar, lv_calendar_date_t * showe */ void lv_calendar_set_highlighted_dates(lv_obj_t * calendar, lv_calendar_date_t * highlighted, uint16_t date_num); - /** * Set the name of the days * @param calendar pointer to a calendar object @@ -159,6 +165,13 @@ void lv_calendar_set_style(lv_obj_t * calendar, lv_calendar_style_t type, lv_sty * Getter functions *====================*/ +/** + * Get the action of a calendar + * @param calendar pointer to a calendar object + * @return pointer to the action function + */ +lv_action_t lv_calendar_get_action(const lv_obj_t * calendar, lv_calendar_action_t type); + /** * Get the today's date * @param calendar pointer to a calendar object