From f1a198bd93cbe3e4eef4e959bb37474212c7807e Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 7 Oct 2020 12:44:54 +0200 Subject: [PATCH] fix imgbtn state change --- CHANGELOG.md | 1 + src/lv_widgets/lv_imgbtn.c | 20 ++++++++++++++++++++ src/lv_widgets/lv_imgbtn.h | 31 +++++++++++++------------------ 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 337a81601..cfc5c48a1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ ### Bugfixes - Theme update to support text selection background +- Fix imgbtn state change ## v7.6.1 (06.10.2020) diff --git a/src/lv_widgets/lv_imgbtn.c b/src/lv_widgets/lv_imgbtn.c index 13c3e1621..072e574dd 100644 --- a/src/lv_widgets/lv_imgbtn.c +++ b/src/lv_widgets/lv_imgbtn.c @@ -170,6 +170,26 @@ void lv_imgbtn_set_src_tiled(lv_obj_t * imgbtn, lv_btn_state_t state, const void #endif +/** + * Set the state of the image button + * @param imgbtn pointer to an image button object + * @param state the new state of the button (from lv_btn_state_t enum) + */ +void lv_imgbtn_set_state(lv_obj_t * imgbtn, lv_btn_state_t state) +{ + lv_btn_set_state(imgbtn, state); + refr_img(imgbtn); +} + +/** + * Toggle the state of the image button (ON->OFF, OFF->ON) + * @param imgbtn pointer to a image button object + */ +void lv_imgbtn_toggle(lv_obj_t * imgbtn) +{ + lv_imgbtn_toggle(imgbtn); + refr_img(imgbtn); +} /*===================== * Getter functions *====================*/ diff --git a/src/lv_widgets/lv_imgbtn.h b/src/lv_widgets/lv_imgbtn.h index 5f7d35a62..d205800e2 100644 --- a/src/lv_widgets/lv_imgbtn.h +++ b/src/lv_widgets/lv_imgbtn.h @@ -98,6 +98,19 @@ void lv_imgbtn_set_src_tiled(lv_obj_t * imgbtn, lv_btn_state_t state, const void #endif +/** + * Set the state of the image button + * @param imgbtn pointer to an image button object + * @param state the new state of the button (from lv_btn_state_t enum) + */ +void lv_imgbtn_set_state(lv_obj_t * imgbtn, lv_btn_state_t state); + +/** + * Toggle the state of the image button (ON->OFF, OFF->ON) + * @param imgbtn pointer to a image button object + */ +void lv_imgbtn_toggle(lv_obj_t * imgbtn); + /** * Enable the toggled states. On release the button will change from/to toggled state. * @param imgbtn pointer to an image button object @@ -108,24 +121,6 @@ static inline void lv_imgbtn_set_checkable(lv_obj_t * imgbtn, bool tgl) lv_btn_set_checkable(imgbtn, tgl); } -/** - * Set the state of the image button - * @param imgbtn pointer to an image button object - * @param state the new state of the button (from lv_btn_state_t enum) - */ -static inline void lv_imgbtn_set_state(lv_obj_t * imgbtn, lv_btn_state_t state) -{ - lv_btn_set_state(imgbtn, state); -} - -/** - * Toggle the state of the image button (ON->OFF, OFF->ON) - * @param imgbtn pointer to a image button object - */ -static inline void lv_imgbtn_toggle(lv_obj_t * imgbtn) -{ - lv_btn_toggle(imgbtn); -} /*===================== * Getter functions