refactoring: class->style, style_dsc->style_list
This commit is contained in:
@@ -51,7 +51,7 @@ typedef struct _lv_event_temp_data
|
||||
|
||||
typedef struct {
|
||||
lv_draw_rect_dsc_t draw_dsc;
|
||||
lv_style_dsc_t * style_dsc;
|
||||
lv_style_list_t * style_dsc;
|
||||
uint8_t state;
|
||||
}lv_draw_rect_cache_t;
|
||||
|
||||
@@ -282,7 +282,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
|
||||
new_obj->ext_attr = NULL;
|
||||
|
||||
lv_style_dsc_init(&new_obj->style_dsc);
|
||||
lv_style_list_init(&new_obj->style_dsc);
|
||||
|
||||
if(parent != NULL) {
|
||||
lv_obj_add_style_class(new_obj, LV_OBJ_PART_MAIN, _t(PANEL));
|
||||
@@ -1183,29 +1183,29 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
|
||||
|
||||
void lv_obj_set_style_color(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_color_t color)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_set_color(&style_dsc->local, prop, color);
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_list_set_local_color(style_dsc, prop, color);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_int(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_set_int(&style_dsc->local, prop, value);
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_list_set_local_int(style_dsc, prop, value);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_opa(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_opa_t opa)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_set_opa(&style_dsc->local, prop, opa);
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_list_set_local_opa(style_dsc, prop, opa);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, void * p)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_set_ptr(&style_dsc->local, prop, p);
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_list_set_local_ptr(style_dsc, prop, p);
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
@@ -1213,26 +1213,26 @@ void lv_obj_add_style_class(lv_obj_t * obj, uint8_t part, lv_style_t * style)
|
||||
{
|
||||
if(style == NULL) return;
|
||||
|
||||
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
if(style_dsc == NULL) {
|
||||
LV_LOG_WARN("lv_obj_add_style_class: can't find style with `type`");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_style_dsc_add_class(style_dsc, style);
|
||||
lv_style_list_add_style(style_dsc, style);
|
||||
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
|
||||
void lv_obj_reset_style(lv_obj_t * obj, uint8_t part)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
lv_style_list_t * style_dsc = lv_obj_get_style(obj, part);
|
||||
if(style_dsc == NULL) {
|
||||
LV_LOG_WARN("lv_obj_clean_styles: can't find style with `part`");
|
||||
return;
|
||||
}
|
||||
|
||||
lv_style_dsc_reset(style_dsc);
|
||||
lv_style_list_reset(style_dsc);
|
||||
|
||||
lv_obj_refresh_style(obj);
|
||||
}
|
||||
@@ -2058,7 +2058,7 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj)
|
||||
* Appearance get
|
||||
*---------------*/
|
||||
|
||||
lv_style_dsc_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t part)
|
||||
lv_style_list_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t part)
|
||||
{
|
||||
if(part == LV_OBJ_PART_MAIN) return &obj->style_dsc;
|
||||
|
||||
@@ -2858,19 +2858,12 @@ static void report_style_mod_core(void * style, lv_obj_t * obj)
|
||||
{
|
||||
uint8_t part_sub;
|
||||
for(part_sub = 0; part_sub != _LV_OBJ_PART_ALL; part_sub++) {
|
||||
lv_style_dsc_t * dsc = lv_obj_get_style(obj, part_sub);
|
||||
lv_style_list_t * dsc = lv_obj_get_style(obj, part_sub);
|
||||
if(dsc == NULL) break;
|
||||
|
||||
if(&dsc->local == style) {
|
||||
lv_obj_refresh_style(obj);
|
||||
/* Two local style can't have the same pointer
|
||||
* so there won't be an other match*/
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t ci;
|
||||
for(ci = 0; ci < dsc->class_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_dsc_get_class(dsc, ci);
|
||||
uint8_t ci;
|
||||
for(ci = 0; ci < dsc->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(dsc, ci);
|
||||
if(class == style) {
|
||||
lv_obj_refresh_style(obj);
|
||||
/*It's enough to handle once (if duplicated)*/
|
||||
@@ -3028,12 +3021,12 @@ static lv_style_int_t lv_obj_get_style_int_core(const lv_obj_t * obj, uint8_t pa
|
||||
lv_res_t res = LV_RES_INV;
|
||||
const lv_obj_t * parent = obj;
|
||||
while(parent) {
|
||||
lv_style_dsc_t * dsc = lv_obj_get_style(parent, part);
|
||||
lv_style_list_t * dsc = lv_obj_get_style(parent, part);
|
||||
|
||||
uint8_t state = lv_obj_get_state(parent, part);
|
||||
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
|
||||
|
||||
res = lv_style_dsc_get_int(dsc, prop, &value);
|
||||
res = lv_style_list_get_int(dsc, prop, &value);
|
||||
if(res == LV_RES_OK) return value;
|
||||
|
||||
if(attr.bits.inherit == 0) break;
|
||||
@@ -3075,12 +3068,12 @@ static lv_color_t lv_obj_get_style_color_core(const lv_obj_t * obj, uint8_t part
|
||||
lv_res_t res = LV_RES_INV;
|
||||
const lv_obj_t * parent = obj;
|
||||
while(parent) {
|
||||
lv_style_dsc_t * dsc = lv_obj_get_style(parent, part);
|
||||
lv_style_list_t * dsc = lv_obj_get_style(parent, part);
|
||||
|
||||
uint8_t state = lv_obj_get_state(parent, part);
|
||||
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
|
||||
|
||||
res = lv_style_dsc_get_color(dsc, prop, &value);
|
||||
res = lv_style_list_get_color(dsc, prop, &value);
|
||||
if(res == LV_RES_OK) return value;
|
||||
|
||||
if(attr.bits.inherit == 0) break;
|
||||
@@ -3118,12 +3111,12 @@ static lv_opa_t lv_obj_get_style_opa_core(const lv_obj_t * obj, uint8_t part, lv
|
||||
lv_res_t res = LV_RES_INV;
|
||||
const lv_obj_t * parent = obj;
|
||||
while(parent) {
|
||||
lv_style_dsc_t * dsc = lv_obj_get_style(parent, part);
|
||||
lv_style_list_t * dsc = lv_obj_get_style(parent, part);
|
||||
|
||||
uint8_t state = lv_obj_get_state(parent, part);
|
||||
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
|
||||
|
||||
res = lv_style_dsc_get_opa(dsc, prop, &value);
|
||||
res = lv_style_list_get_opa(dsc, prop, &value);
|
||||
if(res == LV_RES_OK) return value;
|
||||
|
||||
if(attr.bits.inherit == 0) break;
|
||||
@@ -3163,12 +3156,12 @@ static const void * lv_obj_get_style_ptr_core(const lv_obj_t * obj, uint8_t part
|
||||
lv_res_t res = LV_RES_INV;
|
||||
const lv_obj_t * parent = obj;
|
||||
while(parent) {
|
||||
lv_style_dsc_t * dsc = lv_obj_get_style(parent, part);
|
||||
lv_style_list_t * dsc = lv_obj_get_style(parent, part);
|
||||
|
||||
uint8_t state = lv_obj_get_state(parent, part);
|
||||
prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
|
||||
|
||||
res = lv_style_dsc_get_ptr(dsc, prop, &value);
|
||||
res = lv_style_list_get_ptr(dsc, prop, &value);
|
||||
if(res == LV_RES_OK) return value;
|
||||
|
||||
if(attr.bits.inherit == 0) break;
|
||||
|
||||
@@ -223,7 +223,7 @@ typedef struct _lv_obj_t
|
||||
lv_design_cb_t design_cb; /**< Object type specific design function*/
|
||||
|
||||
void * ext_attr; /**< Object type specific extended data*/
|
||||
lv_style_dsc_t style_dsc;
|
||||
lv_style_list_t style_dsc;
|
||||
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
||||
@@ -294,7 +294,7 @@ typedef struct
|
||||
typedef struct
|
||||
{
|
||||
uint8_t part;
|
||||
lv_style_dsc_t * result;
|
||||
lv_style_list_t * result;
|
||||
} lv_get_style_info_t;
|
||||
|
||||
typedef struct
|
||||
@@ -865,7 +865,7 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj);
|
||||
* Appearance get
|
||||
*---------------*/
|
||||
|
||||
lv_style_dsc_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t type);
|
||||
lv_style_list_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t type);
|
||||
|
||||
lv_style_int_t lv_obj_get_style_int(lv_obj_t * obj, uint8_t type, lv_style_property_t prop);
|
||||
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop);
|
||||
static lv_style_t * get_local_style(lv_style_list_t * list);
|
||||
#if LV_USE_ANIMATION
|
||||
static void style_animator(lv_style_anim_dsc_t * dsc, lv_anim_value_t val);
|
||||
static void style_animation_common_end_cb(lv_anim_t * a);
|
||||
@@ -60,16 +61,7 @@ static void style_animation_common_end_cb(lv_anim_t * a);
|
||||
|
||||
void lv_style_built_in_init(void)
|
||||
{
|
||||
// lv_style_init(&lv_style_transp_tight);
|
||||
// lv_style_set_opa(&lv_style_transp_tight, LV_STYLE_BG_OPA, LV_OPA_TRANSP);
|
||||
// lv_style_set_opa(&lv_style_transp_tight, LV_STYLE_BORDER_OPA, LV_OPA_TRANSP);
|
||||
// lv_style_set_opa(&lv_style_transp_tight, LV_STYLE_SHADOW_OPA, LV_OPA_TRANSP);
|
||||
// lv_style_set_opa(&lv_style_transp_tight, LV_STYLE_PATTERN_OPA, LV_OPA_TRANSP);
|
||||
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_LEFT, 0);
|
||||
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_RIGHT, 0);
|
||||
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_TOP, 0);
|
||||
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_BOTTOM, 0);
|
||||
// lv_style_set_int(&lv_style_transp_tight, LV_STYLE_PAD_INNER, 0);
|
||||
|
||||
}
|
||||
|
||||
void lv_style_init(lv_style_t * style)
|
||||
@@ -86,74 +78,92 @@ void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src)
|
||||
style_dest->size = style_src->size;
|
||||
}
|
||||
|
||||
void lv_style_dsc_init(lv_style_dsc_t * style_dsc)
|
||||
void lv_style_list_init(lv_style_list_t * list)
|
||||
{
|
||||
lv_style_init(&style_dsc->local);
|
||||
style_dsc->classes = NULL;
|
||||
style_dsc->class_cnt = 0;
|
||||
list->style_list = NULL;
|
||||
list->style_cnt = 0;
|
||||
list->has_local = 0;
|
||||
}
|
||||
|
||||
|
||||
void lv_style_dsc_add_class(lv_style_dsc_t * dsc, lv_style_t * class)
|
||||
void lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
|
||||
{
|
||||
/* Do not allocate memory for the first class.
|
||||
* It can be simply stored as a pointer.*/
|
||||
if(dsc->class_cnt == 0) {
|
||||
dsc->classes = (lv_style_t**)class;
|
||||
dsc->class_cnt = 1;
|
||||
} else {
|
||||
/*Remove the style first if already exists*/
|
||||
lv_style_list_remove_style(list, style);
|
||||
|
||||
lv_style_t ** new_classes;
|
||||
if(dsc->class_cnt == 1) new_classes = lv_mem_alloc(sizeof(lv_style_t *) * (dsc->class_cnt + 1));
|
||||
else new_classes = lv_mem_realloc(dsc->classes, sizeof(lv_style_t *) * (dsc->class_cnt + 1));
|
||||
LV_ASSERT_MEM(new_classes);
|
||||
if(new_classes == NULL) {
|
||||
LV_LOG_WARN("lv_style_dsc_add_class: couldn't add the class");
|
||||
return;
|
||||
}
|
||||
|
||||
if(dsc->class_cnt == 1) new_classes[0] = (lv_style_t*)dsc->classes;
|
||||
new_classes[dsc->class_cnt] = class;
|
||||
|
||||
dsc->class_cnt++;
|
||||
dsc->classes = new_classes;
|
||||
lv_style_t ** new_classes;
|
||||
if(list->style_cnt == 0) new_classes = lv_mem_alloc(sizeof(lv_style_t *));
|
||||
else new_classes = lv_mem_realloc(list->style_list, sizeof(lv_style_t *) * (list->style_cnt + 1));
|
||||
LV_ASSERT_MEM(new_classes);
|
||||
if(new_classes == NULL) {
|
||||
LV_LOG_WARN("lv_style_list_add_style: couldn't add the class");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void lv_style_dsc_remove_class(lv_style_dsc_t * dsc, lv_style_t * class)
|
||||
{
|
||||
if(dsc->class_cnt == 0) return;
|
||||
if(dsc->class_cnt == 1) {
|
||||
if((lv_style_t*)dsc->classes == class) {
|
||||
dsc->classes = NULL;
|
||||
dsc->class_cnt = 0;
|
||||
}
|
||||
} else {
|
||||
lv_style_t ** new_classes = lv_mem_realloc(dsc->classes, sizeof(lv_style_t *) * (dsc->class_cnt - 1));
|
||||
LV_ASSERT_MEM(new_classes);
|
||||
if(new_classes == NULL) {
|
||||
LV_LOG_WARN("lv_style_dsc_remove_class: couldn't remove the class");
|
||||
return;
|
||||
}
|
||||
uint8_t i,j;
|
||||
for(i = 0, j = 0; i < dsc->class_cnt; i++) {
|
||||
if(dsc->classes[i] == class) continue;
|
||||
new_classes[j] = dsc->classes[i];
|
||||
j++;
|
||||
|
||||
}
|
||||
|
||||
dsc->class_cnt--;
|
||||
dsc->classes = new_classes;
|
||||
/*Make space for the new style at the beginning. Leave local style if exists*/
|
||||
uint8_t i;
|
||||
uint8_t first_style = list->has_local ? 1 : 0;
|
||||
for(i = list->style_cnt; i > first_style; i--) {
|
||||
new_classes[i] = new_classes[i - 1];
|
||||
}
|
||||
|
||||
new_classes[first_style] = style;
|
||||
list->style_cnt++;
|
||||
list->style_list = new_classes;
|
||||
}
|
||||
|
||||
void lv_style_dsc_reset(lv_style_dsc_t * style_dsc)
|
||||
void lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
|
||||
{
|
||||
if(style_dsc->class_cnt > 1) lv_mem_free(style_dsc->classes);
|
||||
style_dsc->classes = NULL;
|
||||
style_dsc->class_cnt = 0;
|
||||
lv_style_reset(&style_dsc->local);
|
||||
if(list->style_cnt == 0) return;
|
||||
|
||||
/*Check if the style really exists here*/
|
||||
uint8_t i;
|
||||
bool found = false;
|
||||
for(i = 0; i < list->style_cnt; i++) {
|
||||
if(list->style_list[i] == style) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found == false) return;
|
||||
|
||||
if(list->style_cnt == 1) {
|
||||
lv_mem_free(list->style_list);
|
||||
list->style_list = NULL;
|
||||
list->style_cnt = 0;
|
||||
list->has_local = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
lv_style_t ** new_classes = lv_mem_realloc(list->style_list, sizeof(lv_style_t *) * (list->style_cnt - 1));
|
||||
LV_ASSERT_MEM(new_classes);
|
||||
if(new_classes == NULL) {
|
||||
LV_LOG_WARN("lv_style_list_remove_style: couldn't reallocate class list");
|
||||
return;
|
||||
}
|
||||
uint8_t j;
|
||||
for(i = 0, j = 0; i < list->style_cnt; i++) {
|
||||
if(list->style_list[i] == style) continue;
|
||||
new_classes[j] = list->style_list[i];
|
||||
j++;
|
||||
|
||||
}
|
||||
|
||||
list->style_cnt--;
|
||||
list->style_list = new_classes;
|
||||
}
|
||||
|
||||
void lv_style_list_reset(lv_style_list_t * list)
|
||||
{
|
||||
if(list->has_local) {
|
||||
lv_style_t * local = lv_style_list_get_style(list, 0);
|
||||
lv_style_reset(local);
|
||||
lv_mem_free(local);
|
||||
}
|
||||
if(list->style_cnt > 0) lv_mem_free(list->style_list);
|
||||
list->style_list = NULL;
|
||||
list->style_cnt = 0;
|
||||
list->has_local = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -245,7 +255,7 @@ void lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa
|
||||
memcpy(style->map + style->size - sizeof(lv_opa_t), &opa, sizeof(lv_opa_t));
|
||||
}
|
||||
|
||||
void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, void * p)
|
||||
void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p)
|
||||
{
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
@@ -360,12 +370,37 @@ int16_t lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, voi
|
||||
return attr_act.bits.state & attr_goal.bits.state;
|
||||
}
|
||||
}
|
||||
uint32_t prop_fooled[256];
|
||||
|
||||
lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_style_int_t * value)
|
||||
|
||||
void lv_style_list_set_local_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
if(dsc == NULL) return LV_RES_INV;
|
||||
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV;
|
||||
lv_style_t * local = get_local_style(list);
|
||||
lv_style_set_int(local, prop, value);
|
||||
}
|
||||
|
||||
void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t value)
|
||||
{
|
||||
lv_style_t * local = get_local_style(list);
|
||||
lv_style_set_opa(local, prop, value);
|
||||
}
|
||||
|
||||
void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t value)
|
||||
{
|
||||
lv_style_t * local = get_local_style(list);
|
||||
lv_style_set_color(local, prop, value);
|
||||
}
|
||||
|
||||
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value)
|
||||
{
|
||||
lv_style_t * local = get_local_style(list);
|
||||
lv_style_set_ptr(local, prop, value);
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop, lv_style_int_t * value)
|
||||
{
|
||||
if(list == NULL) return LV_RES_INV;
|
||||
if(list->style_list == NULL) return LV_RES_INV;
|
||||
|
||||
lv_style_attr_t attr;
|
||||
attr.full = prop >> 8;
|
||||
@@ -375,22 +410,10 @@ lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
|
||||
int16_t weight = -1;
|
||||
|
||||
lv_style_int_t value_act;
|
||||
weight_act = lv_style_get_int(&dsc->local, prop, &value_act);
|
||||
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*value = value_act;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*If the found ID is better the current candidate then use it*/
|
||||
else if(weight_act > weight) {
|
||||
weight = weight_act;
|
||||
*value = value_act;
|
||||
}
|
||||
|
||||
int16_t ci;
|
||||
for(ci = dsc->class_cnt - 1; ci >= 0; ci--) {
|
||||
lv_style_t * class = lv_style_dsc_get_class(dsc, ci);
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(list, ci);
|
||||
weight_act = lv_style_get_int(class, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
@@ -404,19 +427,16 @@ lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
|
||||
}
|
||||
}
|
||||
|
||||
if(weight >= 0) {
|
||||
prop_fooled[prop&0xFF]++;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
if(weight >= 0) return LV_RES_OK;
|
||||
else return LV_RES_INV;
|
||||
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_color_t * value)
|
||||
lv_res_t lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t prop, lv_color_t * value)
|
||||
{
|
||||
if(dsc == NULL) return LV_RES_INV;
|
||||
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV;
|
||||
if(list == NULL) return LV_RES_INV;
|
||||
if(list->style_list == NULL) return LV_RES_INV;
|
||||
|
||||
lv_style_attr_t attr;
|
||||
attr.full = prop >> 8;
|
||||
@@ -426,22 +446,10 @@ lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop,
|
||||
int16_t weight = -1;
|
||||
|
||||
lv_color_t value_act;
|
||||
weight_act = lv_style_get_color(&dsc->local, prop, &value_act);
|
||||
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*value = value_act;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*If the found ID is better the current candidate then use it*/
|
||||
else if(weight_act > weight) {
|
||||
weight = weight_act;
|
||||
*value = value_act;
|
||||
}
|
||||
|
||||
int16_t ci;
|
||||
for(ci = dsc->class_cnt - 1; ci >= 0; ci--) {
|
||||
lv_style_t * class = lv_style_dsc_get_class(dsc, ci);
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(list, ci);
|
||||
weight_act = lv_style_get_color(class, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
@@ -455,19 +463,16 @@ lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop,
|
||||
}
|
||||
}
|
||||
|
||||
if(weight >= 0) {
|
||||
prop_fooled[prop&0xFF]++;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
if(weight >= 0) return LV_RES_OK;
|
||||
else return LV_RES_INV;
|
||||
}
|
||||
|
||||
|
||||
|
||||
lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_opa_t * value)
|
||||
lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop, lv_opa_t * value)
|
||||
{
|
||||
if(dsc == NULL) return LV_RES_INV;
|
||||
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV;
|
||||
if(list == NULL) return LV_RES_INV;
|
||||
if(list->style_list == NULL) return LV_RES_INV;
|
||||
|
||||
lv_style_attr_t attr;
|
||||
attr.full = prop >> 8;
|
||||
@@ -476,23 +481,11 @@ lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
|
||||
int16_t weight_act;
|
||||
int16_t weight = -1;
|
||||
|
||||
lv_opa_t value_act;
|
||||
weight_act = lv_style_get_opa(&dsc->local, prop, &value_act);
|
||||
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*value = value_act;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*If the found ID is better the current candidate then use it*/
|
||||
else if(weight_act > weight) {
|
||||
weight = weight_act;
|
||||
*value = value_act;
|
||||
}
|
||||
lv_opa_t value_act = LV_OPA_TRANSP;
|
||||
|
||||
int16_t ci;
|
||||
for(ci = dsc->class_cnt - 1; ci >= 0; ci--) {
|
||||
lv_style_t * class = lv_style_dsc_get_class(dsc, ci);
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(list, ci);
|
||||
weight_act = lv_style_get_opa(class, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
@@ -506,18 +499,15 @@ lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv
|
||||
}
|
||||
}
|
||||
|
||||
if(weight >= 0) {
|
||||
prop_fooled[prop&0xFF]++;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
if(weight >= 0) return LV_RES_OK;
|
||||
else return LV_RES_INV;
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, void ** value)
|
||||
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, void ** value)
|
||||
{
|
||||
if(dsc == NULL) return LV_RES_INV;
|
||||
if(dsc->local.map == NULL && dsc->classes == NULL) return LV_RES_INV;
|
||||
if(list == NULL) return LV_RES_INV;
|
||||
if(list->style_list == NULL) return LV_RES_INV;
|
||||
|
||||
lv_style_attr_t attr;
|
||||
attr.full = prop >> 8;
|
||||
@@ -527,22 +517,10 @@ lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, vo
|
||||
int16_t weight = -1;
|
||||
|
||||
void * value_act = NULL;
|
||||
weight_act = lv_style_get_ptr(&dsc->local, prop, &value_act);
|
||||
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*value = value_act;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
/*If the found ID is better the current candidate then use it*/
|
||||
else if(weight_act > weight) {
|
||||
weight = weight_act;
|
||||
*value = value_act;
|
||||
}
|
||||
|
||||
int16_t ci;
|
||||
for(ci = dsc->class_cnt - 1; ci >= 0; ci--) {
|
||||
lv_style_t * class = lv_style_dsc_get_class(dsc, ci);
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * class = lv_style_list_get_style(list, ci);
|
||||
weight_act = lv_style_get_ptr(class, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
@@ -556,10 +534,7 @@ lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, vo
|
||||
}
|
||||
}
|
||||
|
||||
if(weight >= 0) {
|
||||
prop_fooled[prop&0xFF]++;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
if(weight >= 0) return LV_RES_OK;
|
||||
else return LV_RES_INV;
|
||||
}
|
||||
|
||||
@@ -600,8 +575,6 @@ void lv_style_anim_set_styles(lv_anim_t * a, lv_style_t * to_anim, const lv_styl
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static uint32_t cnt = 0;
|
||||
static uint32_t stat[256];
|
||||
static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop)
|
||||
{
|
||||
uint8_t id_to_find = prop & 0xFF;
|
||||
@@ -611,27 +584,6 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
|
||||
int16_t weight = -1;
|
||||
int16_t id_guess = -1;
|
||||
|
||||
stat[id_to_find]++;
|
||||
|
||||
cnt++;
|
||||
if(cnt > 100000) {
|
||||
cnt = 0;
|
||||
uint32_t i;
|
||||
|
||||
printf("\nQuerry:\n");
|
||||
for(i = 0; i < 256; i++) {
|
||||
if(stat[i]) printf("%02x: %d\n", i, stat[i]);
|
||||
}
|
||||
memset(stat, 0x00, sizeof(stat));
|
||||
|
||||
// printf("\nFooled:\n");
|
||||
// for(i = 0; i < 256; i++) {
|
||||
// if(prop_fooled[i]) printf("%02x: %d\n", i, prop_fooled[i]);
|
||||
// }
|
||||
memset(prop_fooled, 0x00, sizeof(stat));
|
||||
// printf("\n");
|
||||
}
|
||||
|
||||
static const uint8_t size[16] = {
|
||||
sizeof(lv_style_int_t) + sizeof(lv_style_property_t),
|
||||
sizeof(lv_style_int_t) + sizeof(lv_style_property_t),
|
||||
@@ -687,6 +639,28 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
|
||||
return id_guess;
|
||||
}
|
||||
|
||||
|
||||
static lv_style_t * get_local_style(lv_style_list_t * list)
|
||||
{
|
||||
|
||||
if(list->has_local) return lv_style_list_get_style(list, 0);
|
||||
|
||||
|
||||
lv_style_t * local_style = lv_mem_alloc(sizeof(lv_style_t));
|
||||
LV_ASSERT_MEM(local_style);
|
||||
if(local_style == NULL) {
|
||||
LV_LOG_WARN("get_local_style: couldn't create local style");
|
||||
return NULL;
|
||||
}
|
||||
lv_style_init(local_style);
|
||||
|
||||
lv_style_list_add_style(list, local_style);
|
||||
list->has_local = 1;
|
||||
|
||||
return local_style;
|
||||
}
|
||||
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
|
||||
/**
|
||||
|
||||
@@ -172,12 +172,10 @@ typedef int16_t lv_style_int_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
lv_style_t local;
|
||||
lv_style_t ** classes;
|
||||
uint8_t class_cnt;
|
||||
}lv_style_dsc_t;
|
||||
|
||||
|
||||
lv_style_t ** style_list;
|
||||
uint8_t style_cnt;
|
||||
uint8_t has_local :1;
|
||||
}lv_style_list_t;
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
/** Data structure for style animations. */
|
||||
@@ -203,20 +201,21 @@ void lv_style_built_in_init(void);
|
||||
|
||||
void lv_style_init(lv_style_t * style);
|
||||
|
||||
void lv_style_dsc_init(lv_style_dsc_t * style_dsc);
|
||||
void lv_style_list_init(lv_style_list_t * style_dsc);
|
||||
|
||||
void lv_style_dsc_add_class(lv_style_dsc_t * style_dsc, lv_style_t * style);
|
||||
void lv_style_list_add_style(lv_style_list_t * style_dsc, lv_style_t * style);
|
||||
|
||||
void lv_style_dsc_remove_class(lv_style_dsc_t * style_dsc, lv_style_t * class);
|
||||
void lv_style_list_remove_style(lv_style_list_t * style_dsc, lv_style_t * class);
|
||||
|
||||
void lv_style_dsc_reset(lv_style_dsc_t * style_dsc);
|
||||
void lv_style_list_reset(lv_style_list_t * style_dsc);
|
||||
|
||||
static inline lv_style_t * lv_style_dsc_get_class(lv_style_dsc_t * style_dsc, uint8_t id)
|
||||
static inline lv_style_t * lv_style_list_get_style(lv_style_list_t * style_dsc, uint8_t id)
|
||||
{
|
||||
if(style_dsc->class_cnt == 0) return NULL;
|
||||
if(style_dsc->class_cnt == 1) return (lv_style_t*) style_dsc->classes;
|
||||
if(style_dsc->style_cnt == 0) return NULL;
|
||||
if(id >= style_dsc->style_cnt) return NULL;
|
||||
|
||||
return style_dsc->style_list[id];
|
||||
|
||||
return style_dsc->classes[id];
|
||||
}
|
||||
|
||||
void lv_style_reset(lv_style_t * style);
|
||||
@@ -240,20 +239,24 @@ void lv_style_mix(const lv_style_t * start, const lv_style_t * end, lv_style_t *
|
||||
void lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value);
|
||||
void lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color);
|
||||
void lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa);
|
||||
void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, void * p);
|
||||
|
||||
void lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p);
|
||||
|
||||
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_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res);
|
||||
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_ptr(const lv_style_t * style, lv_style_property_t prop, void ** res);
|
||||
|
||||
lv_res_t lv_style_dsc_get_int(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_style_int_t * value);
|
||||
lv_res_t lv_style_dsc_get_color(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_color_t * value);
|
||||
lv_res_t lv_style_dsc_get_opa(lv_style_dsc_t * dsc, lv_style_property_t prop, lv_opa_t * value);
|
||||
lv_res_t lv_style_dsc_get_ptr(lv_style_dsc_t * dsc, lv_style_property_t prop, void ** value);
|
||||
void lv_style_list_set_local_int(lv_style_list_t * dsc, lv_style_property_t prop, lv_style_int_t value);
|
||||
void lv_style_list_set_local_opa(lv_style_list_t * dsc, lv_style_property_t prop, lv_opa_t value);
|
||||
void lv_style_list_set_local_color(lv_style_list_t * dsc, lv_style_property_t prop, lv_color_t value);
|
||||
void lv_style_list_set_local_ptr(lv_style_list_t * dsc, lv_style_property_t prop, const void * value);
|
||||
|
||||
lv_res_t lv_style_cache_update(lv_style_dsc_t * dsc);
|
||||
lv_res_t lv_style_list_get_int(lv_style_list_t * dsc, lv_style_property_t prop, lv_style_int_t * value);
|
||||
lv_res_t lv_style_list_get_color(lv_style_list_t * dsc, lv_style_property_t prop, lv_color_t * value);
|
||||
lv_res_t lv_style_list_get_opa(lv_style_list_t * dsc, lv_style_property_t prop, lv_opa_t * value);
|
||||
lv_res_t lv_style_list_get_ptr(lv_style_list_t * dsc, lv_style_property_t prop, void ** value);
|
||||
|
||||
lv_res_t lv_style_cache_update(lv_style_list_t * dsc);
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
|
||||
@@ -351,7 +354,6 @@ static inline void lv_style_anim_create(lv_anim_t * a)
|
||||
/*************************
|
||||
* GLOBAL VARIABLES
|
||||
*************************/
|
||||
//extern lv_style_t lv_style_transp_tight;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -244,6 +244,21 @@ void lv_mem_free(const void * data)
|
||||
|
||||
void * lv_mem_realloc(void * data_p, size_t new_size)
|
||||
{
|
||||
|
||||
#ifdef LV_ARCH_64
|
||||
/*Round the size up to 8*/
|
||||
if(new_size & 0x7) {
|
||||
new_size = new_size & (~0x7);
|
||||
new_size += 8;
|
||||
}
|
||||
#else
|
||||
/*Round the size up to 4*/
|
||||
if(new_size & 0x3) {
|
||||
new_size = new_size & (~0x3);
|
||||
new_size += 4;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*data_p could be previously freed pointer (in this case it is invalid)*/
|
||||
if(data_p != NULL) {
|
||||
lv_mem_ent_t * e = (lv_mem_ent_t *)((uint8_t *)data_p - sizeof(lv_mem_header_t));
|
||||
@@ -336,7 +351,7 @@ void lv_mem_defrag(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
void lv_mem_test(void)
|
||||
lv_res_t lv_mem_test(void)
|
||||
{
|
||||
lv_mem_ent_t * e;
|
||||
e = ent_get_next(NULL);
|
||||
@@ -344,10 +359,12 @@ void lv_mem_test(void)
|
||||
if(e->header.s.d_size > 200000) {
|
||||
printf("mem err\n");
|
||||
while(1);
|
||||
return LV_RES_INV;
|
||||
}
|
||||
e = ent_get_next(e);
|
||||
}
|
||||
|
||||
return LV_RES_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -97,7 +97,7 @@ void * lv_mem_realloc(void * data_p, size_t new_size);
|
||||
*/
|
||||
void lv_mem_defrag(void);
|
||||
|
||||
void lv_mem_test(void);
|
||||
lv_res_t lv_mem_test(void);
|
||||
|
||||
/**
|
||||
* Give information about the work memory of dynamic allocation
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
**********************/
|
||||
static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part);
|
||||
static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -83,8 +83,8 @@ lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Init the new arc arc*/
|
||||
if(copy == NULL) {
|
||||
lv_style_dsc_init(&ext->style_arc);
|
||||
lv_style_dsc_reset(&new_arc->style_dsc);
|
||||
lv_style_list_init(&ext->style_arc);
|
||||
lv_style_list_reset(&new_arc->style_dsc);
|
||||
_ot(new_arc, LV_ARC_PART_BG, ARC_BG);
|
||||
_ot(new_arc, LV_ARC_PART_ARC, ARC);
|
||||
|
||||
@@ -276,13 +276,13 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
* @param part the part of the object. (LV_ARC_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part)
|
||||
static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
|
||||
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_ARC_PART_BG:
|
||||
|
||||
@@ -32,7 +32,7 @@ typedef struct
|
||||
/*New data for this type */
|
||||
lv_coord_t angle_start;
|
||||
lv_coord_t angle_end;
|
||||
lv_style_dsc_t style_arc;
|
||||
lv_style_list_t style_arc;
|
||||
} lv_arc_ext_t;
|
||||
|
||||
/*Parts of the arc*/
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
**********************/
|
||||
static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part);
|
||||
static lv_style_list_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part);
|
||||
|
||||
static void draw_bg(lv_obj_t * bar, const lv_area_t * clip_area);
|
||||
static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area);
|
||||
@@ -102,7 +102,7 @@ lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_bar_init_anim(new_bar, &ext->start_value_anim);
|
||||
#endif
|
||||
ext->type = LV_BAR_TYPE_NORMAL;
|
||||
lv_style_dsc_init(&ext->style_indic);
|
||||
lv_style_list_init(&ext->style_indic);
|
||||
|
||||
lv_obj_set_signal_cb(new_bar, lv_bar_signal);
|
||||
lv_obj_set_design_cb(new_bar, lv_bar_design);
|
||||
@@ -611,12 +611,12 @@ static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
|
||||
return res;
|
||||
}
|
||||
|
||||
static lv_style_dsc_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part)
|
||||
static lv_style_list_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
|
||||
|
||||
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_BAR_PART_BG:
|
||||
|
||||
@@ -76,7 +76,7 @@ typedef struct
|
||||
lv_bar_anim_t start_value_anim;
|
||||
#endif
|
||||
uint8_t type : 2; /*Type of bar*/
|
||||
lv_style_dsc_t style_indic; /*Style of the indicator*/
|
||||
lv_style_list_t style_indic; /*Style of the indicator*/
|
||||
} lv_bar_ext_t;
|
||||
|
||||
/** Bar parts */
|
||||
|
||||
@@ -210,9 +210,9 @@ bool lv_btn_get_toggle(const lv_obj_t * btn)
|
||||
return ext->toggle != 0 ? true : false;
|
||||
}
|
||||
|
||||
lv_style_dsc_t * lv_btn_get_style(lv_obj_t * cont, uint8_t type)
|
||||
lv_style_list_t * lv_btn_get_style(lv_obj_t * cont, uint8_t type)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
switch(type) {
|
||||
case LV_BTN_PART_MAIN:
|
||||
style_dsc_p = &cont->style_dsc;
|
||||
|
||||
@@ -274,7 +274,7 @@ uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn);
|
||||
*/
|
||||
uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn);
|
||||
|
||||
lv_style_dsc_t * lv_btn_get_style(lv_obj_t * cont, uint8_t type);
|
||||
lv_style_list_t * lv_btn_get_style(lv_obj_t * cont, uint8_t type);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
**********************/
|
||||
static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param);
|
||||
static lv_design_res_t lv_btnm_design(lv_obj_t * btnm, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_style_dsc_t * lv_btnm_get_style(lv_obj_t * btnm, uint8_t part);
|
||||
static lv_style_list_t * lv_btnm_get_style(lv_obj_t * btnm, uint8_t part);
|
||||
|
||||
static uint8_t get_button_width(lv_btnm_ctrl_t ctrl_bits);
|
||||
static bool button_is_hidden(lv_btnm_ctrl_t ctrl_bits);
|
||||
@@ -96,7 +96,7 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->map_p = NULL;
|
||||
ext->recolor = 0;
|
||||
ext->one_toggle = 0;
|
||||
lv_style_dsc_init(&ext->style_btn);
|
||||
lv_style_list_init(&ext->style_btn);
|
||||
|
||||
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(new_btnm);
|
||||
|
||||
@@ -978,13 +978,13 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
|
||||
* @param part the part of the object. (LV_BTNM_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_btnm_get_style(lv_obj_t * btnm, uint8_t part)
|
||||
static lv_style_list_t * lv_btnm_get_style(lv_obj_t * btnm, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
|
||||
|
||||
lv_btnm_ext_t * ext = lv_obj_get_ext_attr(btnm);
|
||||
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_BTNM_PART_BG:
|
||||
|
||||
@@ -53,7 +53,7 @@ typedef struct
|
||||
const char ** map_p; /*Pointer to the current map*/
|
||||
lv_area_t * button_areas; /*Array of areas of buttons*/
|
||||
lv_btnm_ctrl_t * ctrl_bits; /*Array of control bytes*/
|
||||
lv_style_dsc_t style_btn; /*Styles of buttons in each state*/
|
||||
lv_style_list_t style_btn; /*Styles of buttons in each state*/
|
||||
uint16_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/
|
||||
uint16_t btn_id_pr; /*Index of the currently pressed button or LV_BTNM_BTN_NONE*/
|
||||
uint16_t btn_id_focused; /*Index of the currently focused button or LV_BTNM_BTN_NONE*/
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef uint8_t day_draw_state_t;
|
||||
**********************/
|
||||
static lv_design_res_t lv_calendar_design(lv_obj_t * calendar, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part);
|
||||
static lv_style_list_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part);
|
||||
static bool calculate_touched_day(lv_obj_t * calendar, const lv_point_t * touched_point);
|
||||
static lv_coord_t get_header_height(lv_obj_t * calendar);
|
||||
static lv_coord_t get_day_names_height(lv_obj_t * calendar);
|
||||
@@ -116,9 +116,9 @@ lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->btn_pressing = 0;
|
||||
|
||||
|
||||
lv_style_dsc_init(&ext->style_date_nums);
|
||||
lv_style_dsc_init(&ext->style_day_names);
|
||||
lv_style_dsc_init(&ext->style_header);
|
||||
lv_style_list_init(&ext->style_date_nums);
|
||||
lv_style_list_init(&ext->style_day_names);
|
||||
lv_style_list_init(&ext->style_header);
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_cb(new_calendar, lv_calendar_signal);
|
||||
@@ -128,11 +128,11 @@ lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
|
||||
/*Different styles will be used from the styles while rendering so disable caching*/
|
||||
lv_style_dsc_reset(&new_calendar->style_dsc);
|
||||
lv_style_dsc_add_class(&new_calendar->style_dsc, lv_theme_get_style(LV_THEME_CALENDAR_BG));
|
||||
lv_style_dsc_add_class(&ext->style_date_nums, lv_theme_get_style(LV_THEME_CALENDAR_DATE_NUMS));
|
||||
lv_style_dsc_add_class(&ext->style_day_names, lv_theme_get_style(LV_THEME_CALENDAR_DAY_NAMES));
|
||||
lv_style_dsc_add_class(&ext->style_header, lv_theme_get_style(LV_THEME_CALENDAR_HEADER));
|
||||
lv_style_list_reset(&new_calendar->style_dsc);
|
||||
lv_style_list_add_style(&new_calendar->style_dsc, lv_theme_get_style(LV_THEME_CALENDAR_BG));
|
||||
lv_style_list_add_style(&ext->style_date_nums, lv_theme_get_style(LV_THEME_CALENDAR_DATE_NUMS));
|
||||
lv_style_list_add_style(&ext->style_day_names, lv_theme_get_style(LV_THEME_CALENDAR_DAY_NAMES));
|
||||
lv_style_list_add_style(&ext->style_header, lv_theme_get_style(LV_THEME_CALENDAR_HEADER));
|
||||
|
||||
lv_obj_refresh_style(new_calendar);
|
||||
|
||||
@@ -537,12 +537,12 @@ static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void *
|
||||
* @param part the part from `lv_calendar_part_t`. (LV_CALENDAR_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part)
|
||||
static lv_style_list_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
|
||||
|
||||
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
|
||||
switch(part) {
|
||||
|
||||
@@ -53,9 +53,9 @@ typedef struct
|
||||
const char ** month_names; /*Pointer to an array with the name of the month (NULL. use default names)*/
|
||||
|
||||
/*Styles*/
|
||||
lv_style_dsc_t style_header;
|
||||
lv_style_dsc_t style_day_names;
|
||||
lv_style_dsc_t style_date_nums;
|
||||
lv_style_list_t style_header;
|
||||
lv_style_list_t style_day_names;
|
||||
lv_style_list_t style_date_nums;
|
||||
} lv_calendar_ext_t;
|
||||
|
||||
/** Calendar parts*/
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_cb_get_style(lv_obj_t * cb, uint8_t type);
|
||||
static lv_style_list_t * lv_cb_get_style(lv_obj_t * cb, uint8_t type);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -202,9 +202,9 @@ static lv_res_t lv_cb_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
|
||||
}
|
||||
|
||||
|
||||
static lv_style_dsc_t * lv_cb_get_style(lv_obj_t * cb, uint8_t type)
|
||||
static lv_style_list_t * lv_cb_get_style(lv_obj_t * cb, uint8_t type)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
lv_cb_ext_t * ext = lv_obj_get_ext_attr(cb);
|
||||
switch(type) {
|
||||
|
||||
@@ -49,7 +49,7 @@ typedef struct {
|
||||
**********************/
|
||||
static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part);
|
||||
static lv_style_list_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part);
|
||||
|
||||
static void draw_series_bg(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask);
|
||||
static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area);
|
||||
@@ -120,8 +120,8 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->secondary_y_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;
|
||||
|
||||
|
||||
lv_style_dsc_init(&ext->style_series_bg);
|
||||
lv_style_dsc_init(&ext->style_series);
|
||||
lv_style_list_init(&ext->style_series_bg);
|
||||
lv_style_list_init(&ext->style_series);
|
||||
|
||||
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_chart);
|
||||
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_chart);
|
||||
@@ -133,7 +133,7 @@ lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_chart, LV_DPI * 3, LV_DPI * 2);
|
||||
|
||||
lv_style_dsc_reset(&new_chart->style_dsc);
|
||||
lv_style_list_reset(&new_chart->style_dsc);
|
||||
lv_obj_add_style_theme(new_chart, LV_CHART_PART_BG, LV_THEME_CHART_BG);
|
||||
lv_obj_add_style_theme(new_chart, LV_CHART_PART_SERIES_BG, LV_THEME_CHART_SERIES_BG);
|
||||
lv_obj_add_style_theme(new_chart, LV_CHART_PART_SERIES, LV_THEME_CHART_SERIES);
|
||||
@@ -665,12 +665,12 @@ static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param
|
||||
* @param part the part of the chart. (LV_CHART_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part)
|
||||
static lv_style_list_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
|
||||
|
||||
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_CHART_PART_BG:
|
||||
|
||||
@@ -87,8 +87,8 @@ typedef struct
|
||||
uint8_t hdiv_cnt; /*Number of horizontal division lines*/
|
||||
uint8_t vdiv_cnt; /*Number of vertical division lines*/
|
||||
uint16_t point_cnt; /*Point number in a data line*/
|
||||
lv_style_dsc_t style_series_bg;
|
||||
lv_style_dsc_t style_series;
|
||||
lv_style_list_t style_series_bg;
|
||||
lv_style_list_t style_series;
|
||||
lv_chart_type_t type; /*Line, column or point chart (from 'lv_chart_type_t')*/
|
||||
lv_chart_axis_cfg_t y_axis;
|
||||
lv_chart_axis_cfg_t x_axis;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_cont_get_style(lv_obj_t * cont, uint8_t type);
|
||||
static lv_style_list_t * lv_cont_get_style(lv_obj_t * cont, uint8_t type);
|
||||
static void lv_cont_refr_layout(lv_obj_t * cont);
|
||||
static void lv_cont_layout_col(lv_obj_t * cont);
|
||||
static void lv_cont_layout_row(lv_obj_t * cont);
|
||||
@@ -288,9 +288,9 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
|
||||
}
|
||||
|
||||
|
||||
static lv_style_dsc_t * lv_cont_get_style(lv_obj_t * cont, uint8_t type)
|
||||
static lv_style_list_t * lv_cont_get_style(lv_obj_t * cont, uint8_t type)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
switch(type) {
|
||||
case LV_CONT_PART_MAIN:
|
||||
style_dsc_p = &cont->style_dsc;
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
static lv_design_res_t lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_ddlist_get_style(lv_obj_t * ddlist, uint8_t part);
|
||||
static lv_style_list_t * lv_ddlist_get_style(lv_obj_t * ddlist, uint8_t part);
|
||||
static lv_res_t release_handler(lv_obj_t * ddlist);
|
||||
static void lv_ddlist_refr_size(lv_obj_t * ddlist, lv_anim_enable_t anim);
|
||||
static void lv_ddlist_pos_current_option(lv_obj_t * ddlist);
|
||||
@@ -102,7 +102,7 @@ lv_obj_t * lv_ddlist_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->sel_opt_id_ori = 0;
|
||||
ext->option_cnt = 0;
|
||||
ext->stay_open = 0;
|
||||
lv_style_dsc_init(&ext->style_sel);
|
||||
lv_style_list_init(&ext->style_sel);
|
||||
|
||||
/*The signal and design functions are not copied so set them here*/
|
||||
lv_obj_set_signal_cb(new_ddlist, lv_ddlist_signal);
|
||||
@@ -594,7 +594,7 @@ static lv_res_t lv_ddlist_signal(lv_obj_t * ddlist, lv_signal_t sign, void * par
|
||||
lv_res_t res;
|
||||
if(sign == LV_SIGNAL_GET_STYLE) {
|
||||
uint8_t ** type_p = param;
|
||||
lv_style_dsc_t ** style_dsc_p = param;
|
||||
lv_style_list_t ** style_dsc_p = param;
|
||||
*style_dsc_p = lv_ddlist_get_style(ddlist, **type_p);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@@ -739,12 +739,12 @@ static lv_res_t lv_ddlist_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void *
|
||||
* @param part the part from `lv_ddlist_part_t`. (LV_DDLIST_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_ddlist_get_style(lv_obj_t * ddlist, uint8_t part)
|
||||
static lv_style_list_t * lv_ddlist_get_style(lv_obj_t * ddlist, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(ddlist, LV_OBJX_NAME);
|
||||
|
||||
lv_ddlist_ext_t * ext = lv_obj_get_ext_attr(ddlist);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_DDLIST_PART_BG:
|
||||
|
||||
@@ -43,7 +43,7 @@ typedef struct
|
||||
lv_page_ext_t page; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_obj_t * label; /*Label for the options*/
|
||||
lv_style_dsc_t style_sel; /*Style of the selected option*/
|
||||
lv_style_list_t style_sel; /*Style of the selected option*/
|
||||
const char * symbol; /*Arrow or other icon when the drop-down list is closed*/
|
||||
uint16_t option_cnt; /*Number of options*/
|
||||
uint16_t sel_opt_id; /*Index of the current option*/
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
**********************/
|
||||
static lv_design_res_t lv_gauge_design(lv_obj_t * gauge, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part);
|
||||
static lv_style_list_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part);
|
||||
static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask);
|
||||
static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area);
|
||||
|
||||
@@ -102,8 +102,8 @@ lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_gauge_set_critical_value(new_gauge, 80);
|
||||
lv_obj_set_size(new_gauge, 2 * LV_DPI, 2 * LV_DPI);
|
||||
|
||||
lv_style_dsc_reset(&new_gauge->style_dsc);
|
||||
lv_style_dsc_init(&ext->style_strong);
|
||||
lv_style_list_reset(&new_gauge->style_dsc);
|
||||
lv_style_list_init(&ext->style_strong);
|
||||
_ot(new_gauge, LV_GAUGE_PART_MAIN, GAUGE);
|
||||
_ot(new_gauge, LV_GAUGE_PART_STRONG, GAUGE_STRONG);
|
||||
|
||||
@@ -410,12 +410,12 @@ static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param
|
||||
* @param part the part from `lv_gauge_part_t`. (LV_GAUGE_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part)
|
||||
static lv_style_list_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
|
||||
|
||||
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_GAUGE_PART_MAIN:
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef struct
|
||||
const lv_color_t * needle_colors; /*Color of the needles (lv_color_t my_colors[needle_num])*/
|
||||
const void * needle_img;
|
||||
lv_point_t needle_img_pivot;
|
||||
lv_style_dsc_t style_strong;
|
||||
lv_style_list_t style_strong;
|
||||
uint8_t needle_count; /*Number of needles*/
|
||||
uint8_t label_count; /*Number of labels on the scale*/
|
||||
} lv_gauge_ext_t;
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
**********************/
|
||||
static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_img_get_style(lv_obj_t * img, uint8_t type);
|
||||
static lv_style_list_t * lv_img_get_style(lv_obj_t * img, uint8_t type);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -629,9 +629,9 @@ static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
|
||||
}
|
||||
|
||||
|
||||
static lv_style_dsc_t * lv_img_get_style(lv_obj_t * img, uint8_t type)
|
||||
static lv_style_list_t * lv_img_get_style(lv_obj_t * img, uint8_t type)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
switch(type) {
|
||||
case LV_IMG_PART_MAIN:
|
||||
style_dsc_p = &img->style_dsc;
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_kb_get_style(lv_obj_t * kb, uint8_t part);
|
||||
static lv_style_list_t * lv_kb_get_style(lv_obj_t * kb, uint8_t part);
|
||||
static void lv_kb_update_map(lv_obj_t * kb);
|
||||
|
||||
/**********************
|
||||
@@ -454,12 +454,12 @@ static lv_res_t lv_kb_signal(lv_obj_t * kb, lv_signal_t sign, void * param)
|
||||
* @param part the part from `lv_kb_part_t`. (LV_KB_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_kb_get_style(lv_obj_t * kb, uint8_t part)
|
||||
static lv_style_list_t * lv_kb_get_style(lv_obj_t * kb, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
|
||||
|
||||
lv_kb_ext_t * ext = lv_obj_get_ext_attr(kb);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_KB_PART_BG:
|
||||
|
||||
@@ -906,9 +906,9 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
|
||||
return (pos->x >= (last_x - letter_space) && pos->x <= (last_x + max_diff));
|
||||
}
|
||||
|
||||
lv_style_dsc_t * lv_label_get_style(lv_obj_t * label, uint8_t type)
|
||||
lv_style_list_t * lv_label_get_style(lv_obj_t * label, uint8_t type)
|
||||
{
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
switch(type) {
|
||||
case LV_LABEL_PART_MAIN:
|
||||
style_dsc_p = &label->style_dsc;
|
||||
|
||||
@@ -278,7 +278,7 @@ uint16_t lv_label_get_text_sel_start(const lv_obj_t * label);
|
||||
uint16_t lv_label_get_text_sel_end(const lv_obj_t * label);
|
||||
|
||||
|
||||
lv_style_dsc_t * lv_label_get_style(lv_obj_t * label, uint8_t type);
|
||||
lv_style_list_t * lv_label_get_style(lv_obj_t * label, uint8_t type);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
|
||||
@@ -82,7 +82,7 @@ lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_led, LV_LED_WIDTH_DEF, LV_LED_HEIGHT_DEF);
|
||||
|
||||
lv_style_dsc_init(&new_led->style_dsc);
|
||||
lv_style_list_init(&new_led->style_dsc);
|
||||
lv_obj_add_style_class(new_led, LV_LED_PART_MAIN, lv_theme_get_style(LV_THEME_LED));
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
**********************/
|
||||
static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_list_get_style(lv_obj_t * list, uint8_t part);
|
||||
static lv_style_list_t * lv_list_get_style(lv_obj_t * list, uint8_t part);
|
||||
static void lv_list_btn_single_select(lv_obj_t * btn);
|
||||
static bool lv_list_is_list_btn(lv_obj_t * list_btn);
|
||||
static bool lv_list_is_list_img(lv_obj_t * list_btn);
|
||||
@@ -171,7 +171,7 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
|
||||
if(ancestor_btn_signal == NULL) ancestor_btn_signal = lv_obj_get_signal_cb(liste);
|
||||
|
||||
/*Set the default styles*/
|
||||
lv_style_dsc_reset(&liste->style_dsc);
|
||||
lv_style_list_reset(&liste->style_dsc);
|
||||
_ot(liste, LV_BTN_PART_MAIN, LIST_BTN);
|
||||
|
||||
lv_page_glue_obj(liste, true);
|
||||
@@ -910,12 +910,12 @@ static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * para
|
||||
* @param part the part from `lv_page_list_t`. (LV_LIST_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_list_get_style(lv_obj_t * list, uint8_t part)
|
||||
static lv_style_list_t * lv_list_get_style(lv_obj_t * list, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
|
||||
|
||||
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_LIST_PART_BG:
|
||||
|
||||
@@ -85,7 +85,7 @@ lv_obj_t * lv_lmeter_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
lv_obj_set_size(new_lmeter, LV_DPI, LV_DPI);
|
||||
|
||||
lv_style_dsc_reset(lv_obj_get_style(new_lmeter, LV_LMETER_PART_MAIN));
|
||||
lv_style_list_reset(lv_obj_get_style(new_lmeter, LV_LMETER_PART_MAIN));
|
||||
_ot(new_lmeter, LV_LMETER_PART_MAIN, LMETER);
|
||||
}
|
||||
/*Copy an existing line meter*/
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
**********************/
|
||||
static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param);
|
||||
static void mbox_realign(lv_obj_t * mbox);
|
||||
static lv_style_dsc_t * lv_mbox_get_style(lv_obj_t * mbox, uint8_t part);
|
||||
static lv_style_list_t * lv_mbox_get_style(lv_obj_t * mbox, uint8_t part);
|
||||
#if LV_USE_ANIMATION
|
||||
static void lv_mbox_close_ready_cb(lv_anim_t * a);
|
||||
#endif
|
||||
@@ -107,7 +107,7 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_event_cb(new_mbox, lv_mbox_default_event_cb);
|
||||
|
||||
/*Set the default styles*/
|
||||
lv_style_dsc_reset(&new_mbox->style_dsc);
|
||||
lv_style_list_reset(&new_mbox->style_dsc);
|
||||
lv_obj_add_style_theme(new_mbox, LV_MBOX_PART_BG, LV_THEME_MBOX_BG);
|
||||
|
||||
}
|
||||
@@ -150,11 +150,11 @@ void lv_mbox_add_btns(lv_obj_t * mbox, const char * btn_map[])
|
||||
if(ext->btnm == NULL) {
|
||||
ext->btnm = lv_btnm_create(mbox, NULL);
|
||||
|
||||
lv_style_dsc_reset(&ext->btnm->style_dsc);
|
||||
lv_style_list_reset(&ext->btnm->style_dsc);
|
||||
lv_obj_add_style_theme(ext->btnm, LV_BTNM_PART_BG, LV_THEME_MBOX_BTN_BG);
|
||||
|
||||
|
||||
lv_style_dsc_reset(lv_obj_get_style(ext->btnm, LV_BTNM_PART_BTN));
|
||||
lv_style_list_reset(lv_obj_get_style(ext->btnm, LV_BTNM_PART_BTN));
|
||||
lv_obj_add_style_theme(ext->btnm, LV_BTNM_PART_BTN, LV_THEME_MBOX_BTN);
|
||||
}
|
||||
|
||||
@@ -472,12 +472,12 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
|
||||
* @param part the part from `lv_mbox_part_t`. (LV_MBOX_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_mbox_get_style(lv_obj_t * mbox, uint8_t part)
|
||||
static lv_style_list_t * lv_mbox_get_style(lv_obj_t * mbox, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
|
||||
|
||||
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_MBOX_PART_BG:
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
static void lv_page_sb_refresh(lv_obj_t * page);
|
||||
static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_page_get_style(lv_obj_t * page, uint8_t part);
|
||||
static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part);
|
||||
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
|
||||
static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event);
|
||||
#if LV_USE_ANIMATION
|
||||
@@ -95,12 +95,12 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
ext->scrl = NULL;
|
||||
lv_style_dsc_init(&ext->sb.style);
|
||||
lv_style_list_init(&ext->sb.style);
|
||||
ext->sb.hor_draw = 0;
|
||||
ext->sb.ver_draw = 0;
|
||||
ext->sb.mode = LV_SB_MODE_AUTO;
|
||||
#if LV_USE_ANIMATION
|
||||
lv_style_dsc_init(&ext->edge_flash.style);
|
||||
lv_style_list_init(&ext->edge_flash.style);
|
||||
ext->edge_flash.enabled = 0;
|
||||
ext->edge_flash.bottom_ip = 0;
|
||||
ext->edge_flash.top_ip = 0;
|
||||
@@ -1075,12 +1075,12 @@ static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event)
|
||||
* @param part the part of the page. (LV_PAGE_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_page_get_style(lv_obj_t * page, uint8_t part)
|
||||
static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
|
||||
|
||||
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_PAGE_PART_BG:
|
||||
|
||||
@@ -57,7 +57,7 @@ typedef struct
|
||||
lv_obj_t * scrl; /*The scrollable object on the background*/
|
||||
struct
|
||||
{
|
||||
lv_style_dsc_t style; /*Style of scrollbars*/
|
||||
lv_style_list_t style; /*Style of scrollbars*/
|
||||
lv_area_t hor_area; /*Horizontal scrollbar area relative to the page. (Handled by the library) */
|
||||
lv_area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/
|
||||
uint8_t hor_draw : 1; /*1: horizontal scrollbar is visible now (Handled by the library)*/
|
||||
@@ -68,7 +68,7 @@ typedef struct
|
||||
struct
|
||||
{
|
||||
lv_anim_value_t state; /*Store the current size of the edge flash effect*/
|
||||
lv_style_dsc_t style; /*Style of edge flash effect (usually homogeneous circle)*/
|
||||
lv_style_list_t style; /*Style of edge flash effect (usually homogeneous circle)*/
|
||||
uint8_t enabled : 1; /*1: Show a flash animation on the edge*/
|
||||
uint8_t top_ip : 1; /*Used internally to show that top most position is reached (flash is In
|
||||
Progress)*/
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
**********************/
|
||||
static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part);
|
||||
static lv_style_list_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part);
|
||||
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param);
|
||||
static void refr_position(lv_obj_t * roller, lv_anim_enable_t animen);
|
||||
static void refr_height(lv_obj_t * roller);
|
||||
@@ -385,7 +385,7 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
lv_res_t res;
|
||||
if(sign == LV_SIGNAL_GET_STYLE) {
|
||||
uint8_t ** type_p = param;
|
||||
lv_style_dsc_t ** style_dsc_p = param;
|
||||
lv_style_list_t ** style_dsc_p = param;
|
||||
*style_dsc_p = lv_roller_get_style(roller, **type_p);
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@@ -475,12 +475,12 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
|
||||
* @param part the part from `lv_roller_part_t`. (LV_ROLLER_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part)
|
||||
static lv_style_list_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
|
||||
|
||||
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_ROLLER_PART_BG:
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
**********************/
|
||||
static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part);
|
||||
static lv_style_list_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part);
|
||||
static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv_coord_t knob_size, bool hor);
|
||||
static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area);
|
||||
|
||||
@@ -77,7 +77,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
/*Initialize the allocated 'ext' */
|
||||
lv_style_dsc_init(&ext->style_knob);
|
||||
lv_style_list_init(&ext->style_knob);
|
||||
ext->value_to_set = NULL;
|
||||
ext->dragging = false;
|
||||
|
||||
@@ -394,12 +394,12 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
|
||||
}
|
||||
|
||||
|
||||
static lv_style_dsc_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part)
|
||||
static lv_style_list_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(slider, LV_OBJX_NAME);
|
||||
|
||||
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_SLIDER_PART_BG:
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef struct
|
||||
{
|
||||
lv_bar_ext_t bar; /*Ext. of ancestor*/
|
||||
/*New data for this type */
|
||||
lv_style_dsc_t style_knob; /*Style of the knob*/
|
||||
lv_style_list_t style_knob; /*Style of the knob*/
|
||||
lv_area_t left_knob_area;
|
||||
lv_area_t right_knob_area;
|
||||
int16_t *value_to_set; /* Which bar value to set */
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_spinbox_get_style(lv_obj_t * ta, uint8_t part);
|
||||
static lv_style_list_t * lv_spinbox_get_style(lv_obj_t * ta, uint8_t part);
|
||||
static void lv_spinbox_updatevalue(lv_obj_t * spinbox);
|
||||
|
||||
/**********************
|
||||
@@ -408,12 +408,12 @@ static lv_res_t lv_spinbox_signal(lv_obj_t * spinbox, lv_signal_t sign, void * p
|
||||
* @param part the part from `lv_spinbox_part_t`. (LV_SPINBOX_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_spinbox_get_style(lv_obj_t * ta, uint8_t part)
|
||||
static lv_style_list_t * lv_spinbox_get_style(lv_obj_t * ta, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
|
||||
|
||||
lv_spinbox_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_SPINBOX_PART_BG:
|
||||
|
||||
@@ -34,8 +34,8 @@
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part);
|
||||
static lv_style_dsc_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part);
|
||||
static lv_style_list_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part);
|
||||
static lv_style_list_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -233,12 +233,12 @@ static lv_res_t lv_sw_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
|
||||
return res;
|
||||
}
|
||||
|
||||
static lv_style_dsc_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part)
|
||||
static lv_style_list_t * lv_sw_get_style(lv_obj_t * sw, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(sw, LV_OBJX_NAME);
|
||||
|
||||
lv_sw_ext_t * ext = lv_obj_get_ext_attr(sw);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_SW_PART_BG:
|
||||
|
||||
@@ -46,7 +46,7 @@ static lv_design_res_t lv_ta_design(lv_obj_t * ta, const lv_area_t * clip_area,
|
||||
static lv_design_res_t lv_ta_scrollable_design(lv_obj_t * scrl, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param);
|
||||
static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_ta_get_style(lv_obj_t * ta, uint8_t part);
|
||||
static lv_style_list_t * lv_ta_get_style(lv_obj_t * ta, uint8_t part);
|
||||
#if LV_USE_ANIMATION
|
||||
static void cursor_blink_anim(lv_obj_t * ta, lv_anim_value_t show);
|
||||
static void pwd_char_hider_anim(lv_obj_t * ta, lv_anim_value_t x);
|
||||
@@ -121,7 +121,7 @@ lv_obj_t * lv_ta_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
ext->label = NULL;
|
||||
ext->placeholder = NULL;
|
||||
|
||||
lv_style_dsc_init(&ext->cursor.style);
|
||||
lv_style_list_init(&ext->cursor.style);
|
||||
|
||||
#if LV_USE_ANIMATION == 0
|
||||
ext->pwd_show_time = 0;
|
||||
@@ -1541,12 +1541,12 @@ static lv_res_t lv_ta_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void
|
||||
* @param part the part from `lv_ta_part_t`. (LV_TA_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_ta_get_style(lv_obj_t * ta, uint8_t part)
|
||||
static lv_style_list_t * lv_ta_get_style(lv_obj_t * ta, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
|
||||
|
||||
lv_ta_ext_t * ext = lv_obj_get_ext_attr(ta);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_TA_PART_BG:
|
||||
|
||||
@@ -54,7 +54,7 @@ typedef struct
|
||||
uint16_t pwd_show_time; /*Time to show characters in password mode before change them to '*' */
|
||||
struct
|
||||
{
|
||||
lv_style_dsc_t style; /* Style of the cursor (NULL to use label's style)*/
|
||||
lv_style_list_t style; /* Style of the cursor (NULL to use label's style)*/
|
||||
lv_coord_t valid_x; /* Used when stepping up/down to a shorter line.
|
||||
* (Used by the library)*/
|
||||
uint16_t pos; /* The current cursor position
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
**********************/
|
||||
static lv_design_res_t lv_table_design(lv_obj_t * table, const lv_area_t * clip_area, lv_design_mode_t mode);
|
||||
static lv_res_t lv_table_signal(lv_obj_t * table, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_table_get_style(lv_obj_t * table, uint8_t part);
|
||||
static lv_style_list_t * lv_table_get_style(lv_obj_t * table, uint8_t part);
|
||||
static lv_coord_t get_row_height(lv_obj_t * table, uint16_t row_id);
|
||||
static void refr_size(lv_obj_t * table);
|
||||
|
||||
@@ -80,7 +80,7 @@ lv_obj_t * lv_table_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
uint16_t i;
|
||||
for(i = 0; i < LV_TABLE_CELL_STYLE_CNT; i++) {
|
||||
lv_style_dsc_init(&ext->cell_style[i]);
|
||||
lv_style_list_init(&ext->cell_style[i]);
|
||||
}
|
||||
|
||||
for(i = 0; i < LV_TABLE_COL_MAX; i++) {
|
||||
@@ -93,7 +93,7 @@ lv_obj_t * lv_table_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
/*Init the new table table*/
|
||||
if(copy == NULL) {
|
||||
lv_style_dsc_reset(&new_table->style_dsc);
|
||||
lv_style_list_reset(&new_table->style_dsc);
|
||||
lv_obj_add_style_theme(new_table, LV_TABLE_PART_BG, LV_THEME_TABLE_BG);
|
||||
lv_obj_add_style_theme(new_table, LV_TABLE_PART_CELL1, LV_THEME_TABLE_CELL1);
|
||||
lv_obj_add_style_theme(new_table, LV_TABLE_PART_CELL2, LV_THEME_TABLE_CELL2);
|
||||
@@ -827,12 +827,12 @@ static lv_res_t lv_table_signal(lv_obj_t * table, lv_signal_t sign, void * param
|
||||
* @param part the part from. (LV_TABLE_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_table_get_style(lv_obj_t * table, uint8_t part)
|
||||
static lv_style_list_t * lv_table_get_style(lv_obj_t * table, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(table, LV_OBJX_NAME);
|
||||
|
||||
lv_table_ext_t * ext = lv_obj_get_ext_attr(table);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_TABLE_PART_BG:
|
||||
|
||||
@@ -61,7 +61,7 @@ typedef struct
|
||||
uint16_t col_cnt;
|
||||
uint16_t row_cnt;
|
||||
char ** cell_data;
|
||||
lv_style_dsc_t cell_style[LV_TABLE_CELL_STYLE_CNT];
|
||||
lv_style_list_t cell_style[LV_TABLE_CELL_STYLE_CNT];
|
||||
lv_coord_t col_w[LV_TABLE_COL_MAX];
|
||||
} lv_table_ext_t;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
**********************/
|
||||
static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * param);
|
||||
static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, void * param);
|
||||
static lv_style_dsc_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part);
|
||||
static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part);
|
||||
|
||||
static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event);
|
||||
static void tabview_realign(lv_obj_t * tabview);
|
||||
@@ -133,11 +133,11 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_page_set_sb_mode(ext->content, LV_SB_MODE_OFF);
|
||||
lv_obj_set_drag_dir(lv_page_get_scrl(ext->content), LV_DRAG_DIR_ONE);
|
||||
|
||||
lv_style_dsc_reset(lv_obj_get_style(ext->content, LV_PAGE_PART_BG));
|
||||
lv_style_dsc_reset(lv_obj_get_style(ext->content, LV_PAGE_PART_SCRL));
|
||||
lv_style_dsc_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_INDIC));
|
||||
lv_style_dsc_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_BTNS));
|
||||
lv_style_dsc_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_BTNS_BG));
|
||||
lv_style_list_reset(lv_obj_get_style(ext->content, LV_PAGE_PART_BG));
|
||||
lv_style_list_reset(lv_obj_get_style(ext->content, LV_PAGE_PART_SCRL));
|
||||
lv_style_list_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_INDIC));
|
||||
lv_style_list_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_BTNS));
|
||||
lv_style_list_reset(lv_obj_get_style(new_tabview, LV_TABVIEW_PART_BTNS_BG));
|
||||
|
||||
lv_obj_reset_style(ext->content, LV_PAGE_PART_BG);
|
||||
_ot(new_tabview, LV_TABVIEW_PART_BG_SCRL, TABVIEW_BG_SCRL);
|
||||
@@ -219,8 +219,8 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
|
||||
lv_obj_t * h = lv_page_create(ext->content, NULL);
|
||||
lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(ext->content));
|
||||
lv_page_set_sb_mode(h, LV_SB_MODE_AUTO);
|
||||
lv_style_dsc_reset(lv_obj_get_style(h, LV_PAGE_PART_BG));
|
||||
lv_style_dsc_reset(lv_obj_get_style(h, LV_PAGE_PART_SCRL));
|
||||
lv_style_list_reset(lv_obj_get_style(h, LV_PAGE_PART_BG));
|
||||
lv_style_list_reset(lv_obj_get_style(h, LV_PAGE_PART_SCRL));
|
||||
_ot(h, LV_PAGE_PART_BG, TABVIEW_TAB_BG);
|
||||
_ot(h, LV_PAGE_PART_SCRL, TABVIEW_TAB_SCRL);
|
||||
lv_page_set_scroll_propagation(h, true);
|
||||
@@ -735,12 +735,12 @@ static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, v
|
||||
* @param part the part from `lv_tabview_part_t`. (LV_TABVIEW_PART_...)
|
||||
* @return pointer to the style descriptor of the specified part
|
||||
*/
|
||||
static lv_style_dsc_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part)
|
||||
static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part)
|
||||
{
|
||||
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
|
||||
|
||||
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
|
||||
lv_style_dsc_t * style_dsc_p;
|
||||
lv_style_list_t * style_dsc_p;
|
||||
|
||||
switch(part) {
|
||||
case LV_TABVIEW_PART_BG:
|
||||
|
||||
@@ -11,15 +11,17 @@ OPTIMIZATION ?= -O3 -g0
|
||||
|
||||
CFLAGS ?= -I$(LVGL_DIR)/ $(DEFINES) $(WARNINGS) $(OPTIMIZATION) -I$(LVGL_DIR) -I.
|
||||
|
||||
LDFLAGS ?=
|
||||
LDFLAGS ?= -lpng
|
||||
BIN ?= demo
|
||||
|
||||
|
||||
#Collect the files to compile
|
||||
MAINSRC = ./test_main.c
|
||||
MAINSRC = ./lv_test_main.c
|
||||
|
||||
include ../lvgl.mk
|
||||
|
||||
CSRCS += lv_test_assert.c
|
||||
|
||||
OBJEXT ?= .o
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
|
||||
@@ -21,6 +21,10 @@ extern "C" {
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
uint32_t custom_tick_get(void);
|
||||
#define LV_TICK_CUSTOM_SYS_TIME_EXPR custom_tick_get()
|
||||
|
||||
typedef int16_t lv_coord_t;
|
||||
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
|
||||
typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#include "../lvgl.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#if LV_BUILD_TEST
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("Call lv_init...\n");
|
||||
lv_init();
|
||||
|
||||
printf("Exit with success!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user