1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-02-04 07:13:00 +08:00

fix(style): make the style parameter const in lv_obj_add/remove_style functions

fixes #3472
This commit is contained in:
Gabor Kiss-Vamosi 2022-07-13 17:02:19 +02:00
parent 7a8a643dff
commit b9a2977711
2 changed files with 4 additions and 4 deletions

View File

@ -73,7 +73,7 @@ void _lv_obj_style_init(void)
_lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(trans_t)); _lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(trans_t));
} }
void lv_obj_add_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector) void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector)
{ {
trans_del(obj, selector, LV_STYLE_PROP_ANY, NULL); trans_del(obj, selector, LV_STYLE_PROP_ANY, NULL);
@ -103,7 +103,7 @@ void lv_obj_add_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t se
lv_obj_refresh_style(obj, selector, LV_STYLE_PROP_ANY); lv_obj_refresh_style(obj, selector, LV_STYLE_PROP_ANY);
} }
void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector) void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector)
{ {
lv_state_t state = lv_obj_style_get_selector_state(selector); lv_state_t state = lv_obj_style_get_selector_state(selector);
lv_part_t part = lv_obj_style_get_selector_part(selector); lv_part_t part = lv_obj_style_get_selector_part(selector);

View File

@ -72,7 +72,7 @@ void _lv_obj_style_init(void);
* @example lv_obj_add_style(btn, &style_btn, 0); //Default button style * @example lv_obj_add_style(btn, &style_btn, 0); //Default button style
* @example lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed * @example lv_obj_add_style(btn, &btn_red, LV_STATE_PRESSED); //Overwrite only some colors to red when pressed
*/ */
void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector); void lv_obj_add_style(struct _lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector);
/** /**
* Add a style to an object. * Add a style to an object.
@ -83,7 +83,7 @@ void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selec
* @example lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part * @example lv_obj_remove_style(obj, NULL, LV_PART_MAIN | LV_STATE_ANY); //Remove all styles from the main part
* @example lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles * @example lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY); //Remove all styles
*/ */
void lv_obj_remove_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector); void lv_obj_remove_style(struct _lv_obj_t * obj, const lv_style_t * style, lv_style_selector_t selector);
/** /**
* Remove all styles from an object * Remove all styles from an object