From 9a5096308b5dd61dd27aeb5cb5e0e61e364ebed4 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sun, 2 Feb 2020 15:58:08 +0100 Subject: [PATCH] finish lv_obj_style_set/get API simplification --- src/lv_core/lv_obj.c | 4 +- src/lv_objx/lv_calendar.c | 4 +- src/lv_objx/lv_canvas.c | 8 ++-- src/lv_objx/lv_cb.c | 2 +- src/lv_objx/lv_chart.c | 2 +- src/lv_objx/lv_ddlist.c | 12 +++--- src/lv_objx/lv_img.c | 44 +++++++++++----------- src/lv_objx/lv_imgbtn.c | 2 +- src/lv_objx/lv_label.c | 40 ++++++++++---------- src/lv_objx/lv_line.c | 4 +- src/lv_objx/lv_list.c | 10 ++--- src/lv_objx/lv_lmeter.c | 8 ++-- src/lv_objx/lv_mbox.c | 10 ++--- src/lv_objx/lv_page.c | 78 +++++++++++++++++++-------------------- src/lv_objx/lv_roller.c | 25 ++++++------- src/lv_objx/lv_slider.c | 48 ++++++++++++------------ src/lv_objx/lv_sw.c | 44 +++++++++++----------- src/lv_objx/lv_ta.c | 61 +++++++++++++++--------------- src/lv_objx/lv_table.c | 28 +++++++------- src/lv_objx/lv_tabview.c | 38 +++++++++---------- 20 files changed, 233 insertions(+), 239 deletions(-) diff --git a/src/lv_core/lv_obj.c b/src/lv_core/lv_obj.c index f131c8e2f..f3591bd30 100644 --- a/src/lv_core/lv_obj.c +++ b/src/lv_core/lv_obj.c @@ -2970,7 +2970,7 @@ static lv_design_res_t lv_obj_design(lv_obj_t * obj, const lv_area_t * clip_area } } else if(mode == LV_DESIGN_DRAW_POST) { - if(lv_obj_get_style_border_post(obj, LV_OBJ_PART_MAIN)) { + if(lv_obj_get_style_clip_corner(obj, LV_OBJ_PART_MAIN)) { lv_draw_mask_radius_param_t * param = lv_draw_mask_remove_custom(obj + 8); lv_mem_buf_release(param); } @@ -3014,7 +3014,7 @@ static lv_res_t lv_obj_signal(lv_obj_t * obj, lv_signal_t sign, void * param) /*Return 'invalid' if the child change signal is not enabled*/ if(lv_obj_is_protected(obj, LV_PROTECT_CHILD_CHG) != false) res = LV_RES_INV; } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { - lv_coord_t shadow = lv_obj_get_style_shadow_width(obj, LV_OBJ_PART_MAIN) >> 1; + lv_coord_t shadow = lv_obj_get_style_shadow_width(obj, LV_OBJ_PART_MAIN); if(shadow) { shadow++; shadow += lv_obj_get_style_shadow_spread(obj, LV_OBJ_PART_MAIN); diff --git a/src/lv_objx/lv_calendar.c b/src/lv_objx/lv_calendar.c index f010ddf0a..fb9677272 100644 --- a/src/lv_objx/lv_calendar.c +++ b/src/lv_objx/lv_calendar.c @@ -652,7 +652,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask) lv_style_int_t header_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t header_left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_HEADER); lv_style_int_t header_right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_HEADER); - const lv_font_t * font = lv_obj_get_style_ptr(calendar, LV_CALENDAR_PART_HEADER, LV_STYLE_FONT); + const lv_font_t * font = lv_obj_get_style_font(calendar, LV_CALENDAR_PART_HEADER); lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); @@ -768,7 +768,7 @@ static void draw_dates(lv_obj_t * calendar, const lv_area_t * mask) { lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar); - const lv_font_t * nums_font = lv_obj_get_style_ptr(calendar, LV_CALENDAR_PART_DATE, LV_STYLE_FONT); + const lv_font_t * nums_font = lv_obj_get_style_font(calendar, LV_CALENDAR_PART_DATE); lv_style_int_t date_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DATE); lv_style_int_t date_bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DATE); diff --git a/src/lv_objx/lv_canvas.c b/src/lv_objx/lv_canvas.c index 872abbee5..453f1d63c 100644 --- a/src/lv_objx/lv_canvas.c +++ b/src/lv_objx/lv_canvas.c @@ -203,7 +203,7 @@ lv_color_t lv_canvas_get_px(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y) LV_ASSERT_OBJ(canvas, LV_OBJX_NAME); lv_canvas_ext_t * ext = lv_obj_get_ext_attr(canvas); - lv_color_t color = lv_obj_get_style_color(canvas, LV_CANVAS_PART_MAIN, LV_STYLE_IMAGE_RECOLOR); + lv_color_t color = lv_obj_get_style_image_recolor(canvas, LV_CANVAS_PART_MAIN); return lv_img_buf_get_px_color(&ext->dsc, x, y, color); } @@ -280,7 +280,7 @@ void lv_canvas_transform(lv_obj_t * canvas, lv_img_dsc_t * img, int16_t angle, u LV_ASSERT_NULL(img); lv_canvas_ext_t * ext_dst = lv_obj_get_ext_attr(canvas); - lv_color_t color = lv_obj_get_style_color(canvas, LV_CANVAS_PART_MAIN, LV_STYLE_IMAGE_RECOLOR); + lv_color_t color = lv_obj_get_style_image_recolor(canvas, LV_CANVAS_PART_MAIN); int32_t dest_width = ext_dst->dsc.header.w; int32_t dest_height = ext_dst->dsc.header.h; @@ -390,7 +390,7 @@ void lv_canvas_blur_hor(lv_obj_t * canvas, const lv_area_t * area, uint16_t r) a.y2 = ext->dsc.header.h - 1; } - lv_color_t color = lv_obj_get_style_color(canvas, LV_CANVAS_PART_MAIN, LV_STYLE_IMAGE_RECOLOR); + lv_color_t color = lv_obj_get_style_image_recolor(canvas, LV_CANVAS_PART_MAIN); uint16_t r_back = r / 2; uint16_t r_front = r / 2; @@ -525,7 +525,7 @@ void lv_canvas_blur_ver(lv_obj_t * canvas, const lv_area_t * area, uint16_t r) a.y2 = ext->dsc.header.h - 1; } - lv_color_t color = lv_obj_get_style_color(canvas, LV_CANVAS_PART_MAIN, LV_STYLE_IMAGE_RECOLOR); + lv_color_t color = lv_obj_get_style_image_recolor(canvas, LV_CANVAS_PART_MAIN); uint16_t r_back = r / 2; uint16_t r_front = r / 2; diff --git a/src/lv_objx/lv_cb.c b/src/lv_objx/lv_cb.c index da4e39034..08d05edd3 100644 --- a/src/lv_objx/lv_cb.c +++ b/src/lv_objx/lv_cb.c @@ -178,7 +178,7 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param) lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb); if(sign == LV_SIGNAL_STYLE_CHG) { - const lv_font_t * font = lv_obj_get_style_ptr(ext->label, LV_LABEL_PART_MAIN, LV_STYLE_FONT); + const lv_font_t * font = lv_obj_get_style_font(ext->label, LV_LABEL_PART_MAIN); lv_coord_t line_height = lv_font_get_line_height(font); lv_obj_set_size(ext->bullet, line_height, line_height); lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CB_PART_BG)); diff --git a/src/lv_objx/lv_chart.c b/src/lv_objx/lv_chart.c index 26b2a1b8d..8514a1609 100644 --- a/src/lv_objx/lv_chart.c +++ b/src/lv_objx/lv_chart.c @@ -789,7 +789,7 @@ static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, co lv_draw_mask_fade_param_t mask_fade_p; int16_t mask_fade_id = LV_MASK_ID_INV; lv_draw_rect_dsc_t area_dsc; - bool has_area = lv_obj_get_style_opa(chart, LV_CHART_PART_SERIES, LV_STYLE_BG_OPA) > LV_OPA_MIN ? true : false; + bool has_area = lv_obj_get_style_bg_opa(chart, LV_CHART_PART_SERIES) > LV_OPA_MIN ? true : false; bool has_fade = false; if(has_area) { lv_draw_rect_dsc_init(&area_dsc); diff --git a/src/lv_objx/lv_ddlist.c b/src/lv_objx/lv_ddlist.c index f4fabff3f..85155fc93 100644 --- a/src/lv_objx/lv_ddlist.c +++ b/src/lv_objx/lv_ddlist.c @@ -765,8 +765,8 @@ static lv_res_t lv_ddlist_page_signal(lv_obj_t * page, lv_signal_t sign, void * /* Make possible to draw on the full width of the background to redraw the selected rectangle * when the ddlist is scrolled in fix height mode. * (The scrollabel is scrolled the "select rectangle" is drawn on the bg too)*/ - lv_style_int_t left = lv_obj_get_style_int(ddlist, LV_DDLIST_PART_LIST, LV_STYLE_PAD_LEFT); - lv_style_int_t right = lv_obj_get_style_int(ddlist, LV_DDLIST_PART_LIST, LV_STYLE_PAD_RIGHT); + lv_style_int_t left = lv_obj_get_style_pad_left(ddlist, LV_DDLIST_PART_LIST); + lv_style_int_t right = lv_obj_get_style_pad_right(ddlist, LV_DDLIST_PART_LIST); lv_obj_t * scrl = lv_page_get_scrl(page); scrl->ext_draw_pad = LV_MATH_MAX(scrl->ext_draw_pad, LV_MATH_MAX(left, right)); } else if(sign == LV_SIGNAL_RELEASED) { @@ -871,8 +871,8 @@ void draw_box(lv_obj_t * ddlist, const lv_area_t * clip_area, uint16_t id, lv_ob page->state_dsc.prev = page->state_dsc.act; /*Draw a rectangle under the selected item*/ - const lv_font_t * font = lv_obj_get_style_ptr(ddlist, LV_DDLIST_PART_LIST, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(ddlist, LV_DDLIST_PART_LIST, LV_STYLE_LINE_SPACE); + const lv_font_t * font = lv_obj_get_style_font(ddlist, LV_DDLIST_PART_LIST); + lv_style_int_t line_space = lv_obj_get_style_line_space(ddlist, LV_DDLIST_PART_LIST); lv_coord_t font_h = lv_font_get_line_height(font); /*Draw the selected*/ @@ -1025,13 +1025,13 @@ static void pos_selected(lv_obj_t * ddlist) { lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist); - const lv_font_t * font = lv_obj_get_style_ptr(ddlist, LV_DDLIST_PART_LIST, LV_STYLE_FONT); + const lv_font_t * font = lv_obj_get_style_font(ddlist, LV_DDLIST_PART_LIST); lv_coord_t font_h = lv_font_get_line_height(font); lv_obj_t * scrl = lv_page_get_scrl(ext->page); lv_obj_t * label = get_label(ddlist); lv_coord_t h = lv_obj_get_height(ext->page); - lv_style_int_t line_space = lv_obj_get_style_int(ddlist, LV_DDLIST_PART_LIST, LV_STYLE_LINE_SPACE); + lv_style_int_t line_space = lv_obj_get_style_line_space(ddlist, LV_DDLIST_PART_LIST); lv_coord_t line_y1 = ext->sel_opt_id * (font_h + line_space) + label->coords.y1 - scrl->coords.y1; diff --git a/src/lv_objx/lv_img.c b/src/lv_objx/lv_img.c index 9d4f70113..6b9f34a11 100644 --- a/src/lv_objx/lv_img.c +++ b/src/lv_objx/lv_img.c @@ -192,9 +192,9 @@ void lv_img_set_src(lv_obj_t * img, const void * src_img) if(src_type == LV_IMG_SRC_SYMBOL) { /*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/ - const lv_font_t * font = lv_obj_get_style_ptr(img, LV_IMG_PART_MAIN, LV_STYLE_FONT); - lv_style_int_t letter_space = lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_LETTER_SPACE); - lv_style_int_t line_space = lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_LINE_SPACE); + const lv_font_t * font = lv_obj_get_style_font(img, LV_IMG_PART_MAIN); + lv_style_int_t letter_space = lv_obj_get_style_letter_space(img, LV_IMG_PART_MAIN); + lv_style_int_t line_space = lv_obj_get_style_line_space(img, LV_IMG_PART_MAIN); lv_point_t size; lv_txt_get_size(&size, src_img, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE); @@ -504,7 +504,7 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area cover = lv_area_is_in(clip_area, &img->coords, 0) ? LV_DESIGN_RES_COVER : LV_DESIGN_RES_NOT_COVER; } - if(lv_obj_get_style_opa(img, LV_IMG_PART_MAIN, LV_STYLE_IMAGE_OPA) < LV_OPA_MAX) return false; + if(lv_obj_get_style_image_opa(img, LV_IMG_PART_MAIN) < LV_OPA_MAX) return false; return cover; } else if(mode == LV_DESIGN_DRAW_MAIN) { @@ -518,22 +518,22 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area lv_obj_init_draw_rect_dsc(img, LV_IMG_PART_MAIN, &bg_dsc); /*If the border is drawn later disable loading its properties*/ - if(lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_BORDER_POST)) { + if(lv_obj_get_style_border_post(img, LV_OBJ_PART_MAIN)) { bg_dsc.border_opa = LV_OPA_TRANSP; } lv_area_t bg_coords; lv_area_copy(&bg_coords, &img_coords); - bg_coords.x1 -= lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_PAD_LEFT); - bg_coords.x2 += lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_PAD_RIGHT); - bg_coords.y1 -= lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_PAD_TOP); - bg_coords.y2 += lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_PAD_BOTTOM); + bg_coords.x1 -= lv_obj_get_style_pad_left(img, LV_IMG_PART_MAIN); + bg_coords.x2 += lv_obj_get_style_pad_right(img, LV_IMG_PART_MAIN); + bg_coords.y1 -= lv_obj_get_style_pad_top(img, LV_IMG_PART_MAIN); + bg_coords.y2 += lv_obj_get_style_pad_bottom(img, LV_IMG_PART_MAIN); lv_draw_rect(&bg_coords, clip_area, &bg_dsc); - if(lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_CLIP_CORNER)) { + if(lv_obj_get_style_clip_corner(img, LV_OBJ_PART_MAIN)) { lv_draw_mask_radius_param_t * mp = lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t)); - lv_coord_t r = lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_RADIUS); + lv_coord_t r = lv_obj_get_style_radius(img, LV_OBJ_PART_MAIN); lv_draw_mask_radius_init(mp, &bg_coords, r, false); /*Add the mask and use `img+8` as custom id. Don't use `obj` directly because it might be used by the user*/ @@ -570,7 +570,7 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area lv_draw_label_dsc_init(&label_dsc); lv_obj_init_draw_label_dsc(img, LV_IMG_PART_MAIN, &label_dsc); - label_dsc.color = lv_obj_get_style_color(img, LV_IMG_PART_MAIN, LV_STYLE_IMAGE_RECOLOR); + label_dsc.color = lv_obj_get_style_image_recolor(img, LV_CANVAS_PART_MAIN); lv_draw_label(&img_coords, clip_area, &label_dsc, ext->src, NULL); } else { /*Trigger the error handler of image drawer*/ @@ -578,7 +578,7 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area lv_draw_img(&img->coords, clip_area, NULL, NULL); } } else if(mode == LV_DESIGN_DRAW_POST) { - if(lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_CLIP_CORNER)) { + if(lv_obj_get_style_clip_corner(img, LV_OBJ_PART_MAIN)) { lv_draw_mask_radius_param_t * param = lv_draw_mask_remove_custom(img + 8); lv_mem_buf_release(param); } @@ -587,7 +587,7 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area lv_draw_rect_dsc_init(&draw_dsc); /*If the border is drawn later disable loading other properties*/ - if(lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_BORDER_POST)) { + if(lv_obj_get_style_border_post(img, LV_OBJ_PART_MAIN)) { draw_dsc.bg_opa = LV_OPA_TRANSP; draw_dsc.pattern_opa = LV_OPA_TRANSP; draw_dsc.shadow_opa = LV_OPA_TRANSP; @@ -650,10 +650,10 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param) } /*Handle the padding of the background*/ - lv_style_int_t left = lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_PAD_LEFT); - lv_style_int_t right = lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_PAD_RIGHT); - lv_style_int_t top = lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_PAD_TOP); - lv_style_int_t bottom = lv_obj_get_style_int(img, LV_IMG_PART_MAIN, LV_STYLE_PAD_BOTTOM); + lv_style_int_t left = lv_obj_get_style_pad_left(img, LV_IMG_PART_MAIN); + lv_style_int_t right = lv_obj_get_style_pad_right(img, LV_IMG_PART_MAIN); + lv_style_int_t top = lv_obj_get_style_pad_top(img, LV_IMG_PART_MAIN); + lv_style_int_t bottom = lv_obj_get_style_pad_bottom(img, LV_IMG_PART_MAIN); img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, left); img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, right); @@ -661,12 +661,12 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param) img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, bottom); /*Handle shadow*/ - lv_coord_t shadow = (lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_SHADOW_WIDTH) >> 1); + lv_coord_t shadow = lv_obj_get_style_shadow_width(img, LV_OBJ_PART_MAIN); if(shadow) { shadow++; - shadow += lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_SHADOW_SPREAD); - shadow += LV_MATH_MAX(LV_MATH_ABS(lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_SHADOW_OFFSET_X)), - LV_MATH_ABS(lv_obj_get_style_int(img, LV_OBJ_PART_MAIN, LV_STYLE_SHADOW_OFFSET_Y))); + shadow += lv_obj_get_style_shadow_spread(img, LV_OBJ_PART_MAIN); + shadow += LV_MATH_MAX(LV_MATH_ABS(lv_obj_get_style_shadow_offset_x(img, LV_OBJ_PART_MAIN)), + LV_MATH_ABS(lv_obj_get_style_shadow_offset_y(img, LV_OBJ_PART_MAIN))); } } else if(sign == LV_SIGNAL_HIT_TEST) { diff --git a/src/lv_objx/lv_imgbtn.c b/src/lv_objx/lv_imgbtn.c index 5a0a3667d..360525b00 100644 --- a/src/lv_objx/lv_imgbtn.c +++ b/src/lv_objx/lv_imgbtn.c @@ -401,7 +401,7 @@ static void refr_img(lv_obj_t * imgbtn) lv_res_t info_res = LV_RES_OK; if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) { - const lv_font_t * font = lv_obj_get_style_ptr(imgbtn, LV_IMGBTN_PART_MAIN, LV_STYLE_FONT); + const lv_font_t * font = lv_obj_get_style_font(imgbtn, LV_IMGBTN_PART_MAIN); header.h = lv_font_get_line_height(font); header.w = lv_txt_get_width(src, (uint16_t)strlen(src), font, 0, LV_TXT_FLAG_NONE); header.always_zero = 0; diff --git a/src/lv_objx/lv_label.c b/src/lv_objx/lv_label.c index f3e3a5649..375326520 100644 --- a/src/lv_objx/lv_label.c +++ b/src/lv_objx/lv_label.c @@ -562,9 +562,9 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t char_id, lv_point_ uint32_t line_start = 0; uint32_t new_line_start = 0; lv_coord_t max_w = lv_obj_get_width(label); - const lv_font_t * font = lv_obj_get_style_ptr(label, LV_LABEL_PART_MAIN, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_LINE_SPACE); - lv_style_int_t letter_space = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_LETTER_SPACE); + const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); + lv_style_int_t line_space = lv_obj_get_style_line_space(label, LV_LABEL_PART_MAIN); + lv_style_int_t letter_space = lv_obj_get_style_letter_space(label, LV_LABEL_PART_MAIN); lv_coord_t letter_height = lv_font_get_line_height(font); lv_coord_t y = 0; lv_txt_flag_t flag = LV_TXT_FLAG_NONE; @@ -666,9 +666,9 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos) uint32_t line_start = 0; uint32_t new_line_start = 0; lv_coord_t max_w = lv_obj_get_width(label); - const lv_font_t * font = lv_obj_get_style_ptr(label, LV_LABEL_PART_MAIN, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_LINE_SPACE); - lv_style_int_t letter_space = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_LETTER_SPACE); + const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); + lv_style_int_t line_space = lv_obj_get_style_line_space(label, LV_LABEL_PART_MAIN); + lv_style_int_t letter_space = lv_obj_get_style_letter_space(label, LV_LABEL_PART_MAIN); lv_coord_t letter_height = lv_font_get_line_height(font); lv_coord_t y = 0; lv_txt_flag_t flag = LV_TXT_FLAG_NONE; @@ -827,9 +827,9 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos) uint32_t line_start = 0; uint32_t new_line_start = 0; lv_coord_t max_w = lv_obj_get_width(label); - const lv_font_t * font = lv_obj_get_style_ptr(label, LV_LABEL_PART_MAIN, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_LINE_SPACE); - lv_style_int_t letter_space = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_LETTER_SPACE); + const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); + lv_style_int_t line_space = lv_obj_get_style_line_space(label, LV_LABEL_PART_MAIN); + lv_style_int_t letter_space = lv_obj_get_style_letter_space(label, LV_LABEL_PART_MAIN); lv_coord_t letter_height = lv_font_get_line_height(font); lv_coord_t y = 0; lv_txt_flag_t flag = LV_TXT_FLAG_NONE; @@ -1022,10 +1022,10 @@ static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_ lv_area_t bg; lv_obj_get_coords(label, &bg); - lv_coord_t left = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_PAD_LEFT); - lv_coord_t right = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_PAD_RIGHT); - lv_coord_t top = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_PAD_TOP); - lv_coord_t bottom = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_PAD_BOTTOM); + lv_coord_t left = lv_obj_get_style_pad_left(label, LV_LABEL_PART_MAIN); + lv_coord_t right = lv_obj_get_style_pad_right(label, LV_LABEL_PART_MAIN); + lv_coord_t top = lv_obj_get_style_pad_top(label, LV_LABEL_PART_MAIN); + lv_coord_t bottom = lv_obj_get_style_pad_bottom(label, LV_LABEL_PART_MAIN); bg.x1 -= left; bg.x2 += right; bg.y1 -= top; @@ -1148,10 +1148,10 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param lv_label_refr_text(label); } } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { - lv_coord_t left = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_PAD_LEFT); - lv_coord_t right = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_PAD_RIGHT); - lv_coord_t top = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_PAD_TOP); - lv_coord_t bottom = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_PAD_BOTTOM); + lv_coord_t left = lv_obj_get_style_pad_left(label, LV_LABEL_PART_MAIN); + lv_coord_t right = lv_obj_get_style_pad_right(label, LV_LABEL_PART_MAIN); + lv_coord_t top = lv_obj_get_style_pad_top(label, LV_LABEL_PART_MAIN); + lv_coord_t bottom = lv_obj_get_style_pad_bottom(label, LV_LABEL_PART_MAIN); label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, left); label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, right); label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, top); @@ -1187,9 +1187,9 @@ static void lv_label_refr_text(lv_obj_t * label) #endif lv_coord_t max_w = lv_obj_get_width(label); - const lv_font_t * font = lv_obj_get_style_ptr(label, LV_LABEL_PART_MAIN, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_LINE_SPACE); - lv_style_int_t letter_space = lv_obj_get_style_int(label, LV_LABEL_PART_MAIN, LV_STYLE_LETTER_SPACE); + const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); + lv_style_int_t line_space = lv_obj_get_style_line_space(label, LV_LABEL_PART_MAIN); + lv_style_int_t letter_space = lv_obj_get_style_letter_space(label, LV_LABEL_PART_MAIN); /*If the width will be expanded set the max length to very big */ if(ext->long_mode == LV_LABEL_LONG_EXPAND) { diff --git a/src/lv_objx/lv_line.c b/src/lv_objx/lv_line.c index e7f414f47..9b94c9482 100644 --- a/src/lv_objx/lv_line.c +++ b/src/lv_objx/lv_line.c @@ -127,7 +127,7 @@ void lv_line_set_points(lv_obj_t * line, const lv_point_t point_a[], uint16_t po ymax = LV_MATH_MAX(point_a[i].y, ymax); } - lv_style_int_t line_width = lv_obj_get_style_int(line, LV_LINE_PART_MAIN, LV_STYLE_LINE_WIDTH); + lv_style_int_t line_width = lv_obj_get_style_line_width(line, LV_LINE_PART_MAIN); lv_obj_set_size(line, xmax + line_width, ymax + line_width); } @@ -279,7 +279,7 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param) if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { /*The corner of the skew lines is out of the intended area*/ - lv_style_int_t line_width = lv_obj_get_style_int(line, LV_LINE_PART_MAIN, LV_STYLE_LINE_WIDTH); + lv_style_int_t line_width = lv_obj_get_style_line_width(line, LV_LINE_PART_MAIN); if(line->ext_draw_pad < line_width) line->ext_draw_pad = line_width; } diff --git a/src/lv_objx/lv_list.c b/src/lv_objx/lv_list.c index 261d744d5..d66177e3a 100644 --- a/src/lv_objx/lv_list.c +++ b/src/lv_objx/lv_list.c @@ -205,11 +205,11 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t lv_obj_set_click(label, false); lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL_CIRC); if(lv_obj_get_base_dir(btn) == LV_BIDI_DIR_RTL) { - lv_coord_t pad = lv_obj_get_style_int(btn, LV_BTN_PART_MAIN, LV_STYLE_PAD_LEFT); + lv_coord_t pad = lv_obj_get_style_pad_left(btn, LV_BTN_PART_MAIN); lv_obj_set_width(label, label->coords.x2 - btn->coords.x1 - pad); } else { - lv_coord_t pad = lv_obj_get_style_int(btn, LV_BTN_PART_MAIN, LV_STYLE_PAD_RIGHT); + lv_coord_t pad = lv_obj_get_style_pad_right(btn, LV_BTN_PART_MAIN); lv_obj_set_width(label, btn->coords.x2 - label->coords.x1 - pad); } if(label_signal == NULL) label_signal = lv_obj_get_signal_cb(label); @@ -782,14 +782,14 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para sign == LV_SIGNAL_STYLE_CHG) { lv_obj_t * label = lv_list_get_btn_label(btn); if(label) { - const lv_font_t * font = lv_obj_get_style_ptr(label, LV_LABEL_PART_MAIN, LV_STYLE_FONT); + const lv_font_t * font = lv_obj_get_style_font(label, LV_LABEL_PART_MAIN); lv_coord_t font_h = lv_font_get_line_height(font); if(lv_obj_get_base_dir(btn) == LV_BIDI_DIR_RTL) { - lv_coord_t pad = lv_obj_get_style_int(btn, LV_BTN_PART_MAIN, LV_STYLE_PAD_LEFT); + lv_coord_t pad = lv_obj_get_style_pad_left(btn, LV_BTN_PART_MAIN); lv_obj_set_size(label, label->coords.x2 - btn->coords.x1 - pad, font_h); } else { - lv_coord_t pad = lv_obj_get_style_int(btn, LV_BTN_PART_MAIN, LV_STYLE_PAD_RIGHT); + lv_coord_t pad = lv_obj_get_style_pad_right(btn, LV_BTN_PART_MAIN); lv_obj_set_size(label, btn->coords.x2 - label->coords.x1 - pad, font_h); } } diff --git a/src/lv_objx/lv_lmeter.c b/src/lv_objx/lv_lmeter.c index 0fd729725..70f4ba816 100644 --- a/src/lv_objx/lv_lmeter.c +++ b/src/lv_objx/lv_lmeter.c @@ -273,7 +273,7 @@ void lv_lmeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uint8_ lv_lmeter_ext_t * ext = lv_obj_get_ext_attr(lmeter); lv_coord_t r_out = lv_obj_get_width(lmeter) / 2; - lv_coord_t r_in = r_out - lv_obj_get_style_int(lmeter, part, LV_STYLE_SCALE_WIDTH); + lv_coord_t r_in = r_out - lv_obj_get_style_scale_width(lmeter, part); if(r_in < 1) r_in = 1; lv_coord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->coords.x1; @@ -283,9 +283,9 @@ void lv_lmeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uint8_ (int32_t)((int32_t)(ext->cur_value - ext->min_value) * ext->line_cnt) / (ext->max_value - ext->min_value); uint8_t i; - lv_color_t main_color = lv_obj_get_style_color(lmeter, part, LV_STYLE_SCALE_COLOR); - lv_color_t grad_color = lv_obj_get_style_color(lmeter, part, LV_STYLE_SCALE_GRAD_COLOR); - lv_color_t ina_color = lv_obj_get_style_color(lmeter, part, LV_STYLE_SCALE_END_COLOR); + lv_color_t main_color = lv_obj_get_style_scale_color(lmeter, part); + lv_color_t grad_color = lv_obj_get_style_scale_grad_color(lmeter, part); + lv_color_t ina_color = lv_obj_get_style_scale_end_color(lmeter, part); lv_draw_line_dsc_t line_dsc; lv_draw_line_dsc_init(&line_dsc); diff --git a/src/lv_objx/lv_mbox.c b/src/lv_objx/lv_mbox.c index 792906c64..452e39a65 100644 --- a/src/lv_objx/lv_mbox.c +++ b/src/lv_objx/lv_mbox.c @@ -511,11 +511,11 @@ static void mbox_realign(lv_obj_t * mbox) } if(ext->btnm) { - lv_style_int_t bg_top = lv_obj_get_style_int(mbox, LV_MBOX_PART_BTN_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bg_bottom = lv_obj_get_style_int(mbox, LV_MBOX_PART_BTN_BG, LV_STYLE_PAD_BOTTOM); - lv_style_int_t btn_top = lv_obj_get_style_int(mbox, LV_MBOX_PART_BTN, LV_STYLE_PAD_TOP); - lv_style_int_t btn_bottom = lv_obj_get_style_int(mbox, LV_MBOX_PART_BTN, LV_STYLE_PAD_BOTTOM); - const lv_font_t * font = lv_obj_get_style_ptr(mbox, LV_MBOX_PART_BTN, LV_STYLE_FONT); + lv_style_int_t bg_top = lv_obj_get_style_pad_top(mbox, LV_MBOX_PART_BTN_BG); + lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(mbox, LV_MBOX_PART_BTN_BG); + lv_style_int_t btn_top = lv_obj_get_style_pad_top(mbox, LV_MBOX_PART_BTN); + lv_style_int_t btn_bottom = lv_obj_get_style_pad_bottom(mbox, LV_MBOX_PART_BTN); + const lv_font_t * font = lv_obj_get_style_font(mbox, LV_MBOX_PART_BTN); lv_coord_t font_h = lv_font_get_line_height(font); lv_mem_test(); diff --git a/src/lv_objx/lv_page.c b/src/lv_objx/lv_page.c index 67f70929b..f7dd41136 100644 --- a/src/lv_objx/lv_page.c +++ b/src/lv_objx/lv_page.c @@ -347,10 +347,10 @@ lv_coord_t lv_page_get_fit_width(lv_obj_t * page) LV_ASSERT_OBJ(page, LV_OBJX_NAME); lv_page_ext_t * ext = lv_obj_get_ext_attr(page); - lv_style_int_t bg_left = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t bg_right = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_RIGHT); - lv_style_int_t scrl_left = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_LEFT); - lv_style_int_t scrl_right = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_RIGHT); + lv_style_int_t bg_left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG); + lv_style_int_t bg_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG); + lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->scrl, LV_CONT_PART_MAIN); + lv_style_int_t scrl_right = lv_obj_get_style_pad_right(ext->scrl, LV_CONT_PART_MAIN); return lv_obj_get_width(page) - bg_left - bg_right - scrl_left - scrl_right; } @@ -366,10 +366,10 @@ lv_coord_t lv_page_get_fit_height(lv_obj_t * page) lv_page_ext_t * ext = lv_obj_get_ext_attr(page); - lv_style_int_t bg_top = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bg_bottom = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_BOTTOM); - lv_style_int_t scrl_top = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_TOP); - lv_style_int_t scrl_bottom = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_BOTTOM); + lv_style_int_t bg_top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG); + lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG); + lv_style_int_t scrl_top = lv_obj_get_style_pad_top(ext->scrl, LV_CONT_PART_MAIN); + lv_style_int_t scrl_bottom = lv_obj_get_style_pad_bottom(ext->scrl, LV_CONT_PART_MAIN); return lv_obj_get_height(page) - bg_top - bg_bottom - scrl_top - scrl_bottom; } @@ -393,10 +393,10 @@ bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge) lv_obj_get_coords(scrl, &scrl_coords); lv_obj_get_coords(page, &page_coords); - lv_style_int_t left = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t right = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_RIGHT); - lv_style_int_t top = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bottom = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_BOTTOM); + lv_style_int_t left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG); + lv_style_int_t right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG); + lv_style_int_t top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG); + lv_style_int_t bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG); if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + top) return true; if((edge & LV_PAGE_EDGE_BOTTOM) && scrl_coords.y2 == page_coords.y2 - bottom) return true; @@ -446,10 +446,10 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_ lv_coord_t top_err = -(scrlable_y + obj_y); lv_coord_t bot_err = scrlable_y + obj_y + obj_h - page_h; - lv_style_int_t bg_top = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bg_bottom = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_BOTTOM); - lv_style_int_t scrl_top = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_TOP); - lv_style_int_t scrl_bottom = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_BOTTOM); + lv_style_int_t bg_top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG); + lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG); + lv_style_int_t scrl_top = lv_obj_get_style_pad_top(ext->scrl, LV_CONT_PART_MAIN); + lv_style_int_t scrl_bottom = lv_obj_get_style_pad_bottom(ext->scrl, LV_CONT_PART_MAIN); /*Out of the page on the top*/ if((obj_h <= page_h && top_err > 0) || (obj_h > page_h && top_err < bot_err)) { @@ -475,10 +475,10 @@ void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_ lv_coord_t left_err = -(scrlable_x + obj_x); lv_coord_t right_err = scrlable_x + obj_x + obj_w - page_w; - lv_style_int_t bg_left = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t bg_right = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_RIGHT); - lv_style_int_t scrl_left = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_LEFT); - lv_style_int_t scrl_right = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_RIGHT); + lv_style_int_t bg_left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG); + lv_style_int_t bg_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG); + lv_style_int_t scrl_left = lv_obj_get_style_pad_top(ext->scrl, LV_CONT_PART_MAIN); + lv_style_int_t scrl_right = lv_obj_get_style_pad_bottom(ext->scrl, LV_CONT_PART_MAIN); /*Out of the page on the left*/ if((obj_w <= page_w && left_err > 0) || (obj_w > page_w && left_err < right_err)) { @@ -717,10 +717,6 @@ static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_ar } #endif - if(lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_CLIP_CORNER)) { - void * param = lv_draw_mask_remove_custom(page + 8); - lv_mem_buf_release(param); - } } return LV_DESIGN_RES_OK; @@ -775,9 +771,9 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) lv_fit_t fit_top = lv_page_get_scrl_fit_top(page); lv_bidi_dir_t base_dir = lv_obj_get_base_dir(page); - lv_style_int_t scrl_left = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_LEFT); - lv_style_int_t scrl_right = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_RIGHT); - lv_style_int_t scrl_top = lv_obj_get_style_int(ext->scrl, LV_CONT_PART_MAIN, LV_STYLE_PAD_TOP); + lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->scrl, LV_CONT_PART_MAIN); + lv_style_int_t scrl_right = lv_obj_get_style_pad_right(ext->scrl, LV_CONT_PART_MAIN); + lv_style_int_t scrl_top = lv_obj_get_style_pad_top(ext->scrl, LV_CONT_PART_MAIN); child = lv_obj_get_child(page, NULL); while(child != NULL) { @@ -811,7 +807,7 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) } else if(sign == LV_SIGNAL_STYLE_CHG) { ext->scrl->signal_cb(ext->scrl, LV_SIGNAL_COORD_CHG, &ext->scrl->coords); - lv_style_int_t sb_width = lv_obj_get_style_int(page, LV_PAGE_PART_SCRLBAR, LV_STYLE_SIZE); + lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCRLBAR); lv_area_set_height(&ext->sb.hor_area, sb_width); lv_area_set_width(&ext->sb.ver_area, sb_width); @@ -928,10 +924,10 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi } } - lv_style_int_t left = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t right = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_RIGHT); - lv_style_int_t top = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bottom = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_BOTTOM); + lv_style_int_t left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG); + lv_style_int_t right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG); + lv_style_int_t top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG); + lv_style_int_t bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG); /*scrollable width smaller then page width? -> align to left*/ if(lv_area_get_width(&scrl_coords) + left +right <= lv_area_get_width(&page_coords)) { @@ -1095,14 +1091,14 @@ static void lv_page_sb_refresh(lv_obj_t * page) lv_coord_t obj_w = lv_obj_get_width(page); lv_coord_t obj_h = lv_obj_get_height(page); - lv_style_int_t sb_width = lv_obj_get_style_int(page, LV_PAGE_PART_SCRLBAR, LV_STYLE_SIZE); - lv_style_int_t sb_right = lv_obj_get_style_int(page, LV_PAGE_PART_SCRLBAR, LV_STYLE_PAD_RIGHT); - lv_style_int_t sb_bottom = lv_obj_get_style_int(page, LV_PAGE_PART_SCRLBAR, LV_STYLE_PAD_BOTTOM); + lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCRLBAR); + lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCRLBAR); + lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCRLBAR); - lv_style_int_t bg_left = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t bg_right = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_RIGHT); - lv_style_int_t bg_top = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bg_bottom = lv_obj_get_style_int(page, LV_PAGE_PART_BG, LV_STYLE_PAD_BOTTOM); + lv_style_int_t bg_left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG); + lv_style_int_t bg_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG); + lv_style_int_t bg_top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG); + lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG); /*Always let 'scrollbar width' padding above, under, left and right to the scrollbars * else: @@ -1211,8 +1207,8 @@ static void lv_page_sb_refresh(lv_obj_t * page) static void refr_ext_draw_pad(lv_obj_t * page) { - lv_style_int_t sb_bottom = lv_obj_get_style_int(page, LV_PAGE_PART_SCRLBAR, LV_STYLE_PAD_BOTTOM); - lv_style_int_t sb_right = lv_obj_get_style_int(page, LV_PAGE_PART_SCRLBAR, LV_STYLE_PAD_RIGHT); + lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCRLBAR); + lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCRLBAR); /*Ensure ext. size for the scrollbars if they are out of the page*/ if(page->ext_draw_pad < (-sb_right)) page->ext_draw_pad = -sb_right; diff --git a/src/lv_objx/lv_roller.c b/src/lv_objx/lv_roller.c index f8f4e4759..6c87fe23a 100644 --- a/src/lv_objx/lv_roller.c +++ b/src/lv_objx/lv_roller.c @@ -239,8 +239,8 @@ void lv_roller_set_visible_row_count(lv_obj_t * roller, uint8_t row_cnt) LV_ASSERT_OBJ(roller, LV_OBJX_NAME); uint8_t n_line_space = (row_cnt > 1) ? row_cnt - 1 : 1; - const lv_font_t * font = lv_obj_get_style_ptr(roller, LV_ROLLER_PART_BG, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(roller, LV_ROLLER_PART_BG, LV_STYLE_LINE_SPACE); + const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); + lv_style_int_t line_space = lv_obj_get_style_line_space(roller, LV_ROLLER_PART_BG); lv_obj_set_height(roller, lv_font_get_line_height(font) * row_cnt + line_space * n_line_space); refr_position(roller, LV_ANIM_OFF); @@ -369,8 +369,8 @@ static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * cli else if(mode == LV_DESIGN_DRAW_MAIN) { draw_bg(roller, clip_area); - const lv_font_t * font = lv_obj_get_style_ptr(roller, LV_ROLLER_PART_BG, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(roller, LV_ROLLER_PART_BG, LV_STYLE_LINE_SPACE); + const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); + lv_style_int_t line_space = lv_obj_get_style_line_space(roller, LV_ROLLER_PART_BG); lv_coord_t font_h = lv_font_get_line_height(font); lv_area_t rect_area; rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - line_space / 2; @@ -571,9 +571,8 @@ static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, int32_t id = -1; lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); - - const lv_font_t * font = lv_obj_get_style_ptr(roller, LV_ROLLER_PART_BG, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(roller, LV_ROLLER_PART_BG, LV_STYLE_LINE_SPACE); + const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); + lv_style_int_t line_space = lv_obj_get_style_line_space(roller, LV_ROLLER_PART_BG); lv_coord_t font_h = lv_font_get_line_height(font); if(sign == LV_SIGNAL_DRAG_END) { @@ -677,8 +676,8 @@ static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en) lv_obj_t * roller_scrl = lv_page_get_scrl(roller); lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller); - const lv_font_t * font = lv_obj_get_style_ptr(roller, LV_ROLLER_PART_BG, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(roller, LV_ROLLER_PART_BG, LV_STYLE_LINE_SPACE); + const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); + lv_style_int_t line_space = lv_obj_get_style_line_space(roller, LV_ROLLER_PART_BG); lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t h = lv_obj_get_height(roller); uint16_t anim_time = lv_roller_get_anim_time(roller); @@ -780,8 +779,8 @@ static void refr_width(lv_obj_t * roller) lv_obj_t * label = get_label(roller); lv_coord_t label_w = lv_obj_get_width(label); - lv_style_int_t left = lv_obj_get_style_int(roller, LV_ROLLER_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t right = lv_obj_get_style_int(roller, LV_ROLLER_PART_BG, LV_STYLE_PAD_RIGHT); + lv_style_int_t left = lv_obj_get_style_pad_left(roller, LV_ROLLER_PART_BG); + lv_style_int_t right = lv_obj_get_style_pad_right(roller, LV_ROLLER_PART_BG); lv_obj_set_width(roller, label_w + left + right); @@ -821,8 +820,8 @@ static void inf_normalize(void * scrl) ext->sel_opt_id += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/ /*Move to the new id*/ - const lv_font_t * font = lv_obj_get_style_ptr(roller, LV_ROLLER_PART_BG, LV_STYLE_FONT); - lv_style_int_t line_space = lv_obj_get_style_int(roller, LV_ROLLER_PART_BG, LV_STYLE_LINE_SPACE); + const lv_font_t * font = lv_obj_get_style_font(roller, LV_ROLLER_PART_BG); + lv_style_int_t line_space = lv_obj_get_style_line_space(roller, LV_ROLLER_PART_BG); lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t h = lv_obj_get_height(roller); diff --git a/src/lv_objx/lv_slider.c b/src/lv_objx/lv_slider.c index 2998a5eaa..f6eb63e24 100644 --- a/src/lv_objx/lv_slider.c +++ b/src/lv_objx/lv_slider.c @@ -284,10 +284,10 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par lv_coord_t w = lv_obj_get_width(slider); lv_coord_t h = lv_obj_get_height(slider); - lv_style_int_t bg_left = lv_obj_get_style_int(slider, LV_SLIDER_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t bg_right = lv_obj_get_style_int(slider, LV_SLIDER_PART_BG, LV_STYLE_PAD_RIGHT); - lv_style_int_t bg_top = lv_obj_get_style_int(slider, LV_SLIDER_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bg_bottom = lv_obj_get_style_int(slider, LV_SLIDER_PART_BG, LV_STYLE_PAD_BOTTOM); + lv_style_int_t bg_left = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_BG); + lv_style_int_t bg_right = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_BG); + lv_style_int_t bg_top = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_BG); + lv_style_int_t bg_bottom = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_BG); int32_t range = ext->bar.max_value - ext->bar.min_value; int16_t new_value = 0; @@ -345,36 +345,36 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par slider->signal_cb(slider, LV_SIGNAL_REFR_EXT_DRAW_PAD, NULL); } } else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { - lv_style_int_t knob_left = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_PAD_LEFT); - lv_style_int_t knob_right = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_PAD_RIGHT); - lv_style_int_t knob_top = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_PAD_TOP); - lv_style_int_t knob_bottom = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_PAD_BOTTOM); + lv_style_int_t knob_left = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_right = lv_obj_get_style_pad_right(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_top = lv_obj_get_style_pad_top(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(slider, LV_SLIDER_PART_KNOB); /* The smaller size is the knob diameter*/ lv_coord_t knob_size = LV_MATH_MIN(lv_obj_get_width(slider), lv_obj_get_height(slider)) >> 1; knob_size += LV_MATH_MAX(LV_MATH_MAX(knob_left, knob_right), LV_MATH_MAX(knob_bottom,knob_top)); knob_size += 2; /*For rounding error*/ - lv_style_int_t knob_sh_width = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_SHADOW_WIDTH); - lv_style_int_t knob_sh_spread = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_SHADOW_SPREAD); - lv_style_int_t knob_sh_ox = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_SHADOW_OFFSET_X); - lv_style_int_t knob_sh_oy = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_SHADOW_OFFSET_Y); + lv_style_int_t knob_sh_width = lv_obj_get_style_shadow_width(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_sh_spread = lv_obj_get_style_shadow_spread(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_sh_ox = lv_obj_get_style_shadow_offset_x(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_sh_oy = lv_obj_get_style_shadow_offset_y(slider, LV_SLIDER_PART_KNOB); knob_size += knob_sh_width + knob_sh_spread; knob_size += LV_MATH_MAX(LV_MATH_ABS(knob_sh_ox), LV_MATH_ABS(knob_sh_oy)); - lv_style_int_t bg_sh_width = lv_obj_get_style_int(slider, LV_SLIDER_PART_BG, LV_STYLE_SHADOW_WIDTH); - lv_style_int_t bg_sh_spread = lv_obj_get_style_int(slider, LV_SLIDER_PART_BG, LV_STYLE_SHADOW_SPREAD); - lv_style_int_t bg_sh_ox = lv_obj_get_style_int(slider, LV_SLIDER_PART_BG, LV_STYLE_SHADOW_OFFSET_X); - lv_style_int_t bg_sh_oy = lv_obj_get_style_int(slider, LV_SLIDER_PART_BG, LV_STYLE_SHADOW_OFFSET_Y); + lv_style_int_t bg_sh_width = lv_obj_get_style_shadow_width(slider, LV_SLIDER_PART_BG); + lv_style_int_t bg_sh_spread = lv_obj_get_style_shadow_spread(slider, LV_SLIDER_PART_BG); + lv_style_int_t bg_sh_ox = lv_obj_get_style_shadow_offset_x(slider, LV_SLIDER_PART_BG); + lv_style_int_t bg_sh_oy = lv_obj_get_style_shadow_offset_y(slider, LV_SLIDER_PART_BG); lv_coord_t bg_size = bg_sh_width + bg_sh_spread; bg_size += LV_MATH_MAX(LV_MATH_ABS(bg_sh_ox), LV_MATH_ABS(bg_sh_oy)); - lv_style_int_t indic_sh_width = lv_obj_get_style_int(slider, LV_SLIDER_PART_INDIC, LV_STYLE_SHADOW_WIDTH); - lv_style_int_t indic_sh_spread = lv_obj_get_style_int(slider, LV_SLIDER_PART_INDIC, LV_STYLE_SHADOW_SPREAD); - lv_style_int_t indic_sh_ox = lv_obj_get_style_int(slider, LV_SLIDER_PART_INDIC, LV_STYLE_SHADOW_OFFSET_X); - lv_style_int_t indic_sh_oy = lv_obj_get_style_int(slider, LV_SLIDER_PART_INDIC, LV_STYLE_SHADOW_OFFSET_Y); + lv_style_int_t indic_sh_width = lv_obj_get_style_shadow_width(slider, LV_SLIDER_PART_INDIC); + lv_style_int_t indic_sh_spread = lv_obj_get_style_shadow_spread(slider, LV_SLIDER_PART_INDIC); + lv_style_int_t indic_sh_ox = lv_obj_get_style_shadow_offset_x(slider, LV_SLIDER_PART_INDIC); + lv_style_int_t indic_sh_oy = lv_obj_get_style_shadow_offset_y(slider, LV_SLIDER_PART_INDIC); lv_coord_t indic_size = indic_sh_width + indic_sh_spread; indic_size += LV_MATH_MAX(LV_MATH_ABS(indic_sh_ox), LV_MATH_ABS(indic_sh_oy)); @@ -443,10 +443,10 @@ static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv knob_area->x2 = slider->coords.x2; } - lv_style_int_t knob_left = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_PAD_LEFT); - lv_style_int_t knob_right = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_PAD_RIGHT); - lv_style_int_t knob_top = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_PAD_TOP); - lv_style_int_t knob_bottom = lv_obj_get_style_int(slider, LV_SLIDER_PART_KNOB, LV_STYLE_PAD_BOTTOM); + lv_style_int_t knob_left = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_right = lv_obj_get_style_pad_right(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_top = lv_obj_get_style_pad_top(slider, LV_SLIDER_PART_KNOB); + lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(slider, LV_SLIDER_PART_KNOB); /*Apply the paddings on the knob area*/ knob_area->x1 -= knob_left; diff --git a/src/lv_objx/lv_sw.c b/src/lv_objx/lv_sw.c index 9111bc050..e82c94232 100644 --- a/src/lv_objx/lv_sw.c +++ b/src/lv_objx/lv_sw.c @@ -209,8 +209,8 @@ static lv_design_res_t lv_sw_design(lv_obj_t * sw, const lv_area_t * clip_area, lv_coord_t knob_size = objh; lv_area_t knob_area; - lv_style_int_t bg_left = lv_obj_get_style_int(sw, LV_SW_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t bg_right = lv_obj_get_style_int(sw, LV_SW_PART_BG, LV_STYLE_PAD_RIGHT); + lv_style_int_t bg_left = lv_obj_get_style_pad_left(sw, LV_SW_PART_BG); + lv_style_int_t bg_right = lv_obj_get_style_pad_right(sw, LV_SW_PART_BG); lv_coord_t max_indic_w = objw - bg_left - bg_right; lv_coord_t act_indic_w = lv_area_get_width(&ext->bar.indic_area); @@ -221,10 +221,10 @@ static lv_design_res_t lv_sw_design(lv_obj_t * sw, const lv_area_t * clip_area, knob_area.y1 = sw->coords.y1; knob_area.y2 = sw->coords.y2; - lv_style_int_t knob_left = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_PAD_LEFT); - lv_style_int_t knob_right = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_PAD_RIGHT); - lv_style_int_t knob_top = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_PAD_TOP); - lv_style_int_t knob_bottom = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_PAD_BOTTOM); + lv_style_int_t knob_left = lv_obj_get_style_pad_left(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_right = lv_obj_get_style_pad_right(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_top = lv_obj_get_style_pad_top(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(sw, LV_SW_PART_KNOB); /*Apply the paddings on the knob area*/ knob_area.x1 -= knob_left; @@ -293,36 +293,36 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param) res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return res; }else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { - lv_style_int_t knob_left = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_PAD_LEFT); - lv_style_int_t knob_right = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_PAD_RIGHT); - lv_style_int_t knob_top = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_PAD_TOP); - lv_style_int_t knob_bottom = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_PAD_BOTTOM); + lv_style_int_t knob_left = lv_obj_get_style_pad_left(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_right = lv_obj_get_style_pad_right(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_top = lv_obj_get_style_pad_top(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(sw, LV_SW_PART_KNOB); /* The smaller size is the knob diameter*/ lv_coord_t knob_size; knob_size = LV_MATH_MAX(LV_MATH_MAX(knob_left, knob_right), LV_MATH_MAX(knob_bottom,knob_top)); knob_size += 2; /*For rounding error*/ - lv_style_int_t knob_sh_width = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_SHADOW_WIDTH); - lv_style_int_t knob_sh_spread = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_SHADOW_SPREAD); - lv_style_int_t knob_sh_ox = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_SHADOW_OFFSET_X); - lv_style_int_t knob_sh_oy = lv_obj_get_style_int(sw, LV_SW_PART_KNOB, LV_STYLE_SHADOW_OFFSET_Y); + lv_style_int_t knob_sh_width = lv_obj_get_style_shadow_width(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_sh_spread = lv_obj_get_style_shadow_spread(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_sh_ox = lv_obj_get_style_shadow_offset_x(sw, LV_SW_PART_KNOB); + lv_style_int_t knob_sh_oy = lv_obj_get_style_shadow_offset_y(sw, LV_SW_PART_KNOB); knob_size += knob_sh_width + knob_sh_spread; knob_size += LV_MATH_MAX(LV_MATH_ABS(knob_sh_ox), LV_MATH_ABS(knob_sh_oy)); - lv_style_int_t bg_sh_width = lv_obj_get_style_int(sw, LV_SW_PART_BG, LV_STYLE_SHADOW_WIDTH); - lv_style_int_t bg_sh_spread = lv_obj_get_style_int(sw, LV_SW_PART_BG, LV_STYLE_SHADOW_SPREAD); - lv_style_int_t bg_sh_ox = lv_obj_get_style_int(sw, LV_SW_PART_BG, LV_STYLE_SHADOW_OFFSET_X); - lv_style_int_t bg_sh_oy = lv_obj_get_style_int(sw, LV_SW_PART_BG, LV_STYLE_SHADOW_OFFSET_Y); + lv_style_int_t bg_sh_width = lv_obj_get_style_shadow_width(sw, LV_SW_PART_BG); + lv_style_int_t bg_sh_spread = lv_obj_get_style_shadow_spread(sw, LV_SW_PART_BG); + lv_style_int_t bg_sh_ox = lv_obj_get_style_shadow_offset_x(sw, LV_SW_PART_BG); + lv_style_int_t bg_sh_oy = lv_obj_get_style_shadow_offset_y(sw, LV_SW_PART_BG); lv_coord_t bg_size = bg_sh_width + bg_sh_spread; bg_size += LV_MATH_MAX(LV_MATH_ABS(bg_sh_ox), LV_MATH_ABS(bg_sh_oy)); - lv_style_int_t indic_sh_width = lv_obj_get_style_int(sw, LV_SW_PART_INDIC, LV_STYLE_SHADOW_WIDTH); - lv_style_int_t indic_sh_spread = lv_obj_get_style_int(sw, LV_SW_PART_INDIC, LV_STYLE_SHADOW_SPREAD); - lv_style_int_t indic_sh_ox = lv_obj_get_style_int(sw, LV_SW_PART_INDIC, LV_STYLE_SHADOW_OFFSET_X); - lv_style_int_t indic_sh_oy = lv_obj_get_style_int(sw, LV_SW_PART_INDIC, LV_STYLE_SHADOW_OFFSET_Y); + lv_style_int_t indic_sh_width = lv_obj_get_style_shadow_width(sw, LV_SW_PART_INDIC); + lv_style_int_t indic_sh_spread = lv_obj_get_style_shadow_spread(sw, LV_SW_PART_INDIC); + lv_style_int_t indic_sh_ox = lv_obj_get_style_shadow_offset_x(sw, LV_SW_PART_INDIC); + lv_style_int_t indic_sh_oy = lv_obj_get_style_shadow_offset_y(sw, LV_SW_PART_INDIC); lv_coord_t indic_size = indic_sh_width + indic_sh_spread; indic_size += LV_MATH_MAX(LV_MATH_ABS(indic_sh_ox), LV_MATH_ABS(indic_sh_oy)); diff --git a/src/lv_objx/lv_ta.c b/src/lv_objx/lv_ta.c index 812d62076..249fe91f0 100644 --- a/src/lv_objx/lv_ta.c +++ b/src/lv_objx/lv_ta.c @@ -122,7 +122,6 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy) ext->placeholder = NULL; lv_style_list_init(&ext->cursor.style); - lv_style_list_init(&ext->placeholder); #if LV_USE_ANIMATION == 0 ext->pwd_show_time = 0; @@ -423,8 +422,8 @@ void lv_ta_del_char(lv_obj_t * ta) /*Don't let 'width == 0' because cursor will not be visible*/ if(lv_obj_get_width(ext->label) == 0) { - lv_style_int_t line_width = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_LINE_WIDTH); - lv_obj_set_width(ext->label, line_width); + lv_style_int_t border_width = lv_obj_get_style_border_width(ta, LV_TA_PART_CURSOR); + lv_obj_set_width(ext->label, border_width == 0 ? 1 : border_width); } if(ext->pwd_mode != 0) { @@ -496,8 +495,8 @@ void lv_ta_set_text(lv_obj_t * ta, const char * txt) /*Don't let 'width == 0' because the cursor will not be visible*/ if(lv_obj_get_width(ext->label) == 0) { - lv_style_int_t line_width = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_LINE_WIDTH); - lv_obj_set_width(ext->label, line_width); + lv_style_int_t border_width = lv_obj_get_style_border_width(ta, LV_TA_PART_CURSOR); + lv_obj_set_width(ext->label, border_width == 0 ? 1 : border_width); } if(ext->pwd_mode != 0) { @@ -588,9 +587,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) /*Position the label to make the cursor visible*/ lv_obj_t * label_par = lv_obj_get_parent(ext->label); lv_point_t cur_pos; - const lv_font_t * font = lv_obj_get_style_ptr(ta, LV_TA_PART_BG, LV_STYLE_FONT); - lv_style_int_t top = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bottom = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_BOTTOM); + const lv_font_t * font = lv_obj_get_style_font(ta, LV_TA_PART_BG); + lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TA_PART_BG); + lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TA_PART_BG); lv_area_t label_cords; lv_area_t ta_cords; lv_label_get_letter_pos(ext->label, pos, &cur_pos); @@ -612,8 +611,8 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos) lv_obj_set_x(label_par, -cur_pos.x + font_h); } - lv_style_int_t right = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_RIGHT); - lv_style_int_t left = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_LEFT); + lv_style_int_t right = lv_obj_get_style_pad_right(ta, LV_TA_PART_BG); + lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TA_PART_BG); /*Check the right (use the font_h as general unit)*/ if(label_cords.x1 + cur_pos.x + font_h + right > ta_cords.x2) { lv_obj_set_x(label_par, -(cur_pos.x - lv_obj_get_width(ta) + font_h + left + right)); @@ -732,10 +731,10 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en) if(ext->one_line == en) return; if(en) { - lv_style_int_t top = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bottom = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_BOTTOM); - lv_style_int_t left = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_LEFT); - const lv_font_t * font = lv_obj_get_style_ptr(ta, LV_TA_PART_BG, LV_STYLE_FONT); + lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TA_PART_BG); + lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TA_PART_BG); + lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TA_PART_BG); + const lv_font_t * font = lv_obj_get_style_font(ta, LV_TA_PART_BG); lv_coord_t font_h = lv_font_get_line_height(font); ext->one_line = 1; @@ -745,8 +744,8 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en) if(ext->placeholder) lv_label_set_long_mode(ext->placeholder, LV_LABEL_LONG_EXPAND); lv_obj_set_pos(lv_page_get_scrl(ta), left, top); } else { - lv_style_int_t top = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t left = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_LEFT); + lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TA_PART_BG); + lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TA_PART_BG); ext->one_line = 0; lv_page_set_scrl_fit2(ta, LV_FIT_FLOOD, LV_FIT_TIGHT); lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK); @@ -1208,8 +1207,8 @@ void lv_ta_cursor_down(lv_obj_t * ta) /*Increment the y with one line and keep the valid x*/ - lv_style_int_t line_space = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_LINE_SPACE); - const lv_font_t * font = lv_obj_get_style_ptr(ta, LV_TA_PART_BG, LV_STYLE_FONT); + lv_style_int_t line_space = lv_obj_get_style_line_space(ta, LV_TA_PART_BG); + const lv_font_t * font = lv_obj_get_style_font(ta, LV_TA_PART_BG); lv_coord_t font_h = lv_font_get_line_height(font); pos.y += font_h + line_space + 1; pos.x = ext->cursor.valid_x; @@ -1240,8 +1239,8 @@ void lv_ta_cursor_up(lv_obj_t * ta) lv_label_get_letter_pos(ext->label, lv_ta_get_cursor_pos(ta), &pos); /*Decrement the y with one line and keep the valid x*/ - lv_style_int_t line_space = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_LINE_SPACE); - const lv_font_t * font = lv_obj_get_style_ptr(ta, LV_TA_PART_BG, LV_STYLE_FONT); + lv_style_int_t line_space = lv_obj_get_style_line_space(ta, LV_TA_PART_BG); + const lv_font_t * font = lv_obj_get_style_font(ta, LV_TA_PART_BG); lv_coord_t font_h = lv_font_get_line_height(font); pos.y -= font_h + line_space - 1; pos.x = ext->cursor.valid_x; @@ -1332,8 +1331,8 @@ static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t memcpy(letter_buf, &txt[ext->cursor.txt_byte_pos], lv_txt_encoded_size(&txt[ext->cursor.txt_byte_pos])); if(cur_dsc.bg_opa == LV_OPA_COVER) { - lv_style_int_t left = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_LEFT); - lv_style_int_t top = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_TOP); + lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TA_PART_CURSOR); + lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TA_PART_CURSOR); cur_area.x1 += left; cur_area.y1 += top; @@ -1389,9 +1388,9 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param) } else if(sign == LV_SIGNAL_STYLE_CHG) { if(ext->label) { if(ext->one_line) { - lv_style_int_t top = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bottom = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_PAD_BOTTOM); - const lv_font_t * font = lv_obj_get_style_ptr(ta, LV_TA_PART_BG, LV_STYLE_FONT); + lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TA_PART_BG); + lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TA_PART_BG); + const lv_font_t * font = lv_obj_get_style_font(ta, LV_TA_PART_BG); /*In one line mode refresh the Text Area height because 'vpad' can modify it*/ lv_coord_t font_h = lv_font_get_line_height(font); @@ -1504,8 +1503,8 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) { /*Set ext. size because the cursor might be out of this object*/ - lv_style_int_t line_space = lv_obj_get_style_int(ta, LV_TA_PART_BG, LV_STYLE_LINE_SPACE); - const lv_font_t * font = lv_obj_get_style_ptr(ta, LV_TA_PART_BG, LV_STYLE_FONT); + lv_style_int_t line_space = lv_obj_get_style_line_space(ta, LV_TA_PART_BG); + const lv_font_t * font = lv_obj_get_style_font(ta, LV_TA_PART_BG); lv_coord_t font_h = lv_font_get_line_height(font); scrl->ext_draw_pad = LV_MATH_MAX(scrl->ext_draw_pad, line_space + font_h); } else if(sign == LV_SIGNAL_COORD_CHG) { @@ -1726,10 +1725,10 @@ static void refr_cursor_area(lv_obj_t * ta) ext->cursor.txt_byte_pos = byte_pos; /*Calculate the cursor according to its type*/ - lv_style_int_t top = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_TOP); - lv_style_int_t bottom = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_BOTTOM); - lv_style_int_t left = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_LEFT); - lv_style_int_t right = lv_obj_get_style_int(ta, LV_TA_PART_CURSOR, LV_STYLE_PAD_RIGHT); + lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TA_PART_CURSOR); + lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TA_PART_CURSOR); + lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TA_PART_CURSOR); + lv_style_int_t right = lv_obj_get_style_pad_top(ta, LV_TA_PART_CURSOR); lv_area_t cur_area; cur_area.x1 = letter_pos.x - left; diff --git a/src/lv_objx/lv_table.c b/src/lv_objx/lv_table.c index 1a62049e8..fe49e811a 100644 --- a/src/lv_objx/lv_table.c +++ b/src/lv_objx/lv_table.c @@ -589,8 +589,8 @@ static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_ lv_area_t txt_area; lv_txt_flag_t txt_flags; - lv_style_int_t bg_top = lv_obj_get_style_int(table, LV_TABLE_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bg_left= lv_obj_get_style_int(table, LV_TABLE_PART_BG, LV_STYLE_PAD_LEFT); + lv_style_int_t bg_top = lv_obj_get_style_pad_top(table, LV_TABLE_PART_BG); + lv_style_int_t bg_left= lv_obj_get_style_pad_left(table, LV_TABLE_PART_BG); lv_draw_rect_dsc_t rect_dsc[LV_TABLE_CELL_STYLE_CNT]; lv_draw_label_dsc_t label_dsc[LV_TABLE_CELL_STYLE_CNT]; @@ -611,10 +611,10 @@ static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_ lv_draw_line_dsc_init(&line_dsc[i]); lv_obj_init_draw_line_dsc(table, LV_TABLE_PART_CELL1 + i, &line_dsc[i]); - cell_left[i] = lv_obj_get_style_int(table, LV_TABLE_PART_CELL1 + i, LV_STYLE_PAD_LEFT); - cell_right[i] = lv_obj_get_style_int(table, LV_TABLE_PART_CELL1 + i, LV_STYLE_PAD_RIGHT); - cell_top[i] = lv_obj_get_style_int(table, LV_TABLE_PART_CELL1 + i, LV_STYLE_PAD_TOP); - cell_bottom[i] = lv_obj_get_style_int(table, LV_TABLE_PART_CELL1 + i, LV_STYLE_PAD_BOTTOM); + cell_left[i] = lv_obj_get_style_pad_left(table, LV_TABLE_PART_CELL1 + i); + cell_right[i] = lv_obj_get_style_pad_right(table, LV_TABLE_PART_CELL1 + i); + cell_top[i] = lv_obj_get_style_pad_top(table, LV_TABLE_PART_CELL1 + i); + cell_bottom[i] = lv_obj_get_style_pad_bottom(table, LV_TABLE_PART_CELL1 + i); } uint16_t col; @@ -837,10 +837,10 @@ static void refr_size(lv_obj_t * table) h += get_row_height(table, i); } - lv_style_int_t bg_top = lv_obj_get_style_int(table, LV_TABLE_PART_BG, LV_STYLE_PAD_TOP); - lv_style_int_t bg_bottom= lv_obj_get_style_int(table, LV_TABLE_PART_BG, LV_STYLE_PAD_BOTTOM); - lv_style_int_t bg_left = lv_obj_get_style_int(table, LV_TABLE_PART_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t bg_right= lv_obj_get_style_int(table, LV_TABLE_PART_BG, LV_STYLE_PAD_RIGHT); + lv_style_int_t bg_top = lv_obj_get_style_pad_top(table, LV_TABLE_PART_BG); + lv_style_int_t bg_bottom= lv_obj_get_style_pad_bottom(table, LV_TABLE_PART_BG); + lv_style_int_t bg_left = lv_obj_get_style_pad_left(table, LV_TABLE_PART_BG); + lv_style_int_t bg_right= lv_obj_get_style_pad_right(table, LV_TABLE_PART_BG); w += bg_left + bg_right; h += bg_top + bg_bottom; @@ -864,10 +864,10 @@ static lv_coord_t get_row_height(lv_obj_t * table, uint16_t row_id) lv_draw_label_dsc_init(&label_dsc[i]); lv_obj_init_draw_label_dsc(table, LV_TABLE_PART_CELL1 + i, &label_dsc[i]); - cell_left[i] = lv_obj_get_style_int(table, LV_TABLE_PART_CELL1 + i, LV_STYLE_PAD_LEFT); - cell_right[i] = lv_obj_get_style_int(table, LV_TABLE_PART_CELL1 + i, LV_STYLE_PAD_RIGHT); - cell_top[i] = lv_obj_get_style_int(table, LV_TABLE_PART_CELL1 + i, LV_STYLE_PAD_TOP); - cell_bottom[i] = lv_obj_get_style_int(table, LV_TABLE_PART_CELL1 + i, LV_STYLE_PAD_BOTTOM); + cell_left[i] = lv_obj_get_style_pad_left(table, LV_TABLE_PART_CELL1 + i); + cell_right[i] = lv_obj_get_style_pad_right(table, LV_TABLE_PART_CELL1 + i); + cell_top[i] = lv_obj_get_style_pad_top(table, LV_TABLE_PART_CELL1 + i); + cell_bottom[i] = lv_obj_get_style_pad_bottom(table, LV_TABLE_PART_CELL1 + i); } diff --git a/src/lv_objx/lv_tabview.c b/src/lv_objx/lv_tabview.c index b8272437b..d313ed09d 100644 --- a/src/lv_objx/lv_tabview.c +++ b/src/lv_objx/lv_tabview.c @@ -327,8 +327,8 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an } lv_coord_t cont_x; - lv_style_int_t scrl_inner = lv_obj_get_style_int(ext->content, LV_PAGE_PART_SCRL, LV_STYLE_PAD_INNER); - lv_style_int_t scrl_left = lv_obj_get_style_int(ext->content, LV_PAGE_PART_SCRL, LV_STYLE_PAD_LEFT); + lv_style_int_t scrl_inner = lv_obj_get_style_pad_inner(ext->content, LV_PAGE_PART_SCRL); + lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->content, LV_PAGE_PART_SCRL); switch(ext->btns_pos) { default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/ @@ -369,9 +369,9 @@ void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t an lv_coord_t indic_size; lv_coord_t indic_pos = 0; /*silence uninitialized variable warning*/; - lv_style_int_t btns_bg_inner = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB_BG, LV_STYLE_PAD_INNER); - lv_style_int_t btns_bg_left = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t btns_bg_top = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB_BG, LV_STYLE_PAD_TOP); + lv_style_int_t btns_bg_inner = lv_obj_get_style_pad_inner(tabview, LV_TABVIEW_PART_TAB_BG); + lv_style_int_t btns_bg_left = lv_obj_get_style_pad_left(tabview, LV_TABVIEW_PART_TAB_BG); + lv_style_int_t btns_bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB_BG); switch(ext->btns_pos) { default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/ @@ -818,7 +818,7 @@ static void refr_indic_size(lv_obj_t * tabview) lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); lv_btnm_ext_t * btnm_ext = lv_obj_get_ext_attr(ext->btns); - lv_coord_t indic_size = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_INDIC, LV_STYLE_SIZE); + lv_coord_t indic_size = lv_obj_get_style_size(tabview, LV_TABVIEW_PART_INDIC); /*Set the indicator width/height*/ lv_coord_t indic_w; @@ -864,17 +864,17 @@ static void refr_btns_size(lv_obj_t * tabview) { lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); - lv_style_int_t btn_bg_left = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB_BG, LV_STYLE_PAD_LEFT); - lv_style_int_t btn_bg_right = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB_BG, LV_STYLE_PAD_RIGHT); - lv_style_int_t btn_bg_top = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB_BG, LV_STYLE_PAD_TOP); - lv_style_int_t btn_bg_bottom = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB_BG, LV_STYLE_PAD_BOTTOM); + lv_style_int_t tab_bg_left = lv_obj_get_style_pad_left(tabview, LV_TABVIEW_PART_TAB_BG); + lv_style_int_t tab_bg_right = lv_obj_get_style_pad_right(tabview, LV_TABVIEW_PART_TAB_BG); + lv_style_int_t tab_bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB_BG); + lv_style_int_t tab_bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB_BG); - lv_style_int_t btn_left = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB, LV_STYLE_PAD_LEFT); - lv_style_int_t btn_right = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB, LV_STYLE_PAD_RIGHT); - lv_style_int_t btn_top = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB, LV_STYLE_PAD_TOP); - lv_style_int_t btn_bottom = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_TAB, LV_STYLE_PAD_BOTTOM); + lv_style_int_t tab_left = lv_obj_get_style_pad_left(tabview, LV_TABVIEW_PART_TAB); + lv_style_int_t tab_right = lv_obj_get_style_pad_right(tabview, LV_TABVIEW_PART_TAB); + lv_style_int_t tab_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB); + lv_style_int_t tab_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB); - const lv_font_t * font = lv_obj_get_style_ptr(tabview, LV_TABVIEW_PART_TAB, LV_STYLE_FONT); + const lv_font_t * font = lv_obj_get_style_font(tabview, LV_TABVIEW_PART_TAB); /*Set the tabs height/width*/ lv_coord_t btns_w; @@ -890,7 +890,7 @@ static void refr_btns_size(lv_obj_t * tabview) case LV_TABVIEW_BTNS_POS_TOP: case LV_TABVIEW_BTNS_POS_BOTTOM: lv_obj_set_hidden(ext->btns, false); - btns_h = lv_font_get_line_height(font) + btn_top + btn_bottom + btn_bg_top + btn_bg_bottom; + btns_h = lv_font_get_line_height(font) + tab_top + tab_bottom + tab_bg_top + tab_bg_bottom; btns_w = lv_obj_get_width(tabview); break; @@ -898,7 +898,7 @@ static void refr_btns_size(lv_obj_t * tabview) case LV_TABVIEW_BTNS_POS_RIGHT: lv_obj_set_hidden(ext->btns, false); btns_w = lv_font_get_glyph_width(font, 'A', '\0') + - btn_left + btn_right + btn_bg_left + btn_bg_right; + tab_left + tab_right + tab_bg_left + tab_bg_right; btns_h = lv_obj_get_height(tabview); break; } @@ -933,8 +933,8 @@ static void refr_content_size(lv_obj_t * tabview) lv_obj_set_size(ext->content, cont_w, cont_h); /*Refresh the size of the tab pages too. `ext->content` has a layout to align the pages*/ - lv_style_int_t bg_top = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_BG_SCRL, LV_STYLE_PAD_TOP); - lv_style_int_t bg_bottom = lv_obj_get_style_int(tabview, LV_TABVIEW_PART_BG_SCRL, LV_STYLE_PAD_BOTTOM); + lv_style_int_t bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_BG_SCRL); + lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_BG_SCRL); cont_h -= bg_top + bg_bottom; lv_obj_t * content_scrl = lv_page_get_scrl(ext->content); lv_obj_t * pages = lv_obj_get_child(content_scrl, NULL);