mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
btn: fix lv_btn_set_state to remove DIABLED state if other state is set
This commit is contained in:
parent
cec2660724
commit
5c6a7fa6d3
@ -134,20 +134,21 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
|
||||
|
||||
switch(state) {
|
||||
case LV_BTN_STATE_RELEASED:
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED);
|
||||
break;
|
||||
case LV_BTN_STATE_PRESSED:
|
||||
lv_obj_clear_state(btn, LV_STATE_CHECKED);
|
||||
lv_obj_clear_state(btn, LV_STATE_CHECKED | LV_STATE_DISABLED);
|
||||
lv_obj_add_state(btn, LV_STATE_PRESSED);
|
||||
break;
|
||||
case LV_BTN_STATE_CHECKED_RELEASED:
|
||||
lv_obj_add_state(btn, LV_STATE_CHECKED);
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED);
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_DISABLED);
|
||||
break;
|
||||
case LV_BTN_STATE_CHECKED_PRESSED:
|
||||
lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
|
||||
lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED);
|
||||
break;
|
||||
case LV_BTN_STATE_DISABLED:
|
||||
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
|
||||
lv_obj_add_state(btn, LV_STATE_DISABLED);
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user