obj: remove state_dsc, from now a simple state is enough

This commit is contained in:
Gabor Kiss-Vamosi
2020-02-21 16:56:05 +01:00
parent 78923b6b9b
commit a9d3dce55b
13 changed files with 114 additions and 148 deletions

View File

@@ -290,7 +290,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
new_obj->protect = LV_PROTECT_NONE; new_obj->protect = LV_PROTECT_NONE;
new_obj->parent_event = 0; new_obj->parent_event = 0;
new_obj->gesture_parent = 1; new_obj->gesture_parent = 1;
new_obj->state_dsc.act = LV_STATE_NORMAL; new_obj->state = LV_STATE_NORMAL;
#if LV_USE_BIDI #if LV_USE_BIDI
if(parent == NULL) new_obj->base_dir = LV_BIDI_BASE_DIR_DEF; if(parent == NULL) new_obj->base_dir = LV_BIDI_BASE_DIR_DEF;
@@ -1472,18 +1472,18 @@ void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot)
*/ */
void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state) void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
{ {
if(obj->state_dsc.act == new_state) return; if(obj->state == new_state) return;
LV_ASSERT_OBJ(obj, LV_OBJX_NAME); LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0 #if LV_USE_ANIMATION == 0
obj->state_dsc.act = new_state; obj->state = new_state;
obj->state_dsc.prev = new_state; obj->state.prev = new_state;
obj->state_dsc.anim = 0; obj->state.anim = 0;
lv_obj_refresh_style(obj); lv_obj_refresh_style(obj);
#else #else
lv_state_t prev_state = obj->state_dsc.act; lv_state_t prev_state = obj->state;
obj->state_dsc.act = new_state; obj->state = new_state;
uint8_t part; uint8_t part;
for(part = 0; part < _LV_OBJ_PART_REAL_LAST; part++) { for(part = 0; part < _LV_OBJ_PART_REAL_LAST; part++) {
@@ -1495,12 +1495,12 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
lv_style_property_t props[LV_STYLE_TRANS_NUM_MAX]; lv_style_property_t props[LV_STYLE_TRANS_NUM_MAX];
lv_style_int_t delay = lv_obj_get_style_trans_delay(obj, part); lv_style_int_t delay = lv_obj_get_style_trans_delay(obj, part);
lv_anim_path_cb_t path = lv_obj_get_style_trans_path(obj, part); lv_anim_path_cb_t path = lv_obj_get_style_trans_path(obj, part);
props[0] = lv_obj_get_style_trans_prop1(obj, part); props[0] = lv_obj_get_style_trans_prop_1(obj, part);
props[1] = lv_obj_get_style_trans_prop2(obj, part); props[1] = lv_obj_get_style_trans_prop_2(obj, part);
props[2] = lv_obj_get_style_trans_prop3(obj, part); props[2] = lv_obj_get_style_trans_prop_3(obj, part);
props[3] = lv_obj_get_style_trans_prop4(obj, part); props[3] = lv_obj_get_style_trans_prop_4(obj, part);
props[4] = lv_obj_get_style_trans_prop5(obj, part); props[4] = lv_obj_get_style_trans_prop_5(obj, part);
props[5] = lv_obj_get_style_trans_prop6(obj, part); props[5] = lv_obj_get_style_trans_prop_6(obj, part);
uint8_t i; uint8_t i;
@@ -1522,7 +1522,7 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
lv_anim_t a; lv_anim_t a;
lv_anim_init(&a); lv_anim_init(&a);
lv_anim_set_var(&a, tr); lv_anim_set_var(&a, tr);
lv_anim_set_exec_cb(&a, trans_anim_cb); lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)trans_anim_cb);
lv_anim_set_start_cb(&a, trans_anim_start_cb); lv_anim_set_start_cb(&a, trans_anim_start_cb);
lv_anim_set_ready_cb(&a, trans_anim_ready_cb); lv_anim_set_ready_cb(&a, trans_anim_ready_cb);
lv_anim_set_values(&a, 0x00, 0xFF); lv_anim_set_values(&a, 0x00, 0xFF);
@@ -1552,16 +1552,16 @@ static lv_anim_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
/*Get the previous and current values*/ /*Get the previous and current values*/
if((prop & 0xF) < LV_STYLE_ID_COLOR) { /*Int*/ if((prop & 0xF) < LV_STYLE_ID_COLOR) { /*Int*/
style_list->skip_trans = 1; style_list->skip_trans = 1;
obj->state_dsc.act = prev_state; obj->state = prev_state;
lv_style_int_t int1 = _lv_obj_get_style_int(obj, part, prop); lv_style_int_t int1 = _lv_obj_get_style_int(obj, part, prop);
obj->state_dsc.act = new_state; obj->state = new_state;
lv_style_int_t int2 = _lv_obj_get_style_int(obj, part, prop); lv_style_int_t int2 = _lv_obj_get_style_int(obj, part, prop);
style_list->skip_trans = 0; style_list->skip_trans = 0;
if(int1 == int2) return NULL; if(int1 == int2) return NULL;
obj->state_dsc.act = prev_state; obj->state = prev_state;
int1 = _lv_obj_get_style_int(obj, part, prop); int1 = _lv_obj_get_style_int(obj, part, prop);
obj->state_dsc.act = new_state; obj->state = new_state;
_lv_style_set_int(style_trans, prop, int1); /*Be sure `trans_style` has a valid value */ _lv_style_set_int(style_trans, prop, int1); /*Be sure `trans_style` has a valid value */
if(prop == LV_STYLE_RADIUS) { if(prop == LV_STYLE_RADIUS) {
@@ -1581,16 +1581,16 @@ static lv_anim_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
} }
else if((prop & 0xF) < LV_STYLE_ID_OPA) { /*Color*/ else if((prop & 0xF) < LV_STYLE_ID_OPA) { /*Color*/
style_list->skip_trans = 1; style_list->skip_trans = 1;
obj->state_dsc.act = prev_state; obj->state = prev_state;
lv_color_t c1 = _lv_obj_get_style_color(obj, part, prop); lv_color_t c1 = _lv_obj_get_style_color(obj, part, prop);
obj->state_dsc.act = new_state; obj->state = new_state;
lv_color_t c2 = _lv_obj_get_style_color(obj, part, prop); lv_color_t c2 = _lv_obj_get_style_color(obj, part, prop);
style_list->skip_trans = 0; style_list->skip_trans = 0;
if(c1.full == c2.full) return NULL; if(c1.full == c2.full) return NULL;
obj->state_dsc.act = prev_state; obj->state = prev_state;
c1 = _lv_obj_get_style_color(obj, part, prop); c1 = _lv_obj_get_style_color(obj, part, prop);
obj->state_dsc.act = new_state; obj->state = new_state;
_lv_style_set_color(style_trans, prop, c1); /*Be sure `trans_style` has a valid value */ _lv_style_set_color(style_trans, prop, c1); /*Be sure `trans_style` has a valid value */
tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll)); tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
@@ -1601,17 +1601,17 @@ static lv_anim_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
} }
else if((prop & 0xF) < LV_STYLE_ID_PTR) { /*Opa*/ else if((prop & 0xF) < LV_STYLE_ID_PTR) { /*Opa*/
style_list->skip_trans = 1; style_list->skip_trans = 1;
obj->state_dsc.act = prev_state; obj->state = prev_state;
lv_opa_t o1 = _lv_obj_get_style_opa(obj, part, prop); lv_opa_t o1 = _lv_obj_get_style_opa(obj, part, prop);
obj->state_dsc.act = new_state; obj->state = new_state;
lv_opa_t o2 = _lv_obj_get_style_opa(obj, part, prop); lv_opa_t o2 = _lv_obj_get_style_opa(obj, part, prop);
style_list->skip_trans = 0; style_list->skip_trans = 0;
if(o1 == o2) return NULL; if(o1 == o2) return NULL;
obj->state_dsc.act = prev_state; obj->state = prev_state;
o1 = _lv_obj_get_style_opa(obj, part, prop); o1 = _lv_obj_get_style_opa(obj, part, prop);
obj->state_dsc.act = new_state; obj->state = new_state;
_lv_style_set_opa(style_trans, prop, o1); /*Be sure `trans_style` has a valid value */ _lv_style_set_opa(style_trans, prop, o1); /*Be sure `trans_style` has a valid value */
tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll)); tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
@@ -1620,17 +1620,17 @@ static lv_anim_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
tr->start_value._opa= o1; tr->start_value._opa= o1;
tr->end_value._opa = o2; tr->end_value._opa = o2;
} else { /*Ptr*/ } else { /*Ptr*/
obj->state_dsc.act = prev_state; obj->state = prev_state;
style_list->skip_trans = 1; style_list->skip_trans = 1;
const void * p1 = _lv_obj_get_style_ptr(obj, part, prop); const void * p1 = _lv_obj_get_style_ptr(obj, part, prop);
obj->state_dsc.act = new_state; obj->state = new_state;
const void * p2 = _lv_obj_get_style_ptr(obj, part, prop); const void * p2 = _lv_obj_get_style_ptr(obj, part, prop);
style_list->skip_trans = 0; style_list->skip_trans = 0;
if(p1 == p2) return NULL; if(p1 == p2) return NULL;
obj->state_dsc.act = prev_state; obj->state = prev_state;
p1 = _lv_obj_get_style_ptr(obj, part, prop); p1 = _lv_obj_get_style_ptr(obj, part, prop);
obj->state_dsc.act = new_state; obj->state = new_state;
_lv_style_set_ptr(style_trans, prop, p1); /*Be sure `trans_style` has a valid value */ _lv_style_set_ptr(style_trans, prop, p1); /*Be sure `trans_style` has a valid value */
tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll)); tr = lv_ll_ins_head(&LV_GC_ROOT(_lv_obj_style_trans_ll));
@@ -1672,8 +1672,8 @@ void lv_obj_add_state(lv_obj_t * obj, lv_state_t state)
{ {
LV_ASSERT_OBJ(obj, LV_OBJX_NAME); LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
lv_state_t new_state = obj->state_dsc.act | state; lv_state_t new_state = obj->state | state;
if(obj->state_dsc.act != new_state) { if(obj->state != new_state) {
lv_obj_set_state(obj, new_state); lv_obj_set_state(obj, new_state);
} }
} }
@@ -1689,8 +1689,8 @@ void lv_obj_clear_state(lv_obj_t * obj, lv_state_t state)
{ {
LV_ASSERT_OBJ(obj, LV_OBJX_NAME); LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
lv_state_t new_state = obj->state_dsc.act & (~state); lv_state_t new_state = obj->state & (~state);
if(obj->state_dsc.act != new_state) { if(obj->state != new_state) {
lv_obj_set_state(obj, new_state); lv_obj_set_state(obj, new_state);
} }
} }
@@ -2306,8 +2306,8 @@ lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_styl
while(parent) { while(parent) {
lv_style_list_t * dsc = lv_obj_get_style_list(parent, part); lv_style_list_t * dsc = lv_obj_get_style_list(parent, part);
lv_obj_state_dsc_t * state = lv_obj_get_state_dsc(parent, part); lv_state_t state = lv_obj_get_state(parent, part);
prop = (uint16_t)prop_ori + ((uint16_t)state->act << LV_STYLE_STATE_POS); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
res = lv_style_list_get_int(dsc, prop, &value_act); res = lv_style_list_get_int(dsc, prop, &value_act);
if(res == LV_RES_OK) return value_act; if(res == LV_RES_OK) return value_act;
@@ -2367,8 +2367,8 @@ lv_color_t _lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_
while(parent) { while(parent) {
lv_style_list_t * dsc = lv_obj_get_style_list(parent, part); lv_style_list_t * dsc = lv_obj_get_style_list(parent, part);
lv_obj_state_dsc_t * state = lv_obj_get_state_dsc(parent, part); lv_state_t state = lv_obj_get_state(parent, part);
prop = (uint16_t)prop_ori + ((uint16_t)state->act << LV_STYLE_STATE_POS); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
res = lv_style_list_get_color(dsc, prop, &value_act); res = lv_style_list_get_color(dsc, prop, &value_act);
if(res == LV_RES_OK) return value_act; if(res == LV_RES_OK) return value_act;
@@ -2423,8 +2423,8 @@ lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prop
while(parent) { while(parent) {
lv_style_list_t * dsc = lv_obj_get_style_list(parent, part); lv_style_list_t * dsc = lv_obj_get_style_list(parent, part);
lv_obj_state_dsc_t * state = lv_obj_get_state_dsc(parent, part); lv_state_t state = lv_obj_get_state(parent, part);
prop = (uint16_t)prop_ori + ((uint16_t)state->act << LV_STYLE_STATE_POS); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
res = lv_style_list_get_opa(dsc, prop, &value_act); res = lv_style_list_get_opa(dsc, prop, &value_act);
if(res == LV_RES_OK) return value_act; if(res == LV_RES_OK) return value_act;
@@ -2480,8 +2480,8 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_
while(parent) { while(parent) {
lv_style_list_t * dsc = lv_obj_get_style_list(parent, part); lv_style_list_t * dsc = lv_obj_get_style_list(parent, part);
lv_obj_state_dsc_t * state = lv_obj_get_state_dsc(parent, part); lv_state_t state = lv_obj_get_state(parent, part);
prop = (uint16_t)prop_ori + ((uint16_t)state->act << LV_STYLE_STATE_POS); prop = (uint16_t)prop_ori + ((uint16_t)state << LV_STYLE_STATE_POS);
res = lv_style_list_get_ptr(dsc, prop, &value_act); res = lv_style_list_get_ptr(dsc, prop, &value_act);
if(res == LV_RES_OK) return value_act; if(res == LV_RES_OK) return value_act;
@@ -2505,7 +2505,6 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_
case LV_STYLE_VALUE_FONT: case LV_STYLE_VALUE_FONT:
return LV_THEME_DEFAULT_FONT_NORMAL; return LV_THEME_DEFAULT_FONT_NORMAL;
case LV_STYLE_TRANS_PATH: case LV_STYLE_TRANS_PATH:
case LV_STYLE_TRANS2_PATH:
return lv_anim_path_linear; return lv_anim_path_linear;
} }
@@ -2677,33 +2676,24 @@ bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot)
return (obj->protect & prot) == 0 ? false : true; return (obj->protect & prot) == 0 ? false : true;
} }
lv_obj_state_dsc_t * lv_obj_get_state_dsc(const lv_obj_t * obj, uint8_t part) lv_state_t lv_obj_get_state(const lv_obj_t * obj, uint8_t part)
{ {
LV_ASSERT_OBJ(obj, LV_OBJX_NAME); LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
if(part < _LV_OBJ_PART_REAL_LAST) return &((lv_obj_t*)obj)->state_dsc; if(part < _LV_OBJ_PART_REAL_LAST) return ((lv_obj_t*)obj)->state;
/*If a real part is asked, then use the object's signal to get its state. /*If a real part is asked, then use the object's signal to get its state.
* A real object can be in different state then the main part * A real object can be in different state then the main part
* and only the object itseld knows who to get it's state. */ * and only the object itseld knows who to get it's state. */
lv_get_state_info_t info; lv_get_state_info_t info;
info.part = part; info.part = part;
info.result = NULL; info.result = LV_STATE_NORMAL;
lv_res_t res; lv_signal_send((lv_obj_t*)obj, LV_SIGNAL_GET_STATE_DSC, &info);
res = lv_signal_send((lv_obj_t*)obj, LV_SIGNAL_GET_STATE_DSC, &info);
if(res != LV_RES_OK) return NULL;
return info.result; return info.result;
} }
lv_state_t lv_obj_get_state(const lv_obj_t * obj, uint8_t part)
{
lv_obj_state_dsc_t * state_dsc = lv_obj_get_state_dsc(obj, part);
return state_dsc->act;
}
/** /**
* Get the signal function of an object * Get the signal function of an object
* @param obj pointer to an object * @param obj pointer to an object

View File

@@ -193,10 +193,6 @@ enum {
typedef uint8_t lv_state_t; typedef uint8_t lv_state_t;
typedef struct {
lv_state_t act;
}lv_obj_state_dsc_t;
typedef struct _lv_obj_t typedef struct _lv_obj_t
{ {
struct _lv_obj_t * parent; /**< Pointer to the parent object*/ struct _lv_obj_t * parent; /**< Pointer to the parent object*/
@@ -240,7 +236,7 @@ typedef struct _lv_obj_t
uint8_t protect; /**< Automatically happening actions can be prevented. uint8_t protect; /**< Automatically happening actions can be prevented.
'OR'ed values from `lv_protect_t`*/ 'OR'ed values from `lv_protect_t`*/
lv_obj_state_dsc_t state_dsc; lv_state_t state;
#if LV_USE_OBJ_REALIGN #if LV_USE_OBJ_REALIGN
lv_realign_t realign; /**< Information about the last call to ::lv_obj_align. */ lv_realign_t realign; /**< Information about the last call to ::lv_obj_align. */
@@ -274,7 +270,6 @@ typedef struct
bool result; bool result;
} lv_hit_test_info_t; } lv_hit_test_info_t;
typedef struct typedef struct
{ {
uint8_t part; uint8_t part;
@@ -284,7 +279,7 @@ typedef struct
typedef struct typedef struct
{ {
uint8_t part; uint8_t part;
lv_obj_state_dsc_t * result; lv_state_t result;
} lv_get_state_info_t; } lv_get_state_info_t;
/********************** /**********************
@@ -1133,7 +1128,6 @@ uint8_t lv_obj_get_protect(const lv_obj_t * obj);
*/ */
bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot); bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot);
lv_obj_state_dsc_t * lv_obj_get_state_dsc(const lv_obj_t * obj, uint8_t part);
lv_state_t lv_obj_get_state(const lv_obj_t * obj, uint8_t part); lv_state_t lv_obj_get_state(const lv_obj_t * obj, uint8_t part);

View File

@@ -138,20 +138,13 @@ _LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_OPA, image_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_TIME, trans_time, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_TIME, trans_time, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_DELAY, trans_delay, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_DELAY, trans_delay, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_1, trans_prop1, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_1, trans_prop_1, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_2, trans_prop2, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_2, trans_prop_2, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_3, trans_prop3, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_3, trans_prop_3, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_4, trans_prop4, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_4, trans_prop_4, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_5, trans_prop5, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_5, trans_prop_5, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_6, trans_prop6, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PROP_6, trans_prop_6, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PATH, trans_path, const lv_anim_path_cb_t , _ptr, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(TRANS_PATH, trans_path, const lv_anim_path_cb_t , _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS2_TIME, trans2_time, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS2_DELAY, trans2_delay, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS2_PROP_1, trans2_prop1, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS2_PROP_2, trans2_prop2, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS2_PROP_3, trans2_prop3, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS2_PROP_4, trans2_prop4, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANS2_PATH, trans2_path, const lv_anim_path_cb_t , _ptr, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int, scalar) _LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int, scalar)

View File

@@ -183,22 +183,12 @@ enum {
LV_STYLE_PROP_INIT(LV_STYLE_TRANS_PROP_6, 0xB, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_TRANS_PROP_6, 0xB, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS_PATH, 0xB, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_TRANS_PATH, 0xB, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_TIME, 0xC, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_SCALE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_DELAY, 0xC, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_SCALE_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_PROP_1, 0xC, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_PROP_2, 0xC, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_LINE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_PROP_3, 0xC, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_SCALE_GRAD_COLOR, 0xC, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_PROP_4, 0xC, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_COLOR, 0xC, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_PROP_5, 0xC, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_PROP_6, 0xC, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_TRANS2_PATH, 0xC, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_WIDTH, 0xD, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_BORDER_WIDTH, 0xD, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_BORDER_WIDTH, 0xD, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_LINE_WIDTH, 0xD, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_GRAD_COLOR, 0xD, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_END_COLOR, 0xD, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_NONE),
}; };
typedef uint16_t lv_style_property_t; typedef uint16_t lv_style_property_t;

View File

@@ -189,7 +189,7 @@ static void basic_init(void)
lv_style_set_pad_top(&panel, LV_STATE_NORMAL, LV_DPI / 5); lv_style_set_pad_top(&panel, LV_STATE_NORMAL, LV_DPI / 5);
lv_style_set_pad_bottom(&panel, LV_STATE_NORMAL, LV_DPI / 5); lv_style_set_pad_bottom(&panel, LV_STATE_NORMAL, LV_DPI / 5);
lv_style_set_pad_inner(&panel, LV_STATE_NORMAL, LV_DPI / 5); lv_style_set_pad_inner(&panel, LV_STATE_NORMAL, LV_DPI / 5);
lv_style_set_trans_prop1(&panel, LV_STATE_NORMAL, LV_STYLE_BORDER_COLOR); lv_style_set_trans_prop_1(&panel, LV_STATE_NORMAL, LV_STYLE_BORDER_COLOR);
lv_style_init(&bg); lv_style_init(&bg);
lv_style_set_radius(&bg, LV_STATE_NORMAL, LV_DPI / 25); lv_style_set_radius(&bg, LV_STATE_NORMAL, LV_DPI / 25);
@@ -250,10 +250,9 @@ static void basic_init(void)
// lv_style_set_trans_path(&btn, LV_STATE_PRESSED, lv_anim_path_overshoot); // lv_style_set_trans_path(&btn, LV_STATE_PRESSED, lv_anim_path_overshoot);
// lv_style_set_trans_path(&btn, LV_STATE_NORMAL, lv_anim_path_linear); // lv_style_set_trans_path(&btn, LV_STATE_NORMAL, lv_anim_path_linear);
lv_style_set_trans_prop1(&btn, LV_STATE_NORMAL, LV_STYLE_BORDER_WIDTH); lv_style_set_trans_prop_1(&btn, LV_STATE_NORMAL, LV_STYLE_BORDER_WIDTH);
lv_style_set_trans_prop2(&btn, LV_STATE_NORMAL, LV_STYLE_OUTLINE_OPA); lv_style_set_trans_prop_2(&btn, LV_STATE_NORMAL, LV_STYLE_OUTLINE_OPA);
lv_style_set_trans_prop3(&btn, LV_STATE_NORMAL, LV_STYLE_BG_COLOR); lv_style_set_trans_prop_3(&btn, LV_STATE_NORMAL, LV_STYLE_BG_COLOR);
lv_style_set_trans_prop4(&btn, LV_STATE_NORMAL, LV_STYLE_VALUE_FONT);
lv_style_set_trans_delay(&btn, LV_STATE_NORMAL, 100); lv_style_set_trans_delay(&btn, LV_STATE_NORMAL, 100);
lv_style_set_trans_delay(&btn, LV_STATE_PRESSED, 0); lv_style_set_trans_delay(&btn, LV_STATE_PRESSED, 0);
} }
@@ -344,7 +343,7 @@ static void slider_init(void)
lv_style_set_pad_top(&slider_knob, LV_STATE_NORMAL, LV_DPI/20); lv_style_set_pad_top(&slider_knob, LV_STATE_NORMAL, LV_DPI/20);
lv_style_set_pad_bottom(&slider_knob, LV_STATE_NORMAL, LV_DPI/20); lv_style_set_pad_bottom(&slider_knob, LV_STATE_NORMAL, LV_DPI/20);
lv_style_set_trans_time(&slider_knob, LV_STATE_NORMAL, 500); lv_style_set_trans_time(&slider_knob, LV_STATE_NORMAL, 500);
lv_style_set_trans_prop1(&slider_knob, LV_STATE_NORMAL, LV_STYLE_BG_COLOR); lv_style_set_trans_prop_1(&slider_knob, LV_STATE_NORMAL, LV_STYLE_BG_COLOR);
#endif #endif
} }
@@ -613,8 +612,8 @@ static void page_init(void)
lv_style_set_bg_color(&sb, LV_STATE_NORMAL, lv_color_hex(0x3a3d42)); lv_style_set_bg_color(&sb, LV_STATE_NORMAL, lv_color_hex(0x3a3d42));
lv_style_set_radius(&sb, LV_STATE_NORMAL, LV_RADIUS_CIRCLE); lv_style_set_radius(&sb, LV_STATE_NORMAL, LV_RADIUS_CIRCLE);
lv_style_set_size(&sb,LV_STATE_NORMAL, LV_DPI / 30); lv_style_set_size(&sb,LV_STATE_NORMAL, LV_DPI / 30);
lv_style_set_pad_right(&sb,LV_STATE_NORMAL, LV_DPI / 10); lv_style_set_pad_right(&sb,LV_STATE_NORMAL, LV_DPI / 20);
lv_style_set_pad_bottom(&sb,LV_STATE_NORMAL, LV_DPI / 10); lv_style_set_pad_bottom(&sb,LV_STATE_NORMAL, LV_DPI / 20);
#endif #endif
} }

View File

@@ -616,14 +616,14 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
/*The state changes without re-caching the styles, disable the use of cache*/ /*The state changes without re-caching the styles, disable the use of cache*/
lv_obj_state_dsc_t state_ori = btnm->state_dsc; lv_state_t state_ori = btnm->state;
btnm->state_dsc.act = LV_STATE_NORMAL; btnm->state = LV_STATE_NORMAL;
lv_draw_rect_dsc_init(&draw_rect_rel_dsc); lv_draw_rect_dsc_init(&draw_rect_rel_dsc);
lv_draw_label_dsc_init(&draw_label_rel_dsc); lv_draw_label_dsc_init(&draw_label_rel_dsc);
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_rel_dsc); lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_rel_dsc);
lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_rel_dsc); lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_rel_dsc);
draw_label_rel_dsc.flag = txt_flag; draw_label_rel_dsc.flag = txt_flag;
btnm->state_dsc = state_ori; btnm->state = state_ori;
bool chk_inited = false; bool chk_inited = false;
bool disabled_inited = false; bool disabled_inited = false;
@@ -656,26 +656,26 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
if(tgl_state) { if(tgl_state) {
if(!chk_inited) { if(!chk_inited) {
btnm->state_dsc.act = LV_STATE_CHECKED; btnm->state = LV_STATE_CHECKED;
lv_draw_rect_dsc_init(&draw_rect_chk_dsc); lv_draw_rect_dsc_init(&draw_rect_chk_dsc);
lv_draw_label_dsc_init(&draw_label_chk_dsc); lv_draw_label_dsc_init(&draw_label_chk_dsc);
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_chk_dsc); lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_chk_dsc);
lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_chk_dsc); lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_chk_dsc);
draw_label_chk_dsc.flag = txt_flag; draw_label_chk_dsc.flag = txt_flag;
btnm->state_dsc = state_ori; btnm->state = state_ori;
chk_inited = true; chk_inited = true;
} }
} }
if(button_is_inactive(ext->ctrl_bits[btn_i])) { if(button_is_inactive(ext->ctrl_bits[btn_i])) {
if(!disabled_inited) { if(!disabled_inited) {
btnm->state_dsc.act = LV_STATE_DISABLED; btnm->state = LV_STATE_DISABLED;
lv_draw_rect_dsc_init(&draw_rect_ina_dsc); lv_draw_rect_dsc_init(&draw_rect_ina_dsc);
lv_draw_label_dsc_init(&draw_label_ina_dsc); lv_draw_label_dsc_init(&draw_label_ina_dsc);
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_ina_dsc); lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_ina_dsc);
lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_ina_dsc); lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_ina_dsc);
draw_label_ina_dsc.flag = txt_flag; draw_label_ina_dsc.flag = txt_flag;
btnm->state_dsc = state_ori; btnm->state = state_ori;
disabled_inited = true; disabled_inited = true;
} }
draw_rect_dsc_act = &draw_rect_ina_dsc; draw_rect_dsc_act = &draw_rect_ina_dsc;
@@ -688,10 +688,10 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
} }
/*Focused and/or pressed + checked or released button*/ /*Focused and/or pressed + checked or released button*/
else { else {
btnm->state_dsc.act = LV_STATE_NORMAL; btnm->state = LV_STATE_NORMAL;
if(tgl_state) btnm->state_dsc.act = LV_STATE_CHECKED; if(tgl_state) btnm->state = LV_STATE_CHECKED;
if(ext->btn_id_pr == btn_i) btnm->state_dsc.act |= LV_STATE_PRESSED; if(ext->btn_id_pr == btn_i) btnm->state |= LV_STATE_PRESSED;
if(ext->btn_id_focused == btn_i) btnm->state_dsc.act |= LV_STATE_FOCUSED; if(ext->btn_id_focused == btn_i) btnm->state |= LV_STATE_FOCUSED;
lv_draw_rect_dsc_init(&draw_rect_tmp_dsc); lv_draw_rect_dsc_init(&draw_rect_tmp_dsc);
lv_draw_label_dsc_init(&draw_label_tmp_dsc); lv_draw_label_dsc_init(&draw_label_tmp_dsc);
@@ -701,7 +701,7 @@ static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * cl
draw_rect_dsc_act = &draw_rect_tmp_dsc; draw_rect_dsc_act = &draw_rect_tmp_dsc;
draw_label_dsc_act = &draw_label_tmp_dsc; draw_label_dsc_act = &draw_label_tmp_dsc;
btnm->state_dsc = state_ori; btnm->state = state_ori;
} }
lv_style_int_t border_part_ori = draw_rect_dsc_act->border_side; lv_style_int_t border_part_ori = draw_rect_dsc_act->border_side;

View File

@@ -673,7 +673,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
lv_obj_init_draw_rect_dsc(calendar, LV_CALENDAR_PART_HEADER, &header_rect_dsc); lv_obj_init_draw_rect_dsc(calendar, LV_CALENDAR_PART_HEADER, &header_rect_dsc);
lv_draw_rect(&header_area, mask, &header_rect_dsc); lv_draw_rect(&header_area, mask, &header_rect_dsc);
lv_obj_state_dsc_t state_ori = calendar->state_dsc; lv_state_t state_ori = calendar->state;
/*Add the year + month name*/ /*Add the year + month name*/
char txt_buf[64]; char txt_buf[64];
@@ -682,7 +682,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
txt_buf[5] = '\0'; txt_buf[5] = '\0';
strcpy(&txt_buf[5], get_month_name(calendar, ext->showed_date.month)); strcpy(&txt_buf[5], get_month_name(calendar, ext->showed_date.month));
calendar->state_dsc.act = LV_STATE_NORMAL; calendar->state = LV_STATE_NORMAL;
lv_draw_label_dsc_t label_dsc; lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc); lv_draw_label_dsc_init(&label_dsc);
@@ -690,11 +690,11 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
label_dsc.flag = LV_TXT_FLAG_CENTER; label_dsc.flag = LV_TXT_FLAG_CENTER;
lv_draw_label(&header_area, mask, &label_dsc,txt_buf, NULL); lv_draw_label(&header_area, mask, &label_dsc,txt_buf, NULL);
calendar->state_dsc = state_ori; /*Restore the state*/ calendar->state = state_ori; /*Restore the state*/
/*Add the left arrow*/ /*Add the left arrow*/
if(ext->btn_pressing < 0) calendar->state_dsc.act |= LV_STATE_PRESSED; if(ext->btn_pressing < 0) calendar->state |= LV_STATE_PRESSED;
else calendar->state_dsc.act &= ~(LV_STATE_PRESSED); else calendar->state &= ~(LV_STATE_PRESSED);
header_area.x1 += header_left; header_area.x1 += header_left;
@@ -702,11 +702,11 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_HEADER, &label_dsc); lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_HEADER, &label_dsc);
lv_draw_label(&header_area, mask, &label_dsc, LV_SYMBOL_LEFT, NULL); lv_draw_label(&header_area, mask, &label_dsc, LV_SYMBOL_LEFT, NULL);
calendar->state_dsc = state_ori; /*Restore the state*/ calendar->state = state_ori; /*Restore the state*/
/*Add the right arrow*/ /*Add the right arrow*/
if(ext->btn_pressing > 0) calendar->state_dsc.act |= LV_STATE_PRESSED; if(ext->btn_pressing > 0) calendar->state |= LV_STATE_PRESSED;
else calendar->state_dsc.act &= ~(LV_STATE_PRESSED); else calendar->state &= ~(LV_STATE_PRESSED);
header_area.x1 = header_area.x2 - header_right - lv_txt_get_width(LV_SYMBOL_RIGHT, (uint16_t)strlen(LV_SYMBOL_RIGHT), font, 0, LV_TXT_FLAG_NONE); header_area.x1 = header_area.x2 - header_right - lv_txt_get_width(LV_SYMBOL_RIGHT, (uint16_t)strlen(LV_SYMBOL_RIGHT), font, 0, LV_TXT_FLAG_NONE);
@@ -714,7 +714,7 @@ static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_HEADER, &label_dsc); lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_HEADER, &label_dsc);
lv_draw_label(&header_area, mask, &label_dsc, LV_SYMBOL_RIGHT, NULL); lv_draw_label(&header_area, mask, &label_dsc, LV_SYMBOL_RIGHT, NULL);
calendar->state_dsc = state_ori; /*Restore the state*/ calendar->state = state_ori; /*Restore the state*/
} }
/** /**
@@ -785,8 +785,8 @@ static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area)
lv_coord_t days_h = calendar->coords.y2 - days_y1 - date_bottom; lv_coord_t days_h = calendar->coords.y2 - days_y1 - date_bottom;
/*The state changes without re-caching the styles, disable the use of cache*/ /*The state changes without re-caching the styles, disable the use of cache*/
lv_obj_state_dsc_t state_ori = calendar->state_dsc; lv_state_t state_ori = calendar->state;
calendar->state_dsc.act = LV_STATE_NORMAL; calendar->state = LV_STATE_NORMAL;
lv_state_t month_state = LV_STATE_DISABLED; lv_state_t month_state = LV_STATE_DISABLED;
@@ -831,7 +831,7 @@ static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area)
box_area.y2 = box_area.y1 + box_size - 1; box_area.y2 = box_area.y1 + box_size - 1;
if(box_area.y1 > clip_area->y2) { if(box_area.y1 > clip_area->y2) {
calendar->state_dsc = state_ori; calendar->state = state_ori;
return; return;
} }
@@ -877,7 +877,7 @@ static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area)
lv_draw_label_dsc_init(&label_dsc); lv_draw_label_dsc_init(&label_dsc);
label_dsc.flag = LV_TXT_FLAG_CENTER; label_dsc.flag = LV_TXT_FLAG_CENTER;
calendar->state_dsc.act = day_state; calendar->state = day_state;
lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DATE, &label_dsc); lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DATE, &label_dsc);
lv_obj_init_draw_rect_dsc(calendar, LV_CALENDAR_PART_DATE, &rect_dsc); lv_obj_init_draw_rect_dsc(calendar, LV_CALENDAR_PART_DATE, &rect_dsc);
@@ -901,7 +901,7 @@ static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area)
day_cnt++; day_cnt++;
} }
} }
calendar->state_dsc = state_ori; calendar->state = state_ori;
} }

View File

@@ -737,7 +737,7 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * ddlist, lv_signal_t sign, void * p
if(info->part == LV_DROPDOWN_PART_LIST || if(info->part == LV_DROPDOWN_PART_LIST ||
info->part == LV_DROPDOWN_PART_SCRLBAR || info->part == LV_DROPDOWN_PART_SCRLBAR ||
info->part == LV_DROPDOWN_PART_SELECTED) { info->part == LV_DROPDOWN_PART_SELECTED) {
info->result = lv_obj_get_state_dsc(ext->page, LV_PAGE_PART_BG); info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_BG);
} }
} }
else if(sign == LV_SIGNAL_CLEANUP) { else if(sign == LV_SIGNAL_CLEANUP) {
@@ -948,10 +948,10 @@ static void draw_box(lv_obj_t * ddlist, const lv_area_t * clip_area, uint16_t id
{ {
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist); lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
lv_obj_t * page = ext->page; lv_obj_t * page = ext->page;
lv_obj_state_dsc_t state_orig = page->state_dsc; lv_state_t state_orig = page->state;
page->state_dsc.act = LV_STATE_NORMAL; page->state = LV_STATE_NORMAL;
page->state_dsc.act |= state; page->state |= state;
/*Draw a rectangle under the selected item*/ /*Draw a rectangle under the selected item*/
const lv_font_t * font = lv_obj_get_style_text_font(ddlist, LV_DROPDOWN_PART_LIST); const lv_font_t * font = lv_obj_get_style_text_font(ddlist, LV_DROPDOWN_PART_LIST);
@@ -974,7 +974,7 @@ static void draw_box(lv_obj_t * ddlist, const lv_area_t * clip_area, uint16_t id
lv_obj_init_draw_rect_dsc(ddlist, LV_DROPDOWN_PART_SELECTED, &sel_rect); lv_obj_init_draw_rect_dsc(ddlist, LV_DROPDOWN_PART_SELECTED, &sel_rect);
lv_draw_rect(&rect_area, clip_area, &sel_rect); lv_draw_rect(&rect_area, clip_area, &sel_rect);
page->state_dsc = state_orig; page->state = state_orig;
} }
@@ -983,10 +983,10 @@ static void draw_box_label(lv_obj_t * ddlist, const lv_area_t * clip_area, uint1
{ {
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist); lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
lv_obj_t * page = ext->page; lv_obj_t * page = ext->page;
lv_obj_state_dsc_t state_orig = page->state_dsc; lv_state_t state_orig = page->state;
page->state_dsc.act = LV_STATE_NORMAL; page->state = LV_STATE_NORMAL;
page->state_dsc.act |= state; page->state |= state;
lv_draw_label_dsc_t label_dsc; lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc); lv_draw_label_dsc_init(&label_dsc);
@@ -1009,7 +1009,7 @@ static void draw_box_label(lv_obj_t * ddlist, const lv_area_t * clip_area, uint1
if(area_ok) { if(area_ok) {
lv_draw_label(&label->coords, &mask_sel, &label_dsc, lv_label_get_text(label), NULL); lv_draw_label(&label->coords, &mask_sel, &label_dsc, lv_label_get_text(label), NULL);
} }
page->state_dsc = state_orig; page->state = state_orig;
} }
/** /**

View File

@@ -406,8 +406,8 @@ static lv_res_t lv_msgbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param
} else if(sign == LV_SIGNAL_GET_STATE_DSC) { } else if(sign == LV_SIGNAL_GET_STATE_DSC) {
lv_get_state_info_t * info = param; lv_get_state_info_t * info = param;
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox); lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(ext->btnm && info->part == LV_MSGBOX_PART_BTN_BG) info->result = lv_obj_get_state_dsc(ext->btnm, LV_BTNMATRIX_PART_BG); if(ext->btnm && info->part == LV_MSGBOX_PART_BTN_BG) info->result = lv_obj_get_state(ext->btnm, LV_BTNMATRIX_PART_BG);
else if(ext->btnm && info->part == LV_MSGBOX_PART_BTN) info->result = lv_obj_get_state_dsc(ext->btnm, LV_BTNMATRIX_PART_BTN); else if(ext->btnm && info->part == LV_MSGBOX_PART_BTN) info->result = lv_obj_get_state(ext->btnm, LV_BTNMATRIX_PART_BTN);
return LV_RES_OK; return LV_RES_OK;
} }

View File

@@ -720,8 +720,8 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
else return ancestor_signal(page, sign, param); else return ancestor_signal(page, sign, param);
} else if(sign == LV_SIGNAL_GET_STATE_DSC) { } else if(sign == LV_SIGNAL_GET_STATE_DSC) {
lv_get_state_info_t * info = param; lv_get_state_info_t * info = param;
if(info->part == LV_PAGE_PART_SCRL) info->result = lv_obj_get_state_dsc(lv_page_get_scrl(page), LV_CONT_PART_MAIN); if(info->part == LV_PAGE_PART_SCRL) info->result = lv_obj_get_state(lv_page_get_scrl(page), LV_CONT_PART_MAIN);
else info->result = lv_obj_get_state_dsc(page, info->part); else info->result = lv_obj_get_state(page, info->part);
return LV_RES_OK; return LV_RES_OK;
} }

View File

@@ -581,10 +581,10 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
} else if(sign == LV_SIGNAL_GET_STATE_DSC) { } else if(sign == LV_SIGNAL_GET_STATE_DSC) {
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_get_state_info_t * info = param; lv_get_state_info_t * info = param;
if(info->part == LV_TABVIEW_PART_TAB_BG) info->result = lv_obj_get_state_dsc(ext->btns, LV_BTNMATRIX_PART_BG); if(info->part == LV_TABVIEW_PART_TAB_BG) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BG);
else if(info->part == LV_TABVIEW_PART_TAB) info->result = lv_obj_get_state_dsc(ext->btns, LV_BTNMATRIX_PART_BTN); else if(info->part == LV_TABVIEW_PART_TAB) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BTN);
else if(info->part == LV_TABVIEW_PART_INDIC) info->result = lv_obj_get_state_dsc(ext->indic, LV_OBJ_PART_MAIN); else if(info->part == LV_TABVIEW_PART_INDIC) info->result = lv_obj_get_state(ext->indic, LV_OBJ_PART_MAIN);
else if(info->part == LV_TABVIEW_PART_BG_SCRL) info->result = lv_obj_get_state_dsc(ext->content, LV_PAGE_PART_SCRL); else if(info->part == LV_TABVIEW_PART_BG_SCRL) info->result = lv_obj_get_state(ext->content, LV_PAGE_PART_SCRL);
return LV_RES_OK; return LV_RES_OK;
} }

View File

@@ -1342,7 +1342,7 @@ static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param
lv_get_state_info_t * info = param; lv_get_state_info_t * info = param;
if(info->part == LV_TEXTAREA_PART_PLACEHOLDER) { if(info->part == LV_TEXTAREA_PART_PLACEHOLDER) {
if(ext->placeholder) { if(ext->placeholder) {
info->result = lv_obj_get_state_dsc(ext->placeholder, LV_LABEL_PART_MAIN); info->result = lv_obj_get_state(ext->placeholder, LV_LABEL_PART_MAIN);
} else { } else {
info->result = NULL; info->result = NULL;
} }

View File

@@ -510,9 +510,9 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
} else if(sign == LV_SIGNAL_GET_STATE_DSC) { } else if(sign == LV_SIGNAL_GET_STATE_DSC) {
lv_win_ext_t * ext = lv_obj_get_ext_attr(win); lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_get_state_info_t * info = param; lv_get_state_info_t * info = param;
if(info->part == LV_WIN_PART_CONTENT_SCRL) info->result = lv_obj_get_state_dsc(lv_page_get_scrl(ext->page), LV_CONT_PART_MAIN); if(info->part == LV_WIN_PART_CONTENT_SCRL) info->result = lv_obj_get_state(lv_page_get_scrl(ext->page), LV_CONT_PART_MAIN);
else if(info->part == LV_WIN_PART_SCRLBAR) info->result = lv_obj_get_state_dsc(ext->page, LV_PAGE_PART_SCRLBAR); else if(info->part == LV_WIN_PART_SCRLBAR) info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_SCRLBAR);
else if(info->part == LV_WIN_PART_HEADER) info->result = lv_obj_get_state_dsc(ext->header, LV_OBJ_PART_MAIN); else if(info->part == LV_WIN_PART_HEADER) info->result = lv_obj_get_state(ext->header, LV_OBJ_PART_MAIN);
return LV_RES_OK; return LV_RES_OK;
} }