spinbox: add inc/dec event callbacks to be used with +/- buttons created for the spinbox

This commit is contained in:
Gabor Kiss-Vamosi
2020-02-19 12:47:28 +01:00
parent 2091ee3261
commit 94af20a451
2 changed files with 36 additions and 0 deletions

View File

@@ -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
**********************/

View File

@@ -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
**********************/