add LV_STYLE_XXX_MAIN if an object has only one style
This commit is contained in:
@@ -413,11 +413,11 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
*/
|
||||
static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t * i;
|
||||
lv_obj_t * found_p = NULL;
|
||||
|
||||
/*If this object is fully cover the draw area check the children too */
|
||||
if(lv_area_is_in(area_p, &obj->coords) && obj->hidden == 0) {
|
||||
lv_obj_t * i;
|
||||
LV_LL_READ(obj->child_ll, i)
|
||||
{
|
||||
found_p = lv_refr_get_top_obj(area_p, i);
|
||||
@@ -458,7 +458,6 @@ static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
|
||||
|
||||
/*Draw the 'younger' sibling objects because they can be on top_obj */
|
||||
lv_obj_t * par;
|
||||
lv_obj_t * i;
|
||||
lv_obj_t * border_p = top_p;
|
||||
|
||||
par = lv_obj_get_parent(top_p);
|
||||
@@ -466,7 +465,7 @@ static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
|
||||
/*Do until not reach the screen*/
|
||||
while(par != NULL) {
|
||||
/*object before border_p has to be redrawn*/
|
||||
i = lv_ll_get_prev(&(par->child_ll), border_p);
|
||||
lv_obj_t * i = lv_ll_get_prev(&(par->child_ll), border_p);
|
||||
|
||||
while(i != NULL) {
|
||||
/*Refresh the objects*/
|
||||
|
||||
@@ -146,7 +146,7 @@ void lv_canvas_set_px(lv_obj_t * canvas, lv_coord_t x, lv_coord_t y, lv_color_t
|
||||
void lv_canvas_set_style(lv_obj_t * canvas, lv_canvas_style_t type, const lv_style_t * style)
|
||||
{
|
||||
switch(type) {
|
||||
case LV_CANVAS_STYLE_MAIN: lv_img_set_style(canvas, style); break;
|
||||
case LV_CANVAS_STYLE_MAIN: lv_img_set_style(canvas, LV_IMG_STYLE_MAIN, style); break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ const lv_style_t * lv_canvas_get_style(const lv_obj_t * canvas, lv_canvas_style_
|
||||
const lv_style_t * style = NULL;
|
||||
|
||||
switch(type) {
|
||||
case LV_CANVAS_STYLE_MAIN: style = lv_img_get_style(canvas); break;
|
||||
case LV_CANVAS_STYLE_MAIN: style = lv_img_get_style(canvas, LV_IMG_STYLE_MAIN); break;
|
||||
default: style = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -304,7 +304,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_style_t * label_style = lv_label_get_style(ext->label);
|
||||
const lv_style_t * label_style = lv_label_get_style(ext->label, LV_LABEL_STYLE_MAIN);
|
||||
lv_obj_set_size(ext->bullet, lv_font_get_line_height(label_style->text.font),
|
||||
lv_font_get_line_height(label_style->text.font));
|
||||
lv_btn_set_state(ext->bullet, lv_btn_get_state(cb));
|
||||
|
||||
@@ -112,9 +112,9 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_chart_set_style(new_chart, th->style.chart);
|
||||
lv_chart_set_style(new_chart, LV_CHART_STYLE_MAIN, th->style.chart);
|
||||
} else {
|
||||
lv_chart_set_style(new_chart, &lv_style_pretty);
|
||||
lv_chart_set_style(new_chart, LV_CHART_STYLE_MAIN, &lv_style_pretty);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
@@ -97,6 +97,11 @@ typedef struct
|
||||
} series;
|
||||
} lv_chart_ext_t;
|
||||
|
||||
enum {
|
||||
LV_CHART_STYLE_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_chart_style_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -218,10 +223,12 @@ void lv_chart_set_update_mode(lv_obj_t * chart, lv_chart_update_mode_t update_mo
|
||||
/**
|
||||
* Set the style of a chart
|
||||
* @param chart pointer to a chart object
|
||||
* @param type which style should be set (can be only `LV_CHART_STYLE_MAIN`)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
static inline void lv_chart_set_style(lv_obj_t * chart, const lv_style_t * style)
|
||||
static inline void lv_chart_set_style(lv_obj_t * chart, lv_chart_style_t type, const lv_style_t * style)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
lv_obj_set_style(chart, style);
|
||||
}
|
||||
|
||||
@@ -290,10 +297,12 @@ lv_opa_t lv_chart_get_series_darking(const lv_obj_t * chart);
|
||||
/**
|
||||
* Get the style of an chart object
|
||||
* @param chart pointer to an chart object
|
||||
* @param type which style should be get (can be only `LV_CHART_STYLE_MAIN`)
|
||||
* @return pointer to the chart's style
|
||||
*/
|
||||
static inline const lv_style_t * lv_chart_get_style(const lv_obj_t * chart)
|
||||
static inline const lv_style_t * lv_chart_get_style(const lv_obj_t * chart, lv_chart_style_t type)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
return lv_obj_get_style(chart);
|
||||
}
|
||||
|
||||
|
||||
@@ -90,9 +90,9 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_cont_set_style(new_cont, th->style.cont);
|
||||
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, th->style.cont);
|
||||
} else {
|
||||
lv_cont_set_style(new_cont, &lv_style_pretty);
|
||||
lv_cont_set_style(new_cont, LV_CONT_STYLE_MAIN, &lv_style_pretty);
|
||||
}
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
|
||||
@@ -66,6 +66,12 @@ typedef struct
|
||||
uint8_t fit_bottom : 2; /*A fit type from `lv_fit_t` enum */
|
||||
} lv_cont_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
enum {
|
||||
LV_CONT_STYLE_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_cont_style_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -126,10 +132,12 @@ static inline void lv_cont_set_fit(lv_obj_t * cont, lv_fit_t fit)
|
||||
/**
|
||||
* Set the style of a container
|
||||
* @param cont pointer to a container object
|
||||
* @param type which style should be set (can be only `LV_CONT_STYLE_MAIN`)
|
||||
* @param style pointer to the new style
|
||||
*/
|
||||
static inline void lv_cont_set_style(lv_obj_t * cont, const lv_style_t * style)
|
||||
static inline void lv_cont_set_style(lv_obj_t * cont, lv_cont_style_t type, const lv_style_t * style)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
lv_obj_set_style(cont, style);
|
||||
}
|
||||
|
||||
@@ -175,10 +183,12 @@ lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont);
|
||||
/**
|
||||
* Get the style of a container
|
||||
* @param cont pointer to a container object
|
||||
* @param type which style should be get (can be only `LV_CONT_STYLE_MAIN`)
|
||||
* @return pointer to the container's style
|
||||
*/
|
||||
static inline const lv_style_t * lv_cont_get_style(const lv_obj_t * cont)
|
||||
static inline const lv_style_t * lv_cont_get_style(const lv_obj_t * cont, lv_cont_style_t type)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
return lv_obj_get_style(cont);
|
||||
}
|
||||
|
||||
|
||||
@@ -95,9 +95,9 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_gauge_set_style(new_gauge, th->style.gauge);
|
||||
lv_gauge_set_style(new_gauge, LV_GAUGE_STYLE_MAIN, th->style.gauge);
|
||||
} else {
|
||||
lv_gauge_set_style(new_gauge, &lv_style_pretty_color);
|
||||
lv_gauge_set_style(new_gauge, LV_GAUGE_STYLE_MAIN, &lv_style_pretty_color);
|
||||
}
|
||||
}
|
||||
/*Copy an existing gauge*/
|
||||
@@ -394,7 +394,7 @@ static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * mask)
|
||||
{
|
||||
lv_style_t style_needle;
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
const lv_style_t * style = lv_gauge_get_style(gauge);
|
||||
const lv_style_t * style = lv_gauge_get_style(gauge, LV_GAUGE_STYLE_MAIN);
|
||||
lv_opa_t opa_scale = lv_obj_get_opa_scale(gauge);
|
||||
|
||||
lv_coord_t r = lv_obj_get_width(gauge) / 2 - style->body.padding.left;
|
||||
|
||||
@@ -50,6 +50,12 @@ typedef struct
|
||||
uint8_t label_count; /*Number of labels on the scale*/
|
||||
} lv_gauge_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
enum {
|
||||
LV_GAUGE_STYLE_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_gauge_style_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -117,11 +123,13 @@ void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint
|
||||
/**
|
||||
* Set the styles of a gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param bg set the style of the gauge
|
||||
* @param type which style should be set (can be only `LV_GAUGE_STYLE_MAIN`)
|
||||
* @param style set the style of the gauge
|
||||
* */
|
||||
static inline void lv_gauge_set_style(lv_obj_t * gauge, lv_style_t * bg)
|
||||
static inline void lv_gauge_set_style(lv_obj_t * gauge, lv_gauge_style_t type, lv_style_t * style)
|
||||
{
|
||||
lv_obj_set_style(gauge, bg);
|
||||
(void) type; /*Unused*/
|
||||
lv_obj_set_style(gauge, style);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
@@ -203,10 +211,12 @@ static inline uint16_t lv_gauge_get_scale_angle(const lv_obj_t * gauge)
|
||||
/**
|
||||
* Get the style of a gauge
|
||||
* @param gauge pointer to a gauge object
|
||||
* @param type which style should be get (can be only `LV_GAUGE_STYLE_MAIN`)
|
||||
* @return pointer to the gauge's style
|
||||
*/
|
||||
static inline const lv_style_t * lv_gauge_get_style(const lv_obj_t * gauge)
|
||||
static inline const lv_style_t * lv_gauge_get_style(const lv_obj_t * gauge, lv_gauge_style_t type)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
return lv_obj_get_style(gauge);
|
||||
}
|
||||
|
||||
|
||||
@@ -173,7 +173,7 @@ 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_style_t * style = lv_img_get_style(img);
|
||||
const lv_style_t * style = lv_img_get_style(img, LV_IMG_STYLE_MAIN);
|
||||
lv_point_t size;
|
||||
lv_txt_get_size(&size, src_img, style->text.font, style->text.letter_space, style->text.line_space,
|
||||
LV_COORD_MAX, LV_TXT_FLAG_NONE);
|
||||
|
||||
@@ -47,6 +47,12 @@ typedef struct
|
||||
uint8_t cf : 5; /*Color format from `lv_img_color_format_t`*/
|
||||
} lv_img_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
enum {
|
||||
LV_IMG_STYLE_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_img_style_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -118,24 +124,15 @@ void lv_img_set_offset_y(lv_obj_t * img, lv_coord_t y);
|
||||
/**
|
||||
* Set the style of an image
|
||||
* @param img pointer to an image object
|
||||
* @param type which style should be set (can be only `LV_IMG_STYLE_MAIN`)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
static inline void lv_img_set_style(lv_obj_t * img, const lv_style_t * style)
|
||||
static inline void lv_img_set_style(lv_obj_t * img, lv_img_style_t type, const lv_style_t * style)
|
||||
{
|
||||
(void)type; /*Unused*/
|
||||
lv_obj_set_style(img, style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
|
||||
* @param img -
|
||||
* @param upscale -
|
||||
*/
|
||||
static inline void lv_img_set_upscale(lv_obj_t * img, bool upcale)
|
||||
{
|
||||
(void)img;
|
||||
(void)upcale;
|
||||
}
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -178,24 +175,15 @@ lv_coord_t lv_img_get_offset_y(lv_obj_t * img);
|
||||
/**
|
||||
* Get the style of an image object
|
||||
* @param img pointer to an image object
|
||||
* @param type which style should be get (can be only `LV_IMG_STYLE_MAIN`)
|
||||
* @return pointer to the image's style
|
||||
*/
|
||||
static inline const lv_style_t * lv_img_get_style(const lv_obj_t * img)
|
||||
static inline const lv_style_t * lv_img_get_style(const lv_obj_t * img, lv_img_style_t type)
|
||||
{
|
||||
(void)type; /*Unused*/
|
||||
return lv_obj_get_style(img);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
|
||||
* @param img -
|
||||
* @return false
|
||||
*/
|
||||
static inline bool lv_img_get_upscale(const lv_obj_t * img)
|
||||
{
|
||||
(void)img;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -110,7 +110,7 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_click(new_label, false);
|
||||
lv_label_set_long_mode(new_label, LV_LABEL_LONG_EXPAND);
|
||||
lv_label_set_text(new_label, "Text");
|
||||
lv_label_set_style(new_label, NULL); /*Inherit parent's style*/
|
||||
lv_label_set_style(new_label, LV_LABEL_STYLE_MAIN, NULL); /*Inherit parent's style*/
|
||||
}
|
||||
/*Copy 'copy' if not NULL*/
|
||||
else {
|
||||
@@ -683,8 +683,8 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
|
||||
|
||||
uint32_t i = line_start;
|
||||
uint32_t i_current = i;
|
||||
uint32_t letter;
|
||||
uint32_t letter_next;
|
||||
uint32_t letter = '\0';
|
||||
uint32_t letter_next = '\0';
|
||||
|
||||
if(new_line_start > 0) {
|
||||
while(i <= new_line_start - 1) {
|
||||
@@ -911,7 +911,7 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param
|
||||
}
|
||||
} else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
if(ext->body_draw) {
|
||||
const lv_style_t * style = lv_label_get_style(label);
|
||||
const lv_style_t * style = lv_label_get_style(label, LV_LABEL_STYLE_MAIN);
|
||||
|
||||
label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, style->body.padding.left);
|
||||
label->ext_draw_pad = LV_MATH_MAX(label->ext_draw_pad, style->body.padding.right);
|
||||
|
||||
@@ -91,6 +91,12 @@ typedef struct
|
||||
characters */
|
||||
} lv_label_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
enum {
|
||||
LV_LABEL_STYLE_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_label_style_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -171,10 +177,12 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed);
|
||||
/**
|
||||
* Set the style of an label
|
||||
* @param label pointer to an label object
|
||||
* @param type which style should be get (can be only `LV_LABEL_STYLE_MAIN`)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
static inline void lv_label_set_style(lv_obj_t * label, const lv_style_t * style)
|
||||
static inline void lv_label_set_style(lv_obj_t * label, lv_label_style_t type, const lv_style_t * style)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
lv_obj_set_style(label, style);
|
||||
}
|
||||
|
||||
@@ -267,10 +275,12 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos);
|
||||
/**
|
||||
* Get the style of an label object
|
||||
* @param label pointer to an label object
|
||||
* @param type which style should be get (can be only `LV_LABEL_STYLE_MAIN`)
|
||||
* @return pointer to the label's style
|
||||
*/
|
||||
static inline const lv_style_t * lv_label_get_style(const lv_obj_t * label)
|
||||
static inline const lv_style_t * lv_label_get_style(const lv_obj_t * label, lv_label_style_t type)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
return lv_obj_get_style(label);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,9 +79,9 @@ lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_led_set_style(new_led, th->style.led);
|
||||
lv_led_set_style(new_led, LV_LED_STYLE_MAIN, th->style.led);
|
||||
} else {
|
||||
lv_led_set_style(new_led, &lv_style_pretty_color);
|
||||
lv_led_set_style(new_led, LV_LED_STYLE_MAIN, &lv_style_pretty_color);
|
||||
}
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
|
||||
@@ -39,6 +39,12 @@ typedef struct
|
||||
uint8_t bright; /*Current brightness of the LED (0..255)*/
|
||||
} lv_led_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
enum {
|
||||
LV_LED_STYLE_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_led_style_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -79,10 +85,12 @@ void lv_led_toggle(lv_obj_t * led);
|
||||
/**
|
||||
* Set the style of a led
|
||||
* @param led pointer to a led object
|
||||
* @param type which style should be set (can be only `LV_LED_STYLE_MAIN`)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
static inline void lv_led_set_style(lv_obj_t * led, const lv_style_t * style)
|
||||
static inline void lv_led_set_style(lv_obj_t * led, lv_led_style_t type, const lv_style_t * style)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
lv_obj_set_style(led, style);
|
||||
}
|
||||
|
||||
@@ -96,10 +104,12 @@ uint8_t lv_led_get_bright(const lv_obj_t * led);
|
||||
/**
|
||||
* Get the style of an led object
|
||||
* @param led pointer to an led object
|
||||
* @param type which style should be get (can be only `LV_CHART_STYLE_MAIN`)
|
||||
* @return pointer to the led's style
|
||||
*/
|
||||
static inline const lv_style_t * lv_led_get_style(const lv_obj_t * led)
|
||||
static inline const lv_style_t * lv_led_get_style(const lv_obj_t * led, lv_led_style_t type)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
return lv_obj_get_style(led);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,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);
|
||||
}
|
||||
|
||||
const lv_style_t * style = lv_line_get_style(line);
|
||||
const lv_style_t * style = lv_line_get_style(line, LV_LINE_STYLE_MAIN);
|
||||
lv_obj_set_size(line, xmax + style->line.width, ymax + style->line.width);
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
|
||||
}
|
||||
buf->type[i] = "lv_line";
|
||||
} else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
const lv_style_t * style = lv_line_get_style(line);
|
||||
const lv_style_t * style = lv_line_get_style(line, LV_LINE_STYLE_MAIN);
|
||||
if(line->ext_draw_pad < style->line.width) line->ext_draw_pad = style->line.width;
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,12 @@ typedef struct
|
||||
uint8_t y_inv : 1; /*1: y == 0 will be on the bottom*/
|
||||
} lv_line_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
enum {
|
||||
LV_LINE_STYLE_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_line_style_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -89,23 +95,15 @@ void lv_line_set_y_invert(lv_obj_t * line, bool en);
|
||||
/**
|
||||
* Set the style of a line
|
||||
* @param line pointer to a line object
|
||||
* @param type which style should be set (can be only `LV_LINE_STYLE_MAIN`)
|
||||
* @param style pointer to a style
|
||||
*/
|
||||
static inline void lv_line_set_style(lv_obj_t * line, const lv_style_t * style)
|
||||
static inline void lv_line_set_style(lv_obj_t * line, lv_line_style_t type, const lv_style_t * style)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
lv_obj_set_style(line, style);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
|
||||
* @param line -
|
||||
* @param upscale -
|
||||
*/
|
||||
static inline void lv_line_set_upscale(lv_obj_t * line, bool upcale)
|
||||
{
|
||||
(void)line;
|
||||
(void)upcale;
|
||||
}
|
||||
/*=====================
|
||||
* Getter functions
|
||||
*====================*/
|
||||
@@ -127,24 +125,15 @@ bool lv_line_get_y_invert(const lv_obj_t * line);
|
||||
/**
|
||||
* Get the style of an line object
|
||||
* @param line pointer to an line object
|
||||
* @param type which style should be get (can be only `LV_LINE_STYLE_MAIN`)
|
||||
* @return pointer to the line's style
|
||||
*/
|
||||
static inline const lv_style_t * lv_line_get_style(const lv_obj_t * line)
|
||||
static inline const lv_style_t * lv_line_get_style(const lv_obj_t * line, lv_line_style_t type)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
return lv_obj_get_style(line);
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsolete since v5.1. Just for compatibility with v5.0. Will be removed in v6.0
|
||||
* @param line -
|
||||
* @return false
|
||||
*/
|
||||
static inline bool lv_line_get_upscale(const lv_obj_t * line)
|
||||
{
|
||||
(void)line;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
@@ -85,9 +85,9 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
lv_lmeter_set_style(new_lmeter, th->style.lmeter);
|
||||
lv_lmeter_set_style(new_lmeter, LV_LMETER_STYLE_MAIN, th->style.lmeter);
|
||||
} else {
|
||||
lv_lmeter_set_style(new_lmeter, &lv_style_pretty_color);
|
||||
lv_lmeter_set_style(new_lmeter, LV_LMETER_STYLE_MAIN, &lv_style_pretty_color);
|
||||
}
|
||||
}
|
||||
/*Copy an existing line meter*/
|
||||
@@ -341,7 +341,7 @@ static lv_res_t lv_lmeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * par
|
||||
} else if(sign == LV_SIGNAL_STYLE_CHG) {
|
||||
lv_obj_refresh_ext_draw_pad(lmeter);
|
||||
} else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
|
||||
const lv_style_t * style = lv_lmeter_get_style(lmeter);
|
||||
const lv_style_t * style = lv_lmeter_get_style(lmeter, LV_LMETER_STYLE_MAIN);
|
||||
lmeter->ext_draw_pad = LV_MATH_MAX(lmeter->ext_draw_pad, style->line.width);
|
||||
} else if(sign == LV_SIGNAL_GET_TYPE) {
|
||||
lv_obj_type_t * buf = param;
|
||||
|
||||
@@ -42,6 +42,12 @@ typedef struct
|
||||
int16_t max_value;
|
||||
} lv_lmeter_ext_t;
|
||||
|
||||
/*Styles*/
|
||||
enum {
|
||||
LV_LMETER_STYLE_MAIN,
|
||||
};
|
||||
typedef uint8_t lv_lmeter_style_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
**********************/
|
||||
@@ -85,11 +91,13 @@ void lv_lmeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint8_t line_cnt);
|
||||
/**
|
||||
* Set the styles of a line meter
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @param bg set the style of the line meter
|
||||
* @param type which style should be set (can be only `LV_LMETER_STYLE_MAIN`)
|
||||
* @param style set the style of the line meter
|
||||
*/
|
||||
static inline void lv_lmeter_set_style(lv_obj_t * lmeter, lv_style_t * bg)
|
||||
static inline void lv_lmeter_set_style(lv_obj_t * lmeter, lv_lmeter_style_t type, lv_style_t * style)
|
||||
{
|
||||
lv_obj_set_style(lmeter, bg);
|
||||
(void) type; /*Unused*/
|
||||
lv_obj_set_style(lmeter, style);
|
||||
}
|
||||
|
||||
/*=====================
|
||||
@@ -134,10 +142,12 @@ uint16_t lv_lmeter_get_scale_angle(const lv_obj_t * lmeter);
|
||||
/**
|
||||
* Get the style of a line meter
|
||||
* @param lmeter pointer to a line meter object
|
||||
* @param type which style should be get (can be only `LV_LMETER_STYLE_MAIN`)
|
||||
* @return pointer to the line meter's style
|
||||
*/
|
||||
static inline const lv_style_t * lv_lmeter_get_style(const lv_obj_t * lmeter)
|
||||
static inline const lv_style_t * lv_lmeter_get_style(const lv_obj_t * lmeter, lv_lmeter_style_t type)
|
||||
{
|
||||
(void) type; /*Unused*/
|
||||
return lv_obj_get_style(lmeter);
|
||||
}
|
||||
|
||||
|
||||
@@ -791,7 +791,7 @@ void lv_ta_set_style(lv_obj_t * ta, lv_ta_style_t type, const lv_style_t * style
|
||||
refr_cursor_area(ta);
|
||||
break;
|
||||
case LV_TA_STYLE_PLACEHOLDER:
|
||||
if(ext->placeholder) lv_label_set_style(ext->placeholder, style);
|
||||
if(ext->placeholder) lv_label_set_style(ext->placeholder, LV_LABEL_STYLE_MAIN, style);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1003,7 +1003,7 @@ const lv_style_t * lv_ta_get_style(const lv_obj_t * ta, lv_ta_style_t type)
|
||||
case LV_TA_STYLE_EDGE_FLASH: style = lv_page_get_style(ta, LV_PAGE_STYLE_EDGE_FLASH); break;
|
||||
case LV_TA_STYLE_CURSOR: style = ext->cursor.style; break;
|
||||
case LV_TA_STYLE_PLACEHOLDER:
|
||||
if(ext->placeholder) style = lv_label_get_style(ext->placeholder);
|
||||
if(ext->placeholder) style = lv_label_get_style(ext->placeholder, LV_LABEL_STYLE_MAIN);
|
||||
break;
|
||||
default: style = NULL; break;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_cont_set_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_NONE);
|
||||
lv_cont_set_layout(ext->content, LV_LAYOUT_ROW_T);
|
||||
lv_cont_set_style(ext->content, &lv_style_transp_tight);
|
||||
lv_cont_set_style(ext->content, LV_CONT_STYLE_MAIN, &lv_style_transp_tight);
|
||||
lv_obj_set_height(ext->content, lv_obj_get_height(new_tabview) - lv_obj_get_height(ext->btns));
|
||||
lv_obj_align(ext->content, ext->btns, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user