Fix some warnings
This commit is contained in:
@@ -1007,126 +1007,86 @@ lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prop
|
|||||||
*/
|
*/
|
||||||
const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
|
||||||
|
|
||||||
/**
|
#include "lv_obj_style_dec.h"
|
||||||
* Macro to declare the most important style set/get API functions.
|
|
||||||
*
|
|
||||||
* - Get the value of a style property from an object in the object's current state.
|
|
||||||
* If there is a transition animation in progress calculate the value accordingly.
|
|
||||||
* If the property is not set in the object's style check the parent(s) if the property can be inherited
|
|
||||||
* If still not found return a default value.
|
|
||||||
* For example:
|
|
||||||
* `lv_obj_get_style_border_width(btn1, LV_BTN_PART_MAIN);`
|
|
||||||
*
|
|
||||||
* - Set a local style property for an object in a given state
|
|
||||||
* For example:
|
|
||||||
* `lv_obj_set_style_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 2);`
|
|
||||||
*
|
|
||||||
* - Get the value from a style in a given state:
|
|
||||||
* For example
|
|
||||||
* `int16_t weight = lv_style_get_border_width(&style1, LV_STATE_PRESSED, &result);`
|
|
||||||
* `if(weight > 0) ...the property is found and loaded into result...`
|
|
||||||
*
|
|
||||||
* - Set a value in a style in a given state
|
|
||||||
* For example
|
|
||||||
* `lv_style_set_border_width(&style1, LV_STATE_PRESSED, 2);`
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define _LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type) \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(RADIUS, radius, lv_style_int_t,_int, scalar)
|
||||||
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(CLIP_CORNER, clip_corner, bool, _int, scalar)
|
||||||
{ \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_TIME, transition_time, lv_style_int_t, _int, scalar)
|
||||||
return (value_type) _lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SIZE, size, lv_style_int_t, _int, scalar)
|
||||||
} \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(OPA_SCALE, opa_scale, lv_opa_t, _opa, scalar)
|
||||||
static inline void lv_obj_set_style_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state, value_type value) \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_TOP, pad_top, lv_style_int_t, _int, scalar)
|
||||||
{ \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_BOTTOM, pad_bottom, lv_style_int_t, _int, scalar)
|
||||||
_lv_obj_set_style##style_type (obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_LEFT, pad_left, lv_style_int_t, _int, scalar)
|
||||||
} \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_RIGHT, pad_right, lv_style_int_t, _int, scalar)
|
||||||
static inline int16_t lv_style_get_##func_name (lv_style_t * style, lv_state_t state, void * res) \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_INNER, pad_inner, lv_style_int_t, _int, scalar)
|
||||||
{ \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
return _lv_style_get##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), res); \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t, _int, scalar)
|
||||||
} \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t, _int, scalar)
|
||||||
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t, _int, scalar)
|
||||||
{ \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_COLOR, bg_color, lv_color_t, _color, nonscalar)
|
||||||
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color, nonscalar)
|
||||||
} \
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_OPA, bg_opa, lv_opa_t , _opa, scalar)
|
||||||
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_WIDTH, border_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(RADIUS, radius, lv_style_int_t,_int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_SIDE, border_side, lv_border_side_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(CLIP_CORNER, clip_corner, bool, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_TIME, transition_time, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_POST, border_post, bool, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SIZE, size, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_COLOR, border_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OPA_SCALE, opa_scale, lv_opa_t, _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_OPA, border_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_TOP, pad_top, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_WIDTH, outline_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_BOTTOM, pad_bottom, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_PAD, outline_pad, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_LEFT, pad_left, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_BLEND_MODE, outline_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_RIGHT, pad_right, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_COLOR, outline_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PAD_INNER, pad_inner, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_OPA, outline_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_WIDTH, shadow_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_X, shadow_offset_x, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_Y, shadow_offset_y, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_SPREAD, shadow_spread, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_COLOR, bg_color, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_BLEND_MODE, shadow_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_COLOR, shadow_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BG_OPA, bg_opa, lv_opa_t , _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OPA, shadow_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_WIDTH, border_width, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_REPEAT, pattern_repeat, bool, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_SIDE, border_side, lv_border_side_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_BLEND_MODE, pattern_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_POST, border_post, bool, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_OPA, pattern_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_COLOR, border_color, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_OPA, border_opa, lv_opa_t, _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_IMAGE, pattern_image, const void *, _ptr, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_WIDTH, outline_width, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_PAD, outline_pad, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_BLEND_MODE, outline_blend_mode, lv_blend_mode_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_BLEND_MODE, value_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_COLOR, outline_color, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_X, value_ofs_x, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_OPA, outline_opa, lv_opa_t, _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_WIDTH, shadow_width, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_ALIGN, value_align, lv_align_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_X, shadow_offset_x, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_COLOR, value_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_Y, shadow_offset_y, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OPA, value_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_SPREAD, shadow_spread, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_FONT, value_font, const lv_font_t * , _ptr, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_BLEND_MODE, shadow_blend_mode, lv_blend_mode_t, _int );
|
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char * , _ptr, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_COLOR, shadow_color, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OPA, shadow_opa, lv_opa_t, _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_REPEAT, pattern_repeat, bool, _int );
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_UNDERLINE, text_underline, bool, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_BLEND_MODE, pattern_blend_mode, lv_blend_mode_t, _int );
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_STRIKETHROUGH, text_strikethrough, bool, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_OPA, pattern_opa, lv_opa_t, _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t, _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_IMAGE, pattern_image, const void *, _ptr);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, text_font, const lv_font_t * , _ptr, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_BLEND_MODE, value_blend_mode, lv_blend_mode_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_X, value_ofs_x, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_ALIGN, value_align, lv_align_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_ROUNDED, line_rounded, bool, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_COLOR, value_color, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_COLOR, line_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OPA, value_opa, lv_opa_t, _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_OPA, line_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_FONT, value_font, const lv_font_t * , _ptr);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char * , _ptr);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_OPA, image_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_UNDERLINE, text_underline, bool, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_STRIKETHROUGH, text_strikethrough, bool, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t, _int, scalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_COLOR, scale_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, text_font, const lv_font_t * , _ptr);
|
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color, nonscalar)
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_ROUNDED, line_rounded, bool, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_COLOR, line_color, lv_color_t, _color);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(LINE_OPA, line_opa, lv_opa_t, _opa);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_OPA, image_opa, lv_opa_t, _opa);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t, _int);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_COLOR, scale_color, lv_color_t, _color);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color);
|
|
||||||
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color);
|
|
||||||
|
|
||||||
#undef _LV_OBJ_STYLE_SET_GET_DECLARE
|
#undef _LV_OBJ_STYLE_SET_GET_DECLARE
|
||||||
/*-----------------
|
/*-----------------
|
||||||
|
|||||||
74
src/lv_core/lv_obj_style_dec.h
Normal file
74
src/lv_core/lv_obj_style_dec.h
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
|
||||||
|
/**
|
||||||
|
* @file lv_obj_style_dec.h
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef LV_OBJ_STYLE_DEC_H
|
||||||
|
#define LV_OBJ_STYLE_DEC_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*********************
|
||||||
|
* DEFINES
|
||||||
|
*********************/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Macro to declare the most important style set/get API functions.
|
||||||
|
*
|
||||||
|
* - Get the value of a style property from an object in the object's current state.
|
||||||
|
* If there is a transition animation in progress calculate the value accordingly.
|
||||||
|
* If the property is not set in the object's style check the parent(s) if the property can be inherited
|
||||||
|
* If still not found return a default value.
|
||||||
|
* For example:
|
||||||
|
* `lv_obj_get_style_border_width(btn1, LV_BTN_PART_MAIN);`
|
||||||
|
*
|
||||||
|
* - Set a local style property for an object in a given state
|
||||||
|
* For example:
|
||||||
|
* `lv_obj_set_style_border_width(btn1, LV_BTN_PART_MAIN, LV_STATE_PRESSED, 2);`
|
||||||
|
*
|
||||||
|
* - Get the value from a style in a given state:
|
||||||
|
* For example
|
||||||
|
* `int16_t weight = lv_style_get_border_width(&style1, LV_STATE_PRESSED, &result);`
|
||||||
|
* `if(weight > 0) ...the property is found and loaded into result...`
|
||||||
|
*
|
||||||
|
* - Set a value in a style in a given state
|
||||||
|
* For example
|
||||||
|
* `lv_style_set_border_width(&style1, LV_STATE_PRESSED, 2);`
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#define _LV_OBJ_STYLE_DECLARE_GET_scalar(prop_name, func_name, value_type, style_type) \
|
||||||
|
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
|
||||||
|
{ \
|
||||||
|
return (value_type) _lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _LV_OBJ_STYLE_DECLARE_GET_nonscalar(prop_name, func_name, value_type, style_type) \
|
||||||
|
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
|
||||||
|
{ \
|
||||||
|
return _lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define _LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type, scalar) \
|
||||||
|
_LV_OBJ_STYLE_DECLARE_GET_##scalar(prop_name, func_name, value_type, style_type) \
|
||||||
|
static inline void lv_obj_set_style_##func_name (lv_obj_t * obj, uint8_t part, lv_state_t state, value_type value) \
|
||||||
|
{ \
|
||||||
|
_lv_obj_set_style##style_type (obj, part, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
|
||||||
|
} \
|
||||||
|
static inline int16_t lv_style_get_##func_name (lv_style_t * style, lv_state_t state, void * res) \
|
||||||
|
{ \
|
||||||
|
return _lv_style_get##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), res); \
|
||||||
|
} \
|
||||||
|
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
|
||||||
|
{ \
|
||||||
|
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
} /* extern "C" */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /*LV_OBJ_H*/
|
||||||
@@ -471,8 +471,9 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
|||||||
* Higher number is means better fit
|
* Higher number is means better fit
|
||||||
* -1 if the not found (`res` will be undefined)
|
* -1 if the not found (`res` will be undefined)
|
||||||
*/
|
*/
|
||||||
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res)
|
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, void * v_res)
|
||||||
{
|
{
|
||||||
|
lv_style_int_t * res = (lv_style_int_t *)v_res;
|
||||||
LV_ASSERT_STYLE(style);
|
LV_ASSERT_STYLE(style);
|
||||||
|
|
||||||
if(style == NULL) return -1;
|
if(style == NULL) return -1;
|
||||||
@@ -505,8 +506,9 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv
|
|||||||
* For example: `lv_style_get_border_opa()`
|
* For example: `lv_style_get_border_opa()`
|
||||||
* @note for performance reasons it's not checked if the property really has opacity type
|
* @note for performance reasons it's not checked if the property really has opacity type
|
||||||
*/
|
*/
|
||||||
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res)
|
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, void * v_res)
|
||||||
{
|
{
|
||||||
|
lv_opa_t * res = (lv_opa_t *)v_res;
|
||||||
LV_ASSERT_STYLE(style);
|
LV_ASSERT_STYLE(style);
|
||||||
|
|
||||||
if(style == NULL) return -1;
|
if(style == NULL) return -1;
|
||||||
@@ -539,8 +541,9 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv
|
|||||||
* For example: `lv_style_get_border_color()`
|
* For example: `lv_style_get_border_color()`
|
||||||
* @note for performance reasons it's not checked if the property really has color type
|
* @note for performance reasons it's not checked if the property really has color type
|
||||||
*/
|
*/
|
||||||
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res)
|
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, void * v_res)
|
||||||
{
|
{
|
||||||
|
lv_color_t * res = (lv_color_t *)v_res;
|
||||||
if(style == NULL) return -1;
|
if(style == NULL) return -1;
|
||||||
if(style->map == NULL) return -1;
|
if(style->map == NULL) return -1;
|
||||||
int32_t id = get_property_index(style, prop);
|
int32_t id = get_property_index(style, prop);
|
||||||
@@ -571,8 +574,9 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
|
|||||||
* For example: `lv_style_get_text_font()`
|
* For example: `lv_style_get_text_font()`
|
||||||
* @note for performance reasons it's not checked if the property really has pointer type
|
* @note for performance reasons it's not checked if the property really has pointer type
|
||||||
*/
|
*/
|
||||||
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res)
|
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void * v_res)
|
||||||
{
|
{
|
||||||
|
void **res = (void *)v_res;
|
||||||
if(style == NULL) return -1;
|
if(style == NULL) return -1;
|
||||||
if(style->map == NULL) return -1;
|
if(style->map == NULL) return -1;
|
||||||
int32_t id = get_property_index(style, prop);
|
int32_t id = get_property_index(style, prop);
|
||||||
|
|||||||
@@ -239,7 +239,7 @@ void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style);
|
|||||||
* @param style_list pointer to a style list
|
* @param style_list pointer to a style list
|
||||||
* @param style pointer to a style to remove
|
* @param style pointer to a style to remove
|
||||||
*/
|
*/
|
||||||
void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * class);
|
void lv_style_list_remove_style(lv_style_list_t *, lv_style_t *);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove all styles added from style list, clear the local style and free all allocated memories
|
* Remove all styles added from style list, clear the local style and free all allocated memories
|
||||||
@@ -335,7 +335,7 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
|||||||
* For example: `lv_style_get_border_width()`
|
* For example: `lv_style_get_border_width()`
|
||||||
* @note for performance reasons it's not checked if the property really has integer type
|
* @note for performance reasons it's not checked if the property really has integer type
|
||||||
*/
|
*/
|
||||||
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res);
|
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, void * res);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a color typed property from a style.
|
* Get a color typed property from a style.
|
||||||
@@ -350,7 +350,7 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv
|
|||||||
* For example: `lv_style_get_border_color()`
|
* For example: `lv_style_get_border_color()`
|
||||||
* @note for performance reasons it's not checked if the property really has color type
|
* @note for performance reasons it's not checked if the property really has color type
|
||||||
*/
|
*/
|
||||||
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res);
|
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, void * res);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an opacity typed property from a style.
|
* Get an opacity typed property from a style.
|
||||||
@@ -365,7 +365,7 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
|
|||||||
* For example: `lv_style_get_border_opa()`
|
* For example: `lv_style_get_border_opa()`
|
||||||
* @note for performance reasons it's not checked if the property really has opacity type
|
* @note for performance reasons it's not checked if the property really has opacity type
|
||||||
*/
|
*/
|
||||||
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res);
|
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, void * res);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a pointer typed property from a style.
|
* Get a pointer typed property from a style.
|
||||||
@@ -380,7 +380,7 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv
|
|||||||
* For example: `lv_style_get_text_font()`
|
* For example: `lv_style_get_text_font()`
|
||||||
* @note for performance reasons it's not checked if the property really has pointer type
|
* @note for performance reasons it's not checked if the property really has pointer type
|
||||||
*/
|
*/
|
||||||
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res);
|
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void * res);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a local integer typed property in a style list.
|
* Set a local integer typed property in a style list.
|
||||||
|
|||||||
@@ -353,6 +353,7 @@ void lv_mem_defrag(void)
|
|||||||
|
|
||||||
lv_res_t lv_mem_test(void)
|
lv_res_t lv_mem_test(void)
|
||||||
{
|
{
|
||||||
|
#if LV_MEM_CUSTOM == 0
|
||||||
lv_mem_ent_t * e;
|
lv_mem_ent_t * e;
|
||||||
e = ent_get_next(NULL);
|
e = ent_get_next(NULL);
|
||||||
while(e) {
|
while(e) {
|
||||||
@@ -362,7 +363,7 @@ lv_res_t lv_mem_test(void)
|
|||||||
}
|
}
|
||||||
e = ent_get_next(e);
|
e = ent_get_next(e);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return LV_RES_OK;
|
return LV_RES_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user