mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
add LV_ANIM_ON/OFF
This commit is contained in:
parent
56b9893854
commit
a2c9c72186
@ -562,6 +562,12 @@ static void style_mod_def(lv_group_t * group, lv_style_t * style)
|
||||
style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_ORANGE, LV_OPA_60);
|
||||
|
||||
style->text.color = lv_color_mix(style->text.color, LV_COLOR_ORANGE, LV_OPA_70);
|
||||
|
||||
/*Add some recolor to the images*/
|
||||
if(style->image.intense < LV_OPA_MIN) {
|
||||
style->image.color = LV_COLOR_ORANGE;
|
||||
style->image.intense = LV_OPA_40;
|
||||
}
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
@ -592,6 +598,13 @@ static void style_mod_edit_def(lv_group_t * group, lv_style_t * style)
|
||||
style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_GREEN, LV_OPA_60);
|
||||
|
||||
style->text.color = lv_color_mix(style->text.color, LV_COLOR_GREEN, LV_OPA_70);
|
||||
|
||||
/*Add some recolor to the images*/
|
||||
if(style->image.intense < LV_OPA_MIN) {
|
||||
style->image.color = LV_COLOR_GREEN;
|
||||
style->image.intense = LV_OPA_40;
|
||||
}
|
||||
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
|
@ -1806,7 +1806,7 @@ const lv_style_t * lv_obj_get_style(const lv_obj_t * obj)
|
||||
#if LV_USE_GROUP == 0
|
||||
style_act = par->style_p;
|
||||
#else
|
||||
/*Is a parent is focused then use then focused style*/
|
||||
/*If a parent is focused then use then focused style*/
|
||||
lv_group_t * g = lv_obj_get_group(par);
|
||||
if(lv_group_get_focused(g) == par) {
|
||||
style_act = lv_group_mod_style(g, par->style_p);
|
||||
|
@ -245,6 +245,7 @@ typedef struct
|
||||
... [x]: "lv_obj" */
|
||||
} lv_obj_type_t;
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
@ -78,6 +78,14 @@ typedef struct _lv_anim_t
|
||||
uint32_t has_run : 1; /*Indicates the animation has run in this round*/
|
||||
} lv_anim_t;
|
||||
|
||||
/*Can be used to indicate if animations are enabled or disabled in a case*/
|
||||
enum {
|
||||
LV_ANIM_OFF,
|
||||
LV_ANIM_ON,
|
||||
};
|
||||
|
||||
typedef uint8_t lv_anim_enable_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
@ -126,9 +126,9 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
* Set a new value on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new value
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediatelly
|
||||
*/
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value, bool anim)
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim = false;
|
||||
@ -142,7 +142,7 @@ void lv_bar_set_value(lv_obj_t * bar, int16_t value, bool anim)
|
||||
|
||||
if(ext->cur_value == new_value) return;
|
||||
|
||||
if(anim == false) {
|
||||
if(anim == LV_ANIM_OFF) {
|
||||
ext->cur_value = new_value;
|
||||
lv_obj_invalidate(bar);
|
||||
} else {
|
||||
|
@ -83,9 +83,9 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
* Set a new value on the bar
|
||||
* @param bar pointer to a bar object
|
||||
* @param value new value
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value, bool anim);
|
||||
void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Set minimum and the maximum values of a bar
|
||||
|
@ -354,14 +354,27 @@ const lv_style_t * lv_btn_get_style(const lv_obj_t * btn, lv_btn_style_t type)
|
||||
{
|
||||
const lv_style_t * style = NULL;
|
||||
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
|
||||
lv_btn_state_t state = lv_btn_get_state(btn);
|
||||
|
||||
switch(type) {
|
||||
case LV_BTN_STYLE_REL: style = ext->styles[LV_BTN_STATE_REL]; break;
|
||||
case LV_BTN_STYLE_PR: style = ext->styles[LV_BTN_STATE_PR]; break;
|
||||
case LV_BTN_STYLE_TGL_REL: style = ext->styles[LV_BTN_STATE_TGL_REL]; break;
|
||||
case LV_BTN_STYLE_TGL_PR: style = ext->styles[LV_BTN_STATE_TGL_PR]; break;
|
||||
case LV_BTN_STYLE_INA: style = ext->styles[LV_BTN_STATE_INA]; break;
|
||||
default: style = NULL; break;
|
||||
/* If the style of the current state is asked then return object style.
|
||||
* If the button is focused then this style is updated by the group's
|
||||
* `style_mod_cb` function */
|
||||
if((type == LV_BTN_STYLE_REL && state == LV_BTN_STATE_REL) ||
|
||||
(type == LV_BTN_STYLE_PR && state == LV_BTN_STATE_PR) ||
|
||||
(type == LV_BTN_STYLE_TGL_REL && state == LV_BTN_STATE_TGL_REL) ||
|
||||
(type == LV_BTN_STYLE_TGL_PR && state == LV_BTN_STATE_TGL_PR) ||
|
||||
(type == LV_BTN_STYLE_INA && state == LV_BTN_STATE_INA)) {
|
||||
|
||||
style = lv_obj_get_style(btn);
|
||||
} else {
|
||||
switch(type) {
|
||||
case LV_BTN_STYLE_REL: style = ext->styles[LV_BTN_STATE_REL]; break;
|
||||
case LV_BTN_STYLE_PR: style = ext->styles[LV_BTN_STATE_PR]; break;
|
||||
case LV_BTN_STYLE_TGL_REL: style = ext->styles[LV_BTN_STATE_TGL_REL]; break;
|
||||
case LV_BTN_STYLE_TGL_PR: style = ext->styles[LV_BTN_STATE_TGL_PR]; break;
|
||||
case LV_BTN_STYLE_INA: style = ext->styles[LV_BTN_STATE_INA]; break;
|
||||
default: style = NULL; break;
|
||||
}
|
||||
}
|
||||
|
||||
return style;
|
||||
|
@ -41,7 +41,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig
|
||||
static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
|
||||
static lv_res_t release_handler(lv_obj_t * ddlist);
|
||||
static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en);
|
||||
static void lv_ddlist_refr_size(lv_obj_t * ddlist, lv_anim_enable_t anim);
|
||||
static void lv_ddlist_pos_current_option(lv_obj_t * ddlist);
|
||||
static void lv_ddlist_refr_width(lv_obj_t * ddlist);
|
||||
#if LV_USE_ANIMATION
|
||||
@ -452,9 +452,9 @@ lv_label_align_t lv_ddlist_get_align(const lv_obj_t * ddlist)
|
||||
/**
|
||||
* Open the drop down list with or without animation
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param anim_en true: use animation; false: not use animations
|
||||
* @param anim_en LV_ANIM_EN: use animation; LV_ANIM_OFF: not use animations
|
||||
*/
|
||||
void lv_ddlist_open(lv_obj_t * ddlist, bool anim_en)
|
||||
void lv_ddlist_open(lv_obj_t * ddlist, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_en = false;
|
||||
@ -462,15 +462,15 @@ void lv_ddlist_open(lv_obj_t * ddlist, bool anim_en)
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
ext->opened = 1;
|
||||
lv_obj_set_drag(lv_page_get_scrl(ddlist), true);
|
||||
lv_ddlist_refr_size(ddlist, anim_en);
|
||||
lv_ddlist_refr_size(ddlist, anim);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close (Collapse) the drop down list
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param anim_en true: use animation; false: not use animations
|
||||
* @param anim_en LV_ANIM_ON: use animation; LV_ANIM_OFF: not use animations
|
||||
*/
|
||||
void lv_ddlist_close(lv_obj_t * ddlist, bool anim_en)
|
||||
void lv_ddlist_close(lv_obj_t * ddlist, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_en = false;
|
||||
@ -478,7 +478,7 @@ void lv_ddlist_close(lv_obj_t * ddlist, bool anim_en)
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
ext->opened = 0;
|
||||
lv_obj_set_drag(lv_page_get_scrl(ddlist), false);
|
||||
lv_ddlist_refr_size(ddlist, anim_en);
|
||||
lv_ddlist_refr_size(ddlist, anim);
|
||||
}
|
||||
|
||||
/**********************
|
||||
@ -827,9 +827,9 @@ static lv_res_t release_handler(lv_obj_t * ddlist)
|
||||
/**
|
||||
* Refresh the size of drop down list according to its status (open or closed)
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param anim_en Change the size (open/close) with or without animation (true/false)
|
||||
* @param anim Change the size (open/close) with or without animation (true/false)
|
||||
*/
|
||||
static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en)
|
||||
static void lv_ddlist_refr_size(lv_obj_t * ddlist, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_en = false;
|
||||
@ -858,7 +858,7 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, bool anim_en)
|
||||
lv_page_set_sb_mode(ddlist, LV_SB_MODE_HIDE);
|
||||
}
|
||||
|
||||
if(anim_en == 0) {
|
||||
if(anim == LV_ANIM_OFF) {
|
||||
lv_obj_set_height(ddlist, new_height);
|
||||
lv_ddlist_pos_current_option(ddlist);
|
||||
if(ext->opened) lv_page_set_sb_mode(ddlist, LV_SB_MODE_UNHIDE);
|
||||
|
@ -241,16 +241,16 @@ lv_label_align_t lv_ddlist_get_align(const lv_obj_t * ddlist);
|
||||
/**
|
||||
* Open the drop down list with or without animation
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param anim_en true: use animation; false: not use animations
|
||||
* @param anim_en LV_ANIM_ON: use animation; LV_ANOM_OFF: not use animations
|
||||
*/
|
||||
void lv_ddlist_open(lv_obj_t * ddlist, bool anim_en);
|
||||
void lv_ddlist_open(lv_obj_t * ddlist, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Close (Collapse) the drop down list
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param anim_en true: use animation; false: not use animations
|
||||
* @param anim_en LV_ANIM_ON: use animation; LV_ANOM_OFF: not use animations
|
||||
*/
|
||||
void lv_ddlist_close(lv_obj_t * ddlist, bool anim_en);
|
||||
void lv_ddlist_close(lv_obj_t * ddlist, lv_anim_enable_t anim);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
@ -690,9 +690,9 @@ void lv_list_down(const lv_obj_t * list)
|
||||
/**
|
||||
* Focus on a list button. It ensures that the button will be visible on the list.
|
||||
* @param btn pointer to a list button to focus
|
||||
* @param anim_en true: scroll with animation, false: without animation
|
||||
* @param anim_en LV_ANIM_ON: scroll with animation, LV_ANOM_OFF: without animation
|
||||
*/
|
||||
void lv_list_focus(const lv_obj_t * btn, bool anim_en)
|
||||
void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim)
|
||||
{
|
||||
|
||||
#if LV_USE_ANIMATION == 0
|
||||
@ -701,7 +701,7 @@ void lv_list_focus(const lv_obj_t * btn, bool anim_en)
|
||||
|
||||
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
|
||||
|
||||
lv_page_focus(list, btn, anim_en == false ? 0 : lv_list_get_anim_time(list));
|
||||
lv_page_focus(list, btn, anim == LV_ANIM_OFF ? 0 : lv_list_get_anim_time(list));
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -322,9 +322,9 @@ void lv_list_down(const lv_obj_t * list);
|
||||
/**
|
||||
* Focus on a list button. It ensures that the button will be visible on the list.
|
||||
* @param btn pointer to a list button to focus
|
||||
* @param anim_en true: scroll with animation, false: without animation
|
||||
* @param anim LV_ANOM_ON: scroll with animation, LV_ANIM_OFF: without animation
|
||||
*/
|
||||
void lv_list_focus(const lv_obj_t * btn, bool anim_en);
|
||||
void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
@ -35,7 +35,7 @@
|
||||
static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_design_mode_t mode);
|
||||
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param);
|
||||
static void refr_position(lv_obj_t * roller, bool anim_en);
|
||||
static void refr_position(lv_obj_t * roller, lv_anim_enable_t animen);
|
||||
static void refr_height(lv_obj_t * roller);
|
||||
static void inf_normalize(void * roller_scrl);
|
||||
#if LV_USE_ANIMATION
|
||||
@ -188,18 +188,18 @@ void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align)
|
||||
* Set the selected option
|
||||
* @param roller pointer to a roller object
|
||||
* @param sel_opt id of the selected option (0 ... number of option - 1);
|
||||
* @param anim_en true: set with animation; false set immediately
|
||||
* @param anim_en LV_ANIM_ON: set with animation; LV_ANOM_OFF set immediately
|
||||
*/
|
||||
void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, bool anim_en)
|
||||
void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_en = false;
|
||||
anim = LV_ANIM_OFF;
|
||||
#endif
|
||||
|
||||
if(lv_roller_get_selected(roller) == sel_opt) return;
|
||||
|
||||
lv_ddlist_set_selected(roller, sel_opt);
|
||||
refr_position(roller, anim_en);
|
||||
refr_position(roller, anim);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -596,12 +596,12 @@ static void draw_bg(lv_obj_t * roller, const lv_area_t * mask)
|
||||
/**
|
||||
* Refresh the position of the roller. It uses the id stored in: ext->ddlist.selected_option_id
|
||||
* @param roller pointer to a roller object
|
||||
* @param anim_en true: refresh with animation; false: without animation
|
||||
* @param anim LV_ANIM_ON: refresh with animation; LV_ANOM_OFF: without animation
|
||||
*/
|
||||
static void refr_position(lv_obj_t * roller, bool anim_en)
|
||||
static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_en = false;
|
||||
anim = LV_ANOM_OFF;
|
||||
#endif
|
||||
lv_obj_t * roller_scrl = lv_page_get_scrl(roller);
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
@ -612,11 +612,7 @@ static void refr_position(lv_obj_t * roller, bool anim_en)
|
||||
|
||||
/* Normally the animtaion's `end_cb` sets correct position of the roller is infinite.
|
||||
* But without animations do it manually*/
|
||||
if(anim_en == false
|
||||
#if LV_USE_ANIMATION
|
||||
|| ext->ddlist.anim_time == 0
|
||||
#endif
|
||||
) {
|
||||
if(anim == LV_ANIM_OFF || ext->ddlist.anim_time == 0) {
|
||||
inf_normalize(roller_scrl);
|
||||
}
|
||||
|
||||
@ -625,11 +621,7 @@ static void refr_position(lv_obj_t * roller, bool anim_en)
|
||||
id * (font_h + style_label->text.line_space) + ext->ddlist.label->coords.y1 - roller_scrl->coords.y1;
|
||||
lv_coord_t new_y = -line_y1 + (h - font_h) / 2;
|
||||
|
||||
if(anim_en == false
|
||||
#if LV_USE_ANIMATION
|
||||
|| ext->ddlist.anim_time == 0
|
||||
#endif
|
||||
) {
|
||||
if(anim == LV_ANIM_OFF || ext->ddlist.anim_time == 0) {
|
||||
lv_obj_set_y(roller_scrl, new_y);
|
||||
} else {
|
||||
#if LV_USE_ANIMATION
|
||||
|
@ -86,9 +86,9 @@ void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align);
|
||||
* Set the selected option
|
||||
* @param roller pointer to a roller object
|
||||
* @param sel_opt id of the selected option (0 ... number of option - 1);
|
||||
* @param anim_en true: set with animation; false set immediately
|
||||
* @param anim LV_ANOM_ON: set with animation; LV_ANIM_OFF set immediately
|
||||
*/
|
||||
void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, bool anim_en);
|
||||
void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Set the height to show the given number of rows (options)
|
||||
|
@ -74,9 +74,9 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
* Set a new value on the slider
|
||||
* @param slider pointer to a slider object
|
||||
* @param value new value
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
static inline void lv_slider_set_value(lv_obj_t * slider, int16_t value, bool anim)
|
||||
static inline void lv_slider_set_value(lv_obj_t * slider, int16_t value, lv_anim_enable_t anim)
|
||||
{
|
||||
lv_bar_set_value(slider, value, anim);
|
||||
}
|
||||
|
@ -125,12 +125,12 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/**
|
||||
* Turn ON the switch
|
||||
* @param sw pointer to a switch objec
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANOM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_sw_on(lv_obj_t * sw, bool anim)
|
||||
void lv_sw_on(lv_obj_t * sw, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim = false;
|
||||
anim = LV_ANIM_OFF;
|
||||
#endif
|
||||
lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);
|
||||
lv_slider_set_value(sw, LV_SW_MAX_VALUE, anim);
|
||||
@ -140,12 +140,12 @@ void lv_sw_on(lv_obj_t * sw, bool anim)
|
||||
/**
|
||||
* Turn OFF the switch
|
||||
* @param sw pointer to a switch object
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_sw_off(lv_obj_t * sw, bool anim)
|
||||
void lv_sw_off(lv_obj_t * sw, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim = false;
|
||||
anim = LV_ANIM_OFF;
|
||||
#endif
|
||||
lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);
|
||||
lv_slider_set_value(sw, 0, anim);
|
||||
@ -155,13 +155,13 @@ void lv_sw_off(lv_obj_t * sw, bool anim)
|
||||
/**
|
||||
* Toggle the position of the switch
|
||||
* @param sw pointer to a switch object
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
* @return resulting state of the switch.
|
||||
*/
|
||||
bool lv_sw_toggle(lv_obj_t * sw, bool anim)
|
||||
bool lv_sw_toggle(lv_obj_t * sw, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim = false;
|
||||
anim = LV_ANIM_OFF;
|
||||
#endif
|
||||
|
||||
bool state = lv_sw_get_state(sw);
|
||||
|
@ -79,24 +79,24 @@ lv_obj_t * lv_sw_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
/**
|
||||
* Turn ON the switch
|
||||
* @param sw pointer to a switch object
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_sw_on(lv_obj_t * sw, bool anim);
|
||||
void lv_sw_on(lv_obj_t * sw, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Turn OFF the switch
|
||||
* @param sw pointer to a switch object
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_sw_off(lv_obj_t * sw, bool anim);
|
||||
void lv_sw_off(lv_obj_t * sw, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Toggle the position of the switch
|
||||
* @param sw pointer to a switch object
|
||||
* @param anim true: set the value with an animation; false: change the value immediatelly
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
* @return resulting state of the switch.
|
||||
*/
|
||||
bool lv_sw_toggle(lv_obj_t * sw, bool anim);
|
||||
bool lv_sw_toggle(lv_obj_t * sw, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Set a style of a switch
|
||||
|
@ -324,12 +324,12 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
|
||||
* Set a new tab
|
||||
* @param tabview pointer to Tab view object
|
||||
* @param id index of a tab to load
|
||||
* @param anim_en true: set with sliding animation; false: set immediately
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_en = false;
|
||||
anim = LV_ANIM_OFF;
|
||||
#endif
|
||||
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
|
||||
|
||||
@ -363,11 +363,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
break;
|
||||
}
|
||||
|
||||
if(anim_en == false
|
||||
#if LV_USE_ANIMATION
|
||||
|| ext->anim_time == 0
|
||||
#endif
|
||||
) {
|
||||
if(anim == LV_ANIM_OFF || ext->anim_time == 0) {
|
||||
lv_obj_set_x(ext->content, cont_x);
|
||||
} else {
|
||||
#if LV_USE_ANIMATION
|
||||
@ -406,11 +402,7 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
break;
|
||||
}
|
||||
|
||||
if(anim_en == false
|
||||
#if LV_USE_ANIMATION
|
||||
|| ext->anim_time == 0
|
||||
#endif
|
||||
) {
|
||||
if(anim == LV_ANIM_OFF || ext->anim_time == 0) {
|
||||
switch(ext->btns_pos) {
|
||||
case LV_TABVIEW_BTNS_POS_TOP:
|
||||
case LV_TABVIEW_BTNS_POS_BOTTOM: lv_obj_set_x(ext->indic, indic_pos); break;
|
||||
|
@ -117,9 +117,9 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name);
|
||||
* Set a new tab
|
||||
* @param tabview pointer to Tab view object
|
||||
* @param id index of a tab to load
|
||||
* @param anim_en true: set with sliding animation; false: set immediately
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, bool anim_en);
|
||||
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Enable horizontal sliding with touch pad
|
||||
|
@ -181,12 +181,12 @@ void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t * val
|
||||
* @param tileview pointer to a tileview object
|
||||
* @param x column id (0, 1, 2...)
|
||||
* @param y line id (0, 1, 2...)
|
||||
* @param anim_en true: move with animation
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, bool anim_en)
|
||||
void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim)
|
||||
{
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_en = false;
|
||||
anim = LV_ANIM_OFF;
|
||||
#endif
|
||||
|
||||
lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
|
||||
@ -207,7 +207,7 @@ void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, b
|
||||
lv_coord_t x_coord = -x * lv_obj_get_width(tileview);
|
||||
lv_coord_t y_coord = -y * lv_obj_get_height(tileview);
|
||||
lv_obj_t * scrl = lv_page_get_scrl(tileview);
|
||||
if(anim_en) {
|
||||
if(anim) {
|
||||
#if LV_USE_ANIMATION
|
||||
lv_coord_t x_act = lv_obj_get_x(scrl);
|
||||
lv_coord_t y_act = lv_obj_get_y(scrl);
|
||||
|
@ -96,9 +96,9 @@ void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t * val
|
||||
* @param tileview pointer to a tileview object
|
||||
* @param x column id (0, 1, 2...)
|
||||
* @param y line id (0, 1, 2...)
|
||||
* @param anim_en true: move with animation
|
||||
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
||||
*/
|
||||
void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, bool anim_en);
|
||||
void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim);
|
||||
|
||||
/**
|
||||
* Enable the edge flash effect. (Show an arc when the an edge is reached)
|
||||
|
Loading…
x
Reference in New Issue
Block a user