fixes and updates according to test results
This commit is contained in:
@@ -285,10 +285,10 @@ static bool lv_bar_design(lv_obj_t * bar, const area_t * mask, lv_design_mode_t
|
||||
lv_style_t * style_indic = lv_bar_get_indicator_style(bar);
|
||||
area_t indic_area;
|
||||
area_cpy(&indic_area, &bar->coords);
|
||||
indic_area.x1 += style_indic->body.padding.horizontal;
|
||||
indic_area.x2 -= style_indic->body.padding.horizontal;
|
||||
indic_area.y1 += style_indic->body.padding.vertical;
|
||||
indic_area.y2 -= style_indic->body.padding.vertical;
|
||||
indic_area.x1 += style_indic->body.padding.hor;
|
||||
indic_area.x2 -= style_indic->body.padding.hor;
|
||||
indic_area.y1 += style_indic->body.padding.ver;
|
||||
indic_area.y2 -= style_indic->body.padding.ver;
|
||||
|
||||
cord_t w = area_get_width(&indic_area);
|
||||
cord_t h = area_get_height(&indic_area);
|
||||
|
||||
@@ -267,9 +267,9 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
|
||||
/*Set size and positions of the buttons*/
|
||||
lv_style_t * btnms = lv_obj_get_style(btnm);
|
||||
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->body.padding.horizontal;
|
||||
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->body.padding.vertical;
|
||||
cord_t act_y = btnms->body.padding.vertical;
|
||||
cord_t max_w = lv_obj_get_width(btnm) - 2 * btnms->body.padding.hor;
|
||||
cord_t max_h = lv_obj_get_height(btnm) - 2 * btnms->body.padding.ver;
|
||||
cord_t act_y = btnms->body.padding.ver;
|
||||
|
||||
/*Count the lines to calculate button height*/
|
||||
uint8_t line_cnt = 1;
|
||||
@@ -308,7 +308,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
|
||||
/*Set the button size and positions and set the texts*/
|
||||
uint16_t i;
|
||||
cord_t act_x = btnms->body.padding.horizontal;
|
||||
cord_t act_x = btnms->body.padding.hor;
|
||||
cord_t act_unit_w;
|
||||
unit_act_cnt = 0;
|
||||
for(i = 0; i < btn_cnt; i++) {
|
||||
@@ -318,7 +318,7 @@ void lv_btnm_set_map(lv_obj_t * btnm, const char ** map)
|
||||
act_unit_w = (all_unit_w * get_button_width(map_p_tmp[i])) / unit_cnt;
|
||||
|
||||
/*Always recalculate act_x because of rounding errors */
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->body.padding.inner + btnms->body.padding.horizontal;
|
||||
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * btnms->body.padding.inner + btnms->body.padding.hor;
|
||||
|
||||
area_set(&ext->button_areas[btn_i], act_x,
|
||||
act_y,
|
||||
|
||||
@@ -69,7 +69,6 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Init the new checkbox object*/
|
||||
if(copy == NULL) {
|
||||
ext->bullet = lv_btn_create(new_cb, NULL);
|
||||
if(ancestor_bullet_design_f == NULL) ancestor_bullet_design_f = lv_obj_get_design_func(ext->bullet);
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
@@ -80,11 +79,12 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_cont_set_fit(new_cb, true, true);
|
||||
lv_btn_set_toggle(new_cb, true);
|
||||
|
||||
if(ancestor_bullet_design_f == NULL) ancestor_bullet_design_f = lv_obj_get_design_func(ext->bullet);
|
||||
lv_obj_set_click(ext->bullet, false);
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_PRETTY_COLOR));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_BUTTON_ON_RELEASED));
|
||||
lv_btn_set_style(new_cb, LV_BTN_STATE_ON_PRESSED, lv_style_get(LV_STYLE_BUTTON_ON_PRESSED));
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_OFF_RELEASED, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_OFF_PRESSED, lv_style_get(LV_STYLE_PRETTY_COLOR));
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_ON_RELEASED, lv_style_get(LV_STYLE_BUTTON_ON_RELEASED));
|
||||
lv_btn_set_style(ext->bullet, LV_BTN_STATE_ON_PRESSED, lv_style_get(LV_STYLE_BUTTON_ON_PRESSED));
|
||||
|
||||
ext->label = lv_label_create(new_cb, NULL);
|
||||
lv_obj_set_style(ext->label, NULL); /*Inherit the style of the parent*/
|
||||
@@ -125,6 +125,7 @@ bool lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
|
||||
if(valid != false) {
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_obj_set_size(ext->bullet, font_get_height(style->text.font), font_get_height(style->text.font));
|
||||
lv_btn_set_state(lv_cb_get_bullet(cb), lv_btn_get_state(cb));
|
||||
} else if(sign == LV_SIGNAL_PRESSED ||
|
||||
sign == LV_SIGNAL_RELEASED ||
|
||||
sign == LV_SIGNAL_PRESS_LOST) {
|
||||
@@ -243,7 +244,7 @@ static bool lv_bullet_design(lv_obj_t * bullet, const area_t * mask, lv_design_m
|
||||
lv_obj_t * bg = lv_obj_get_parent(bullet);
|
||||
lv_style_t * style_page = lv_obj_get_style(bg);
|
||||
lv_group_t * g = lv_obj_get_group(bg);
|
||||
if(style_page->body.empty != 0 || style_page->opacity == OPA_TRANSP) { /*Background is visible?*/
|
||||
if(style_page->body.empty != 0 || style_page->opa == OPA_TRANSP) { /*Background is visible?*/
|
||||
if(lv_group_get_focused(g) == bg) {
|
||||
lv_style_t * style_mod;
|
||||
style_mod = lv_group_mod_style(g, style_ori);
|
||||
|
||||
@@ -71,10 +71,10 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
ext->dl_num = 0;
|
||||
ext->ymin = LV_CHART_YMIN_DEF;
|
||||
ext->ymax = LV_CHART_YMAX_DEF;
|
||||
ext->hdiv_num = LV_CHART_HDIV_DEF;
|
||||
ext->vdiv_num = LV_CHART_VDIV_DEF;
|
||||
ext->hdiv_cnt = LV_CHART_HDIV_DEF;
|
||||
ext->vdiv_cnt = LV_CHART_VDIV_DEF;
|
||||
ext->pnum = LV_CHART_PNUM_DEF;
|
||||
ext->type = LV_CHART_LINE;
|
||||
ext->type = LV_CHART_TYPE_LINE;
|
||||
ext->dl_opa = OPA_COVER;
|
||||
ext->dl_dark = OPA_50;
|
||||
ext->dl_width = 2 << LV_ANTIALIAS;
|
||||
@@ -87,13 +87,14 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Init the new chart background object*/
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_style(new_chart, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_size(new_chart, LV_HOR_RES / 2, LV_VER_RES / 2);
|
||||
} else {
|
||||
lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
|
||||
ext->type = ext_copy->type;
|
||||
ext->ymin = ext_copy->ymin;
|
||||
ext->ymax = ext_copy->ymax;
|
||||
ext->hdiv_num = ext_copy->hdiv_num;
|
||||
ext->vdiv_num = ext_copy->vdiv_num;
|
||||
ext->hdiv_cnt = ext_copy->hdiv_cnt;
|
||||
ext->vdiv_cnt = ext_copy->vdiv_cnt;
|
||||
ext->pnum = ext_copy->pnum;
|
||||
ext->dl_opa = ext_copy->dl_opa;
|
||||
|
||||
@@ -167,7 +168,7 @@ lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color)
|
||||
* Refresh a chart if its data line has changed
|
||||
* @param chart pointer to chart object
|
||||
*/
|
||||
void lv_chart_refr(lv_obj_t * chart)
|
||||
void lv_chart_refresh(lv_obj_t * chart)
|
||||
{
|
||||
lv_obj_invalidate(chart);
|
||||
}
|
||||
@@ -181,12 +182,12 @@ void lv_chart_refr(lv_obj_t * chart)
|
||||
* @param hdiv number of horizontal division lines
|
||||
* @param vdiv number of vertical division lines
|
||||
*/
|
||||
void lv_chart_set_hvdiv(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
|
||||
void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
|
||||
ext->hdiv_num = hdiv;
|
||||
ext->vdiv_num = vdiv;
|
||||
ext->hdiv_cnt = hdiv;
|
||||
ext->vdiv_cnt = vdiv;
|
||||
|
||||
lv_obj_invalidate(chart);
|
||||
}
|
||||
@@ -206,7 +207,7 @@ void lv_chart_set_range(lv_obj_t * chart, cord_t ymin, cord_t ymax)
|
||||
ext->ymin = ymin;
|
||||
ext->ymax = ymax;
|
||||
|
||||
lv_chart_refr(chart);
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -219,7 +220,7 @@ void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
ext->type = type;
|
||||
|
||||
lv_chart_refr(chart);
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,15 +232,25 @@ void lv_chart_set_pnum(lv_obj_t * chart, uint16_t pnum)
|
||||
{
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
lv_chart_dl_t * dl;
|
||||
uint16_t pnum_old = ext->pnum;
|
||||
uint16_t i;
|
||||
cord_t def = (ext->ymin + ext->ymax) >> 1; /*half range as default value*/
|
||||
|
||||
if(pnum < 1) pnum = 1;
|
||||
|
||||
LL_READ_BACK(ext->dl_ll, dl) {
|
||||
dl->points = dm_realloc(dl->points, sizeof(cord_t) * pnum);
|
||||
|
||||
/*Initialize the new points*/
|
||||
if(pnum > pnum_old) {
|
||||
for(i = pnum_old - 1; i < pnum; i++) {
|
||||
dl->points[i] = def;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ext->pnum = pnum;
|
||||
lv_chart_refr(chart);
|
||||
lv_chart_refresh(chart);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -291,7 +302,7 @@ void lv_chart_set_next(lv_obj_t * chart, lv_chart_dl_t * dl, cord_t y)
|
||||
}
|
||||
|
||||
dl->points[ext->pnum - 1] = y;
|
||||
lv_chart_refr(chart);
|
||||
lv_chart_refresh(chart);
|
||||
|
||||
}
|
||||
|
||||
@@ -384,9 +395,9 @@ static bool lv_chart_design(lv_obj_t * chart, const area_t * mask, lv_design_mod
|
||||
|
||||
lv_chart_draw_div(chart, mask);
|
||||
|
||||
if(ext->type & LV_CHART_LINE) lv_chart_draw_lines(chart, mask);
|
||||
if(ext->type & LV_CHART_COL) lv_chart_draw_cols(chart, mask);
|
||||
if(ext->type & LV_CHART_POINT) lv_chart_draw_points(chart, mask);
|
||||
if(ext->type & LV_CHART_TYPE_LINE) lv_chart_draw_lines(chart, mask);
|
||||
if(ext->type & LV_CHART_TYPE_COLUMN) lv_chart_draw_cols(chart, mask);
|
||||
if(ext->type & LV_CHART_TYPE_POINT) lv_chart_draw_points(chart, mask);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -411,20 +422,20 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
|
||||
cord_t x_ofs = chart->coords.x1;
|
||||
cord_t y_ofs = chart->coords.y1;
|
||||
|
||||
if(ext->hdiv_num != 0) {
|
||||
if(ext->hdiv_cnt != 0) {
|
||||
/*Draw slide lines if no border*/
|
||||
if(style->body.border.width != 0) {
|
||||
div_i_start = 1;
|
||||
div_i_end = ext->hdiv_num;
|
||||
div_i_end = ext->hdiv_cnt;
|
||||
} else {
|
||||
div_i_start = 0;
|
||||
div_i_end = ext->hdiv_num + 1;
|
||||
div_i_end = ext->hdiv_cnt + 1;
|
||||
}
|
||||
|
||||
p1.x = 0 + x_ofs;
|
||||
p2.x = w + x_ofs;
|
||||
for(div_i = div_i_start; div_i <= div_i_end; div_i++) {
|
||||
p1.y = (int32_t)((int32_t)h * div_i) / (ext->hdiv_num + 1);
|
||||
p1.y = (int32_t)((int32_t)h * div_i) / (ext->hdiv_cnt + 1);
|
||||
p1.y += y_ofs;
|
||||
if(div_i == div_i_start) p1.y += (style->line.width >> 1) + 1; /*The first line might not be visible*/
|
||||
if(div_i == div_i_end) p1.y -= (style->line.width >> 1) + 1; /*The last line might not be visible*/
|
||||
@@ -434,20 +445,20 @@ static void lv_chart_draw_div(lv_obj_t * chart, const area_t * mask)
|
||||
}
|
||||
}
|
||||
|
||||
if(ext->vdiv_num != 0) {
|
||||
if(ext->vdiv_cnt != 0) {
|
||||
/*Draw slide lines if no border*/
|
||||
if(style->body.border.width != 0) {
|
||||
div_i_start = 1;
|
||||
div_i_end = ext->vdiv_num;
|
||||
div_i_end = ext->vdiv_cnt;
|
||||
} else {
|
||||
div_i_start = 0;
|
||||
div_i_end = ext->vdiv_num + 1;
|
||||
div_i_end = ext->vdiv_cnt + 1;
|
||||
}
|
||||
|
||||
p1.y = 0 + y_ofs;
|
||||
p2.y = h + y_ofs;
|
||||
for(div_i = div_i_start; div_i <= div_i_end; div_i ++) {
|
||||
p1.x = (int32_t)((int32_t)w * div_i) / (ext->vdiv_num + 1);
|
||||
p1.x = (int32_t)((int32_t)w * div_i) / (ext->vdiv_cnt + 1);
|
||||
p1.x += x_ofs;
|
||||
if(div_i == div_i_start) p1.x += (style->line.width >> 1) + 1; /*The first line might not be visible*/
|
||||
if(div_i == div_i_end) p1.x -= (style->line.width >> 1) + 1; /*The last line might not be visible*/
|
||||
@@ -477,7 +488,7 @@ static void lv_chart_draw_lines(lv_obj_t * chart, const area_t * mask)
|
||||
lv_chart_dl_t * dl;
|
||||
lv_style_t lines;
|
||||
lv_style_copy(&lines, lv_style_get(LV_STYLE_PLAIN));
|
||||
lines.opacity = (uint16_t)((uint16_t)style->opacity * ext->dl_opa) >> 8;
|
||||
lines.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
lines.line.width = ext->dl_width;
|
||||
|
||||
/*Go through all data lines*/
|
||||
@@ -530,7 +541,7 @@ static void lv_chart_draw_points(lv_obj_t * chart, const area_t * mask)
|
||||
style_point.body.border.width = 0;
|
||||
style_point.body.empty = 0;
|
||||
style_point.body.radius = LV_RADIUS_CIRCLE;
|
||||
style_point.opacity = (uint16_t)((uint16_t)style->opacity * ext->dl_opa) >> 8;
|
||||
style_point.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
style_point.body.radius = ext->dl_width;
|
||||
|
||||
/*Go through all data lines*/
|
||||
@@ -581,7 +592,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const area_t * mask)
|
||||
rects.body.border.width = 0;
|
||||
rects.body.empty = 0;
|
||||
rects.body.radius = 0;
|
||||
rects.opacity = (uint16_t)((uint16_t)style->opacity * ext->dl_opa) >> 8;
|
||||
rects.opa = (uint16_t)((uint16_t)style->opa * ext->dl_opa) >> 8;
|
||||
|
||||
col_a.y2 = chart->coords.y2;
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ typedef struct
|
||||
ll_dsc_t dl_ll; /*Linked list for the data line pointers (stores lv_chart_dl_t)*/
|
||||
cord_t ymin; /*y min value (used to scale the data)*/
|
||||
cord_t ymax; /*y max value (used to scale the data)*/
|
||||
uint8_t hdiv_num; /*Number of horizontal division lines*/
|
||||
uint8_t vdiv_num; /*Number of vertical division lines*/
|
||||
uint8_t hdiv_cnt; /*Number of horizontal division lines*/
|
||||
uint8_t vdiv_cnt; /*Number of vertical division lines*/
|
||||
uint16_t pnum; /*Point number in a data line*/
|
||||
cord_t dl_width; /*Line width or point radius*/
|
||||
uint8_t dl_num; /*Number of data lines in dl_ll*/
|
||||
@@ -53,10 +53,9 @@ typedef struct
|
||||
/*Chart types*/
|
||||
typedef enum
|
||||
{
|
||||
LV_CHART_NONE = 0,
|
||||
LV_CHART_LINE = 0x01,
|
||||
LV_CHART_COL = 0x02,
|
||||
LV_CHART_POINT = 0x04,
|
||||
LV_CHART_TYPE_LINE = 0x01,
|
||||
LV_CHART_TYPE_COLUMN = 0x02,
|
||||
LV_CHART_TYPE_POINT = 0x04,
|
||||
}lv_chart_type_t;
|
||||
|
||||
|
||||
@@ -92,7 +91,7 @@ lv_chart_dl_t * lv_chart_add_data_line(lv_obj_t * chart, color_t color);
|
||||
* Refresh a chart if its data line has changed
|
||||
* @param chart pointer to chart object
|
||||
*/
|
||||
void lv_chart_refr(lv_obj_t * chart);
|
||||
void lv_chart_refresh(lv_obj_t * chart);
|
||||
|
||||
/**
|
||||
* Set the number of horizontal and vertical division lines
|
||||
@@ -100,7 +99,7 @@ void lv_chart_refr(lv_obj_t * chart);
|
||||
* @param hdiv number of horizontal division lines
|
||||
* @param vdiv number of vertical division lines
|
||||
*/
|
||||
void lv_chart_set_hvdiv(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv);
|
||||
void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv);
|
||||
|
||||
/**
|
||||
* Set the minimal and maximal x and y values
|
||||
|
||||
@@ -75,8 +75,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_obj_allocate_ext_attr(new_rect, sizeof(lv_cont_ext_t));
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(new_rect);
|
||||
dm_assert(ext);
|
||||
ext->hfit_en = 0;
|
||||
ext->vfit_en = 0;
|
||||
ext->hor_fit = 0;
|
||||
ext->ver_fit = 0;
|
||||
ext->layout = LV_CONT_LAYOUT_OFF;
|
||||
|
||||
lv_obj_set_signal_func(new_rect, lv_cont_signal);
|
||||
@@ -88,8 +88,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
lv_cont_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
ext->hfit_en = copy_ext->hfit_en;
|
||||
ext->vfit_en = copy_ext->vfit_en;
|
||||
ext->hor_fit = copy_ext->hor_fit;
|
||||
ext->ver_fit = copy_ext->ver_fit;
|
||||
ext->layout = copy_ext->layout;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
@@ -164,8 +164,8 @@ void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en)
|
||||
{
|
||||
lv_obj_invalidate(cont);
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
ext->hfit_en = hor_en == false ? 0 : 1;
|
||||
ext->vfit_en = ver_en == false ? 0 : 1;
|
||||
ext->hor_fit = hor_en == false ? 0 : 1;
|
||||
ext->ver_fit = ver_en == false ? 0 : 1;
|
||||
|
||||
/*Send a signal to set a new size*/
|
||||
cont->signal_func(cont, LV_SIGNAL_CORD_CHG, cont);
|
||||
@@ -191,10 +191,10 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont)
|
||||
* @param cont pointer to a container object
|
||||
* @return true: horizontal padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_hfit(lv_obj_t * cont)
|
||||
bool lv_cont_get_hor_fit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
return ext->hfit_en == 0 ? false : true;
|
||||
return ext->hor_fit == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -202,10 +202,10 @@ bool lv_cont_get_hfit(lv_obj_t * cont)
|
||||
* @param cont pointer to a container object
|
||||
* @return true: vertical padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_vfit(lv_obj_t * cont)
|
||||
bool lv_cont_get_ver_fit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
return ext->vfit_en == 0 ? false : true;
|
||||
return ext->ver_fit == 0 ? false : true;
|
||||
}
|
||||
|
||||
|
||||
@@ -281,7 +281,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
|
||||
|
||||
switch(type) {
|
||||
case LV_CONT_LAYOUT_COL_L:
|
||||
hpad_corr = style->body.padding.horizontal;
|
||||
hpad_corr = style->body.padding.hor;
|
||||
align = LV_ALIGN_IN_TOP_LEFT;
|
||||
break;
|
||||
case LV_CONT_LAYOUT_COL_M:
|
||||
@@ -289,7 +289,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
|
||||
align = LV_ALIGN_IN_TOP_MID;
|
||||
break;
|
||||
case LV_CONT_LAYOUT_COL_R:
|
||||
hpad_corr = -style->body.padding.horizontal;
|
||||
hpad_corr = -style->body.padding.hor;
|
||||
align = LV_ALIGN_IN_TOP_RIGHT;
|
||||
break;
|
||||
default:
|
||||
@@ -302,7 +302,7 @@ static void lv_cont_layout_col(lv_obj_t * cont)
|
||||
* an unnecessary child change signals could be sent*/
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
/* Align the children */
|
||||
cord_t last_cord = style->body.padding.vertical;
|
||||
cord_t last_cord = style->body.padding.ver;
|
||||
LL_READ_BACK(cont->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false ||
|
||||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
|
||||
@@ -326,11 +326,11 @@ static void lv_cont_layout_row(lv_obj_t * cont)
|
||||
/*Adjust margin and get the alignment type*/
|
||||
lv_align_t align;
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
cord_t vpad_corr = style->body.padding.vertical;
|
||||
cord_t vpad_corr = style->body.padding.ver;
|
||||
|
||||
switch(type) {
|
||||
case LV_CONT_LAYOUT_ROW_T:
|
||||
vpad_corr = style->body.padding.vertical;
|
||||
vpad_corr = style->body.padding.ver;
|
||||
align = LV_ALIGN_IN_TOP_LEFT;
|
||||
break;
|
||||
case LV_CONT_LAYOUT_ROW_M:
|
||||
@@ -338,7 +338,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
|
||||
align = LV_ALIGN_IN_LEFT_MID;
|
||||
break;
|
||||
case LV_CONT_LAYOUT_ROW_B:
|
||||
vpad_corr = -style->body.padding.vertical;
|
||||
vpad_corr = -style->body.padding.ver;
|
||||
align = LV_ALIGN_IN_BOTTOM_LEFT;
|
||||
break;
|
||||
default:
|
||||
@@ -352,7 +352,7 @@ static void lv_cont_layout_row(lv_obj_t * cont)
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/* Align the children */
|
||||
cord_t last_cord = style->body.padding.horizontal;
|
||||
cord_t last_cord = style->body.padding.hor;
|
||||
LL_READ_BACK(cont->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false ||
|
||||
lv_obj_is_protected(child, LV_PROTECT_POS) != false) continue;
|
||||
@@ -415,7 +415,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
|
||||
lv_obj_t * child_tmp; /* Temporary child */
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
cord_t w_obj = lv_obj_get_width(cont);
|
||||
cord_t act_y = style->body.padding.vertical;
|
||||
cord_t act_y = style->body.padding.ver;
|
||||
/* Disable child change action because the children will be moved a lot
|
||||
* an unnecessary child change signals could be sent*/
|
||||
|
||||
@@ -427,7 +427,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
|
||||
child_rc = child_rs; /*Initially the the row starter and closer is the same*/
|
||||
while(child_rs != NULL) {
|
||||
cord_t h_row = 0;
|
||||
cord_t w_row = style->body.padding.horizontal * 2; /*The width is at least the left+right hpad*/
|
||||
cord_t w_row = style->body.padding.hor * 2; /*The width is at least the left+right hpad*/
|
||||
uint32_t obj_num = 0;
|
||||
|
||||
/*Find the row closer object and collect some data*/
|
||||
@@ -476,7 +476,7 @@ static void lv_cont_layout_pretty(lv_obj_t * cont)
|
||||
else {
|
||||
w_row -= style->body.padding.inner * obj_num;
|
||||
cord_t new_opad = (w_obj - w_row) / (obj_num - 1);
|
||||
cord_t act_x = style->body.padding.horizontal; /*x init*/
|
||||
cord_t act_x = style->body.padding.hor; /*x init*/
|
||||
child_tmp = child_rs;
|
||||
while(child_tmp != NULL) {
|
||||
if(lv_obj_get_hidden(child_tmp) == false &&
|
||||
@@ -509,10 +509,10 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
|
||||
cord_t w_tot = lv_obj_get_width(cont);
|
||||
cord_t w_obj = lv_obj_get_width(lv_obj_get_child(cont, NULL));
|
||||
cord_t h_obj = lv_obj_get_height(lv_obj_get_child(cont, NULL));
|
||||
uint16_t obj_row = (w_tot - (2 * style->body.padding.horizontal)) / (w_obj + style->body.padding.inner); /*Obj. num. in a row*/
|
||||
uint16_t obj_row = (w_tot - (2 * style->body.padding.hor)) / (w_obj + style->body.padding.inner); /*Obj. num. in a row*/
|
||||
cord_t x_ofs;
|
||||
if(obj_row > 1) {
|
||||
x_ofs = w_obj + (w_tot - (2 * style->body.padding.horizontal) - (obj_row * w_obj)) / (obj_row - 1);
|
||||
x_ofs = w_obj + (w_tot - (2 * style->body.padding.hor) - (obj_row * w_obj)) / (obj_row - 1);
|
||||
} else {
|
||||
x_ofs = w_tot / 2 - w_obj / 2;
|
||||
}
|
||||
@@ -523,8 +523,8 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
|
||||
lv_obj_set_protect(cont, LV_PROTECT_CHILD_CHG);
|
||||
|
||||
/* Align the children */
|
||||
cord_t act_x = style->body.padding.horizontal;
|
||||
cord_t act_y = style->body.padding.vertical;
|
||||
cord_t act_x = style->body.padding.hor;
|
||||
cord_t act_y = style->body.padding.ver;
|
||||
uint16_t obj_cnt = 0;
|
||||
LL_READ_BACK(cont->child_ll, child) {
|
||||
if(lv_obj_get_hidden(child) != false ||
|
||||
@@ -540,7 +540,7 @@ static void lv_cont_layout_grid(lv_obj_t * cont)
|
||||
|
||||
if(obj_cnt >= obj_row) {
|
||||
obj_cnt = 0;
|
||||
act_x = style->body.padding.horizontal;
|
||||
act_x = style->body.padding.hor;
|
||||
act_y += y_ofs;
|
||||
}
|
||||
}
|
||||
@@ -556,8 +556,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
{
|
||||
lv_cont_ext_t * ext = lv_obj_get_ext_attr(cont);
|
||||
|
||||
if(ext->hfit_en == 0 &&
|
||||
ext->vfit_en == 0) {
|
||||
if(ext->hor_fit == 0 &&
|
||||
ext->ver_fit == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -565,8 +565,8 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
area_t ori;
|
||||
lv_style_t * style = lv_obj_get_style(cont);
|
||||
lv_obj_t * i;
|
||||
cord_t hpad = style->body.padding.horizontal;
|
||||
cord_t vpad = style->body.padding.vertical;
|
||||
cord_t hpad = style->body.padding.hor;
|
||||
cord_t vpad = style->body.padding.ver;
|
||||
|
||||
/*Search the side coordinates of the children*/
|
||||
lv_obj_get_coords(cont, &ori);
|
||||
@@ -587,14 +587,14 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
|
||||
|
||||
/*If the value is not the init value then the page has >=1 child.*/
|
||||
if(new_cords.x1 != CORD_MAX) {
|
||||
if(ext->hfit_en != 0) {
|
||||
if(ext->hor_fit != 0) {
|
||||
new_cords.x1 -= hpad;
|
||||
new_cords.x2 += hpad;
|
||||
} else {
|
||||
new_cords.x1 = cont->coords.x1;
|
||||
new_cords.x2 = cont->coords.x2;
|
||||
}
|
||||
if(ext->vfit_en != 0) {
|
||||
if(ext->ver_fit != 0) {
|
||||
new_cords.y1 -= vpad;
|
||||
new_cords.y2 += vpad;
|
||||
} else {
|
||||
|
||||
@@ -45,15 +45,16 @@ typedef struct
|
||||
{
|
||||
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
uint8_t layout :5; /*A layout from 'lv_cont_layout_t' enum*/
|
||||
uint8_t hfit_en :1; /*Enable horizontal padding to involve all children*/
|
||||
uint8_t vfit_en :1; /*Enable horizontal padding to involve all children*/
|
||||
uint8_t layout :4; /*A layout from 'lv_cont_layout_t' enum*/
|
||||
uint8_t hor_fit :1; /*1: Enable horizontal fit to involve all children*/
|
||||
uint8_t ver_fit :1; /*1: Enable horizontal fir to involve all children*/
|
||||
}lv_cont_ext_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
|
||||
|
||||
/**
|
||||
* Create a container objects
|
||||
* @param par pointer to an object, it will be the parent of the new container
|
||||
@@ -98,14 +99,14 @@ lv_cont_layout_t lv_cont_get_layout(lv_obj_t * cont);
|
||||
* @param cont pointer to a container object
|
||||
* @return true: horizontal padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_hfit(lv_obj_t * cont);
|
||||
bool lv_cont_get_hor_fit(lv_obj_t * cont);
|
||||
|
||||
/**
|
||||
* Get vertical fit enable attribute of a container
|
||||
* @param cont pointer to a container object
|
||||
* @return true: vertical padding is enabled
|
||||
*/
|
||||
bool lv_cont_get_vfit(lv_obj_t * cont);
|
||||
bool lv_cont_get_ver_fit(lv_obj_t * cont);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -67,14 +67,14 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
dm_assert(ext);
|
||||
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->opt_label = NULL;
|
||||
ext->cb = NULL;
|
||||
ext->options_label = NULL;
|
||||
ext->callback = NULL;
|
||||
ext->opened = 0;
|
||||
ext->fix_height = 0;
|
||||
ext->sel_opt = 0;
|
||||
ext->num_opt = 0;
|
||||
ext->selected_option_id = 0;
|
||||
ext->option_cnt = 0;
|
||||
ext->anim_time = LV_DDLIST_DEF_ANIM_TIME;
|
||||
ext->style_sel = lv_style_get(LV_STYLE_PLAIN_COLOR);
|
||||
ext->selected_style = lv_style_get(LV_STYLE_PLAIN_COLOR);
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_ddlist);
|
||||
@@ -89,7 +89,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_obj_set_style(scrl, lv_style_get(LV_STYLE_TRANSPARENT));
|
||||
lv_cont_set_fit(scrl, true, true);
|
||||
|
||||
ext->opt_label = lv_label_create(new_ddlist, NULL);
|
||||
ext->options_label = lv_label_create(new_ddlist, NULL);
|
||||
lv_cont_set_fit(new_ddlist, true, false);
|
||||
lv_page_set_rel_action(new_ddlist, lv_ddlist_rel_action);
|
||||
lv_page_set_sb_mode(new_ddlist, LV_PAGE_SB_MODE_DRAG);
|
||||
@@ -99,12 +99,14 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Copy an existing drop down list*/
|
||||
else {
|
||||
lv_ddlist_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
ext->opt_label = lv_label_create(new_ddlist, copy_ext->opt_label);
|
||||
lv_label_set_text(ext->opt_label, lv_label_get_text(copy_ext->opt_label));
|
||||
ext->sel_opt = copy_ext->sel_opt;
|
||||
ext->options_label = lv_label_create(new_ddlist, copy_ext->options_label);
|
||||
lv_label_set_text(ext->options_label, lv_label_get_text(copy_ext->options_label));
|
||||
ext->selected_option_id = copy_ext->selected_option_id;
|
||||
ext->fix_height = copy_ext->fix_height;
|
||||
ext->cb = copy_ext->cb;
|
||||
ext->num_opt = copy_ext->num_opt;
|
||||
ext->callback = copy_ext->callback;
|
||||
ext->option_cnt = copy_ext->option_cnt;
|
||||
ext->selected_style = copy_ext->selected_style;
|
||||
ext->anim_time = copy_ext->anim_time;
|
||||
|
||||
/*Refresh the style with new signal function*/
|
||||
lv_obj_refresh_style(new_ddlist);
|
||||
@@ -148,19 +150,19 @@ bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param)
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
char c = *((char*)param);
|
||||
if(c == LV_GROUP_KEY_RIGHT || c == LV_GROUP_KEY_DOWN) {
|
||||
if(ext->sel_opt +1 < ext->num_opt) {
|
||||
ext->sel_opt ++;
|
||||
if(ext->selected_option_id +1 < ext->option_cnt) {
|
||||
ext->selected_option_id ++;
|
||||
lv_obj_invalidate(ddlist);
|
||||
if(ext->cb != NULL) {
|
||||
ext->cb(ddlist);
|
||||
if(ext->callback != NULL) {
|
||||
ext->callback(ddlist);
|
||||
}
|
||||
}
|
||||
} else if(c == LV_GROUP_KEY_LEFT || c == LV_GROUP_KEY_UP) {
|
||||
if(ext->sel_opt > 0) {
|
||||
ext->sel_opt --;
|
||||
if(ext->selected_option_id > 0) {
|
||||
ext->selected_option_id --;
|
||||
lv_obj_invalidate(ddlist);
|
||||
if(ext->cb != NULL) {
|
||||
ext->cb(ddlist);
|
||||
if(ext->callback != NULL) {
|
||||
ext->callback(ddlist);
|
||||
}
|
||||
}
|
||||
} else if(c == LV_GROUP_KEY_ENTER || c == LV_GROUP_KEY_ESC) {
|
||||
@@ -190,15 +192,15 @@ void lv_ddlist_set_options(lv_obj_t * ddlist, const char ** options)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
|
||||
lv_label_set_text(ext->opt_label, "");
|
||||
lv_label_set_text(ext->options_label, "");
|
||||
uint16_t i = 0;
|
||||
while(options[i][0] != '\0') {
|
||||
lv_label_ins_text(ext->opt_label, LV_LABEL_POS_LAST, options[i]);
|
||||
if(options[i + 1][0] != '\0') lv_label_ins_text(ext->opt_label, LV_LABEL_POS_LAST, "\n");
|
||||
lv_label_ins_text(ext->options_label, LV_LABEL_POS_LAST, options[i]);
|
||||
if(options[i + 1][0] != '\0') lv_label_ins_text(ext->options_label, LV_LABEL_POS_LAST, "\n");
|
||||
i++;
|
||||
}
|
||||
|
||||
ext->num_opt = i;
|
||||
ext->option_cnt = i;
|
||||
|
||||
lv_ddlist_refr_size(ddlist, 0);
|
||||
}
|
||||
@@ -213,14 +215,14 @@ void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options)
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
|
||||
/*Count the '\n'-s to determine the number of options*/
|
||||
ext->num_opt = 0;
|
||||
ext->option_cnt = 0;
|
||||
uint16_t i;
|
||||
for(i = 0; options[i] != '\0'; i++) {
|
||||
if(options[i] == '\n') ext->num_opt++;
|
||||
if(options[i] == '\n') ext->option_cnt++;
|
||||
}
|
||||
ext->num_opt++; /*Last option in the at row*/
|
||||
ext->option_cnt++; /*Last option in the at row*/
|
||||
|
||||
lv_label_set_text(ext->opt_label, options);
|
||||
lv_label_set_text(ext->options_label, options);
|
||||
lv_ddlist_refr_size(ddlist, 0);
|
||||
}
|
||||
|
||||
@@ -233,7 +235,7 @@ void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
|
||||
ext->sel_opt = sel_opt < ext->num_opt ? sel_opt : ext->num_opt - 1;
|
||||
ext->selected_option_id = sel_opt < ext->option_cnt ? sel_opt : ext->option_cnt - 1;
|
||||
|
||||
/*Move the list to show the current option*/
|
||||
if(ext->opened == 0) {
|
||||
@@ -251,7 +253,7 @@ void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt)
|
||||
void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t cb)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
ext->cb = cb;
|
||||
ext->callback = cb;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -283,26 +285,37 @@ void lv_ddlist_set_anim_time(lv_obj_t * ddlist, uint16_t anim_time)
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param style pointer the new style of the select rectangle
|
||||
*/
|
||||
void lv_ddlist_set_style_select(lv_obj_t * ddlist, lv_style_t * style)
|
||||
void lv_ddlist_set_selected_style(lv_obj_t * ddlist, lv_style_t * style)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
ext->style_sel = style;
|
||||
ext->selected_style = style;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Open or Collapse the drop down list
|
||||
* Open the drop down list with or without animation
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param state true: open; false: collapse
|
||||
* @param anim true: use animations; false: not use animations
|
||||
* @param anim true: use animation; false: not use animations
|
||||
*/
|
||||
void lv_ddlist_open(lv_obj_t * ddlist, bool state, bool anim)
|
||||
void lv_ddlist_open(lv_obj_t * ddlist, bool anim)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
ext->opened = state ? 1 : 0;
|
||||
ext->opened = 1;
|
||||
lv_ddlist_refr_size(ddlist, anim ? ext->anim_time : 0);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Close (Collapse) the drop down list
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param anim true: use animation; false: not use animations
|
||||
*/
|
||||
void lv_ddlist_close(lv_obj_t * ddlist, bool anim)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
ext->opened = 0;
|
||||
lv_ddlist_refr_size(ddlist, anim ? ext->anim_time : 0);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -315,7 +328,7 @@ void lv_ddlist_open(lv_obj_t * ddlist, bool state, bool anim)
|
||||
const char * lv_ddlist_get_options(lv_obj_t * ddlist)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
return lv_label_get_text(ext->opt_label);
|
||||
return lv_label_get_text(ext->options_label);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -327,7 +340,7 @@ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
|
||||
return ext->sel_opt;
|
||||
return ext->selected_option_id;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -341,11 +354,11 @@ void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf)
|
||||
|
||||
uint16_t i;
|
||||
uint16_t line = 0;
|
||||
const char * opt_txt = lv_label_get_text(ext->opt_label);
|
||||
const char * opt_txt = lv_label_get_text(ext->options_label);
|
||||
uint16_t txt_len = strlen(opt_txt);
|
||||
|
||||
|
||||
for(i = 0; i < txt_len && line != ext->sel_opt; i++) {
|
||||
for(i = 0; i < txt_len && line != ext->selected_option_id; i++) {
|
||||
if(opt_txt[i] == '\n') line ++;
|
||||
}
|
||||
|
||||
@@ -374,9 +387,9 @@ cord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist)
|
||||
lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist)
|
||||
{
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
if(ext->style_sel == NULL) return lv_obj_get_style(ddlist);
|
||||
if(ext->selected_style == NULL) return lv_obj_get_style(ddlist);
|
||||
|
||||
return ext->style_sel;
|
||||
return ext->selected_style;
|
||||
}
|
||||
/**
|
||||
* Get the open/close animation time.
|
||||
@@ -420,15 +433,15 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const area_t * mask, lv_design_m
|
||||
const font_t * font = style->text.font;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
area_t rect_area;
|
||||
rect_area.y1 = ext->opt_label->coords.y1;
|
||||
rect_area.y1 += ext->sel_opt * (font_h + style->text.space_line);
|
||||
rect_area.y1 = ext->options_label->coords.y1;
|
||||
rect_area.y1 += ext->selected_option_id * (font_h + style->text.space_line);
|
||||
rect_area.y1 -= style->text.space_line / 2;
|
||||
|
||||
rect_area.y2 = rect_area.y1 + font_h + style->text.space_line;
|
||||
rect_area.x1 = ext->opt_label->coords.x1 - style->body.padding.horizontal;
|
||||
rect_area.x1 = ext->options_label->coords.x1 - style->body.padding.hor;
|
||||
rect_area.x2 = rect_area.x1 + lv_obj_get_width(lv_page_get_scrl(ddlist));
|
||||
|
||||
lv_draw_rect(&rect_area, mask, ext->style_sel);
|
||||
lv_draw_rect(&rect_area, mask, ext->selected_style);
|
||||
}
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
@@ -459,22 +472,22 @@ static lv_action_res_t lv_ddlist_rel_action(lv_obj_t * ddlist)
|
||||
lv_indev_t *indev = lv_indev_get_act();
|
||||
point_t p;
|
||||
lv_indev_get_point(indev, &p);
|
||||
p.x -= ext->opt_label->coords.x1;
|
||||
p.y -= ext->opt_label->coords.y1;
|
||||
p.x -= ext->options_label->coords.x1;
|
||||
p.y -= ext->options_label->coords.y1;
|
||||
uint16_t letter_i;
|
||||
letter_i = lv_label_get_letter_on(ext->opt_label, &p);
|
||||
letter_i = lv_label_get_letter_on(ext->options_label, &p);
|
||||
|
||||
uint16_t new_opt = 0;
|
||||
const char * txt = lv_label_get_text(ext->opt_label);
|
||||
const char * txt = lv_label_get_text(ext->options_label);
|
||||
uint16_t i;
|
||||
for(i = 0; i < letter_i; i++) {
|
||||
if(txt[i] == '\n') new_opt ++;
|
||||
}
|
||||
|
||||
ext->sel_opt = new_opt;
|
||||
ext->selected_option_id = new_opt;
|
||||
|
||||
if(ext->cb != NULL) {
|
||||
ext->cb(ddlist);
|
||||
if(ext->callback != NULL) {
|
||||
ext->callback(ddlist);
|
||||
}
|
||||
}
|
||||
lv_ddlist_refr_size(ddlist, ext->anim_time);
|
||||
@@ -494,11 +507,11 @@ static void lv_ddlist_refr_size(lv_obj_t * ddlist, uint16_t anim_time)
|
||||
lv_style_t * style = lv_obj_get_style(ddlist);
|
||||
cord_t new_height;
|
||||
if(ext->opened) { /*Open the list*/
|
||||
if(ext->fix_height == 0) new_height = lv_obj_get_height(lv_page_get_scrl(ddlist)) + 2 * style->body.padding.vertical;
|
||||
if(ext->fix_height == 0) new_height = lv_obj_get_height(lv_page_get_scrl(ddlist)) + 2 * style->body.padding.ver;
|
||||
else new_height = ext->fix_height;
|
||||
} else { /*Close the list*/
|
||||
const font_t * font = style->text.font;
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->opt_label);
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->options_label);
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
new_height = font_h + 2 * label_style->text.space_line;
|
||||
}
|
||||
@@ -534,11 +547,11 @@ static void lv_ddlist_pos_act_option(lv_obj_t * ddlist)
|
||||
lv_style_t * style = lv_obj_get_style(ddlist);
|
||||
const font_t * font = style->text.font;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->opt_label);
|
||||
lv_style_t * label_style = lv_obj_get_style(ext->options_label);
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ddlist);
|
||||
|
||||
cord_t h = lv_obj_get_height(ddlist);
|
||||
cord_t line_y1 = ext->sel_opt * (font_h + label_style->text.space_line) + ext->opt_label->coords.y1 - scrl->coords.y1;
|
||||
cord_t line_y1 = ext->selected_option_id * (font_h + label_style->text.space_line) + ext->options_label->coords.y1 - scrl->coords.y1;
|
||||
|
||||
lv_obj_set_y(scrl, - line_y1 + (h - font_h) / 2);
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ typedef struct
|
||||
{
|
||||
lv_page_ext_t page; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_obj_t * opt_label; /*Label for the options*/
|
||||
lv_style_t * style_sel; /*Style of the selected option*/
|
||||
lv_action_t cb; /*Pointer to function to call when an option is selected*/
|
||||
uint16_t num_opt; /*Number of options*/
|
||||
uint16_t sel_opt; /*Index of the current option*/
|
||||
lv_obj_t * options_label; /*Label for the options*/
|
||||
lv_style_t * selected_style; /*Style of the selected option*/
|
||||
lv_action_t callback; /*Pointer to function to call when an option is selected*/
|
||||
uint16_t option_cnt; /*Number of options*/
|
||||
uint16_t selected_option_id; /*Index of the current option*/
|
||||
uint16_t anim_time; /*Open/Close animation time [ms]*/
|
||||
uint8_t opened :1; /*1: The list is opened*/
|
||||
cord_t fix_height; /*Height if the ddlist is opened. (0: auto-size)*/
|
||||
@@ -74,15 +74,21 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, lv_obj_t * copy);
|
||||
bool lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
|
||||
|
||||
/**
|
||||
* Set the options in a drop down list
|
||||
* Set the options in a drop down list from an array
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param options an array of strings wit the text of the options.
|
||||
* @param options an array of strings with the text of the options.
|
||||
* The lest element has to be "" (empty string)
|
||||
* E.g. const char * opts[] = {"apple", "banana", "orange", ""};
|
||||
*/
|
||||
void lv_ddlist_set_options(lv_obj_t * ddlist, const char ** options);
|
||||
|
||||
/**
|
||||
* Set the options in a drop down list from a string
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
|
||||
*/
|
||||
void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options);
|
||||
|
||||
/**
|
||||
* Set the selected option
|
||||
* @param ddlist pointer to drop down list object
|
||||
@@ -90,7 +96,6 @@ void lv_ddlist_set_options_str(lv_obj_t * ddlist, const char * options);
|
||||
*/
|
||||
void lv_ddlist_set_selected(lv_obj_t * ddlist, uint16_t sel_opt);
|
||||
|
||||
|
||||
/**
|
||||
* Set a function to call when a new option is chosen
|
||||
* @param ddlist pointer to a drop down list
|
||||
@@ -106,20 +111,33 @@ void lv_ddlist_set_action(lv_obj_t * ddlist, lv_action_t cb);
|
||||
*/
|
||||
void lv_ddlist_set_fix_height(lv_obj_t * ddlist, cord_t h);
|
||||
|
||||
/**
|
||||
* Set the open/close animation time.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @param anim_time: open/close animation time [ms]
|
||||
*/
|
||||
void lv_ddlist_set_anim_time(lv_obj_t * ddlist, uint16_t anim_time);
|
||||
|
||||
/**
|
||||
* Set the style of the rectangle on the selected option
|
||||
* @param ddlist pointer to a drop down list object
|
||||
* @param style pointer the new style of the select rectangle
|
||||
*/
|
||||
void lv_ddlist_set_style_select(lv_obj_t * ddlist, lv_style_t * style);
|
||||
void lv_ddlist_set_selected_style(lv_obj_t * ddlist, lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Open or Collapse the drop down list
|
||||
* Open the drop down list with or without animation
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param state true: open; false: collapse
|
||||
* @param anim true: use animations; false: not use animations
|
||||
* @param anim true: use animation; false: not use animations
|
||||
*/
|
||||
void lv_ddlist_open(lv_obj_t * ddlist, bool state, bool anim);
|
||||
void lv_ddlist_open(lv_obj_t * ddlist, bool anim);
|
||||
|
||||
/**
|
||||
* Close (Collapse) the drop down list
|
||||
* @param ddlist pointer to drop down list object
|
||||
* @param anim true: use animation; false: not use animations
|
||||
*/
|
||||
void lv_ddlist_close(lv_obj_t * ddlist, bool anim);
|
||||
|
||||
/**
|
||||
* Get the options of a drop down list
|
||||
@@ -142,7 +160,6 @@ uint16_t lv_ddlist_get_selected(lv_obj_t * ddlist);
|
||||
*/
|
||||
void lv_ddlist_get_selected_str(lv_obj_t * ddlist, char * buf);
|
||||
|
||||
|
||||
/**
|
||||
* Get the fix height value.
|
||||
* @param ddlist pointer to a drop down list object
|
||||
@@ -157,6 +174,13 @@ cord_t lv_ddlist_get_fix_height(lv_obj_t * ddlist);
|
||||
*/
|
||||
lv_style_t * lv_ddlist_get_style_select(lv_obj_t * ddlist);
|
||||
|
||||
/**
|
||||
* Get the open/close animation time.
|
||||
* @param ddlist pointer to a drop down list
|
||||
* @return open/close animation time [ms]
|
||||
*/
|
||||
uint16_t lv_ddlist_get_anim_time(lv_obj_t * ddlist);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -25,7 +25,11 @@
|
||||
#define LV_GAUGE_MAX_NEEDLE 4 /*Max number of needles. Used in the style.*/
|
||||
#endif
|
||||
|
||||
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
|
||||
#define LV_GAUGE_DEF_NEEDLE_COLOR COLOR_RED
|
||||
#define LV_GAUGE_DEF_LABEL_COUNT 6
|
||||
#define LV_GAUGE_DEF_SCALE_LINE_COUNT 21 /*Should be: ((label_cnt - 1) * internal_lines) + 1*/
|
||||
#define LV_GAUGE_DEF_ANGLE 220
|
||||
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -35,8 +39,8 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mode_t mode);
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_t * style);
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style_t * style);
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask);
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -72,12 +76,10 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
dm_assert(ext);
|
||||
|
||||
/*Initialize the allocated 'ext' */
|
||||
ext->needle_num = 0;
|
||||
ext->needle_count = 0;
|
||||
ext->values = NULL;
|
||||
ext->needle_colors = NULL;
|
||||
ext->low_critical = 0;
|
||||
ext->style_critical = lv_style_get(LV_STYLE_PRETTY_COLOR);
|
||||
|
||||
ext->label_count = LV_GAUGE_DEF_LABEL_COUNT;
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_func(new_gauge);
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
@@ -86,7 +88,7 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
|
||||
/*Init the new gauge gauge*/
|
||||
if(copy == NULL) {
|
||||
lv_lmeter_set_scale(new_gauge, 220, 6);
|
||||
lv_lmeter_set_scale(new_gauge, LV_GAUGE_DEF_ANGLE, LV_GAUGE_DEF_SCALE_LINE_COUNT);
|
||||
lv_gauge_set_needle_num(new_gauge, 1, NULL);
|
||||
lv_obj_set_size(new_gauge, 2 * LV_DPI, 2 * LV_DPI);
|
||||
lv_obj_set_style(new_gauge, lv_style_get(LV_STYLE_PRETTY));
|
||||
@@ -94,12 +96,10 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
/*Copy an existing gauge*/
|
||||
else {
|
||||
lv_gauge_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
ext->low_critical = copy_ext->low_critical;
|
||||
lv_gauge_set_style_critical(new_gauge, lv_gauge_get_style_critical(copy));
|
||||
lv_gauge_set_needle_num(new_gauge, copy_ext->needle_num, copy_ext->needle_colors);
|
||||
lv_gauge_set_needle_num(new_gauge, copy_ext->needle_count, copy_ext->needle_colors);
|
||||
|
||||
uint8_t i;
|
||||
for(i = 0; i < ext->needle_num; i++) {
|
||||
for(i = 0; i < ext->needle_count; i++) {
|
||||
ext->values[i] = copy_ext->values[i];
|
||||
}
|
||||
|
||||
@@ -132,10 +132,6 @@ bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param)
|
||||
dm_free(ext->values);
|
||||
ext->values = NULL;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
|
||||
lv_style_t * style_crit = lv_gauge_get_style_critical(gauge);
|
||||
if(style_crit->body.shadow.width > gauge->ext_size) gauge->ext_size = style_crit->body.shadow.width;
|
||||
}
|
||||
}
|
||||
|
||||
return valid;
|
||||
@@ -148,10 +144,10 @@ bool lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param)
|
||||
/**
|
||||
* Set the number of needles
|
||||
* @param gauge pointer to gauge object
|
||||
* @param num number of needles
|
||||
* @param needle_cnt new count of needles
|
||||
* @param colors an array of colors for needles (with 'num' elements)
|
||||
*/
|
||||
void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t num, color_t * colors)
|
||||
void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t needle_cnt, color_t * colors)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
if(ext->values != NULL) {
|
||||
@@ -159,31 +155,41 @@ void lv_gauge_set_needle_num(lv_obj_t * gauge, uint8_t num, color_t * colors)
|
||||
ext->values = NULL;
|
||||
}
|
||||
|
||||
ext->values = dm_realloc(ext->values, num * sizeof(int16_t));
|
||||
ext->values = dm_realloc(ext->values, needle_cnt * sizeof(int16_t));
|
||||
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
uint8_t n;
|
||||
for(n = ext->needle_num; n < num; n++) {
|
||||
for(n = ext->needle_count; n < needle_cnt; n++) {
|
||||
ext->values[n] = min;
|
||||
}
|
||||
|
||||
ext->needle_num = num;
|
||||
ext->needle_count = needle_cnt;
|
||||
ext->needle_colors = colors;
|
||||
lv_obj_invalidate(gauge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of labels (and the thicker lines too)
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param label_cnt new count of labels
|
||||
*/
|
||||
void lv_gauge_set_label_count(lv_obj_t * gauge, uint8_t label_cnt)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
ext->label_count = label_cnt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of a needle
|
||||
* @param gauge pointer to gauge
|
||||
* @param needle the id of the needle
|
||||
* @param gauge pointer to a gauge
|
||||
* @param needle_id the id of the needle
|
||||
* @param value the new value
|
||||
*/
|
||||
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle, int16_t value)
|
||||
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int16_t value)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
if(needle >= ext->needle_num) return;
|
||||
if(needle_id >= ext->needle_count) return;
|
||||
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
int16_t max = lv_bar_get_max_value(gauge);
|
||||
@@ -191,56 +197,41 @@ void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle, int16_t value)
|
||||
if(value > max) value = max;
|
||||
else if(value < min) value = min;
|
||||
|
||||
ext->values[needle] = value;
|
||||
ext->values[needle_id] = value;
|
||||
|
||||
/*To be consistent with bar set the first needle's value for the bar*/
|
||||
if(needle == 0) lv_bar_set_value(gauge, value);
|
||||
if(needle_id == 0) lv_bar_set_value(gauge, value);
|
||||
|
||||
lv_obj_invalidate(gauge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set which value is more critical (lower or higher)
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param low false: higher / true: lower value is more critical
|
||||
*/
|
||||
void lv_gauge_set_low_critical(lv_obj_t * gauge, bool low)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
ext->low_critical = low == false ? 0 : 1;
|
||||
|
||||
lv_obj_invalidate(gauge);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the critical style of the gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param style pointer to the new critical style
|
||||
*/
|
||||
void lv_gauge_set_style_critical(lv_obj_t * gauge, lv_style_t * style)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
ext->style_critical = style;
|
||||
gauge->signal_func(gauge, LV_SIGNAL_REFR_EXT_SIZE, NULL);
|
||||
lv_obj_invalidate(gauge);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
|
||||
/**
|
||||
* Get the number of needles on a gauge
|
||||
* Get the count of needles on a gauge
|
||||
* @param gauge pointer to gauge
|
||||
* @return number of needles
|
||||
* @return count of needles
|
||||
*/
|
||||
uint8_t lv_gauge_get_needle_num(lv_obj_t * gauge)
|
||||
uint8_t lv_gauge_get_needle_count(lv_obj_t * gauge)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
return ext->needle_num;
|
||||
return ext->needle_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the number of labels (and the thicker lines too)
|
||||
* @param gauge pointer to a gauge object
|
||||
* @return count of labels
|
||||
*/
|
||||
uint8_t lv_gauge_get_label_count(lv_obj_t * gauge)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
return ext->label_count;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the value of a needle
|
||||
* @param gauge pointer to gauge object
|
||||
@@ -252,37 +243,11 @@ int16_t lv_gauge_get_value(lv_obj_t * gauge, uint8_t needle)
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
|
||||
if(needle >= ext->needle_num) return min;
|
||||
if(needle >= ext->needle_count) return min;
|
||||
|
||||
return ext->values[needle];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get which value is more critical (lower or higher)
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param low false: higher / true: lower value is more critical
|
||||
*/
|
||||
bool lv_gauge_get_low_critical(lv_obj_t * gauge)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
return ext->low_critical == 0 ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the critical style of the gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @return pointer to the critical style
|
||||
*/
|
||||
lv_style_t * lv_gauge_get_style_critical(lv_obj_t * gauge)
|
||||
{
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
if(ext->style_critical == NULL) return lv_obj_get_style(gauge);
|
||||
|
||||
return ext->style_critical;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -306,47 +271,35 @@ static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mod
|
||||
}
|
||||
/*Draw the object*/
|
||||
else if(mode == LV_DESIGN_DRAW_MAIN) {
|
||||
lv_style_t * style_base = lv_obj_get_style(gauge);
|
||||
lv_style_t * style_critical = lv_gauge_get_style_critical(gauge);
|
||||
|
||||
lv_style_t * style = lv_obj_get_style(gauge);
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
|
||||
/* Draw the background
|
||||
* Re-color the gauge according to the critical value*/
|
||||
lv_style_t style_bg;
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
int16_t max = lv_bar_get_max_value(gauge);
|
||||
lv_gauge_draw_scale(gauge, mask);
|
||||
|
||||
/*To be consistent with bar use the bar value as the first needle*/
|
||||
if(ext->needle_num != 0) {
|
||||
ext->values[0] = lv_bar_get_value(gauge);
|
||||
}
|
||||
/*Draw the ancestor line meter with max value to show the rainbow like line colors*/
|
||||
uint16_t scale_num_tmp = ext->lmeter.scale_num;
|
||||
int16_t value_tmp = ext->lmeter.bar.act_value;
|
||||
ext->lmeter.bar.act_value = ext->lmeter.bar.max_value;
|
||||
ancestor_design_f(gauge, mask, mode); /*To draw lines*/
|
||||
|
||||
int16_t critical_val = ext->low_critical == 0 ? min : max;
|
||||
uint8_t i;
|
||||
/*Temporally modify the line meter to draw thicker and longer lines where labels are*/
|
||||
lv_style_t style_tmp;
|
||||
lv_style_copy(&style_tmp, style);
|
||||
ext->lmeter.scale_num = ext->label_count; /*Only to labels*/
|
||||
style_tmp.line.width = style_tmp.line.width * 2; /*Ticker lines*/
|
||||
style_tmp.body.padding.hor = style_tmp.body.padding.hor * 2; /*Longer lines*/
|
||||
gauge->style_p = &style_tmp;
|
||||
|
||||
for(i = 0; i < ext->needle_num; i++) {
|
||||
critical_val = ext->low_critical == 0 ? MATH_MAX(critical_val, ext->values[i]) : MATH_MIN(critical_val, ext->values[i]);
|
||||
}
|
||||
ancestor_design_f(gauge, mask, mode); /*To draw lines*/
|
||||
|
||||
opa_t ratio = ((critical_val - min) * OPA_COVER) / (max - min);
|
||||
ext->lmeter.scale_num = scale_num_tmp; /*Restore the parameters*/
|
||||
ext->lmeter.bar.act_value = value_tmp;
|
||||
gauge->style_p = style;
|
||||
|
||||
if(ext->low_critical != 0) ratio = OPA_COVER - ratio;
|
||||
|
||||
/*Mix the normal and the critical style*/
|
||||
memcpy(&style_bg, style_base, sizeof(lv_style_t));
|
||||
style_bg.text.color = color_mix(style_critical->text.color, style_base->text.color, ratio);
|
||||
style_bg.body.color_main= color_mix(style_critical->body.color_main, style_base->body.color_main, ratio);
|
||||
style_bg.body.color_gradient = color_mix(style_critical->body.color_gradient, style_base->body.color_gradient, ratio);
|
||||
style_bg.body.border.color = color_mix(style_critical->body.border.color, style_base->body.border.color, ratio);
|
||||
style_bg.body.shadow.color = color_mix(style_critical->body.shadow.color, style_base->body.shadow.color, ratio);
|
||||
style_bg.body.shadow.width = (cord_t)(((cord_t)style_critical->body.shadow.width * ratio) + ((cord_t)style_base->body.shadow.width * (OPA_COVER - ratio))) >> 8;
|
||||
style_bg.opacity = (cord_t)(((uint16_t)style_critical->opacity * ratio) + ((uint16_t)style_base->opacity * (OPA_COVER - ratio))) >> 8;
|
||||
lv_gauge_draw_needle(gauge, mask);
|
||||
|
||||
lv_draw_rect(&gauge->coords, mask, &style_bg);
|
||||
|
||||
lv_gauge_draw_scale(gauge, mask, &style_bg);
|
||||
|
||||
lv_gauge_draw_needle(gauge, mask, &style_bg);
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
@@ -361,23 +314,25 @@ static bool lv_gauge_design(lv_obj_t * gauge, const area_t * mask, lv_design_mod
|
||||
* @param gauge pointer to gauge object
|
||||
* @param mask mask of drawing
|
||||
*/
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_t * style)
|
||||
static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask)
|
||||
{
|
||||
char scale_txt[16];
|
||||
|
||||
cord_t r = lv_obj_get_width(gauge) / 2 - style->body.padding.horizontal;
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
lv_style_t * style = lv_obj_get_style(gauge);
|
||||
cord_t r = lv_obj_get_width(gauge) / 2 - (3 * style->body.padding.hor) - style->body.padding.inner;
|
||||
cord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->coords.x1;
|
||||
cord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->coords.y1;
|
||||
int16_t scale_angle = lv_lmeter_get_scale_angle(gauge);
|
||||
uint16_t scale_num = lv_lmeter_get_scale_num(gauge);
|
||||
uint16_t label_num = ext->label_count;
|
||||
int16_t angle_ofs = 90 + (360 - scale_angle) / 2;
|
||||
int16_t min = lv_bar_get_min_value(gauge);
|
||||
int16_t max = lv_bar_get_max_value(gauge);
|
||||
|
||||
uint8_t i;
|
||||
for(i = 0; i < scale_num; i++) {
|
||||
for(i = 0; i < label_num; i++) {
|
||||
/*Calculate the position a scale label*/
|
||||
int16_t angle = (i * scale_angle) / (scale_num - 1) + angle_ofs;
|
||||
int16_t angle = (i * scale_angle) / (label_num - 1) + angle_ofs;
|
||||
|
||||
cord_t y = (int32_t)((int32_t)trigo_sin(angle) * r) / TRIGO_SIN_MAX;
|
||||
y += y_ofs;
|
||||
@@ -385,7 +340,7 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_
|
||||
cord_t x = (int32_t)((int32_t)trigo_sin(angle + 90) * r) / TRIGO_SIN_MAX;
|
||||
x += x_ofs;
|
||||
|
||||
int16_t scale_act = (int32_t)((int32_t)(max - min) * i) / (scale_num - 1);
|
||||
int16_t scale_act = (int32_t)((int32_t)(max - min) * i) / (label_num - 1);
|
||||
scale_act += min;
|
||||
sprintf(scale_txt, "%d", scale_act);
|
||||
|
||||
@@ -409,12 +364,18 @@ static void lv_gauge_draw_scale(lv_obj_t * gauge, const area_t * mask, lv_style_
|
||||
* @param gauge pointer to gauge object
|
||||
* @param mask mask of drawing
|
||||
*/
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style_t * style)
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask)
|
||||
{
|
||||
lv_style_t style_needle;
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
lv_style_t * style = lv_obj_get_style(gauge);
|
||||
|
||||
cord_t r = lv_obj_get_width(gauge) / 2 - style->body.padding.inner;
|
||||
/*To be consistent with bar use the bar value as the first needle*/
|
||||
if(ext->needle_count != 0) {
|
||||
ext->values[0] = lv_bar_get_value(gauge);
|
||||
}
|
||||
|
||||
cord_t r = lv_obj_get_width(gauge) / 2 - style->body.padding.hor;
|
||||
cord_t x_ofs = lv_obj_get_width(gauge) / 2 + gauge->coords.x1;
|
||||
cord_t y_ofs = lv_obj_get_height(gauge) / 2 + gauge->coords.y1;
|
||||
uint16_t angle = lv_lmeter_get_scale_angle(gauge);
|
||||
@@ -429,7 +390,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
|
||||
|
||||
p_mid.x = x_ofs;
|
||||
p_mid.y = y_ofs;
|
||||
for(i = 0; i < ext->needle_num; i++) {
|
||||
for(i = 0; i < ext->needle_count; i++) {
|
||||
/*Calculate the end point of a needle*/
|
||||
int16_t needle_angle = (ext->values[i] - min) * angle / (max - min) + angle_ofs;
|
||||
p_end.y = (trigo_sin(needle_angle) * r) / TRIGO_SIN_MAX + y_ofs;
|
||||
@@ -450,10 +411,10 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const area_t * mask, lv_style
|
||||
style_neddle_mid.body.radius = LV_RADIUS_CIRCLE;
|
||||
|
||||
area_t nm_cord;
|
||||
nm_cord.x1 = x_ofs - style->body.padding.inner;
|
||||
nm_cord.y1 = y_ofs - style->body.padding.inner;
|
||||
nm_cord.x2 = x_ofs + style->body.padding.inner;
|
||||
nm_cord.y2 = y_ofs + style->body.padding.inner;
|
||||
nm_cord.x1 = x_ofs - style->body.padding.ver;
|
||||
nm_cord.y1 = y_ofs - style->body.padding.ver;
|
||||
nm_cord.x2 = x_ofs + style->body.padding.ver;
|
||||
nm_cord.y2 = y_ofs + style->body.padding.ver;
|
||||
|
||||
lv_draw_rect(&nm_cord, mask, &style_neddle_mid);
|
||||
}
|
||||
|
||||
@@ -46,10 +46,9 @@ typedef struct
|
||||
lv_lmeter_ext_t lmeter; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
int16_t * values; /*Array of the set values (for needles) */
|
||||
lv_style_t * style_critical; /*Fade to this style nearer to the critical value*/
|
||||
color_t * needle_colors; /*Color of the needles (color_t my_colors[needle_num])*/
|
||||
uint8_t needle_num; /*Number of needles*/
|
||||
uint8_t low_critical:1; /*0: the higher value is more critical, 1: the lower value is more critical*/
|
||||
uint8_t needle_count; /*Number of needles*/
|
||||
uint8_t label_count; /*Number of labels on the scale*/
|
||||
}lv_gauge_ext_t;
|
||||
|
||||
/**********************
|
||||
@@ -108,8 +107,9 @@ void lv_gauge_set_style_critical(lv_obj_t * gauge, lv_style_t * style);
|
||||
* @param gauge pointer to gauge
|
||||
* @return number of needles
|
||||
*/
|
||||
uint8_t lv_gauge_get_needle_num(lv_obj_t * gauge);
|
||||
uint8_t lv_gauge_get_needle_count(lv_obj_t * gauge);
|
||||
|
||||
uint8_t lv_gauge_get_label_count(lv_obj_t * gauge);
|
||||
/**
|
||||
* Get the value of a needle
|
||||
* @param gauge pointer to gauge object
|
||||
|
||||
@@ -223,7 +223,7 @@ lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, l
|
||||
/*Make the size adjustment*/
|
||||
cord_t w = lv_obj_get_width(list);
|
||||
lv_style_t * style_scrl = lv_obj_get_style(lv_page_get_scrl(list));
|
||||
cord_t pad_hor_tot = style->body.padding.horizontal + style_scrl->body.padding.horizontal;
|
||||
cord_t pad_hor_tot = style->body.padding.hor + style_scrl->body.padding.hor;
|
||||
w -= pad_hor_tot * 2;
|
||||
|
||||
/*Make place for the scrollbar if pad_hor_tot is too small*/
|
||||
|
||||
@@ -186,7 +186,7 @@ static bool lv_lmeter_design(lv_obj_t * lmeter, const area_t * mask, lv_design_m
|
||||
memcpy(&style_tmp, style, sizeof(lv_style_t));
|
||||
|
||||
cord_t r_out = lv_obj_get_width(lmeter) / 2;
|
||||
cord_t r_in =r_out - style->body.padding.horizontal;
|
||||
cord_t r_in = r_out - style->body.padding.hor;
|
||||
cord_t x_ofs = lv_obj_get_width(lmeter) / 2 + lmeter->coords.x1;
|
||||
cord_t y_ofs = lv_obj_get_height(lmeter) / 2 + lmeter->coords.y1;
|
||||
int16_t angle_ofs = 90 + (360 - ext->scale_angle) / 2;
|
||||
|
||||
@@ -89,7 +89,7 @@ lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_obj_set_style(ext->scrl, lv_style_get(LV_STYLE_PRETTY));
|
||||
lv_obj_set_design_func(ext->scrl, lv_scrl_design);
|
||||
|
||||
lv_page_set_sb_width(new_page, style->body.padding.horizontal);
|
||||
lv_page_set_sb_width(new_page, style->body.padding.hor);
|
||||
lv_page_set_sb_mode(new_page, ext->sb_mode);
|
||||
lv_page_set_style_sb(new_page, ext->style_sb);
|
||||
|
||||
@@ -155,8 +155,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_style_t * style = lv_obj_get_style(page);
|
||||
if(lv_cont_get_hfit(ext->scrl) == false) {
|
||||
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.horizontal);
|
||||
if(lv_cont_get_hor_fit(ext->scrl) == false) {
|
||||
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.hor);
|
||||
} else {
|
||||
ext->scrl->signal_func(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->coords);
|
||||
}
|
||||
@@ -177,8 +177,8 @@ bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
|
||||
(lv_obj_get_width(page) != area_get_width(param) ||
|
||||
lv_obj_get_height(page) != area_get_height(param))) {
|
||||
|
||||
if(lv_cont_get_hfit(ext->scrl) == false) {
|
||||
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.horizontal);
|
||||
if(lv_cont_get_hor_fit(ext->scrl) == false) {
|
||||
lv_obj_set_width(ext->scrl, lv_obj_get_width(page) - 2 * style->body.padding.hor);
|
||||
}
|
||||
|
||||
ext->scrl->signal_func(ext->scrl, LV_SIGNAL_CORD_CHG, &ext->scrl->coords);
|
||||
@@ -228,8 +228,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
|
||||
if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
|
||||
/*Be sure the width of the scrollable is correct*/
|
||||
if(lv_cont_get_hfit(scrl) == false) {
|
||||
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * page_style->body.padding.horizontal);
|
||||
if(lv_cont_get_hor_fit(scrl) == false) {
|
||||
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * page_style->body.padding.hor);
|
||||
}
|
||||
|
||||
cord_t new_x;
|
||||
@@ -238,8 +238,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
|
||||
bool refr_y = false;
|
||||
area_t page_cords;
|
||||
area_t scrl_cords;
|
||||
cord_t hpad = page_style->body.padding.horizontal;
|
||||
cord_t vpad = page_style->body.padding.vertical;
|
||||
cord_t hpad = page_style->body.padding.hor;
|
||||
cord_t vpad = page_style->body.padding.ver;
|
||||
|
||||
new_x = lv_obj_get_x(scrl);
|
||||
new_y = lv_obj_get_y(scrl);
|
||||
@@ -288,8 +288,8 @@ bool lv_page_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
|
||||
lv_page_sb_refresh(page);
|
||||
} else if(sign == LV_SIGNAL_DRAG_BEGIN) {
|
||||
if(page_ext->sb_mode == LV_PAGE_SB_MODE_DRAG ) {
|
||||
cord_t sbh_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.horizontal);
|
||||
cord_t sbv_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.vertical);
|
||||
cord_t sbh_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.hor);
|
||||
cord_t sbv_pad = MATH_MAX(page_ext->sb_width, page_style->body.padding.ver);
|
||||
if(area_get_height(&page_ext->sbv) < lv_obj_get_height(scrl) - 2 * sbv_pad) {
|
||||
page_ext->sbv_draw = 1;
|
||||
}
|
||||
@@ -438,8 +438,8 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
|
||||
if((obj_h <= page_h && top_err > 0) ||
|
||||
(obj_h > page_h && top_err < bot_err)) {
|
||||
/*Calculate a new position and to let scrable_rects.vpad space above*/
|
||||
scrlable_y = -(obj_y - style_scrl->body.padding.vertical - style->body.padding.vertical);
|
||||
scrlable_y += style_scrl->body.padding.vertical;
|
||||
scrlable_y = -(obj_y - style_scrl->body.padding.ver - style->body.padding.ver);
|
||||
scrlable_y += style_scrl->body.padding.ver;
|
||||
}
|
||||
/*Out of the page on the bottom*/
|
||||
else if((obj_h <= page_h && bot_err > 0) ||
|
||||
@@ -447,7 +447,7 @@ void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, uint16_t anim_time)
|
||||
/*Calculate a new position and to let scrable_rects.vpad space below*/
|
||||
scrlable_y = -obj_y;
|
||||
scrlable_y += page_h - obj_h;
|
||||
scrlable_y -= style_scrl->body.padding.vertical;
|
||||
scrlable_y -= style_scrl->body.padding.ver;
|
||||
} else {
|
||||
/*Alraedy in focus*/
|
||||
return;
|
||||
@@ -594,7 +594,7 @@ static bool lv_scrl_design(lv_obj_t * scrl, const area_t * mask, lv_design_mode_
|
||||
lv_obj_t * page = lv_obj_get_parent(scrl);
|
||||
lv_style_t * style_page = lv_obj_get_style(page);
|
||||
lv_group_t * g = lv_obj_get_group(page);
|
||||
if(style_page->body.empty != 0 || style_page->opacity == OPA_TRANSP) { /*Background is visible?*/
|
||||
if(style_page->body.empty != 0 || style_page->opa == OPA_TRANSP) { /*Background is visible?*/
|
||||
if(lv_group_get_focused(g) == page) {
|
||||
lv_style_t * style_mod;
|
||||
style_mod = lv_group_mod_style(g, style_ori);
|
||||
@@ -633,12 +633,12 @@ static void lv_page_sb_refresh(lv_obj_t * page)
|
||||
cord_t size_tmp;
|
||||
cord_t scrl_w = lv_obj_get_width(scrl);
|
||||
cord_t scrl_h = lv_obj_get_height(scrl);
|
||||
cord_t hpad = style->body.padding.horizontal;
|
||||
cord_t vpad = style->body.padding.vertical;
|
||||
cord_t hpad = style->body.padding.hor;
|
||||
cord_t vpad = style->body.padding.ver;
|
||||
cord_t obj_w = lv_obj_get_width(page);
|
||||
cord_t obj_h = lv_obj_get_height(page);
|
||||
cord_t sbh_pad = MATH_MAX(ext->sb_width, style->body.padding.horizontal);
|
||||
cord_t sbv_pad = MATH_MAX(ext->sb_width, style->body.padding.vertical);
|
||||
cord_t sbh_pad = MATH_MAX(ext->sb_width, style->body.padding.hor);
|
||||
cord_t sbv_pad = MATH_MAX(ext->sb_width, style->body.padding.ver);
|
||||
|
||||
if(ext->sb_mode == LV_PAGE_SB_MODE_OFF) return;
|
||||
|
||||
|
||||
@@ -74,9 +74,9 @@ lv_obj_t * lv_roller_create(lv_obj_t * par, lv_obj_t * copy)
|
||||
lv_page_set_rel_action(new_roller, NULL); /*Handle roller specific actions*/
|
||||
lv_cont_set_fit(lv_page_get_scrl(new_roller), true, false); /*Height is specified directly*/
|
||||
lv_obj_set_signal_func(scrl, roller_scrl_signal);
|
||||
lv_ddlist_open(new_roller, true, 0);
|
||||
lv_ddlist_open(new_roller, false);
|
||||
|
||||
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.opt_label);
|
||||
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.options_label);
|
||||
lv_ddlist_set_fix_height(new_roller, (font_get_height(style_label->text.font) >> FONT_ANTIALIAS) * 3
|
||||
+ style_label->text.space_line * 4);
|
||||
lv_obj_refresh_style(new_roller); /*To set scrollable size automatically*/
|
||||
@@ -112,15 +112,15 @@ bool lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param)
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_obj_set_height(lv_page_get_scrl(roller),
|
||||
lv_obj_get_height(ext->ddlist.opt_label) + lv_obj_get_height(roller));
|
||||
lv_obj_align(ext->ddlist.opt_label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt);
|
||||
lv_obj_get_height(ext->ddlist.options_label) + lv_obj_get_height(roller));
|
||||
lv_obj_align(ext->ddlist.options_label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_ddlist_set_selected(roller, ext->ddlist.selected_option_id);
|
||||
} else if(sign == LV_SIGNAL_CORD_CHG) {
|
||||
lv_ddlist_set_fix_height(roller, lv_obj_get_height(roller));
|
||||
lv_obj_set_height(lv_page_get_scrl(roller),
|
||||
lv_obj_get_height(ext->ddlist.opt_label) + lv_obj_get_height(roller));
|
||||
lv_obj_align(ext->ddlist.opt_label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_ddlist_set_selected(roller, ext->ddlist.sel_opt);
|
||||
lv_obj_get_height(ext->ddlist.options_label) + lv_obj_get_height(roller));
|
||||
lv_obj_align(ext->ddlist.options_label, NULL, LV_ALIGN_CENTER, 0, 0);
|
||||
lv_ddlist_set_selected(roller, ext->ddlist.selected_option_id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,10 +193,10 @@ static bool lv_roller_design(lv_obj_t * roller, const area_t * mask, lv_design_m
|
||||
area_t rect_area;
|
||||
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.space_line - 2;
|
||||
rect_area.y2 = rect_area.y1 + font_h + style->text.space_line;
|
||||
rect_area.x1 = ext->ddlist.opt_label->coords.x1 - style->body.padding.horizontal;
|
||||
rect_area.x1 = ext->ddlist.options_label->coords.x1 - style->body.padding.hor;
|
||||
rect_area.x2 = rect_area.x1 + lv_obj_get_width(lv_page_get_scrl(roller));
|
||||
|
||||
lv_draw_rect(&rect_area, mask, ext->ddlist.style_sel);
|
||||
lv_draw_rect(&rect_area, mask, ext->ddlist.selected_style);
|
||||
}
|
||||
/*Post draw when the children are drawn*/
|
||||
else if(mode == LV_DESIGN_DRAW_POST) {
|
||||
@@ -227,36 +227,36 @@ static bool roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void *
|
||||
int32_t id = -1;
|
||||
lv_obj_t * roller = lv_obj_get_parent(roller_scrl);
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.opt_label);
|
||||
lv_style_t * style_label = lv_obj_get_style(ext->ddlist.options_label);
|
||||
const font_t * font = style_label->text.font;
|
||||
cord_t font_h = font_get_height(font) >> FONT_ANTIALIAS;
|
||||
if(sign == LV_SIGNAL_DRAG_END) {
|
||||
/*If dragged then align the list to there be an element in the middle*/
|
||||
cord_t label_y1 = ext->ddlist.opt_label->coords.y1 - roller->coords.y1;
|
||||
cord_t label_y1 = ext->ddlist.options_label->coords.y1 - roller->coords.y1;
|
||||
cord_t label_unit = (font_get_height(style_label->text.font) >> FONT_ANTIALIAS) + style_label->text.space_line / 2;
|
||||
cord_t mid = (roller->coords.y2 - roller->coords.y1) / 2;
|
||||
id = (mid - label_y1) / label_unit;
|
||||
if(id < 0) id = 0;
|
||||
if(id >= ext->ddlist.num_opt) id = ext->ddlist.num_opt - 1;
|
||||
ext->ddlist.sel_opt = id;
|
||||
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
||||
ext->ddlist.selected_option_id = id;
|
||||
}
|
||||
else if(sign == LV_SIGNAL_RELEASED) {
|
||||
/*If picked an option by clicking then set it*/
|
||||
if(!lv_indev_is_dragging(indev)) {
|
||||
point_t p;
|
||||
lv_indev_get_point(indev, &p);
|
||||
p.y = p.y - ext->ddlist.opt_label->coords.y1;
|
||||
p.y = p.y - ext->ddlist.options_label->coords.y1;
|
||||
id = p.y / (font_h + style_label->text.space_line);
|
||||
if(id < 0) id = 0;
|
||||
if(id >= ext->ddlist.num_opt) id = ext->ddlist.num_opt - 1;
|
||||
ext->ddlist.sel_opt = id;
|
||||
if(id >= ext->ddlist.option_cnt) id = ext->ddlist.option_cnt - 1;
|
||||
ext->ddlist.selected_option_id = id;
|
||||
}
|
||||
}
|
||||
|
||||
/*Position the scrollable according to the new selected option*/
|
||||
if(id != -1) {
|
||||
cord_t h = lv_obj_get_height(roller);
|
||||
cord_t line_y1 = id * (font_h + style_label->text.space_line) + ext->ddlist.opt_label->coords.y1 - roller_scrl->coords.y1;
|
||||
cord_t line_y1 = id * (font_h + style_label->text.space_line) + ext->ddlist.options_label->coords.y1 - roller_scrl->coords.y1;
|
||||
cord_t new_y = - line_y1 + (h - font_h) / 2;
|
||||
|
||||
if(ext->ddlist.anim_time == 0) {
|
||||
|
||||
@@ -155,7 +155,7 @@ bool lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param)
|
||||
if(slider->ext_size < x) slider->ext_size = x;
|
||||
} else {
|
||||
lv_style_t * style = lv_obj_get_style(slider);
|
||||
cord_t pad = MATH_MIN(style->body.padding.horizontal, style->body.padding.vertical);
|
||||
cord_t pad = MATH_MIN(style->body.padding.hor, style->body.padding.ver);
|
||||
if(pad < 0) {
|
||||
pad = -pad;
|
||||
if(slider->ext_size < pad) slider->ext_size = pad;
|
||||
@@ -290,8 +290,8 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
|
||||
area_t area_bar;
|
||||
area_cpy(&area_bar, &slider->coords);
|
||||
/*Be sure at least vpad/hpad width bar will remain*/
|
||||
cord_t pad_ver_bar = style_slider->body.padding.vertical;
|
||||
cord_t pad_hor_bar = style_slider->body.padding.horizontal;
|
||||
cord_t pad_ver_bar = style_slider->body.padding.ver;
|
||||
cord_t pad_hor_bar = style_slider->body.padding.hor;
|
||||
if(pad_ver_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) {
|
||||
pad_ver_bar = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
|
||||
}
|
||||
@@ -310,8 +310,8 @@ static bool lv_slider_design(lv_obj_t * slider, const area_t * mask, lv_design_m
|
||||
area_cpy(&area_indic, &area_bar);
|
||||
|
||||
/*Be sure at least vpad/hpad width indicator will remain*/
|
||||
cord_t pad_ver_indic = style_indic->body.padding.vertical;
|
||||
cord_t pad_hor_indic = style_indic->body.padding.horizontal;
|
||||
cord_t pad_ver_indic = style_indic->body.padding.ver;
|
||||
cord_t pad_hor_indic = style_indic->body.padding.hor;
|
||||
if(pad_ver_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) {
|
||||
pad_ver_indic = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
|
||||
}
|
||||
|
||||
@@ -177,10 +177,10 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
if(ext->one_line) { /*In one line mode refresh the Text Area height because 'vpad' can modify it*/
|
||||
lv_style_t * style_label = lv_obj_get_style(ext->label);
|
||||
cord_t font_h = font_get_height(style_label->text.font) >> FONT_ANTIALIAS;
|
||||
lv_obj_set_height(ta, font_h + (style_ta->body.padding.vertical + style_scrl->body.padding.vertical) * 2);
|
||||
lv_obj_set_height(ta, font_h + (style_ta->body.padding.ver + style_scrl->body.padding.ver) * 2);
|
||||
} else { /*In not one line mode refresh the Label width because 'hpad' can modify it*/
|
||||
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.horizontal);
|
||||
lv_obj_set_pos(ext->label, style_scrl->body.padding.horizontal, style_scrl->body.padding.vertical); /*Be sure the Label is in the correct position*/
|
||||
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
|
||||
lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver); /*Be sure the Label is in the correct position*/
|
||||
}
|
||||
lv_label_set_text(ext->label, NULL);
|
||||
|
||||
@@ -193,8 +193,8 @@ bool lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
|
||||
lv_obj_get_height(ta) != area_get_height(param)) {
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ta);
|
||||
lv_style_t * style_scrl = lv_obj_get_style(scrl);
|
||||
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.horizontal);
|
||||
lv_obj_set_pos(ext->label, style_scrl->body.padding.horizontal, style_scrl->body.padding.vertical);
|
||||
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
|
||||
lv_obj_set_pos(ext->label, style_scrl->body.padding.hor, style_scrl->body.padding.ver);
|
||||
lv_label_set_text(ext->label, NULL); /*Refresh the label*/
|
||||
}
|
||||
}
|
||||
@@ -478,9 +478,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
|
||||
/*Check the bottom*/
|
||||
cord_t font_h = font_get_height(font_p) >> FONT_ANTIALIAS;
|
||||
if(label_cords.y1 + cur_pos.y + font_h + style_scrl->body.padding.vertical > ta_cords.y2) {
|
||||
if(label_cords.y1 + cur_pos.y + font_h + style_scrl->body.padding.ver > ta_cords.y2) {
|
||||
lv_obj_set_y(label_par, -(cur_pos.y - lv_obj_get_height(ta) +
|
||||
font_h + 2 * style_scrl->body.padding.vertical));
|
||||
font_h + 2 * style_scrl->body.padding.ver));
|
||||
}
|
||||
/*Check the left (use the font_h as general unit)*/
|
||||
if(lv_obj_get_x(label_par) + cur_pos.x < font_h) {
|
||||
@@ -488,9 +488,9 @@ void lv_ta_set_cursor_pos(lv_obj_t * ta, int16_t pos)
|
||||
}
|
||||
|
||||
/*Check the right (use the font_h as general unit)*/
|
||||
if(label_cords.x1 + cur_pos.x + font_h + style_scrl->body.padding.horizontal > ta_cords.x2) {
|
||||
if(label_cords.x1 + cur_pos.x + font_h + style_scrl->body.padding.hor > ta_cords.x2) {
|
||||
lv_obj_set_x(label_par, -(cur_pos.x - lv_obj_get_width(ta) +
|
||||
font_h + 2 * style_scrl->body.padding.horizontal));
|
||||
font_h + 2 * style_scrl->body.padding.hor));
|
||||
}
|
||||
|
||||
/*Reset cursor blink animation*/
|
||||
@@ -682,10 +682,10 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
|
||||
|
||||
ext->one_line = 1;
|
||||
lv_cont_set_fit(lv_page_get_scrl(ta), true, true);
|
||||
lv_obj_set_height(ta, font_h + (style_ta->body.padding.vertical + style_scrl->body.padding.vertical) * 2);
|
||||
lv_obj_set_height(ta, font_h + (style_ta->body.padding.ver + style_scrl->body.padding.ver) * 2);
|
||||
lv_label_set_long_mode(ext->label, LV_LABEL_LONG_EXPAND);
|
||||
lv_label_set_no_break(ext->label, true);
|
||||
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.horizontal, style_ta->body.padding.vertical);
|
||||
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.hor, style_ta->body.padding.ver);
|
||||
} else {
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
lv_style_t * style_ta = lv_obj_get_style(ta);
|
||||
@@ -695,7 +695,7 @@ void lv_ta_set_one_line(lv_obj_t * ta, bool en)
|
||||
lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK);
|
||||
lv_label_set_no_break(ext->label, false);
|
||||
lv_obj_set_height(ta, LV_TA_DEF_HEIGHT);
|
||||
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.horizontal, style_ta->body.padding.vertical);
|
||||
lv_obj_set_pos(lv_page_get_scrl(ta), style_ta->body.padding.hor, style_ta->body.padding.ver);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -868,10 +868,10 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
|
||||
cur_style.body.shadow.width = 0;
|
||||
cur_style.body.radius = 0;
|
||||
cur_style.body.empty = 0;
|
||||
cur_style.body.padding.horizontal = 0;
|
||||
cur_style.body.padding.vertical = 0;
|
||||
cur_style.body.padding.hor = 0;
|
||||
cur_style.body.padding.ver = 0;
|
||||
cur_style.line.width = 1 << LV_ANTIALIAS;
|
||||
cur_style.opacity = OPA_COVER;
|
||||
cur_style.opa = OPA_COVER;
|
||||
}
|
||||
|
||||
uint16_t cur_pos = lv_ta_get_cursor_pos(ta);
|
||||
@@ -916,16 +916,16 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
|
||||
/*Draw he cursor according to the type*/
|
||||
area_t cur_area;
|
||||
if(ta_ext->cursor_type == LV_TA_CURSOR_LINE) {
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal - (cur_style.line.width >> 1) - (cur_style.line.width & 0x1);
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical;
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal + (cur_style.line.width >> 1);
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical + letter_h;
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor - (cur_style.line.width >> 1) - (cur_style.line.width & 0x1);
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver;
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + (cur_style.line.width >> 1);
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver + letter_h;
|
||||
lv_draw_rect(&cur_area, mask, &cur_style);
|
||||
} else if(ta_ext->cursor_type == LV_TA_CURSOR_BLOCK) {
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.horizontal;
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.vertical;
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal + letter_w;
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical + letter_h;
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.hor;
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.ver;
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + letter_w;
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver + letter_h;
|
||||
|
||||
lv_draw_rect(&cur_area, mask, &cur_style);
|
||||
|
||||
@@ -938,24 +938,24 @@ static bool lv_ta_scrling_design(lv_obj_t * scrl, const area_t * mask, lv_design
|
||||
char letter_buf[8] = {0};
|
||||
memcpy(letter_buf, &txt[byte_pos], txt_utf8_size(txt[byte_pos]));
|
||||
#endif
|
||||
cur_area.x1 += cur_style.body.padding.horizontal;
|
||||
cur_area.y1 += cur_style.body.padding.vertical;
|
||||
cur_area.x1 += cur_style.body.padding.hor;
|
||||
cur_area.y1 += cur_style.body.padding.ver;
|
||||
lv_draw_label(&cur_area, mask, &cur_style, letter_buf, TXT_FLAG_NONE, 0);
|
||||
|
||||
} else if(ta_ext->cursor_type == LV_TA_CURSOR_OUTLINE) {
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.horizontal;
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.vertical;
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal + letter_w;
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.vertical+ letter_h;
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 - cur_style.body.padding.hor;
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.ver;
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + letter_w;
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 - cur_style.body.padding.ver+ letter_h;
|
||||
|
||||
cur_style.body.empty = 1;
|
||||
if(cur_style.body.border.width == 0) cur_style.body.border.width = 1 << LV_ANTIALIAS; /*Be sure the border will be drawn*/
|
||||
lv_draw_rect(&cur_area, mask, &cur_style);
|
||||
} else if(ta_ext->cursor_type == LV_TA_CURSOR_UNDERLINE) {
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal;
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical + letter_h - (cur_style.line.width >> 1);
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.horizontal + letter_w;
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.vertical + letter_h + (cur_style.line.width >> 1) + (cur_style.line.width & 0x1);
|
||||
cur_area.x1 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor;
|
||||
cur_area.y1 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver + letter_h - (cur_style.line.width >> 1);
|
||||
cur_area.x2 = letter_pos.x + ta_ext->label->coords.x1 + cur_style.body.padding.hor + letter_w;
|
||||
cur_area.y2 = letter_pos.y + ta_ext->label->coords.y1 + cur_style.body.padding.ver + letter_h + (cur_style.line.width >> 1) + (cur_style.line.width & 0x1);
|
||||
|
||||
lv_draw_rect(&cur_area, mask, &cur_style);
|
||||
}
|
||||
|
||||
@@ -201,9 +201,9 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
|
||||
|
||||
/*Modify the indicator size*/
|
||||
lv_style_t * style_tabs = lv_obj_get_style(ext->tabs);
|
||||
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) - 2 * style_tabs->body.padding.horizontal) / ext->tab_cnt;
|
||||
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) - 2 * style_tabs->body.padding.hor) / ext->tab_cnt;
|
||||
lv_obj_set_width(ext->indic, indic_width);
|
||||
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + style_tabs->body.padding.inner * ext->tab_act + style_tabs->body.padding.horizontal);
|
||||
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + style_tabs->body.padding.inner * ext->tab_act + style_tabs->body.padding.hor);
|
||||
|
||||
/*Set the first tab as active*/
|
||||
if(ext->tab_cnt == 1) {
|
||||
@@ -235,7 +235,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
anim_en = false;
|
||||
#endif
|
||||
|
||||
cord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id + style->body.padding.horizontal);
|
||||
cord_t cont_x = -(lv_obj_get_width(tabview) * id + style->body.padding.inner * id + style->body.padding.hor);
|
||||
if(anim_en == false) {
|
||||
lv_obj_set_x(ext->content, cont_x);
|
||||
} else {
|
||||
@@ -258,7 +258,7 @@ void lv_tabview_set_act(lv_obj_t * tabview, uint16_t id, bool anim_en)
|
||||
/*Move the indicator*/
|
||||
cord_t indic_width = lv_obj_get_width(ext->indic);
|
||||
lv_style_t * tabs_style = lv_obj_get_style(ext->tabs);
|
||||
cord_t indic_x = indic_width * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.horizontal;
|
||||
cord_t indic_x = indic_width * id + tabs_style->body.padding.inner * id + tabs_style->body.padding.hor;
|
||||
|
||||
if(anim_en == false) {
|
||||
lv_obj_set_x(ext->indic, indic_x);
|
||||
@@ -376,7 +376,7 @@ void lv_tabview_realign(lv_obj_t * tabview)
|
||||
if(ext->tab_cnt != 0) {
|
||||
lv_style_t * style_tabs = lv_obj_get_style(ext->tabs);
|
||||
cord_t indic_width = (lv_obj_get_width(tabview) - style_tabs->body.padding.inner * (ext->tab_cnt - 1) -
|
||||
2 * style_tabs->body.padding.horizontal) / ext->tab_cnt;
|
||||
2 * style_tabs->body.padding.hor) / ext->tab_cnt;
|
||||
lv_obj_set_width(ext->indic, indic_width);
|
||||
}
|
||||
|
||||
@@ -534,7 +534,7 @@ static void tabpage_pressing_hadler(lv_obj_t * tabview, lv_obj_t * tabpage)
|
||||
lv_style_t * indic_style = lv_obj_get_style(ext->indic);
|
||||
cord_t p = ((tabpage->coords.x1 - tabview->coords.x1) * (indic_width + tabs_style->body.padding.inner)) / lv_obj_get_width(tabview);
|
||||
|
||||
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + tabs_style->body.padding.inner * ext->tab_act + indic_style->body.padding.horizontal - p);
|
||||
lv_obj_set_x(ext->indic, indic_width * ext->tab_act + tabs_style->body.padding.inner * ext->tab_act + indic_style->body.padding.hor - p);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ cord_t lv_win_get_width(lv_obj_t * win)
|
||||
lv_obj_t * scrl = lv_page_get_scrl(ext->page);
|
||||
lv_style_t * style_scrl = lv_obj_get_style(scrl);
|
||||
|
||||
return lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.horizontal;
|
||||
return lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,16 +414,16 @@ static void lv_win_realign(lv_obj_t * win)
|
||||
}
|
||||
|
||||
lv_style_t * btnh_style = lv_obj_get_style(ext->btnh);
|
||||
lv_obj_set_height(ext->btnh, ext->cbtn_size + 2 * btnh_style->body.padding.vertical * 2);
|
||||
lv_obj_set_height(ext->btnh, ext->cbtn_size + 2 * btnh_style->body.padding.ver * 2);
|
||||
lv_obj_set_width(ext->header, lv_obj_get_width(win));
|
||||
|
||||
/*Align the higher object first to make the correct header size first*/
|
||||
if(lv_obj_get_height(ext->title) > lv_obj_get_height(ext->btnh)) {
|
||||
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.horizontal, 0);
|
||||
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.horizontal, 0);
|
||||
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.hor, 0);
|
||||
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.hor, 0);
|
||||
} else {
|
||||
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.horizontal, 0);
|
||||
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.horizontal, 0);
|
||||
lv_obj_align(ext->btnh, NULL, LV_ALIGN_IN_RIGHT_MID, - ext->style_header->body.padding.hor, 0);
|
||||
lv_obj_align(ext->title, NULL, LV_ALIGN_IN_LEFT_MID, ext->style_header->body.padding.hor, 0);
|
||||
}
|
||||
|
||||
lv_obj_set_pos_scale(ext->header, 0, 0);
|
||||
@@ -435,7 +435,7 @@ static void lv_win_realign(lv_obj_t * win)
|
||||
lv_style_t * style_page = lv_obj_get_style(page);
|
||||
lv_obj_t * scrl = lv_page_get_scrl(page);
|
||||
|
||||
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * style_page->body.padding.horizontal);
|
||||
lv_obj_set_width(scrl, lv_obj_get_width(page) - 2 * style_page->body.padding.hor);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user