diff --git a/src/lv_widgets/lv_spinbox.c b/src/lv_widgets/lv_spinbox.c index a9a14de01..3e2d90578 100644 --- a/src/lv_widgets/lv_spinbox.c +++ b/src/lv_widgets/lv_spinbox.c @@ -314,6 +314,30 @@ void lv_spinbox_decrement(lv_obj_t * spinbox) lv_spinbox_updatevalue(spinbox); } +/** + * An event callback which can ne simply used for a "+" button + * @param spinbox pointer to spinbox + * @param e the event (`LV_EVENT_...`) + */ +void lv_spinbox_increment_event_cb(lv_obj_t * spinbox, lv_event_t e) +{ + if(e == LV_EVENT_SHORT_CLICKED || e == LV_EVENT_LONG_PRESSED_REPEAT) { + lv_spinbox_increment(spinbox); + } +} + +/** + * An event callback which can be simply used for a "-" button + * @param spinbox pointer to spinbox + * @param e the event (`LV_EVENT_...`) + */ +void lv_spinbox_decrement_event_cb(lv_obj_t * spinbox, lv_event_t e) +{ + if(e == LV_EVENT_SHORT_CLICKED || e == LV_EVENT_LONG_PRESSED_REPEAT) { + lv_spinbox_decrement(spinbox); + } +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/lv_widgets/lv_spinbox.h b/src/lv_widgets/lv_spinbox.h index 5edfa64c4..9f1547784 100644 --- a/src/lv_widgets/lv_spinbox.h +++ b/src/lv_widgets/lv_spinbox.h @@ -150,7 +150,19 @@ void lv_spinbox_increment(lv_obj_t * spinbox); * @param spinbox pointer to spinbox */ void lv_spinbox_decrement(lv_obj_t * spinbox); +/** + * An event callback which can ne simply used for a "+" button + * @param spinbox pointer to spinbox + * @param e the event (`LV_EVENT_...`) + */ +void lv_spinbox_increment_event_cb(lv_obj_t * spinbox, lv_event_t e); +/** + * An event callback which can be simply used for a "-" button + * @param spinbox pointer to spinbox + * @param e the event (`LV_EVENT_...`) + */ +void lv_spinbox_decrement_event_cb(lv_obj_t * spinbox, lv_event_t e); /********************** * MACROS **********************/