integarte label and checkbox

This commit is contained in:
Gabor Kiss-Vamosi
2020-12-21 10:56:25 +01:00
parent 181692605a
commit 093a6652cf
17 changed files with 994 additions and 1128 deletions

View File

@@ -47,6 +47,7 @@ props = [
{'name': 'IMG_RECOLOR_OPA', 'style_type': '_int', 'var_type': 'lv_opa_t' }, {'name': 'IMG_RECOLOR_OPA', 'style_type': '_int', 'var_type': 'lv_opa_t' },
{'name': 'OUTLINE_WIDTH', 'style_type': '_int', 'var_type': 'lv_coord_t' }, {'name': 'OUTLINE_WIDTH', 'style_type': '_int', 'var_type': 'lv_coord_t' },
{'name': 'OUTLINE_COLOR', 'style_type': '_color', 'var_type': 'lv_color_t' }, {'name': 'OUTLINE_COLOR', 'style_type': '_color', 'var_type': 'lv_color_t' },
{'name': 'OUTLINE_COLOR_FILTERED', 'style_type': '_color', 'var_type': 'lv_color_t' },
{'name': 'OUTLINE_OPA', 'style_type': '_int', 'var_type': 'lv_opa_t' }, {'name': 'OUTLINE_OPA', 'style_type': '_int', 'var_type': 'lv_opa_t' },
{'name': 'OUTLINE_PAD', 'style_type': '_int', 'var_type': 'lv_coord_t' }, {'name': 'OUTLINE_PAD', 'style_type': '_int', 'var_type': 'lv_coord_t' },
{'name': 'OUTLINE_BLEND_MODE', 'style_type': '_int', 'var_type': 'lv_blend_mode_t' }, {'name': 'OUTLINE_BLEND_MODE', 'style_type': '_int', 'var_type': 'lv_blend_mode_t' },

View File

@@ -58,6 +58,15 @@ typedef struct _lv_event_temp_data {
struct _lv_event_temp_data * prev; struct _lv_event_temp_data * prev;
} lv_event_temp_data_t; } lv_event_temp_data_t;
typedef struct {
uint16_t time;
uint16_t delay;
lv_part_t part;
lv_state_t state;
lv_style_prop_t prop;
const lv_anim_path_t * path;
}trans_set_t;
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
@@ -74,22 +83,6 @@ static void lv_obj_destructor(void * obj);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static const uint16_t trans_prop_def[] =
{
LV_STYLE_RADIUS, LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_TRANSFORM_ZOOM, LV_STYLE_TRANSFORM_ANGLE, LV_STYLE_OPA,
LV_STYLE_COLOR_FILTER_CB, LV_STYLE_COLOR_FILTER_OPA,
LV_STYLE_PAD_TOP, LV_STYLE_PAD_BOTTOM, LV_STYLE_PAD_LEFT, LV_STYLE_PAD_RIGHT,
LV_STYLE_MARGIN_TOP, LV_STYLE_MARGIN_BOTTOM, LV_STYLE_MARGIN_LEFT, LV_STYLE_MARGIN_RIGHT,
LV_STYLE_BG_COLOR, LV_STYLE_BG_OPA, LV_STYLE_BG_GRAD_COLOR, LV_STYLE_BG_MAIN_STOP, LV_STYLE_BG_GRAD_STOP,
LV_STYLE_BORDER_COLOR, LV_STYLE_BORDER_OPA, LV_STYLE_BORDER_WIDTH,
LV_STYLE_TEXT_COLOR, LV_STYLE_TEXT_OPA, LV_STYLE_TEXT_FONT, LV_STYLE_TEXT_LETTER_SPACE, LV_STYLE_TEXT_LINE_SPACE,
LV_STYLE_IMG_OPA, LV_STYLE_IMG_RECOLOR, LV_STYLE_IMG_RECOLOR_OPA,
LV_STYLE_OUTLINE_WIDTH, LV_STYLE_OUTLINE_COLOR, LV_STYLE_OUTLINE_OPA, LV_STYLE_OUTLINE_PAD,
LV_STYLE_SHADOW_WIDTH, LV_STYLE_SHADOW_OFS_X, LV_STYLE_SHADOW_OFS_Y, LV_STYLE_SHADOW_SPREAD, LV_STYLE_SHADOW_COLOR, LV_STYLE_SHADOW_OPA,
LV_STYLE_LINE_WIDTH, LV_STYLE_LINE_COLOR, LV_STYLE_LINE_OPA,
LV_STYLE_CONTENT_OFS_X, LV_STYLE_CONTENT_OFS_Y,
0
};
static bool lv_initialized = false; static bool lv_initialized = false;
static lv_event_temp_data_t * event_temp_data_head; static lv_event_temp_data_t * event_temp_data_head;
static const void * event_act_data; static const void * event_act_data;
@@ -149,10 +142,20 @@ void lv_init(void)
_lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t)); _lv_ll_init(&LV_GC_ROOT(_lv_disp_ll), sizeof(lv_disp_t));
_lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t)); _lv_ll_init(&LV_GC_ROOT(_lv_indev_ll), sizeof(lv_indev_t));
lv_mem_monitor_t mon;
lv_mem_monitor(&mon);
printf("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d\n",
(int)mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
(int)mon.free_biggest_size);
lv_theme_t * th = LV_THEME_DEFAULT_INIT(LV_THEME_DEFAULT_COLOR_PRIMARY, LV_THEME_DEFAULT_COLOR_SECONDARY, lv_theme_t * th = LV_THEME_DEFAULT_INIT(LV_THEME_DEFAULT_COLOR_PRIMARY, LV_THEME_DEFAULT_COLOR_SECONDARY,
LV_THEME_DEFAULT_FLAG, LV_THEME_DEFAULT_FLAG,
LV_THEME_DEFAULT_FONT_SMALL, LV_THEME_DEFAULT_FONT_NORMAL, LV_THEME_DEFAULT_FONT_SUBTITLE, LV_THEME_DEFAULT_FONT_TITLE); LV_THEME_DEFAULT_FONT_SMALL, LV_THEME_DEFAULT_FONT_NORMAL, LV_THEME_DEFAULT_FONT_SUBTITLE, LV_THEME_DEFAULT_FONT_TITLE);
lv_mem_monitor(&mon);
printf("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d\n",
(int)mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
(int)mon.free_biggest_size);
lv_theme_set_act(th); lv_theme_set_act(th);
/*Initialize the screen refresh system*/ /*Initialize the screen refresh system*/
@@ -215,12 +218,21 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
{ {
lv_obj_t * obj = lv_class_new(&lv_obj); lv_obj_t * obj = lv_class_new(&lv_obj);
lv_obj.constructor(obj, parent, copy); lv_obj.constructor(obj, parent, copy);
if(copy == NULL) lv_theme_apply(obj);
// else lv_style_list_copy(&obj->style_list, &copy->style_list); lv_obj_create_finish(obj, parent, copy);
return obj; return obj;
} }
void lv_obj_create_finish(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t * copy)
{
if(!copy) lv_theme_apply(obj);
// else lv_style_list_copy(&checkbox->style_indic, &checkbox_copy->style_indic);
lv_obj_clear_state(obj, LV_STATE_BORN);
}
/** /**
* Delete 'obj' and all of its children * Delete 'obj' and all of its children
* @param obj pointer to an object to delete * @param obj pointer to an object to delete
@@ -650,15 +662,6 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
/*If there is no difference in styles there is nothing else to do*/ /*If there is no difference in styles there is nothing else to do*/
if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return; if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return;
typedef struct {
uint16_t time;
uint16_t delay;
lv_part_t part;
lv_state_t state;
lv_style_prop_t prop;
const lv_anim_path_t * path;
}trans_set_t;
trans_set_t * ts = _lv_mem_buf_get(sizeof(trans_set_t) * STYLE_TRANSITION_MAX); trans_set_t * ts = _lv_mem_buf_get(sizeof(trans_set_t) * STYLE_TRANSITION_MAX);
_lv_memset_00(ts, sizeof(sizeof(trans_set_t) * 64)); _lv_memset_00(ts, sizeof(sizeof(trans_set_t) * 64));
uint32_t tsi = 0; uint32_t tsi = 0;
@@ -1277,25 +1280,6 @@ lv_obj_t * _lv_obj_get_focused_obj(const lv_obj_t * obj)
return (lv_obj_t *)focus_obj; return (lv_obj_t *)focus_obj;
} }
/**
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
* @param obj pointer to an object
* @param buf pointer to `lv_obj_type_t`. (`param` in the signal callback)
* @param name name of the object. E.g. "lv_btn". (Only the pointer is saved)
* @return LV_RES_OK
*/
lv_res_t _lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name)
{
uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
if(buf->type[i] == NULL) break;
}
buf->type[i] = name;
return LV_RES_OK;
}
/** /**
* Get object's and its ancestors type. Put their name in `type_buf` starting with the current type. * Get object's and its ancestors type. Put their name in `type_buf` starting with the current type.
* E.g. buf.type[0]="lv_btn", buf.type[1]="lv_cont", buf.type[2]="lv_obj" * E.g. buf.type[0]="lv_btn", buf.type[1]="lv_cont", buf.type[2]="lv_obj"
@@ -1482,7 +1466,8 @@ static void lv_obj_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t
obj->flags |= LV_OBJ_FLAG_SCROLL_MOMENTUM; obj->flags |= LV_OBJ_FLAG_SCROLL_MOMENTUM;
obj->flags |= LV_OBJ_FLAG_FOCUS_SCROLL; obj->flags |= LV_OBJ_FLAG_FOCUS_SCROLL;
if(parent) obj->flags |= LV_OBJ_FLAG_GESTURE_BUBBLE; if(parent) obj->flags |= LV_OBJ_FLAG_GESTURE_BUBBLE;
obj->state = LV_STATE_DEFAULT;
obj->state = LV_STATE_BORN;
/*Copy the attributes if required*/ /*Copy the attributes if required*/
if(copy != NULL) { if(copy != NULL) {

View File

@@ -162,6 +162,7 @@ enum {
LV_STATE_PRESSED = 0x10, LV_STATE_PRESSED = 0x10,
LV_STATE_SCROLLED = 0x20, LV_STATE_SCROLLED = 0x20,
LV_STATE_DISABLED = 0x40, LV_STATE_DISABLED = 0x40,
LV_STATE_BORN = 0x80,
}; };
typedef uint8_t lv_state_t; typedef uint8_t lv_state_t;
@@ -255,16 +256,11 @@ enum {
LV_PART_KNOB, LV_PART_KNOB,
LV_PART_PLACEHOLDER, LV_PART_PLACEHOLDER,
LV_PART_HIGHLIGHT, LV_PART_HIGHLIGHT,
LV_PART_MARKER,
}; };
typedef uint8_t lv_part_t; typedef uint8_t lv_part_t;
/** Used by `lv_obj_get_type()`. The object's and its ancestor types are stored here*/
typedef struct {
const char * type[LV_MAX_ANCESTOR_NUM]; /**< [0]: the actual type, [1]: ancestor, [2] #1's ancestor
... [x]: "lv_obj" */
} lv_obj_type_t;
typedef struct { typedef struct {
lv_point_t * point; lv_point_t * point;
bool result; bool result;
@@ -303,6 +299,7 @@ void lv_deinit(void);
*/ */
lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy); lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy);
void lv_obj_create_finish(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t * copy);
/** /**
* Delete 'obj' and all of its children * Delete 'obj' and all of its children
* @param obj pointer to an object to delete * @param obj pointer to an object to delete

View File

@@ -88,7 +88,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
draw_dsc->border_opa = lv_obj_get_style_border_opa(obj, part); draw_dsc->border_opa = lv_obj_get_style_border_opa(obj, part);
if(draw_dsc->border_opa > LV_OPA_MIN) { if(draw_dsc->border_opa > LV_OPA_MIN) {
draw_dsc->border_side = lv_obj_get_style_border_side(obj, part); draw_dsc->border_side = lv_obj_get_style_border_side(obj, part);
draw_dsc->border_color = lv_obj_get_style_border_color(obj, part); draw_dsc->border_color = lv_obj_get_style_border_color_filtered(obj, part);
} }
#if LV_USE_BLEND_MODES #if LV_USE_BLEND_MODES
draw_dsc->border_blend_mode = lv_obj_get_style_border_blend_mode(obj, part); draw_dsc->border_blend_mode = lv_obj_get_style_border_blend_mode(obj, part);

View File

@@ -32,30 +32,6 @@ typedef struct {
lv_style_value_t end_value; lv_style_value_t end_value;
} lv_style_trans_t; } lv_style_trans_t;
typedef struct {
lv_draw_rect_dsc_t rect;
lv_draw_label_dsc_t label;
lv_draw_line_dsc_t line;
lv_draw_img_dsc_t img;
lv_coord_t pad_top;
lv_coord_t pad_bottom;
lv_coord_t pad_right;
lv_coord_t pad_left;
lv_coord_t pad_inner;
lv_coord_t margin_top;
lv_coord_t margin_bottom;
lv_coord_t margin_left;
lv_coord_t margin_right;
lv_coord_t transform_width;
lv_coord_t transform_height;
lv_coord_t transform_angle;
lv_coord_t transform_zoom;
lv_opa_t opa_scale;
uint32_t clip_corder :1;
uint32_t border_post :1;
}style_snapshot_t;
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
@@ -756,12 +732,19 @@ static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v)
if(v == 0) value_final._int = tr->start_value._int; if(v == 0) value_final._int = tr->start_value._int;
else if(v == 255) value_final._int = tr->end_value._int; else if(v == 255) value_final._int = tr->end_value._int;
else value_final._int = tr->start_value._int + ((int32_t)((int32_t)(tr->end_value._int - tr->start_value._int) * v) >> 8); else value_final._int = tr->start_value._int + ((int32_t)((int32_t)(tr->end_value._int - tr->start_value._int) * v) >> 8);
break; break;
} }
lv_style_value_t old_value;
bool refr = true;
if(lv_style_get_prop(list->styles[i].style, tr->prop, &old_value)) {
if(value_final._ptr == old_value._ptr && value_final._func == old_value._ptr && value_final._color.full == old_value._color.full && value_final._int == old_value._int) {
refr = false;
}
}
lv_style_set_prop(list->styles[i].style, tr->prop, value_final); lv_style_set_prop(list->styles[i].style, tr->prop, value_final);
_lv_obj_refresh_style(tr->obj, tr->prop); if (refr)_lv_obj_refresh_style(tr->obj, tr->prop);
break; break;
} }

View File

@@ -309,6 +309,9 @@ static inline lv_coord_t lv_obj_get_style_outline_width(const struct _lv_obj_t *
static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * obj, uint32_t part) { static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR); return v._color; } lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR); return v._color; }
static inline lv_color_t lv_obj_get_style_outline_color_filtered(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR_FILTERED); return v._color; }
static inline lv_opa_t lv_obj_get_style_outline_opa(const struct _lv_obj_t * obj, uint32_t part) { static inline lv_opa_t lv_obj_get_style_outline_opa(const struct _lv_obj_t * obj, uint32_t part) {
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA); return v._int; } lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA); return v._int; }

View File

@@ -101,6 +101,10 @@ void _alloc_ext(lv_style_t * style)
style->ext = lv_mem_alloc(sizeof(lv_style_ext_t)); style->ext = lv_mem_alloc(sizeof(lv_style_ext_t));
LV_ASSERT_MEM(style->ext); LV_ASSERT_MEM(style->ext);
_lv_memset_00(style->ext, sizeof(lv_style_ext_t)); _lv_memset_00(style->ext, sizeof(lv_style_ext_t));
static uint32_t c = 0;
// printf("alloc: %d\n", c);
c++;
} }
void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t value) void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t value)

View File

@@ -92,80 +92,80 @@ typedef enum {
LV_STYLE_OPA = 7 | LV_STYLE_PROP_INHERIT, LV_STYLE_OPA = 7 | LV_STYLE_PROP_INHERIT,
LV_STYLE_COLOR_FILTER_CB = 8, LV_STYLE_COLOR_FILTER_CB = 8,
LV_STYLE_COLOR_FILTER_OPA = 9, LV_STYLE_COLOR_FILTER_OPA = 9,
LV_STYLE_TRANSITION = 10,
LV_STYLE_PAD_TOP = 10 | LV_STYLE_PROP_LAYOUT_REFR, LV_STYLE_PAD_TOP = 20 | LV_STYLE_PROP_LAYOUT_REFR,
LV_STYLE_PAD_BOTTOM = 11 | LV_STYLE_PROP_LAYOUT_REFR, LV_STYLE_PAD_BOTTOM = 21 | LV_STYLE_PROP_LAYOUT_REFR,
LV_STYLE_PAD_LEFT = 12 | LV_STYLE_PROP_LAYOUT_REFR, LV_STYLE_PAD_LEFT = 22 | LV_STYLE_PROP_LAYOUT_REFR,
LV_STYLE_PAD_RIGHT = 13 | LV_STYLE_PROP_LAYOUT_REFR, LV_STYLE_PAD_RIGHT = 23 | LV_STYLE_PROP_LAYOUT_REFR,
LV_STYLE_MARGIN_TOP = 14 | LV_STYLE_PROP_LAYOUT_REFR, LV_STYLE_MARGIN_TOP = 24 | LV_STYLE_PROP_LAYOUT_REFR,
LV_STYLE_MARGIN_BOTTOM = 15 | LV_STYLE_PROP_LAYOUT_REFR, LV_STYLE_MARGIN_BOTTOM = 25 | LV_STYLE_PROP_LAYOUT_REFR,
LV_STYLE_MARGIN_LEFT = 16 | LV_STYLE_PROP_LAYOUT_REFR, LV_STYLE_MARGIN_LEFT = 26 | LV_STYLE_PROP_LAYOUT_REFR,
LV_STYLE_MARGIN_RIGHT = 17 | LV_STYLE_PROP_LAYOUT_REFR, LV_STYLE_MARGIN_RIGHT = 27 | LV_STYLE_PROP_LAYOUT_REFR,
LV_STYLE_BG_COLOR = 20, LV_STYLE_BG_COLOR = 30,
LV_STYLE_BG_COLOR_FILTERED = 20 | LV_STYLE_PROP_FILTER, LV_STYLE_BG_COLOR_FILTERED = 30 | LV_STYLE_PROP_FILTER,
LV_STYLE_BG_OPA = 21, LV_STYLE_BG_OPA = 31,
LV_STYLE_BG_GRAD_COLOR = 22, LV_STYLE_BG_GRAD_COLOR = 32,
LV_STYLE_BG_GRAD_COLOR_FILTERED = 22 | LV_STYLE_PROP_FILTER, LV_STYLE_BG_GRAD_COLOR_FILTERED = 32 | LV_STYLE_PROP_FILTER,
LV_STYLE_BG_GRAD_DIR = 23, LV_STYLE_BG_GRAD_DIR = 33,
LV_STYLE_BG_BLEND_MODE = 24, LV_STYLE_BG_BLEND_MODE = 34,
LV_STYLE_BG_MAIN_STOP = 25, LV_STYLE_BG_MAIN_STOP = 35,
LV_STYLE_BG_GRAD_STOP = 26, LV_STYLE_BG_GRAD_STOP = 36,
LV_STYLE_BORDER_COLOR = 31, LV_STYLE_BORDER_COLOR = 40,
LV_STYLE_BORDER_COLOR_FILTERED = 31 | LV_STYLE_PROP_FILTER, LV_STYLE_BORDER_COLOR_FILTERED = 40 | LV_STYLE_PROP_FILTER,
LV_STYLE_BORDER_OPA = 32, LV_STYLE_BORDER_OPA = 41,
LV_STYLE_BORDER_WIDTH = 33, LV_STYLE_BORDER_WIDTH = 42,
LV_STYLE_BORDER_SIDE = 34, LV_STYLE_BORDER_SIDE = 43,
LV_STYLE_BORDER_POST = 35, LV_STYLE_BORDER_POST = 44,
LV_STYLE_BORDER_BLEND_MODE = 36, LV_STYLE_BORDER_BLEND_MODE = 45,
LV_STYLE_TEXT_COLOR = 40 | LV_STYLE_PROP_INHERIT, LV_STYLE_TEXT_COLOR = 50 | LV_STYLE_PROP_INHERIT,
LV_STYLE_TEXT_COLOR_FILTERED = 40 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_FILTER, LV_STYLE_TEXT_COLOR_FILTERED = 50 | LV_STYLE_PROP_INHERIT | LV_STYLE_PROP_FILTER,
LV_STYLE_TEXT_OPA = 41 | LV_STYLE_PROP_INHERIT, LV_STYLE_TEXT_OPA = 51 | LV_STYLE_PROP_INHERIT,
LV_STYLE_TEXT_FONT = 42 | LV_STYLE_PROP_INHERIT, LV_STYLE_TEXT_FONT = 52 | LV_STYLE_PROP_INHERIT,
LV_STYLE_TEXT_LETTER_SPACE = 43 | LV_STYLE_PROP_INHERIT, LV_STYLE_TEXT_LETTER_SPACE = 53 | LV_STYLE_PROP_INHERIT,
LV_STYLE_TEXT_LINE_SPACE = 44 | LV_STYLE_PROP_INHERIT, LV_STYLE_TEXT_LINE_SPACE = 54 | LV_STYLE_PROP_INHERIT,
LV_STYLE_TEXT_DECOR = 45 | LV_STYLE_PROP_INHERIT, LV_STYLE_TEXT_DECOR = 55 | LV_STYLE_PROP_INHERIT,
LV_STYLE_TEXT_BLEND_MODE = 46 | LV_STYLE_PROP_INHERIT, LV_STYLE_TEXT_BLEND_MODE = 56 | LV_STYLE_PROP_INHERIT,
LV_STYLE_IMG_OPA = 50, LV_STYLE_IMG_OPA = 60,
LV_STYLE_IMG_BLEND_MODE = 51, LV_STYLE_IMG_BLEND_MODE = 61,
LV_STYLE_IMG_RECOLOR = 52, LV_STYLE_IMG_RECOLOR = 62,
LV_STYLE_IMG_RECOLOR_FILTERED = 52 | LV_STYLE_PROP_FILTER, LV_STYLE_IMG_RECOLOR_FILTERED = 62 | LV_STYLE_PROP_FILTER,
LV_STYLE_IMG_RECOLOR_OPA = 53, LV_STYLE_IMG_RECOLOR_OPA = 63,
LV_STYLE_OUTLINE_WIDTH = 61 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OUTLINE_WIDTH = 71 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_OUTLINE_COLOR = 62, LV_STYLE_OUTLINE_COLOR = 72,
LV_STYLE_OUTLINE_COLOR_FILTERED = 62 | LV_STYLE_PROP_FILTER, LV_STYLE_OUTLINE_COLOR_FILTERED = 72 | LV_STYLE_PROP_FILTER,
LV_STYLE_OUTLINE_OPA = 63 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OUTLINE_OPA = 73 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_OUTLINE_PAD = 64 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_OUTLINE_PAD = 74 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_OUTLINE_BLEND_MODE = 65, LV_STYLE_OUTLINE_BLEND_MODE = 75,
LV_STYLE_SHADOW_WIDTH = 70 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_SHADOW_WIDTH = 80 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_SHADOW_OFS_X = 71 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_SHADOW_OFS_X = 81 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_SHADOW_OFS_Y = 72 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_SHADOW_OFS_Y = 82 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_SHADOW_SPREAD = 73 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_SHADOW_SPREAD = 83 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_SHADOW_BLEND_MODE = 74, LV_STYLE_SHADOW_BLEND_MODE = 84,
LV_STYLE_SHADOW_COLOR = 75, LV_STYLE_SHADOW_COLOR = 85,
LV_STYLE_SHADOW_COLOR_FILTERED = 75 | LV_STYLE_PROP_FILTER, LV_STYLE_SHADOW_COLOR_FILTERED = 85 | LV_STYLE_PROP_FILTER,
LV_STYLE_SHADOW_OPA = 76 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_SHADOW_OPA = 86 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_LINE_WIDTH = 80 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_LINE_WIDTH = 90 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_LINE_BLEND_MODE = 81, LV_STYLE_LINE_BLEND_MODE = 91,
LV_STYLE_LINE_DASH_WIDTH = 82, LV_STYLE_LINE_DASH_WIDTH = 92,
LV_STYLE_LINE_DASH_GAP = 83, LV_STYLE_LINE_DASH_GAP = 93,
LV_STYLE_LINE_ROUNDED = 84, LV_STYLE_LINE_ROUNDED = 94,
LV_STYLE_LINE_COLOR = 85, LV_STYLE_LINE_COLOR = 95,
LV_STYLE_LINE_COLOR_FILTERED = 85 | LV_STYLE_PROP_FILTER, LV_STYLE_LINE_COLOR_FILTERED = 95 | LV_STYLE_PROP_FILTER,
LV_STYLE_LINE_OPA = 86, LV_STYLE_LINE_OPA = 96,
LV_STYLE_CONTENT_SRC = 90 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_CONTENT_SRC = 100 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_CONTENT_ALIGN = 91 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_CONTENT_ALIGN = 101 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_CONTENT_OFS_X = 92 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_CONTENT_OFS_X = 102 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_CONTENT_OFS_Y = 93 | LV_STYLE_PROP_EXT_DRAW, LV_STYLE_CONTENT_OFS_Y = 103 | LV_STYLE_PROP_EXT_DRAW,
LV_STYLE_TRANSITION = 100,
_LV_STYLE_LAST_BUIL_IN_PROP, _LV_STYLE_LAST_BUIL_IN_PROP,
@@ -179,9 +179,6 @@ typedef struct {
const struct _lv_style_transiton_t * transition; const struct _lv_style_transiton_t * transition;
const char * content_text; const char * content_text;
uint16_t transition_time;
uint16_t transition_delay;
lv_color_t bg_grad_color; lv_color_t bg_grad_color;
lv_color_t outline_color; lv_color_t outline_color;
lv_color_t shadow_color; lv_color_t shadow_color;

View File

@@ -44,7 +44,7 @@ typedef struct {
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/
uint32_t _lv_txt_ap_calc_bytes_cnt(const char * txt); uint32_t _lv_txt_ap_proc(const char * txt);
void _lv_txt_ap_proc(const char * txt, char * txt_out); void _lv_txt_ap_proc(const char * txt, char * txt_out);
/********************** /**********************

View File

@@ -91,6 +91,7 @@ typedef struct {
lv_style_t bg_color_gray; lv_style_t bg_color_gray;
lv_style_t pressed; lv_style_t pressed;
lv_style_t disabled; lv_style_t disabled;
lv_style_t pad_zero;
lv_style_t pad_small; lv_style_t pad_small;
lv_style_t pad_small_negative; lv_style_t pad_small_negative;
lv_style_t focus_border; lv_style_t focus_border;
@@ -101,6 +102,8 @@ typedef struct {
lv_style_t no_radius; lv_style_t no_radius;
lv_style_t clip_corner; lv_style_t clip_corner;
lv_style_t grow; lv_style_t grow;
lv_style_t transition_delayed;
lv_style_t transition_normal;
/*Parts*/ /*Parts*/
lv_style_t knob; lv_style_t knob;
@@ -113,10 +116,6 @@ typedef struct {
lv_style_t arc_knob; lv_style_t arc_knob;
#endif #endif
#if LV_USE_BAR
lv_style_t bar_bg;
lv_style_t bar_indic;
#endif
#if LV_USE_BTNMATRIX #if LV_USE_BTNMATRIX
lv_style_t btnmatrix_btn; lv_style_t btnmatrix_btn;
@@ -127,7 +126,7 @@ typedef struct {
#endif #endif
#if LV_USE_CHECKBOX #if LV_USE_CHECKBOX
lv_style_t cb_bg, cb_bullet; lv_style_t cb_marker;
#endif #endif
#if LV_USE_DROPDOWN #if LV_USE_DROPDOWN
@@ -146,9 +145,6 @@ typedef struct {
lv_style_t roller_bg, roller_sel; lv_style_t roller_bg, roller_sel;
#endif #endif
#if LV_USE_SLIDER
lv_style_t slider_knob, slider_bg;
#endif
#if LV_USE_SWITCH #if LV_USE_SWITCH
lv_style_t sw_knob; lv_style_t sw_knob;
@@ -189,7 +185,7 @@ static bool inited;
static void basic_init(void) static void basic_init(void)
{ {
const static lv_style_prop_t trans_props[] = { const static lv_style_prop_t trans_props[] = {
LV_STYLE_BG_OPA, LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_COLOR_FILTER_OPA, LV_STYLE_COLOR_FILTER_CB, 0 LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR, LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT, LV_STYLE_COLOR_FILTER_OPA, LV_STYLE_COLOR_FILTER_CB, 0
}; };
static lv_style_transiton_t trans_delayed; static lv_style_transiton_t trans_delayed;
@@ -201,6 +197,13 @@ static void basic_init(void)
static lv_style_transiton_t trans_normal; static lv_style_transiton_t trans_normal;
lv_style_transition_init(&trans_normal, trans_props, &lv_anim_path_def, TRANSITION_TIME, 0); lv_style_transition_init(&trans_normal, trans_props, &lv_anim_path_def, TRANSITION_TIME, 0);
style_init_reset(&styles->transition_delayed);
lv_style_set_transition(&styles->transition_delayed, &trans_delayed); /*Go back to default state with delay*/
style_init_reset(&styles->transition_normal);
lv_style_set_transition(&styles->transition_normal, &trans_normal); /*Go back to default state with delay*/
style_init_reset(&styles->scrollbar); style_init_reset(&styles->scrollbar);
lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_COVER); lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_COVER);
lv_style_set_bg_color(&styles->scrollbar, (IS_LIGHT ? lv_color_hex(0xcccfd1) : lv_color_hex(0x777f85))); lv_style_set_bg_color(&styles->scrollbar, (IS_LIGHT ? lv_color_hex(0xcccfd1) : lv_color_hex(0x777f85)));
@@ -255,7 +258,6 @@ static void basic_init(void)
lv_style_set_img_recolor(&styles->btn, CARD_TEXT_COLOR); lv_style_set_img_recolor(&styles->btn, CARD_TEXT_COLOR);
lv_style_set_pad_hor(&styles->btn, LV_DPX(40)); lv_style_set_pad_hor(&styles->btn, LV_DPX(40));
lv_style_set_pad_ver(&styles->btn, LV_DPX(15)); lv_style_set_pad_ver(&styles->btn, LV_DPX(15));
lv_style_set_transition(&styles->btn, &trans_delayed); /*Go back to default state with delay*/
style_init_reset(&styles->btn_color); style_init_reset(&styles->btn_color);
@@ -270,23 +272,24 @@ static void basic_init(void)
style_init_reset(&styles->pressed); style_init_reset(&styles->pressed);
lv_style_set_color_filter_cb(&styles->pressed, lv_color_darken); lv_style_set_color_filter_cb(&styles->pressed, lv_color_darken);
lv_style_set_color_filter_opa(&styles->pressed, LV_OPA_20); lv_style_set_color_filter_opa(&styles->pressed, LV_OPA_20);
lv_style_set_transition(&styles->pressed, &trans_normal);
style_init_reset(&styles->disabled); style_init_reset(&styles->disabled);
lv_style_set_color_filter_cb(&styles->disabled, lv_color_lighten); lv_style_set_color_filter_cb(&styles->disabled, lv_color_lighten);
lv_style_set_color_filter_opa(&styles->disabled, LV_OPA_40); lv_style_set_color_filter_opa(&styles->disabled, LV_OPA_40);
lv_style_set_transition(&styles->disabled, &trans_normal);
style_init_reset(&styles->clip_corner); style_init_reset(&styles->clip_corner);
lv_style_set_clip_corner(&styles->clip_corner, true); lv_style_set_clip_corner(&styles->clip_corner, true);
style_init_reset(&styles->pad_small); style_init_reset(&styles->pad_small);
lv_coord_t pad_small_value = lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? LV_DPX(10) : LV_DPX(20); lv_coord_t pad_small_value = LV_DPX(10);
lv_style_set_pad_all(&styles->pad_small, pad_small_value); lv_style_set_pad_all(&styles->pad_small, pad_small_value);
style_init_reset(&styles->pad_small_negative); style_init_reset(&styles->pad_small_negative);
lv_style_set_pad_all(&styles->pad_small_negative, - LV_DPX(2)); lv_style_set_pad_all(&styles->pad_small_negative, - LV_DPX(2));
style_init_reset(&styles->pad_zero);
lv_style_set_pad_all(&styles->pad_zero, LV_DPX(2));
style_init_reset(&styles->bg_color_primary); style_init_reset(&styles->bg_color_primary);
lv_style_set_bg_color(&styles->bg_color_primary, theme.color_primary); lv_style_set_bg_color(&styles->bg_color_primary, theme.color_primary);
lv_style_set_bg_opa(&styles->bg_color_primary, LV_OPA_COVER); lv_style_set_bg_opa(&styles->bg_color_primary, LV_OPA_COVER);
@@ -307,13 +310,41 @@ static void basic_init(void)
lv_style_set_bg_opa(&styles->knob, LV_OPA_COVER); lv_style_set_bg_opa(&styles->knob, LV_OPA_COVER);
lv_style_set_pad_all(&styles->knob, LV_DPX(5)); lv_style_set_pad_all(&styles->knob, LV_DPX(5));
lv_style_set_radius(&styles->knob, LV_RADIUS_CIRCLE); lv_style_set_radius(&styles->knob, LV_RADIUS_CIRCLE);
}
static void btn_init(void)
{
#if LV_USE_BTN != 0
#endif style_init_reset(&styles->cb_marker);
//static void checkbox_init(void)
//{
//#if LV_USE_CHECKBOX != 0
// style_init_reset(&styles->cb_bg);
// lv_style_set_radius(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(4));
// lv_style_set_outline_color(&styles->cb_bg, LV_STATE_DEFAULT, theme.color_primary);
// lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
// lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
// lv_style_set_outline_width(&styles->cb_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
// lv_style_set_outline_pad(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(6));
// lv_style_set_transition_time(&styles->cb_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
// lv_style_set_transition_prop_6(&styles->cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
//
// style_init_reset(&styles->cb_bullet);
// lv_style_set_outline_opa(&styles->cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP);
// lv_style_set_radius(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(4));
// lv_style_set_pattern_image(&styles->cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK);
// lv_style_set_pattern_recolor(&styles->cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE);
// lv_style_set_pattern_opa(&styles->cb_bullet, LV_STATE_DEFAULT, LV_OPA_TRANSP);
// lv_style_set_pattern_opa(&styles->cb_bullet, LV_STATE_CHECKED, LV_OPA_COVER);
// lv_style_set_transition_prop_3(&styles->cb_bullet, LV_STATE_DEFAULT, LV_STYLE_PATTERN_OPA);
// lv_style_set_text_font(&styles->cb_bullet, LV_STATE_CHECKED, theme.font_small);
// lv_style_set_pad_left(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
// lv_style_set_pad_right(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
// lv_style_set_pad_top(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
// lv_style_set_pad_bottom(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
// lv_style_set_margin_right(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(6));
//#endif
//}
} }
static void btnmatrix_init(void) static void btnmatrix_init(void)
@@ -324,45 +355,6 @@ static void btnmatrix_init(void)
#endif #endif
} }
static void label_init(void)
{
#if LV_USE_LABEL != 0
#endif
}
static void bar_init(void)
{
#if LV_USE_BAR
// style_init_reset(&styles->bar_bg);
// lv_style_set_radius(&styles->bar_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
// lv_style_set_bg_opa(&styles->bar_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
// lv_style_set_bg_color(&styles->bar_bg, LV_STATE_DEFAULT, COLOR_BG_SEC);
// lv_style_set_value_color(&styles->bar_bg, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
// lv_style_set_outline_color(&styles->bar_bg, LV_STATE_DEFAULT, theme.color_primary);
// lv_style_set_outline_color(&styles->bar_bg, LV_STATE_EDITED, theme.color_secondary);
// lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
// lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
// lv_style_set_outline_width(&styles->bar_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
// lv_style_set_transition_time(&styles->bar_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
// lv_style_set_transition_prop_6(&styles->bar_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
//
// style_init_reset(&styles->bar_indic);
// lv_style_set_bg_opa(&styles->bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
// lv_style_set_radius(&styles->bar_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
// lv_style_set_bg_color(&styles->bar_indic, LV_STATE_DEFAULT, theme.color_primary);
// lv_style_set_bg_color(&styles->bar_indic, LV_STATE_DISABLED, lv_color_hex3(0x888));
// lv_style_set_value_color(&styles->bar_indic, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x41404f) : LV_COLOR_WHITE);
#endif
}
static void img_init(void)
{
#if LV_USE_IMG != 0
#endif
}
static void line_init(void) static void line_init(void)
{ {
#if LV_USE_LINE != 0 #if LV_USE_LINE != 0
@@ -370,28 +362,6 @@ static void line_init(void)
#endif #endif
} }
static void slider_init(void)
{
#if LV_USE_SLIDER != 0
// style_init_reset(&styles->slider_knob);
// lv_style_set_bg_opa(&styles->slider_knob, LV_STATE_DEFAULT, LV_OPA_COVER);
// lv_style_set_bg_color(&styles->slider_knob, LV_STATE_DEFAULT, IS_LIGHT ? theme.color_primary : LV_COLOR_WHITE);
// lv_style_set_value_color(&styles->slider_knob, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
// lv_style_set_radius(&styles->slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
// lv_style_set_pad_left(&styles->slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
// lv_style_set_pad_right(&styles->slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
// lv_style_set_pad_top(&styles->slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
// lv_style_set_pad_bottom(&styles->slider_knob, LV_STATE_DEFAULT, LV_DPX(7));
//
// style_init_reset(&styles->slider_bg);
// lv_style_set_margin_left(&styles->slider_bg, LV_STATE_DEFAULT, LV_DPX(10));
// lv_style_set_margin_right(&styles->slider_bg, LV_STATE_DEFAULT, LV_DPX(10));
// lv_style_set_margin_top(&styles->slider_bg, LV_STATE_DEFAULT, LV_DPX(10));
// lv_style_set_margin_bottom(&styles->slider_bg, LV_STATE_DEFAULT, LV_DPX(10));
#endif
}
static void switch_init(void) static void switch_init(void)
{ {
#if LV_USE_SWITCH != 0 #if LV_USE_SWITCH != 0
@@ -510,36 +480,6 @@ static void chart_init(void)
#endif #endif
} }
static void checkbox_init(void)
{
#if LV_USE_CHECKBOX != 0
style_init_reset(&styles->cb_bg);
lv_style_set_radius(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(4));
lv_style_set_outline_color(&styles->cb_bg, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50);
lv_style_set_outline_width(&styles->cb_bg, LV_STATE_DEFAULT, OUTLINE_WIDTH);
lv_style_set_outline_pad(&styles->cb_bg, LV_STATE_DEFAULT, LV_DPX(6));
lv_style_set_transition_time(&styles->cb_bg, LV_STATE_DEFAULT, TRANSITION_TIME);
lv_style_set_transition_prop_6(&styles->cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA);
style_init_reset(&styles->cb_bullet);
lv_style_set_outline_opa(&styles->cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP);
lv_style_set_radius(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(4));
lv_style_set_pattern_image(&styles->cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK);
lv_style_set_pattern_recolor(&styles->cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE);
lv_style_set_pattern_opa(&styles->cb_bullet, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_style_set_pattern_opa(&styles->cb_bullet, LV_STATE_CHECKED, LV_OPA_COVER);
lv_style_set_transition_prop_3(&styles->cb_bullet, LV_STATE_DEFAULT, LV_STYLE_PATTERN_OPA);
lv_style_set_text_font(&styles->cb_bullet, LV_STATE_CHECKED, theme.font_small);
lv_style_set_pad_left(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
lv_style_set_pad_right(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
lv_style_set_pad_top(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
lv_style_set_pad_bottom(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(3));
lv_style_set_margin_right(&styles->cb_bullet, LV_STATE_DEFAULT, LV_DPX(6));
#endif
}
static void textarea_init(void) static void textarea_init(void)
{ {
#if LV_USE_TEXTAREA #if LV_USE_TEXTAREA
@@ -655,20 +595,14 @@ lv_theme_t * lv_theme_default_init(lv_color_t color_primary, lv_color_t color_se
theme.flags = flags; theme.flags = flags;
basic_init(); basic_init();
btn_init();
btnmatrix_init(); btnmatrix_init();
label_init();
bar_init();
img_init();
line_init(); line_init();
slider_init();
switch_init(); switch_init();
linemeter_init(); linemeter_init();
gauge_init(); gauge_init();
arc_init(); arc_init();
spinner_init(); spinner_init();
chart_init(); chart_init();
checkbox_init();
textarea_init(); textarea_init();
ddlist_init(); ddlist_init();
roller_init(); roller_init();
@@ -707,8 +641,11 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
else if(lv_obj_check_type(obj, &lv_btn)) { else if(lv_obj_check_type(obj, &lv_btn)) {
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->btn); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->btn);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->btn_color); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->btn_color);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->pressed); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->pressed);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_BORN, &styles->grow);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->btn_color_checked); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->btn_color_checked);
} }
#endif #endif
@@ -720,13 +657,32 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->bg_color_primary); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->bg_color_primary);
lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->circle); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->circle);
} }
#endif
#if LV_USE_SLIDER
else if(lv_obj_check_type(obj, &lv_slider)) { else if(lv_obj_check_type(obj, &lv_slider)) {
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->bg_color_gray);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->circle); lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->circle);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_DEFAULT, &styles->transition_delayed);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal);
lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->bg_color_primary); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->bg_color_primary);
lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->circle); lv_obj_add_style(obj, LV_PART_INDICATOR, LV_STATE_DEFAULT, &styles->circle);
lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_DEFAULT, &styles->knob); lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_DEFAULT, &styles->knob);
lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_PRESSED, &styles->grow);
lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_DEFAULT, &styles->transition_delayed);
lv_obj_add_style(obj, LV_PART_KNOB, LV_STATE_PRESSED, &styles->transition_normal);
}
#endif
#if LV_USE_CHECKBOX
else if(lv_obj_check_type(obj, &lv_checkbox)) {
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->card);
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->pad_zero);
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_CHECKED, &styles->bg_color_primary);
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_PRESSED, &styles->pressed);
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal);
lv_obj_add_style(obj, LV_PART_MARKER, LV_STATE_DEFAULT, &styles->transition_delayed);
} }
#endif #endif
@@ -772,11 +728,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
break; break;
#endif #endif
#if LV_USE_LABEL
case LV_THEME_LABEL:
break;
#endif
#if LV_USE_LINE #if LV_USE_LINE
case LV_THEME_LINE: case LV_THEME_LINE:
break; break;
@@ -799,32 +750,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
break; break;
#endif #endif
#if LV_USE_SLIDER
// case LV_THEME_SLIDER:
// list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_MAIN);
// _lv_style_list_add_style(list, &styles->bar_bg);
// _lv_style_list_add_style(list, &styles->slider_bg);
//
// list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
// _lv_style_list_add_style(list, &styles->bar_indic);
//
// list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
// _lv_style_list_add_style(list, &styles->slider_knob);
// break;
#endif
#if LV_USE_CHECKBOX
case LV_THEME_CHECKBOX:
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_MAIN);
_lv_style_list_add_style(list, &styles->cb_bg);
_lv_style_list_add_style(list, &styles->sb);
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
_lv_style_list_add_style(list, &styles->btn);
_lv_style_list_add_style(list, &styles->cb_bullet);
break;
#endif
#if LV_USE_ROLLER #if LV_USE_ROLLER
case LV_THEME_ROLLER: case LV_THEME_ROLLER:
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_BG); list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);

View File

@@ -1,5 +1,3 @@
/** /**
* @file lv_bar.c * @file lv_bar.c
* *
@@ -85,10 +83,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * parent, const lv_obj_t * copy)
lv_obj_t * obj = lv_class_new(&lv_bar); lv_obj_t * obj = lv_class_new(&lv_bar);
lv_bar.constructor(obj, parent, copy); lv_bar.constructor(obj, parent, copy);
lv_bar_t * bar = (lv_bar_t *) obj; lv_obj_create_finish(obj, parent, copy);
const lv_bar_t * bar_copy = (const lv_bar_t *) copy;
if(!copy) lv_theme_apply(obj);
// else lv_style_list_copy(&bar->style_indic, &bar_copy->style_indic);
return obj; return obj;
} }
@@ -409,10 +404,19 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(obj); lv_bidi_dir_t base_dir = lv_obj_get_base_dir(obj);
lv_coord_t objw = lv_obj_get_width(obj); lv_area_t bar_coords;
lv_coord_t objh = lv_obj_get_height(obj); lv_obj_get_coords(obj, &bar_coords);
lv_coord_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
lv_coord_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
bar_coords.x1 -= transf_w;
bar_coords.x2 += transf_w;
bar_coords.y1 -= transf_h;
bar_coords.y2 += transf_h;
lv_coord_t barw = lv_area_get_width(&bar_coords);
lv_coord_t barh = lv_area_get_height(&bar_coords);
int32_t range = bar->max_value - bar->min_value; int32_t range = bar->max_value - bar->min_value;
bool hor = objw >= objh ? true : false; bool hor = barw >= barh ? true : false;
bool sym = false; bool sym = false;
if(bar->type == LV_BAR_TYPE_SYMMETRICAL && bar->min_value < 0 && bar->max_value > 0 && if(bar->type == LV_BAR_TYPE_SYMMETRICAL && bar->min_value < 0 && bar->max_value > 0 &&
bar->start_value == bar->min_value) sym = true; bar->start_value == bar->min_value) sym = true;
@@ -422,20 +426,19 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN);
lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN);
lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN);
/*Respect padding and minimum width/height too*/ /*Respect padding and minimum width/height too*/
lv_area_copy(&bar->indic_area, &bar->coords); lv_area_copy(&bar->indic_area, &bar_coords);
bar->indic_area.x1 += bg_left; bar->indic_area.x1 += bg_left;
bar->indic_area.x2 -= bg_right; bar->indic_area.x2 -= bg_right;
bar->indic_area.y1 += bg_top; bar->indic_area.y1 += bg_top;
bar->indic_area.y2 -= bg_bottom; bar->indic_area.y2 -= bg_bottom;
if(hor && lv_area_get_height(&bar->indic_area) < LV_BAR_SIZE_MIN) { if(hor && lv_area_get_height(&bar->indic_area) < LV_BAR_SIZE_MIN) {
bar->indic_area.y1 = bar->coords.y1 + (objh / 2) - (LV_BAR_SIZE_MIN / 2); bar->indic_area.y1 = bar->coords.y1 + (barh / 2) - (LV_BAR_SIZE_MIN / 2);
bar->indic_area.y2 = bar->indic_area.y1 + LV_BAR_SIZE_MIN; bar->indic_area.y2 = bar->indic_area.y1 + LV_BAR_SIZE_MIN;
} }
else if(!hor && lv_area_get_width(&bar->indic_area) < LV_BAR_SIZE_MIN) { else if(!hor && lv_area_get_width(&bar->indic_area) < LV_BAR_SIZE_MIN) {
bar->indic_area.x1 = bar->coords.x1 + (objw / 2) - (LV_BAR_SIZE_MIN / 2); bar->indic_area.x1 = bar->coords.x1 + (barw / 2) - (LV_BAR_SIZE_MIN / 2);
bar->indic_area.x2 = bar->indic_area.x1 + LV_BAR_SIZE_MIN; bar->indic_area.x2 = bar->indic_area.x1 + LV_BAR_SIZE_MIN;
} }
@@ -532,7 +535,7 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
if(!sym && indic_length_calc(&bar->indic_area) <= 1) return; if(!sym && indic_length_calc(&bar->indic_area) <= 1) return;
uint16_t bg_radius = lv_obj_get_style_radius(obj, LV_PART_MAIN); uint16_t bg_radius = lv_obj_get_style_radius(obj, LV_PART_MAIN);
lv_coord_t short_side = LV_MATH_MIN(objw, objh); lv_coord_t short_side = LV_MATH_MIN(barw, barh);
if(bg_radius > short_side >> 1) bg_radius = short_side >> 1; if(bg_radius > short_side >> 1) bg_radius = short_side >> 1;
lv_draw_rect_dsc_t draw_indic_dsc; lv_draw_rect_dsc_t draw_indic_dsc;
@@ -557,7 +560,7 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
} }
lv_draw_mask_radius_param_t mask_bg_param; lv_draw_mask_radius_param_t mask_bg_param;
lv_draw_mask_radius_init(&mask_bg_param, &bar->coords, bg_radius, false); lv_draw_mask_radius_init(&mask_bg_param, &bar_coords, bg_radius, false);
int16_t mask_bg_id = lv_draw_mask_add(&mask_bg_param, NULL); int16_t mask_bg_id = lv_draw_mask_add(&mask_bg_param, NULL);
/*Draw_only the background and the pattern*/ /*Draw_only the background and the pattern*/
@@ -570,17 +573,17 @@ static void draw_indic(lv_obj_t * obj, const lv_area_t * clip_area)
/*Get the max possible indicator area. The gradient should be applied on this*/ /*Get the max possible indicator area. The gradient should be applied on this*/
lv_area_t mask_indic_max_area; lv_area_t mask_indic_max_area;
lv_area_copy(&mask_indic_max_area, &bar->coords); lv_area_copy(&mask_indic_max_area, &bar_coords);
mask_indic_max_area.x1 += bg_left; mask_indic_max_area.x1 += bg_left;
mask_indic_max_area.y1 += bg_top; mask_indic_max_area.y1 += bg_top;
mask_indic_max_area.x2 -= bg_right; mask_indic_max_area.x2 -= bg_right;
mask_indic_max_area.y2 -= bg_bottom; mask_indic_max_area.y2 -= bg_bottom;
if(hor && lv_area_get_height(&mask_indic_max_area) < LV_BAR_SIZE_MIN) { if(hor && lv_area_get_height(&mask_indic_max_area) < LV_BAR_SIZE_MIN) {
mask_indic_max_area.y1 = bar->coords.y1 + (objh / 2) - (LV_BAR_SIZE_MIN / 2); mask_indic_max_area.y1 = bar->coords.y1 + (barh / 2) - (LV_BAR_SIZE_MIN / 2);
mask_indic_max_area.y2 = mask_indic_max_area.y1 + LV_BAR_SIZE_MIN; mask_indic_max_area.y2 = mask_indic_max_area.y1 + LV_BAR_SIZE_MIN;
} }
else if(!hor && lv_area_get_width(&mask_indic_max_area) < LV_BAR_SIZE_MIN) { else if(!hor && lv_area_get_width(&mask_indic_max_area) < LV_BAR_SIZE_MIN) {
mask_indic_max_area.x1 = bar->coords.x1 + (objw / 2) - (LV_BAR_SIZE_MIN / 2); mask_indic_max_area.x1 = bar->coords.x1 + (barw / 2) - (LV_BAR_SIZE_MIN / 2);
mask_indic_max_area.x2 = mask_indic_max_area.x1 + LV_BAR_SIZE_MIN; mask_indic_max_area.x2 = mask_indic_max_area.x1 + LV_BAR_SIZE_MIN;
} }

View File

@@ -68,7 +68,7 @@ lv_obj_t * lv_btn_create(lv_obj_t * parent, const lv_obj_t * copy)
lv_obj_t * obj = lv_class_new(&lv_btn); lv_obj_t * obj = lv_class_new(&lv_btn);
lv_btn.constructor(obj, parent, copy); lv_btn.constructor(obj, parent, copy);
if(!copy) lv_theme_apply(obj); lv_obj_create_finish(obj, parent, copy);
LV_LOG_TRACE("button create started"); LV_LOG_TRACE("button create started");
return obj; return obj;

View File

@@ -26,15 +26,15 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_design_res_t lv_checkbox_design(lv_obj_t * cb, const lv_area_t * clip_area, lv_design_mode_t mode); static void lv_checkbox_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t * copy);
static lv_res_t lv_checkbox_signal(lv_obj_t * cb, lv_signal_t sign, void * param); static void lv_checkbox_destructor(void * obj);
static lv_style_list_t * lv_checkbox_get_style(lv_obj_t * cb, uint8_t type); static lv_design_res_t lv_checkbox_design(lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_checkbox_signal(lv_obj_t * obj, lv_signal_t sign, void * param);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
**********************/ **********************/
static lv_signal_cb_t ancestor_signal; lv_checkbox_class_t lv_checkbox;
static lv_design_cb_t ancestor_design;
/********************** /**********************
* MACROS * MACROS
@@ -50,51 +50,25 @@ static lv_design_cb_t ancestor_design;
* @param copy pointer to a check box object, if not NULL then the new object will be copied from it * @param copy pointer to a check box object, if not NULL then the new object will be copied from it
* @return pointer to the created check box * @return pointer to the created check box
*/ */
lv_obj_t * lv_checkbox_create(lv_obj_t * par, const lv_obj_t * copy) lv_obj_t * lv_checkbox_create(lv_obj_t * parent, const lv_obj_t * copy)
{ {
LV_LOG_TRACE("check box create started"); LV_LOG_TRACE("check box create started");
/*Create the ancestor basic object*/ if(!lv_checkbox._inited) {
lv_obj_t * cb = lv_obj_create(par, copy); LV_CLASS_INIT(lv_checkbox, lv_obj);
LV_ASSERT_MEM(cb); lv_checkbox.constructor = lv_checkbox_constructor;
if(cb == NULL) return NULL; lv_checkbox.destructor = lv_checkbox_destructor;
lv_checkbox.design_cb = lv_checkbox_design;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(cb); lv_checkbox.signal_cb = lv_checkbox_signal;
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(cb);
lv_checkbox_ext_t * ext = lv_obj_allocate_ext_attr(cb, sizeof(lv_checkbox_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(cb);
return NULL;
} }
lv_style_list_init(&ext->style_bullet); lv_obj_t * obj = lv_class_new(&lv_checkbox);
lv_checkbox.constructor(obj, parent, copy);
lv_obj_set_signal_cb(cb, lv_checkbox_signal); lv_obj_create_finish(obj, parent, copy);
lv_obj_set_design_cb(cb, lv_checkbox_design);
/*Init the new checkbox object*/
if(copy == NULL) {
ext->txt = "Check box";
ext->static_txt = 1;
lv_theme_apply(cb, LV_THEME_CHECKBOX);
lv_obj_add_flag(cb, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_flag(cb, LV_OBJ_FLAG_CHECKABLE);
lv_obj_set_size(cb, LV_SIZE_AUTO, LV_SIZE_AUTO);
}
else {
lv_checkbox_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
lv_style_list_copy(&ext->style_bullet, &copy_ext->style_bullet);
/*Refresh the style with new signal function*/
_lv_obj_refresh_style(cb, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("check box created"); LV_LOG_INFO("check box created");
return obj;
return cb;
} }
/*===================== /*=====================
@@ -107,18 +81,26 @@ lv_obj_t * lv_checkbox_create(lv_obj_t * par, const lv_obj_t * copy)
* @param cb pointer to a check box * @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text. * @param txt the text of the check box. NULL to refresh with the current text.
*/ */
void lv_checkbox_set_text(lv_obj_t * cb, const char * txt) void lv_checkbox_set_text(lv_obj_t * obj, const char * txt)
{ {
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb); lv_checkbox_t * cb = (lv_checkbox_t *) obj;
#if LV_USE_ARABIC_PERSIAN_CHARS
size_t len = _lv_txt_ap_proc(txt);
#else
size_t len = strlen(txt); size_t len = strlen(txt);
#endif
if(!ext->static_txt) ext->txt = lv_mem_realloc(ext->txt, len + 1); if(!cb->static_txt) cb->txt = lv_mem_realloc(cb->txt, len + 1);
else ext->txt = lv_mem_alloc(len + 1); else cb->txt = lv_mem_alloc(len + 1);
#if LV_USE_ARABIC_PERSIAN_CHARS
_lv_txt_ap_proc(txt, cb->txt);
#else
strcpy(cb->txt, txt);
#endif
strcpy(ext->txt, txt); cb->static_txt = 0;
ext->static_txt = 0;
_lv_obj_handle_self_size_chg(cb); _lv_obj_handle_self_size_chg(obj);
} }
/** /**
@@ -127,16 +109,16 @@ void lv_checkbox_set_text(lv_obj_t * cb, const char * txt)
* @param cb pointer to a check box * @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text. * @param txt the text of the check box. NULL to refresh with the current text.
*/ */
void lv_checkbox_set_text_static(lv_obj_t * cb, const char * txt) void lv_checkbox_set_text_static(lv_obj_t * obj, const char * txt)
{ {
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb); lv_checkbox_t * cb = (lv_checkbox_t *) obj;
if(!ext->static_txt) lv_mem_free(ext->txt); if(!cb->static_txt) lv_mem_free(cb->txt);
ext->txt = (char*)txt; cb->txt = (char*)txt;
ext->static_txt = 1; cb->static_txt = 1;
_lv_obj_handle_self_size_chg(cb); _lv_obj_handle_self_size_chg(obj);
} }
/*===================== /*=====================
@@ -148,16 +130,56 @@ void lv_checkbox_set_text_static(lv_obj_t * cb, const char * txt)
* @param cb pointer to check box object * @param cb pointer to check box object
* @return pointer to the text of the check box * @return pointer to the text of the check box
*/ */
const char * lv_checkbox_get_text(const lv_obj_t * cb) const char * lv_checkbox_get_text(const lv_obj_t * obj)
{ {
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb); lv_checkbox_t * cb = (lv_checkbox_t *) obj;
return ext->txt; return cb->txt;
} }
/********************** /**********************
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static void lv_checkbox_constructor(lv_obj_t * obj, lv_obj_t * parent, const lv_obj_t * copy)
{
LV_LOG_TRACE("lv_checkbox create started");
LV_CLASS_CONSTRUCTOR_BEGIN(obj, lv_checkbox)
lv_checkbox.base_p->constructor(obj, parent, copy);
lv_checkbox_t * cb = (lv_checkbox_t *) obj;
/*Create the ancestor basic object*/
/*Init the new checkbox object*/
if(copy == NULL) {
cb->txt = "Check box";
cb->static_txt = 1;
lv_obj_add_flag(obj, LV_OBJ_FLAG_CLICKABLE);
lv_obj_add_flag(obj, LV_OBJ_FLAG_CHECKABLE);
lv_obj_set_size(obj, LV_SIZE_AUTO, LV_SIZE_AUTO);
}
else {
const lv_checkbox_t * copy_ext = (const lv_checkbox_t *)copy;
}
LV_CLASS_CONSTRUCTOR_END(obj, lv_checkbox)
LV_LOG_INFO("lv_checkbox created");
}
static void lv_checkbox_destructor(void * obj)
{
// lv_checkbox_t * bar = obj;
//
// _lv_obj_reset_style_list_no_refr(obj, LV_PART_INDICATOR);
//#if LV_USE_ANIMATION
// lv_anim_del(&bar->cur_value_anim, NULL);
// lv_anim_del(&bar->start_value_anim, NULL);
//#endif
// bar->class_p->base_p->destructor(obj);
}
/** /**
* Handle the drawing related tasks of the check box * Handle the drawing related tasks of the check box
* @param cb pointer to a check box object * @param cb pointer to a check box object
@@ -168,52 +190,50 @@ const char * lv_checkbox_get_text(const lv_obj_t * cb)
* LV_DESIGN_DRAW_POST: drawing after every children are drawn * LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t` * @param return an element of `lv_design_res_t`
*/ */
static lv_design_res_t lv_checkbox_design(lv_obj_t * cb, const lv_area_t * clip_area, lv_design_mode_t mode) static lv_design_res_t lv_checkbox_design(lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode)
{ {
/* A label never covers an area */ /* A label never covers an area */
if(mode == LV_DESIGN_COVER_CHK) if(mode == LV_DESIGN_COVER_CHK)
return LV_DESIGN_RES_NOT_COVER; return lv_checkbox.base_p->design_cb(obj, clip_area, mode);
else if(mode == LV_DESIGN_DRAW_MAIN) { else if(mode == LV_DESIGN_DRAW_MAIN) {
/*Draw the background*/ /*Draw the background*/
ancestor_design(cb, clip_area, mode); lv_checkbox.base_p->design_cb(obj, clip_area, mode);
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb); lv_checkbox_t * cb = (lv_checkbox_t *) obj;
const lv_font_t * font = lv_obj_get_style_text_font(cb, LV_CHECKBOX_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
lv_coord_t bg_topp = lv_obj_get_style_pad_top(cb, LV_CHECKBOX_PART_MAIN); lv_coord_t bg_topp = lv_obj_get_style_pad_top(obj, LV_PART_MAIN);
lv_coord_t bg_leftp = lv_obj_get_style_pad_left(cb, LV_CHECKBOX_PART_MAIN); lv_coord_t bg_leftp = lv_obj_get_style_pad_left(obj, LV_PART_MAIN);
lv_coord_t bullet_leftm = lv_obj_get_style_margin_left(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_rightm = lv_obj_get_style_margin_right(obj, LV_PART_MARKER);
lv_coord_t bullet_topm = lv_obj_get_style_margin_top(cb, LV_CHECKBOX_PART_BULLET);
lv_coord_t bullet_rightm = lv_obj_get_style_margin_right(cb, LV_CHECKBOX_PART_BULLET);
lv_coord_t bullet_leftp = lv_obj_get_style_pad_left(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_leftp = lv_obj_get_style_pad_left(obj, LV_PART_MARKER);
lv_coord_t bullet_rightp = lv_obj_get_style_pad_right(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_rightp = lv_obj_get_style_pad_right(obj, LV_PART_MARKER);
lv_coord_t bullet_topp = lv_obj_get_style_pad_top(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_topp = lv_obj_get_style_pad_top(obj, LV_PART_MARKER);
lv_coord_t bullet_bottomp = lv_obj_get_style_pad_bottom(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_bottomp = lv_obj_get_style_pad_bottom(obj, LV_PART_MARKER);
lv_draw_rect_dsc_t bullet_dsc; lv_draw_rect_dsc_t bullet_dsc;
lv_draw_rect_dsc_init(&bullet_dsc); lv_draw_rect_dsc_init(&bullet_dsc);
lv_obj_init_draw_rect_dsc(cb, LV_CHECKBOX_PART_BULLET, &bullet_dsc); lv_obj_init_draw_rect_dsc(obj, LV_PART_MARKER, &bullet_dsc);
lv_area_t bullet_area; lv_area_t bullet_area;
bullet_area.x1 = cb->coords.x1 + bg_leftp + bullet_leftm; bullet_area.x1 = cb->coords.x1 + bg_leftp;
bullet_area.x2 = bullet_area.x1 + font_h + bullet_leftp + bullet_rightp - 1; bullet_area.x2 = bullet_area.x1 + font_h + bullet_leftp + bullet_rightp - 1;
bullet_area.y1 = cb->coords.y1 + bg_topp + bullet_topm; bullet_area.y1 = cb->coords.y1 + bg_topp;
bullet_area.y2 = bullet_area.y1 + font_h + bullet_topp + bullet_bottomp - 1; bullet_area.y2 = bullet_area.y1 + font_h + bullet_topp + bullet_bottomp - 1;
lv_draw_rect(&bullet_area, clip_area, &bullet_dsc); lv_draw_rect(&bullet_area, clip_area, &bullet_dsc);
lv_coord_t line_space = lv_obj_get_style_text_line_space(cb, LV_CHECKBOX_PART_MAIN); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);
lv_coord_t letter_space = lv_obj_get_style_text_letter_space(cb, LV_CHECKBOX_PART_MAIN); lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN);
lv_point_t txt_size; lv_point_t txt_size;
_lv_txt_get_size(&txt_size, ext->txt, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE); _lv_txt_get_size(&txt_size, cb->txt, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE);
lv_draw_label_dsc_t txt_dsc; lv_draw_label_dsc_t txt_dsc;
lv_draw_label_dsc_init(&txt_dsc); lv_draw_label_dsc_init(&txt_dsc);
lv_obj_init_draw_label_dsc(cb, LV_CHECKBOX_PART_MAIN, &txt_dsc); lv_obj_init_draw_label_dsc(obj, LV_PART_MAIN, &txt_dsc);
lv_coord_t y_ofs = (lv_area_get_height(&bullet_area) - font_h) / 2; lv_coord_t y_ofs = (lv_area_get_height(&bullet_area) - font_h) / 2;
lv_area_t txt_area; lv_area_t txt_area;
@@ -222,10 +242,10 @@ static lv_design_res_t lv_checkbox_design(lv_obj_t * cb, const lv_area_t * clip_
txt_area.y1 = cb->coords.y1 + bg_topp + y_ofs; txt_area.y1 = cb->coords.y1 + bg_topp + y_ofs;
txt_area.y2 = txt_area.y1 + txt_size.y; txt_area.y2 = txt_area.y1 + txt_size.y;
lv_draw_label(&txt_area, clip_area, &txt_dsc, ext->txt, NULL); lv_draw_label(&txt_area, clip_area, &txt_dsc, cb->txt, NULL);
} else { } else {
ancestor_design(cb, clip_area, mode); lv_checkbox.base_p->design_cb(obj, clip_area, mode);
} }
return LV_DESIGN_RES_OK; return LV_DESIGN_RES_OK;
@@ -237,45 +257,34 @@ static lv_design_res_t lv_checkbox_design(lv_obj_t * cb, const lv_area_t * clip_
* @param param pointer to a signal specific variable * @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted * @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/ */
static lv_res_t lv_checkbox_signal(lv_obj_t * cb, lv_signal_t sign, void * param) static lv_res_t lv_checkbox_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
{ {
lv_res_t res; lv_res_t res;
/* Include the ancient signal function */ /* Include the ancient signal function */
res = ancestor_signal(cb, sign, param); res = lv_checkbox.base_p->signal_cb(obj, sign, param);
if(res != LV_RES_OK) return res; if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_checkbox_get_style(cb, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(cb, sign, param);
}
else if (sign == LV_SIGNAL_GET_TYPE) {
return _lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
}
else if (sign == LV_SIGNAL_GET_SELF_SIZE) { else if (sign == LV_SIGNAL_GET_SELF_SIZE) {
lv_point_t * p = param; lv_point_t * p = param;
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb); lv_checkbox_t * cb = (lv_checkbox_t *) obj;
const lv_font_t * font = lv_obj_get_style_text_font(cb, LV_CHECKBOX_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN);
lv_coord_t font_h = lv_font_get_line_height(font); lv_coord_t font_h = lv_font_get_line_height(font);
lv_coord_t line_space = lv_obj_get_style_text_line_space(cb, LV_CHECKBOX_PART_MAIN); lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);
lv_coord_t letter_space = lv_obj_get_style_text_letter_space(cb, LV_CHECKBOX_PART_MAIN); lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN);
lv_point_t txt_size; lv_point_t txt_size;
_lv_txt_get_size(&txt_size, ext->txt, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE); _lv_txt_get_size(&txt_size, cb->txt, font, letter_space, line_space, LV_COORD_MAX, LV_TXT_FLAG_NONE);
lv_coord_t bullet_leftm = lv_obj_get_style_margin_left(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_rightm = lv_obj_get_style_margin_right(obj, LV_PART_MARKER);
lv_coord_t bullet_topm = lv_obj_get_style_margin_top(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_bottomm = lv_obj_get_style_margin_bottom(obj, LV_PART_MARKER);
lv_coord_t bullet_rightm = lv_obj_get_style_margin_right(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_leftp = lv_obj_get_style_pad_left(obj, LV_PART_MARKER);
lv_coord_t bullet_bottomm = lv_obj_get_style_margin_bottom(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_rightp = lv_obj_get_style_pad_right(obj, LV_PART_MARKER);
lv_coord_t bullet_leftp = lv_obj_get_style_pad_left(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_topp = lv_obj_get_style_pad_top(obj, LV_PART_MARKER);
lv_coord_t bullet_rightp = lv_obj_get_style_pad_right(cb, LV_CHECKBOX_PART_BULLET); lv_coord_t bullet_bottomp = lv_obj_get_style_pad_bottom(obj, LV_PART_MARKER);
lv_coord_t bullet_topp = lv_obj_get_style_pad_top(cb, LV_CHECKBOX_PART_BULLET);
lv_coord_t bullet_bottomp = lv_obj_get_style_pad_bottom(cb, LV_CHECKBOX_PART_BULLET);
lv_point_t bullet_size; lv_point_t bullet_size;
bullet_size.x = font_h + bullet_leftm + bullet_rightm + bullet_leftp + bullet_rightp; bullet_size.x = font_h + bullet_rightm + bullet_leftp + bullet_rightp;
bullet_size.y = font_h + bullet_topm + bullet_bottomm + bullet_topp + bullet_bottomp; bullet_size.y = font_h + bullet_bottomm + bullet_topp + bullet_bottomp;
p->x = bullet_size.x + txt_size.x; p->x = bullet_size.x + txt_size.x;
p->y = LV_MATH_MAX(bullet_size.y, txt_size.y); p->y = LV_MATH_MAX(bullet_size.y, txt_size.y);
@@ -285,24 +294,4 @@ static lv_res_t lv_checkbox_signal(lv_obj_t * cb, lv_signal_t sign, void * param
return res; return res;
} }
static lv_style_list_t * lv_checkbox_get_style(lv_obj_t * cb, uint8_t type)
{
lv_style_list_t * style_dsc_p;
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb);
switch(type) {
case LV_CHECKBOX_PART_MAIN:
style_dsc_p = &cb->style_list;
break;
case LV_CHECKBOX_PART_BULLET:
style_dsc_p = &ext->style_bullet;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
#endif #endif

View File

@@ -31,21 +31,22 @@ extern "C" {
* TYPEDEFS * TYPEDEFS
**********************/ **********************/
/*Data of check box*/
typedef struct {
/*New data for this widget */
lv_style_list_t style_bullet;
char * txt;
uint32_t static_txt :1;
} lv_checkbox_ext_t;
/** Checkbox styles. */ LV_CLASS_DECLARE_START(lv_checkbox, lv_obj);
enum {
LV_CHECKBOX_PART_MAIN = LV_OBJ_PART_MAIN, /**< Style of object background. */ #define _lv_checkbox_constructor void (*constructor)(struct _lv_obj_t * obj, struct _lv_obj_t * parent, const struct _lv_obj_t * copy)
LV_CHECKBOX_PART_BULLET, /**< Style of the bullet */
_LV_CHECKBOX_PART_VIRTUAL_LAST, #define _lv_checkbox_data \
}; _lv_obj_data \
typedef uint8_t lv_checkbox_style_t; char * txt; \
uint32_t static_txt :1;
#define _lv_checkbox_class_dsc \
_lv_obj_class_dsc
LV_CLASS_DECLARE_END(lv_checkbox, lv_obj);
extern lv_checkbox_class_t lv_checkbox;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES

File diff suppressed because it is too large Load Diff

View File

@@ -42,12 +42,11 @@ LV_EXPORT_CONST_INT(LV_LABEL_TEXT_SEL_OFF);
/** Long mode behaviors. Used in 'lv_label_ext_t' */ /** Long mode behaviors. Used in 'lv_label_ext_t' */
enum { enum {
LV_LABEL_LONG_EXPAND, /**< Expand the object size to the text size*/ LV_LABEL_LONG_EXPAND, /**< Expand the object size to the text size*/
LV_LABEL_LONG_BREAK, /**< Keep the object width, break the too long lines and expand the object LV_LABEL_LONG_WRAP, /**< Keep the object width, wrap the too long lines and expand the object height*/
height*/
LV_LABEL_LONG_DOT, /**< Keep the size and write dots at the end if the text is too long*/ LV_LABEL_LONG_DOT, /**< Keep the size and write dots at the end if the text is too long*/
LV_LABEL_LONG_SROLL, /**< Keep the size and roll the text back and forth*/ LV_LABEL_LONG_SROLL, /**< Keep the size and roll the text back and forth*/
LV_LABEL_LONG_SROLL_CIRC, /**< Keep the size and roll the text circularly*/ LV_LABEL_LONG_SROLL_CIRC, /**< Keep the size and roll the text circularly*/
LV_LABEL_LONG_CROP, /**< Keep the size and crop the text out of it*/ LV_LABEL_LONG_CLIP, /**< Keep the size and clip the text out of it*/
}; };
typedef uint8_t lv_label_long_mode_t; typedef uint8_t lv_label_long_mode_t;
@@ -60,50 +59,55 @@ enum {
}; };
typedef uint8_t lv_label_align_t; typedef uint8_t lv_label_align_t;
/** Data of label*/
typedef struct {
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
/*New data for this type */
char * text; /*Text of the label*/
union { LV_CLASS_DECLARE_START(lv_label, lv_obj);
char * tmp_ptr; /* Pointer to the allocated memory containing the character which are replaced by dots (Handled
by the library)*/
char tmp[LV_LABEL_DOT_NUM + 1]; /* Directly store the characters if <=4 characters */
} dot;
uint32_t dot_end; /*The text end position in dot mode (Handled by the library)*/ #define _lv_label_constructor void (*constructor)(struct _lv_obj_t * obj, struct _lv_obj_t * parent, const struct _lv_obj_t * copy)
#if LV_USE_ANIMATION #if LV_USE_ANIMATION
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/ #define LV_LABEL_ANIM_DATA uint32_t anim_speed;
#else
#define LV_LABEL_ANIM_DATA
#endif #endif
lv_point_t offset; /*Text draw position offset*/
#if LV_LABEL_LONG_TXT_HINT #if LV_LABEL_LONG_TXT_HINT
lv_draw_label_hint_t hint; /*Used to buffer info about large text*/ #define LV_LABEL_HINT_DATA lv_draw_label_hint_t hint;
#else
#define LV_LABEL_HINT_DATA
#endif #endif
#if LV_LABEL_TEXT_SEL #if LV_LABEL_TEXT_SEL
uint32_t sel_start; #define LV_LABEL_TEXT_SEL_DATA uint32_t sel_start; uint32_t sel_end;
uint32_t sel_end; #else
#define LV_LABEL_TEXT_SEL_DATA
#endif #endif
lv_label_long_mode_t long_mode : 3; /*Determinate what to do with the long texts*/
uint8_t static_txt : 1; /*Flag to indicate the text is static*/
uint8_t align : 2; /*Align type from 'lv_label_align_t'*/
uint8_t recolor : 1; /*Enable in-line letter re-coloring*/
uint8_t expand : 1; /*Ignore real width (used by the library with LV_LABEL_LONG_SROLL)*/
uint8_t dot_tmp_alloc : 1; /*True if dot_tmp has been allocated. False if dot_tmp directly holds up to 4 bytes of
characters */
} lv_label_ext_t;
/** Label styles*/ #define _lv_label_data \
enum { _lv_obj_data \
LV_LABEL_PART_MAIN, char * text; \
}; union { \
char * tmp_ptr; /* Pointer to the allocated memory containing the character replaced by dots*/ \
char tmp[LV_LABEL_DOT_NUM + 1]; /* Directly store the characters if <=4 characters */ \
} dot; \
uint32_t dot_end; /*The real text length, used in dot mode*/ \
LV_LABEL_ANIM_DATA /*Speed of scroll and roll animation in px/sec unit*/ \
LV_LABEL_HINT_DATA /*Used to buffer info about large text*/ \
LV_LABEL_TEXT_SEL_DATA \
lv_point_t offset; /*Text draw position offset*/ \
lv_label_long_mode_t long_mode : 3; /*Determinate what to do with the long texts*/ \
uint8_t static_txt : 1; /*Flag to indicate the text is static*/ \
uint8_t align : 2; /*Align type from 'lv_label_align_t'*/ \
uint8_t recolor : 1; /*Enable in-line letter re-coloring*/ \
uint8_t expand : 1; /*Ignore real width (used by the library with LV_LABEL_LONG_SROLL)*/ \
uint8_t dot_tmp_alloc : 1; /*1: dot_tmp has been allocated;.0: dot_tmp directly holds up to 4 bytes of characters */ \
typedef uint8_t lv_label_part_t; #define _lv_label_class_dsc \
_lv_obj_class_dsc
LV_CLASS_DECLARE_END(lv_label, lv_obj);
extern lv_label_class_t lv_label;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
@@ -187,6 +191,7 @@ void lv_label_set_text_sel_start(lv_obj_t * label, uint32_t index);
* @param index index to set. `LV_LABEL_TXT_SEL_OFF` to select nothing. * @param index index to set. `LV_LABEL_TXT_SEL_OFF` to select nothing.
*/ */
void lv_label_set_text_sel_end(lv_obj_t * label, uint32_t index); void lv_label_set_text_sel_end(lv_obj_t * label, uint32_t index);
/*===================== /*=====================
* Getter functions * Getter functions
*====================*/ *====================*/
@@ -266,9 +271,6 @@ uint32_t lv_label_get_text_sel_start(const lv_obj_t * label);
*/ */
uint32_t lv_label_get_text_sel_end(const lv_obj_t * label); uint32_t lv_label_get_text_sel_end(const lv_obj_t * label);
lv_style_list_t * lv_label_get_style(lv_obj_t * label, uint8_t type);
/*===================== /*=====================
* Other functions * Other functions
*====================*/ *====================*/

View File

@@ -72,21 +72,10 @@ lv_obj_t * lv_slider_create(lv_obj_t * parent, const lv_obj_t * copy)
lv_slider.design_cb = lv_slider_design; lv_slider.design_cb = lv_slider_design;
} }
lv_obj_t * obj = lv_class_new(&lv_slider); lv_obj_t * obj = lv_class_new(&lv_slider);
lv_slider.constructor(obj, parent, copy); lv_slider.constructor(obj, parent, copy);
lv_slider_t * slider = (lv_slider_t *) obj; lv_obj_create_finish(obj, parent, copy);
/*Init the new slider slider*/
if(copy == NULL) {
lv_theme_apply(obj);
} else {
// lv_slider_t * copy_slider = (lv_slider_t *) copy;
// lv_style_list_copy(&slider->style_knob, &copy_slider->style_knob);
//
// _lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("slider created"); LV_LOG_INFO("slider created");
@@ -426,7 +415,9 @@ static lv_res_t lv_slider_signal(lv_obj_t * obj, lv_signal_t sign, void * param)
lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB);
/* The smaller size is the knob diameter*/ /* The smaller size is the knob diameter*/
lv_coord_t knob_size = LV_MATH_MIN(lv_obj_get_width(obj), lv_obj_get_height(obj)) >> 1; lv_coord_t trans_w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN);
lv_coord_t trans_h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN);
lv_coord_t knob_size = LV_MATH_MIN(lv_obj_get_width(obj) + 2 * trans_w, lv_obj_get_height(obj) + 2 * trans_h) >> 1;
knob_size += LV_MATH_MAX(LV_MATH_MAX(knob_left, knob_right), LV_MATH_MAX(knob_bottom, knob_top)); knob_size += LV_MATH_MAX(LV_MATH_MAX(knob_left, knob_right), LV_MATH_MAX(knob_bottom, knob_top));
knob_size += 2; /*For rounding error*/ knob_size += 2; /*For rounding error*/
@@ -488,11 +479,14 @@ static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv
lv_coord_t knob_top = lv_obj_get_style_pad_top(slider, LV_PART_KNOB); lv_coord_t knob_top = lv_obj_get_style_pad_top(slider, LV_PART_KNOB);
lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(slider, LV_PART_KNOB); lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(slider, LV_PART_KNOB);
lv_coord_t transf_w = lv_obj_get_style_transform_width(slider, LV_PART_KNOB);
lv_coord_t transf_h = lv_obj_get_style_transform_height(slider, LV_PART_KNOB);
/*Apply the paddings on the knob area*/ /*Apply the paddings on the knob area*/
knob_area->x1 -= knob_left; knob_area->x1 -= knob_left + transf_w;
knob_area->x2 += knob_right; knob_area->x2 += knob_right + transf_w;
knob_area->y1 -= knob_top; knob_area->y1 -= knob_top + transf_h;
knob_area->y2 += knob_bottom; knob_area->y2 += knob_bottom + transf_h;
} }
static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area) static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area)