lv_sw.c: lv_sw_toggle_anim initial commit
This commit is contained in:
committed by
Gabor Kiss-Vamosi
parent
514511c15a
commit
9cecebfe0a
@@ -189,6 +189,22 @@ void lv_sw_off_anim(lv_obj_t * sw)
|
||||
lv_slider_set_style(sw, LV_SLIDER_STYLE_KNOB, ext->style_knob_off);
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle the position of the switch with an animation
|
||||
* @param sw pointer to a switch object
|
||||
* @return resulting state of the switch.
|
||||
*/
|
||||
bool lv_sw_toggle_anim(lv_obj_t *sw) {
|
||||
bool state = lv_sw_get_state(sw);
|
||||
if(state) {
|
||||
lv_sw_off_anim(sw);
|
||||
}
|
||||
else {
|
||||
lv_sw_on_anim(sw);
|
||||
}
|
||||
return !state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a style of a switch
|
||||
* @param sw pointer to a switch object
|
||||
|
||||
@@ -107,6 +107,13 @@ void lv_sw_on_anim(lv_obj_t * sw);
|
||||
*/
|
||||
void lv_sw_off_anim(lv_obj_t * sw);
|
||||
|
||||
/**
|
||||
* Toggle the position of the switch with an animation
|
||||
* @param sw pointer to a switch object
|
||||
* @return resulting state of the switch.
|
||||
*/
|
||||
bool lv_sw_toggle_anim(lv_obj_t *sw);
|
||||
|
||||
/**
|
||||
* Set a function which will be called when the switch is toggled by the user
|
||||
* @param sw pointer to switch object
|
||||
|
||||
Reference in New Issue
Block a user