diff --git a/lv_core/lv_style.c b/lv_core/lv_style.c index d28f179c4..76071deef 100644 --- a/lv_core/lv_style.c +++ b/lv_core/lv_style.c @@ -78,8 +78,10 @@ void lv_style_init(void) lv_style_scr.body.main_color = LV_COLOR_WHITE; lv_style_scr.body.grad_color = LV_COLOR_WHITE; lv_style_scr.body.radius = 0; - lv_style_scr.body.padding.ver = 0; - lv_style_scr.body.padding.hor = 0; + lv_style_scr.body.padding.left = 0; + lv_style_scr.body.padding.right = 0; + lv_style_scr.body.padding.top = 0; + lv_style_scr.body.padding.bottom = 0; lv_style_scr.body.padding.inner = LV_DPI / 12; lv_style_scr.body.border.color = LV_COLOR_BLACK; @@ -108,8 +110,10 @@ void lv_style_init(void) /*Plain style (by default near the same as the screen style)*/ memcpy(&lv_style_plain, &lv_style_scr, sizeof(lv_style_t)); - lv_style_plain.body.padding.hor = LV_DPI / 12; - lv_style_plain.body.padding.ver = LV_DPI / 12; + lv_style_plain.body.padding.left = LV_DPI / 12; + lv_style_plain.body.padding.right = LV_DPI / 12; + lv_style_plain.body.padding.top = LV_DPI / 12; + lv_style_plain.body.padding.bottom = LV_DPI / 12; /*Plain color style*/ memcpy(&lv_style_plain_color, &lv_style_plain, sizeof(lv_style_t)); @@ -148,8 +152,10 @@ void lv_style_init(void) /*Transparent fitting size*/ memcpy(&lv_style_transp_fit, &lv_style_transp, sizeof(lv_style_t)); - lv_style_transp_fit.body.padding.hor = 0; - lv_style_transp_fit.body.padding.ver = 0; + lv_style_transp_fit.body.padding.left = 0; + lv_style_transp_fit.body.padding.right = 0; + lv_style_transp_fit.body.padding.top = 0; + lv_style_transp_fit.body.padding.bottom = 0; /*Transparent tight style*/ memcpy(&lv_style_transp_tight, &lv_style_transp_fit, sizeof(lv_style_t)); @@ -160,8 +166,10 @@ void lv_style_init(void) lv_style_btn_rel.body.main_color = LV_COLOR_MAKE(0x76, 0xa2, 0xd0); lv_style_btn_rel.body.grad_color = LV_COLOR_MAKE(0x19, 0x3a, 0x5d); lv_style_btn_rel.body.radius = LV_DPI / 15; - lv_style_btn_rel.body.padding.hor = LV_DPI / 4; - lv_style_btn_rel.body.padding.ver = LV_DPI / 6; + lv_style_btn_rel.body.padding.left= LV_DPI / 4; + lv_style_btn_rel.body.padding.right = LV_DPI / 4; + lv_style_btn_rel.body.padding.top = LV_DPI / 6; + lv_style_btn_rel.body.padding.bottom = LV_DPI / 6; lv_style_btn_rel.body.padding.inner = LV_DPI / 10; lv_style_btn_rel.body.border.color = LV_COLOR_MAKE(0x0b, 0x19, 0x28); lv_style_btn_rel.body.border.width = LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1; diff --git a/lv_objx/lv_ddlist.c b/lv_objx/lv_ddlist.c index a1b14f02f..416788bf0 100644 --- a/lv_objx/lv_ddlist.c +++ b/lv_objx/lv_ddlist.c @@ -16,6 +16,7 @@ #include "../lv_themes/lv_theme.h" #include "../lv_misc/lv_symbol_def.h" #include "../lv_misc/lv_anim.h" +#include "../lv_misc/lv_math.h" #include /********************* diff --git a/lv_objx/lv_list.c b/lv_objx/lv_list.c index 7df6f13e0..cc8c13f21 100644 --- a/lv_objx/lv_list.c +++ b/lv_objx/lv_list.c @@ -344,7 +344,6 @@ void lv_list_set_style(lv_obj_t * list, lv_list_style_t type, lv_style_t * style break; case LV_LIST_STYLE_SCRL: lv_page_set_style(list, LV_PAGE_STYLE_SCRL, style); - refr_btn_width(list); break; case LV_LIST_STYLE_SB: lv_page_set_style(list, LV_PAGE_STYLE_SB, style); @@ -739,14 +738,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) res = ancestor_page_signal(list, sign, param); if(res != LV_RES_OK) return res; - if(sign == LV_SIGNAL_CORD_CHG) { - /*Be sure the width of the buttons are correct*/ - lv_coord_t w = lv_obj_get_width(list); - if(w != lv_area_get_width(param)) { /*Width changed*/ - refr_btn_width(list); - } - } - else if(sign == LV_SIGNAL_RELEASED || + if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESSING || sign == LV_SIGNAL_LONG_PRESS || @@ -789,10 +781,6 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) } } } - else if(sign == LV_SIGNAL_STYLE_CHG) { - /*Because of the possible change of horizontal and vertical padding refresh buttons width */ - refr_btn_width(list); - } else if(sign == LV_SIGNAL_FOCUS) { #if LV_USE_GROUP