diff --git a/src/lv_themes/lv_theme.c b/src/lv_themes/lv_theme.c index 365fe3aa4..d990912db 100644 --- a/src/lv_themes/lv_theme.c +++ b/src/lv_themes/lv_theme.c @@ -106,6 +106,17 @@ void lv_theme_set_base(lv_theme_t * new, lv_theme_t * base) new->base = base; } +/** + * Set a callback for a theme. + * The callback is used to add styles to different objects + * @param theme pointer to theme which callback should be set + * @param cb pointer to the callback + */ +void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb) +{ + theme->apply_cb = apply_cb; +} + /** * Get the small font of the theme * @return pointer to the font diff --git a/src/lv_themes/lv_theme.h b/src/lv_themes/lv_theme.h index 0a24f5e7d..788766726 100644 --- a/src/lv_themes/lv_theme.h +++ b/src/lv_themes/lv_theme.h @@ -206,6 +206,14 @@ void lv_theme_copy(lv_theme_t * theme, const lv_theme_t * copy); */ void lv_theme_set_base(lv_theme_t * new, lv_theme_t * base); +/** + * Set an apply callback for a theme. + * The apply callback is used to add styles to different objects + * @param theme pointer to theme which callback should be set + * @param apply_cb pointer to the callback + */ +void lv_theme_set_apply_cb(lv_theme_t * theme, lv_theme_apply_cb_t apply_cb); + /** * Get the small font of the theme * @return pointer to the font