1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-28 07:03:00 +08:00

add lv_obj_remove_style

This commit is contained in:
Gabor Kiss-Vamosi 2020-05-28 07:58:10 +02:00
parent 8d5dfa1ec2
commit ec5b10142f
2 changed files with 36 additions and 3 deletions

View File

@ -1132,7 +1132,7 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
*--------------------*/
/**
* Add a new stye to the style list of an object.
* Add a new style to the style list of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
@ -1144,7 +1144,7 @@ void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
if(style_dsc == NULL) {
LV_LOG_WARN("lv_obj_add_style: can't find style with `type`");
LV_LOG_WARN("Can't find style with part: %d", part);
return;
}
@ -1155,6 +1155,30 @@ void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
}
/**
* Remove a style from the style list of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param style pointer to a style to remove
*/
void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style)
{
if(style == NULL) return;
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
if(style_dsc == NULL) {
LV_LOG_WARN("Can't find style with part: %d", part);
return;
}
_lv_style_list_remove_style(style_dsc, style);
#if LV_USE_ANIMATION
trans_del(obj, part, 0xFF, NULL);
#endif
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
}
/**
* Reset a style to the default (empty) state.
* Release all used memories and cancel pending related transitions.

View File

@ -502,7 +502,7 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
*--------------------*/
/**
* Add a new stye to the style list of an object.
* Add a new style to the style list of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
@ -510,6 +510,15 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
*/
void lv_obj_add_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
/**
* Remove a style from the style list of an object.
* @param obj pointer to an object
* @param part the part of the object which style property should be set.
* E.g. `LV_OBJ_PART_MAIN`, `LV_BTN_PART_MAIN`, `LV_SLIDER_PART_KNOB`
* @param style pointer to a style to remove
*/
void lv_obj_remove_style(lv_obj_t * obj, uint8_t part, lv_style_t * style);
/**
* Reset a style to the default (empty) state.
* Release all used memories and cancel pending related transitions.