lv_group: object types are activated correctly (ddlist open/close, label background, page scrl activate)
This commit is contained in:
@@ -64,7 +64,10 @@ void lv_group_set_style_cb(lv_group_t * group, void (*style_cb)(lv_style_t * sty
|
||||
|
||||
void lv_group_activate_next(lv_group_t * group)
|
||||
{
|
||||
if(group->actve_obj != NULL) lv_obj_inv(*group->actve_obj);
|
||||
if(group->actve_obj != NULL) {
|
||||
(*group->actve_obj)->signal_f(*group->actve_obj, LV_SIGNAL_DEACTIVATE, NULL);
|
||||
lv_obj_inv(*group->actve_obj);
|
||||
}
|
||||
|
||||
lv_obj_t ** obj_next;
|
||||
if(group->actve_obj == NULL) obj_next = ll_get_head(&group->obj_ll);
|
||||
@@ -73,7 +76,10 @@ void lv_group_activate_next(lv_group_t * group)
|
||||
if(obj_next == NULL) obj_next = ll_get_head(&group->obj_ll);
|
||||
group->actve_obj = obj_next;
|
||||
|
||||
if(group->actve_obj != NULL) lv_obj_inv(*group->actve_obj);
|
||||
if(group->actve_obj != NULL){
|
||||
(*group->actve_obj)->signal_f(*group->actve_obj, LV_SIGNAL_ACTIVATE, NULL);
|
||||
lv_obj_inv(*group->actve_obj);
|
||||
}
|
||||
}
|
||||
|
||||
void lv_group_activate_prev(lv_group_t * group)
|
||||
@@ -91,6 +97,24 @@ void lv_group_activate_prev(lv_group_t * group)
|
||||
|
||||
}
|
||||
|
||||
lv_style_t * lv_group_activate_style(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
lv_style_cpy(&group->style_tmp, style);
|
||||
|
||||
if(group->style_activate != NULL) group->style_activate(&group->style_tmp);
|
||||
else style_activate_def(&group->style_tmp);
|
||||
|
||||
return &group->style_tmp;
|
||||
}
|
||||
|
||||
lv_obj_t * lv_group_get_active(lv_group_t * group)
|
||||
{
|
||||
if(group == NULL) return NULL;
|
||||
if(group->actve_obj == NULL) return NULL;
|
||||
|
||||
return *group->actve_obj;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -38,6 +38,8 @@ void lv_group_add(lv_group_t * group, lv_obj_t * obj);
|
||||
void lv_group_activate_obj(lv_group_t * group, lv_obj_t * obj);
|
||||
void lv_group_activate_next(lv_group_t * group);
|
||||
void lv_group_activate_prev(lv_group_t * group);
|
||||
lv_style_t * lv_group_activate_style(lv_group_t * group, lv_style_t * style);
|
||||
lv_obj_t * lv_group_get_active(lv_group_t * group);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -1249,20 +1249,13 @@ lv_style_t * lv_obj_get_style(lv_obj_t * obj)
|
||||
par = par->par;
|
||||
}
|
||||
}
|
||||
|
||||
#if LV_OBJ_GROUP != 0
|
||||
if(obj->group_p != NULL) {
|
||||
lv_obj_t * active_obj = NULL;
|
||||
if(((lv_group_t *)obj->group_p)->actve_obj != NULL) {
|
||||
active_obj = *((lv_group_t *)obj->group_p)->actve_obj;
|
||||
}
|
||||
|
||||
if(active_obj == obj) {
|
||||
lv_style_cpy(&((lv_group_t *)obj->group_p)->style_tmp, style_act);
|
||||
((lv_group_t *)obj->group_p)->style_activate(&((lv_group_t *)obj->group_p)->style_tmp);
|
||||
style_act = &((lv_group_t *)obj->group_p)->style_tmp;
|
||||
if(lv_group_get_active(obj->group_p) == obj) {
|
||||
style_act = lv_group_activate_style(obj->group_p, style_act);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
return style_act;
|
||||
}
|
||||
|
||||
@@ -1411,6 +1404,18 @@ void * lv_obj_get_free_p(lv_obj_t * obj)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_OBJ_GROUP != 0
|
||||
/**
|
||||
* Get the group of the object
|
||||
* @param obj pointer to an object
|
||||
* @return the pointer to group of the object
|
||||
*/
|
||||
void * lv_obj_get_group(lv_obj_t * obj)
|
||||
{
|
||||
return obj->group_p;
|
||||
}
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -85,6 +85,8 @@ typedef enum
|
||||
LV_SIGNAL_CORD_CHG,
|
||||
LV_SIGNAL_STYLE_CHG,
|
||||
LV_SIGNAL_REFR_EXT_SIZE,
|
||||
LV_SIGNAL_ACTIVATE,
|
||||
LV_SIGNAL_DEACTIVATE,
|
||||
}lv_signal_t;
|
||||
|
||||
typedef bool (* lv_signal_f_t) (struct __LV_OBJ_T * obj, lv_signal_t sign, void * param);
|
||||
@@ -661,6 +663,14 @@ uint8_t lv_obj_get_free_num(lv_obj_t * obj);
|
||||
void * lv_obj_get_free_p(lv_obj_t * obj);
|
||||
#endif
|
||||
|
||||
#if LV_OBJ_GROUP != 0
|
||||
/**
|
||||
* Get the group of the object
|
||||
* @param obj pointer to an object
|
||||
* @return the pointer to group of the object
|
||||
*/
|
||||
void * lv_obj_get_group(lv_obj_t * obj);
|
||||
#endif
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
Reference in New Issue
Block a user