1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

Add lv_theme_set_base() to allow easy extension of built-in (or any) themes

This commit is contained in:
Gabor Kiss-Vamosi 2020-06-26 14:05:34 +02:00
parent eb006b3d39
commit 91f64c8662
8 changed files with 350 additions and 292 deletions

View File

@ -9,10 +9,11 @@ Available in the `dev` branch
- Add `lv_chart_set_ext_array()` function - Set an external array of data points to use for the chart
- Add `lv_chart_set_point_id()` function - Set an individual point value in the chart series directly based on index
- Add `lv_chart_get_x_start_point()` function - Get the current index of the x-axis start point in the data array
- Add `lv_chart_get_point_id()` funtion - Get an individual point value in the chart series directly based on index
- Add `lv_chart_get_point_id()` function - Get an individual point value in the chart series directly based on index
- Add `ext_buf_assigned` bit field to `lv_chart_series_t` structure - it's true if external buffer is assigned to series
- Allow setting different font for the selected text in `lv_roller`
- Add `theme->apply_cb` to replace `theme->apply_xcb` to make it compatible with the Micropython binding
- Add `theme->apply_cb` to replace `theme->apply_xcb` to make it compatible with the MicroPython binding
- Add `lv_theme_set_base()` to allow easy extension of built-in (or any) themes.
## v7.1.0 (planned on 07.07.2020)
*Available in the `master` branch*

View File

@ -47,6 +47,9 @@ extern "C" {
#define LV_EXT_CLICK_AREA_TINY 1
#define LV_EXT_CLICK_AREA_FULL 2
#define _LV_OBJ_PART_VIRTUAL_FIRST 0x01
#define _LV_OBJ_PART_REAL_FIRST 0x40
/**********************
* TYPEDEFS
**********************/
@ -247,8 +250,8 @@ typedef struct _lv_obj_t {
enum {
LV_OBJ_PART_MAIN,
_LV_OBJ_PART_VIRTUAL_LAST = 0x01,
_LV_OBJ_PART_REAL_LAST = 0x40,
_LV_OBJ_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_FIRST,
_LV_OBJ_PART_REAL_LAST = _LV_OBJ_PART_REAL_FIRST,
LV_OBJ_PART_ALL = 0xFF,
};

View File

@ -44,7 +44,6 @@ static inline void bits_write(uint8_t * out, uint32_t bit_pos, uint8_t val, uint
static inline void rle_init(const uint8_t * in, uint8_t bpp);
static inline uint8_t rle_next(void);
/**********************
* STATIC VARIABLES
**********************/

View File

@ -6,8 +6,7 @@
/*********************
* INCLUDES
*********************/
#include "lv_theme.h"
#include "../lv_core/lv_obj.h"
#include "../../lvgl.h"
/*********************
* DEFINES
@ -20,6 +19,8 @@
/**********************
* STATIC PROTOTYPES
**********************/
static void apply_theme(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
static void clear_styles(lv_obj_t * obj, lv_theme_style_t name);
/**********************
* STATIC VARIABLES
@ -53,6 +54,34 @@ lv_theme_t * lv_theme_get_act(void)
return act_theme;
}
/**
* Apply the active theme on an object
* @param obj pointer to an object
* @param name the name of the theme element to apply. E.g. `LV_THEME_BTN`
*/
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name)
{
/* Remove the existing styles from all part of the object. */
clear_styles(obj, name);
/*Apply the theme including the base theme(s)*/
apply_theme(act_theme, obj, name);
}
/**
* Set a base theme for a theme.
* The styles from the base them will be added before the styles of the current theme.
* Arbitrary long chain of themes can be created by setting base themes.
* @param new pointer to theme which base should be set
* @param base pointer to the base theme
*/
void lv_theme_set_base(lv_theme_t * new, lv_theme_t * base)
{
new->base_theme = base;
}
/**
* Get the small font of the theme
* @return pointer to the font
@ -116,18 +145,299 @@ uint32_t lv_theme_get_flags(void)
return act_theme->flags;
}
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name)
{
/*apply_xcb is deprecated, use apply_cb instead*/
if (act_theme->apply_xcb) {
act_theme->apply_xcb(obj, name);
}
else if(act_theme->apply_cb) {
act_theme->apply_cb(act_theme, obj, name);
}
}
/**********************
* STATIC FUNCTIONS
**********************/
static void apply_theme(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
{
if(th->base_theme) {
apply_theme(th->base_theme, obj, name);
}
/*apply_xcb is deprecated, use apply_cb instead*/
if (th->apply_xcb) {
th->apply_xcb(obj, name);
}
else if(th->apply_cb) {
th->apply_cb(act_theme, obj, name);
}
}
static void clear_styles(lv_obj_t * obj, lv_theme_style_t name)
{
switch(name) {
case LV_THEME_NONE:
break;
case LV_THEME_SCR:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
break;
case LV_THEME_OBJ:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
break;
#if LV_USE_CONT
case LV_THEME_CONT:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
break;
#endif
#if LV_USE_BTN
case LV_THEME_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
break;
#endif
#if LV_USE_BTNMATRIX
case LV_THEME_BTNMATRIX:
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
break;
#endif
#if LV_USE_KEYBOARD
case LV_THEME_KEYBOARD:
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
break;
#endif
#if LV_USE_BAR
case LV_THEME_BAR:
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
break;
#endif
#if LV_USE_SWITCH
case LV_THEME_SWITCH:
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
break;
#endif
#if LV_USE_CANVAS
case LV_THEME_CANVAS:
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
break;
#endif
#if LV_USE_IMG
case LV_THEME_IMAGE:
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_IMGBTN
case LV_THEME_IMGBTN:
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_LABEL
case LV_THEME_LABEL:
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_LINE
case LV_THEME_LINE:
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_ARC
case LV_THEME_ARC:
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
break;
#endif
#if LV_USE_SPINNER
case LV_THEME_SPINNER:
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
break;
#endif
#if LV_USE_SLIDER
case LV_THEME_SLIDER:
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
break;
#endif
#if LV_USE_CHECKBOX
case LV_THEME_CHECKBOX:
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
break;
#endif
#if LV_USE_MSGBOX
case LV_THEME_MSGBOX:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
break;
case LV_THEME_MSGBOX_BTNS:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
break;
#endif
#if LV_USE_LED
case LV_THEME_LED:
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
break;
#endif
#if LV_USE_PAGE
case LV_THEME_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
break;
#endif
#if LV_USE_TABVIEW
case LV_THEME_TABVIEW:
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
break;
case LV_THEME_TABVIEW_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
break;
#endif
#if LV_USE_TILEVIEW
case LV_THEME_TILEVIEW:
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
break;
#endif
#if LV_USE_ROLLER
case LV_THEME_ROLLER:
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
break;
#endif
#if LV_USE_OBJMASK
case LV_THEME_OBJMASK:
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
break;
#endif
#if LV_USE_LIST
case LV_THEME_LIST:
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
break;
case LV_THEME_LIST_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
break;
#endif
#if LV_USE_DROPDOWN
case LV_THEME_DROPDOWN:
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
break;
#endif
#if LV_USE_CHART
case LV_THEME_CHART:
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
break;
#endif
#if LV_USE_TABLE
case LV_THEME_TABLE:
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
break;
#endif
#if LV_USE_WIN
case LV_THEME_WIN:
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
break;
case LV_THEME_WIN_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
break;
#endif
#if LV_USE_TEXTAREA
case LV_THEME_TEXTAREA:
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
break;
#endif
#if LV_USE_SPINBOX
case LV_THEME_SPINBOX:
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
break;
case LV_THEME_SPINBOX_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
break;
#endif
#if LV_USE_CALENDAR
case LV_THEME_CALENDAR:
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
break;
#endif
#if LV_USE_CPICKER
case LV_THEME_CPICKER:
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
break;
#endif
#if LV_USE_LINEMETER
case LV_THEME_LINEMETER:
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
break;
#endif
#if LV_USE_GAUGE
case LV_THEME_GAUGE:
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
break;
#endif
default:
break;
}
}

View File

@ -114,7 +114,7 @@ typedef enum {
#endif
#if LV_USE_SPINBOX
LV_THEME_SPINBOX,
LV_THEME_SPINBOX_BTN, /*Button extra for spinbox*/
LV_THEME_SPINBOX_BTN, /*Control button for the spinbox*/
#endif
#if LV_USE_SPINNER
LV_THEME_SPINNER,
@ -149,6 +149,7 @@ typedef enum {
typedef struct _lv_theme_t {
void (*apply_xcb)(lv_obj_t *, lv_theme_style_t); /*Deprecated: use `apply_cb` instead*/
void (*apply_cb)(struct _lv_theme_t *, lv_obj_t *, lv_theme_style_t);
struct _lv_theme_t * base_theme; /**< Apply the current theme's style on top of this theme.*/
lv_color_t color_primary;
lv_color_t color_secondary;
const lv_font_t * font_small;
@ -176,9 +177,21 @@ void lv_theme_set_act(lv_theme_t * th);
*/
lv_theme_t * lv_theme_get_act(void);
/**
* Apply the active theme on an object
* @param obj pointer to an object
* @param name the name of the theme element to apply. E.g. `LV_THEME_BTN`
*/
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name);
/**
* Set a base theme for a theme.
* The styles from the base them will be added before the styles of the current theme.
* Arbitrary long chain of themes can be created by setting base themes.
* @param new pointer to theme which base should be set
* @param base pointer to the base theme
*/
void lv_theme_set_base(lv_theme_t * new, lv_theme_t * base);
/**
* Get the small font of the theme
@ -222,7 +235,6 @@ lv_color_t lv_theme_get_color_secondary(void);
*/
uint32_t lv_theme_get_flags(void);
/**********************
* MACROS
**********************/

View File

@ -950,18 +950,15 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
case LV_THEME_SCR:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
_lv_style_list_add_style(list, &styles->scr);
break;
case LV_THEME_OBJ:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
break;
#if LV_USE_CONT
case LV_THEME_CONT:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
break;
@ -969,7 +966,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BTN
case LV_THEME_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->btn);
break;
@ -977,12 +973,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BTNMATRIX
case LV_THEME_BTNMATRIX:
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->bg_click);
@ -991,12 +985,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_KEYBOARD
case LV_THEME_KEYBOARD:
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
_lv_style_list_add_style(list, &styles->scr);
_lv_style_list_add_style(list, &styles->kb_bg);
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->bg_click);
@ -1005,11 +997,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BAR
case LV_THEME_BAR:
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
_lv_style_list_add_style(list, &styles->bar_bg);
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
_lv_style_list_add_style(list, &styles->bar_indic);
break;
@ -1017,15 +1007,12 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SWITCH
case LV_THEME_SWITCH:
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
_lv_style_list_add_style(list, &styles->bar_bg);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
_lv_style_list_add_style(list, &styles->bar_indic);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
_lv_style_list_add_style(list, &styles->sw_knob);
break;
@ -1033,42 +1020,35 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CANVAS
case LV_THEME_CANVAS:
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
break;
#endif
#if LV_USE_IMG
case LV_THEME_IMAGE:
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_IMGBTN
case LV_THEME_IMGBTN:
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_LABEL
case LV_THEME_LABEL:
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_LINE
case LV_THEME_LINE:
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_ARC
case LV_THEME_ARC:
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->arc_bg);
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
_lv_style_list_add_style(list, &styles->arc_indic);
break;
@ -1076,11 +1056,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SPINNER
case LV_THEME_SPINNER:
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
_lv_style_list_add_style(list, &styles->arc_bg);
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
_lv_style_list_add_style(list, &styles->arc_indic);
break;
@ -1088,16 +1066,13 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SLIDER
case LV_THEME_SLIDER:
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
_lv_style_list_add_style(list, &styles->bar_bg);
_lv_style_list_add_style(list, &styles->slider_bg);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
_lv_style_list_add_style(list, &styles->bar_indic);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
_lv_style_list_add_style(list, &styles->slider_knob);
break;
@ -1105,11 +1080,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CHECKBOX
case LV_THEME_CHECKBOX:
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
_lv_style_list_add_style(list, &styles->cb_bg);
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
_lv_style_list_add_style(list, &styles->btn);
_lv_style_list_add_style(list, &styles->cb_bullet);
@ -1118,18 +1091,15 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_MSGBOX
case LV_THEME_MSGBOX:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->mbox_bg);
break;
case LV_THEME_MSGBOX_BTNS:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
_lv_style_list_add_style(list, &styles->btn);
break;
@ -1137,27 +1107,22 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_LED
case LV_THEME_LED:
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
_lv_style_list_add_style(list, &styles->led);
break;
#endif
#if LV_USE_PAGE
case LV_THEME_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
_lv_style_list_add_style(list, &styles->pad_inner);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
#if LV_USE_ANIMATION
lv_obj_clean_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
_lv_style_list_add_style(list, &styles->edge_flash);
#endif
@ -1165,29 +1130,20 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_TABVIEW
case LV_THEME_TABVIEW:
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
_lv_style_list_add_style(list, &styles->scr);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
_lv_style_list_add_style(list, &styles->tabview_btns_bg);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
_lv_style_list_add_style(list, &styles->tabview_indic);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
_lv_style_list_add_style(list, &styles->tabview_btns);
break;
case LV_THEME_TABVIEW_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
_lv_style_list_add_style(list, &styles->tabview_page_scrl);
@ -1196,16 +1152,13 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_TILEVIEW
case LV_THEME_TILEVIEW:
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
_lv_style_list_add_style(list, &styles->scr);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
#if LV_USE_ANIMATION
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
_lv_style_list_add_style(list, &styles->edge_flash);
#endif
@ -1215,12 +1168,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_ROLLER
case LV_THEME_ROLLER:
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->roller_bg);
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
_lv_style_list_add_style(list, &styles->roller_sel);
break;
@ -1229,27 +1180,22 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_OBJMASK
case LV_THEME_OBJMASK:
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
break;
#endif
#if LV_USE_LIST
case LV_THEME_LIST:
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->list_bg);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
break;
case LV_THEME_LIST_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->list_btn);
break;
@ -1257,22 +1203,18 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_DROPDOWN
case LV_THEME_DROPDOWN:
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->bg_click);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->ddlist_page);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
_lv_style_list_add_style(list, &styles->ddlist_sel);
break;
@ -1280,41 +1222,33 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CHART
case LV_THEME_CHART:
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->chart_bg);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
_lv_style_list_add_style(list, &styles->pad_small);
_lv_style_list_add_style(list, &styles->chart_series_bg);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
_lv_style_list_add_style(list, &styles->chart_series);
break;
#endif
#if LV_USE_TABLE
case LV_THEME_TABLE:
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
_lv_style_list_add_style(list, &styles->table_cell);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
_lv_style_list_add_style(list, &styles->table_cell);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
_lv_style_list_add_style(list, &styles->table_cell);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
_lv_style_list_add_style(list, &styles->table_cell);
break;
@ -1322,25 +1256,20 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_WIN
case LV_THEME_WIN:
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
_lv_style_list_add_style(list, &styles->scr);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
_lv_style_list_add_style(list, &styles->tabview_page_scrl);
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
_lv_style_list_add_style(list, &styles->tabview_btns_bg);
break;
case LV_THEME_WIN_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->tabview_btns);
break;
@ -1348,20 +1277,16 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_TEXTAREA
case LV_THEME_TEXTAREA:
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
_lv_style_list_add_style(list, &styles->ta_placeholder);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
_lv_style_list_add_style(list, &styles->ta_cursor);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
break;
@ -1371,18 +1296,15 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SPINBOX
case LV_THEME_SPINBOX:
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
_lv_style_list_add_style(list, &styles->spinbox_cursor);
break;
case LV_THEME_SPINBOX_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->bg_click);
@ -1391,30 +1313,24 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CALENDAR
case LV_THEME_CALENDAR:
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
_lv_style_list_add_style(list, &styles->calendar_date_nums);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
_lv_style_list_add_style(list, &styles->calendar_header);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
_lv_style_list_add_style(list, &styles->calendar_daynames);
break;
#endif
#if LV_USE_CPICKER
case LV_THEME_CPICKER:
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
_lv_style_list_add_style(list, &styles->cpicker_bg);
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
_lv_style_list_add_style(list, &styles->cpicker_indic);
break;
@ -1422,7 +1338,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_LINEMETER
case LV_THEME_LINEMETER:
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->lmeter);
@ -1430,16 +1345,13 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_GAUGE
case LV_THEME_GAUGE:
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->gauge_main);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
_lv_style_list_add_style(list, &styles->gauge_strong);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
_lv_style_list_add_style(list, &styles->gauge_needle);
break;

View File

@ -570,18 +570,15 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
case LV_THEME_SCR:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
_lv_style_list_add_style(list, &styles->scr);
break;
case LV_THEME_OBJ:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
break;
#if LV_USE_CONT
case LV_THEME_CONT:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
break;
@ -589,7 +586,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BTN
case LV_THEME_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -598,11 +594,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BTNMATRIX
case LV_THEME_BTNMATRIX:
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -611,12 +605,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_KEYBOARD
case LV_THEME_KEYBOARD:
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -625,13 +617,11 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BAR
case LV_THEME_BAR:
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_none);
_lv_style_list_add_style(list, &styles->round);
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->fg_color);
@ -641,18 +631,15 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SWITCH
case LV_THEME_SWITCH:
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_none);
_lv_style_list_add_style(list, &styles->round);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->fg_color);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_none);
@ -662,46 +649,39 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CANVAS
case LV_THEME_CANVAS:
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
break;
#endif
#if LV_USE_IMG
case LV_THEME_IMAGE:
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_IMGBTN
case LV_THEME_IMGBTN:
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_LABEL
case LV_THEME_LABEL:
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_LINE
case LV_THEME_LINE:
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_ARC
case LV_THEME_ARC:
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
_lv_style_list_add_style(list, &styles->arc_bg);
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
_lv_style_list_add_style(list, &styles->arc_indic);
break;
@ -709,12 +689,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SPINNER
case LV_THEME_SPINNER:
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tick_line);
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->fg_color);
@ -724,17 +702,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SLIDER
case LV_THEME_SLIDER:
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_none);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->fg_color);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
@ -744,11 +719,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CHECKBOX
case LV_THEME_CHECKBOX:
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -757,17 +730,14 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_MSGBOX
case LV_THEME_MSGBOX:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_MSGBOX_BTNS:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
_lv_style_list_add_style(list, &styles->pad_inner);
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -776,7 +746,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_LED
case LV_THEME_LED:
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
@ -784,45 +753,31 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_PAGE
case LV_THEME_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
_lv_style_list_add_style(list, &styles->pad_inner);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
break;
#endif
#if LV_USE_TABVIEW
case LV_THEME_TABVIEW:
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
_lv_style_list_add_style(list, &styles->scr);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
_lv_style_list_add_style(list, &styles->tab_bg);
_lv_style_list_add_style(list, &styles->pad_small);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
case LV_THEME_TABVIEW_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
_lv_style_list_add_style(list, &styles->pad_normal);
@ -831,15 +786,12 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_TILEVIEW
case LV_THEME_TILEVIEW:
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
_lv_style_list_add_style(list, &styles->bg);
break;
@ -848,12 +800,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_ROLLER
case LV_THEME_ROLLER:
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->big_line_space);
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->fg_color);
@ -864,28 +814,22 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_OBJMASK
case LV_THEME_OBJMASK:
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
break;
#endif
#if LV_USE_LIST
case LV_THEME_LIST:
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_none);
_lv_style_list_add_style(list, &styles->clip_corner);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
break;
case LV_THEME_LIST_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -896,21 +840,17 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_DROPDOWN
case LV_THEME_DROPDOWN:
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->big_line_space);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->fg_color);
@ -920,42 +860,34 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CHART
case LV_THEME_CHART:
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->border_none);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
_lv_style_list_add_style(list, &styles->chart_series);
break;
#endif
#if LV_USE_TABLE
case LV_THEME_TABLE:
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->no_radius);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->no_radius);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->no_radius);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->no_radius);
@ -964,25 +896,20 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_WIN
case LV_THEME_WIN:
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_WIN_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -991,17 +918,12 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_TEXTAREA
case LV_THEME_TEXTAREA:
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
_lv_style_list_add_style(list, &styles->ta_cursor);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->sb);
break;
@ -1010,11 +932,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SPINBOX
case LV_THEME_SPINBOX:
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->fg_color);
@ -1023,7 +943,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
case LV_THEME_SPINBOX_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -1032,11 +951,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CALENDAR
case LV_THEME_CALENDAR:
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -1044,12 +961,10 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
_lv_style_list_add_style(list, &styles->border_none);
_lv_style_list_add_style(list, &styles->calendar_date);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
_lv_style_list_add_style(list, &styles->pad_normal);
_lv_style_list_add_style(list, &styles->border_none);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->pad_small);
@ -1057,11 +972,9 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_CPICKER
case LV_THEME_CPICKER:
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
@ -1070,7 +983,6 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_LINEMETER
case LV_THEME_LINEMETER:
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
@ -1079,16 +991,13 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_GAUGE
case LV_THEME_GAUGE:
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
_lv_style_list_add_style(list, &styles->gauge_major);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
_lv_style_list_add_style(list, &styles->gauge_needle);
break;

View File

@ -420,19 +420,16 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
case LV_THEME_SCR:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
break;
case LV_THEME_OBJ:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
break;
#if LV_USE_CONT
case LV_THEME_CONT:
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CONT_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
break;
@ -440,7 +437,6 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BTN
case LV_THEME_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -449,11 +445,9 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BTNMATRIX
case LV_THEME_BTNMATRIX:
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BG);
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_BTNMATRIX_PART_BTN);
list = lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -462,11 +456,9 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_KEYBOARD
case LV_THEME_KEYBOARD:
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BG);
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_KEYBOARD_PART_BTN);
list = lv_obj_get_style_list(obj, LV_KEYBOARD_PART_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -475,12 +467,10 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_BAR
case LV_THEME_BAR:
lv_obj_clean_style_list(obj, LV_BAR_PART_BG);
list = lv_obj_get_style_list(obj, LV_BAR_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
lv_obj_clean_style_list(obj, LV_BAR_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
@ -489,18 +479,15 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SWITCH
case LV_THEME_SWITCH:
lv_obj_clean_style_list(obj, LV_SWITCH_PART_BG);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
_lv_style_list_add_style(list, &styles->round);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
lv_obj_clean_style_list(obj, LV_SWITCH_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
@ -510,48 +497,41 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CANVAS
case LV_THEME_CANVAS:
lv_obj_clean_style_list(obj, LV_CANVAS_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
break;
#endif
#if LV_USE_IMG
case LV_THEME_IMAGE:
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_IMGBTN
case LV_THEME_IMGBTN:
lv_obj_clean_style_list(obj, LV_IMG_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
break;
#endif
#if LV_USE_LABEL
case LV_THEME_LABEL:
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_LINE
case LV_THEME_LINE:
lv_obj_clean_style_list(obj, LV_LABEL_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
break;
#endif
#if LV_USE_ARC
case LV_THEME_ARC:
lv_obj_clean_style_list(obj, LV_ARC_PART_BG);
list = lv_obj_get_style_list(obj, LV_ARC_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tick_line);
_lv_style_list_add_style(list, &styles->round);
lv_obj_clean_style_list(obj, LV_ARC_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
@ -561,12 +541,10 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SPINNER
case LV_THEME_SPINNER:
lv_obj_clean_style_list(obj, LV_SPINNER_PART_BG);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tick_line);
lv_obj_clean_style_list(obj, LV_SPINNER_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SPINNER_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
@ -576,16 +554,13 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SLIDER
case LV_THEME_SLIDER:
lv_obj_clean_style_list(obj, LV_SLIDER_PART_BG);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
lv_obj_clean_style_list(obj, LV_SLIDER_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
@ -594,10 +569,8 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CHECKBOX
case LV_THEME_CHECKBOX:
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BG);
lv_obj_clean_style_list(obj, LV_CHECKBOX_PART_BULLET);
list = lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -606,17 +579,14 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_MSGBOX
case LV_THEME_MSGBOX:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_MSGBOX_BTNS:
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN_BG);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_MSGBOX_PART_BTN);
list = lv_obj_get_style_list(obj, LV_MSGBOX_PART_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -625,7 +595,6 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_LED
case LV_THEME_LED:
lv_obj_clean_style_list(obj, LV_LED_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LED_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
@ -634,53 +603,43 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_PAGE
case LV_THEME_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->gray);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->bg);
break;
#endif
#if LV_USE_TABVIEW
case LV_THEME_TABVIEW:
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRLLABLE);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BG);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_INDIC);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB_BTN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
break;
case LV_THEME_TABVIEW_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->gray);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
_lv_style_list_add_style(list, &styles->bg);
@ -689,15 +648,12 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_TILEVIEW
case LV_THEME_TILEVIEW:
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_BG);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
_lv_style_list_add_style(list, &styles->bg);
break;
@ -706,11 +662,9 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_ROLLER
case LV_THEME_ROLLER:
lv_obj_clean_style_list(obj, LV_ROLLER_PART_BG);
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_ROLLER_PART_SELECTED);
list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
@ -720,27 +674,22 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_OBJMASK
case LV_THEME_OBJMASK:
lv_obj_clean_style_list(obj, LV_OBJMASK_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
break;
#endif
#if LV_USE_LIST
case LV_THEME_LIST:
lv_obj_clean_style_list(obj, LV_LIST_PART_BG);
list = lv_obj_get_style_list(obj, LV_LIST_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLABLE);
lv_obj_clean_style_list(obj, LV_LIST_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_LIST_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_LIST_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -749,20 +698,16 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_DROPDOWN
case LV_THEME_DROPDOWN:
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_LIST);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SELECTED);
list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->color);
@ -771,15 +716,12 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CHART
case LV_THEME_CHART:
lv_obj_clean_style_list(obj, LV_CHART_PART_BG);
list = lv_obj_get_style_list(obj, LV_CHART_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES_BG);
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CHART_PART_SERIES);
list = lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
@ -787,23 +729,18 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_TABLE
case LV_THEME_TABLE:
lv_obj_clean_style_list(obj, LV_TABLE_PART_BG);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL1);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL1);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL2);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL2);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL3);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL3);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TABLE_PART_CELL4);
list = lv_obj_get_style_list(obj, LV_TABLE_PART_CELL4);
_lv_style_list_add_style(list, &styles->bg);
break;
@ -811,25 +748,20 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_WIN
case LV_THEME_WIN:
lv_obj_clean_style_list(obj, LV_WIN_PART_BG);
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
list = lv_obj_get_style_list(obj, LV_WIN_PART_HEADER);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_WIN_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -838,20 +770,16 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_TEXTAREA
case LV_THEME_TEXTAREA:
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_BG);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
_lv_style_list_add_style(list, &styles->gray);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_CURSOR);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCROLLBAR);
_lv_style_list_add_style(list, &styles->bg);
break;
@ -860,17 +788,14 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_SPINBOX
case LV_THEME_SPINBOX:
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_BG);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_SPINBOX_PART_CURSOR);
list = lv_obj_get_style_list(obj, LV_SPINBOX_PART_CURSOR);
_lv_style_list_add_style(list, &styles->bg);
break;
case LV_THEME_SPINBOX_BTN:
lv_obj_clean_style_list(obj, LV_BTN_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
@ -879,21 +804,17 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_CALENDAR
case LV_THEME_CALENDAR:
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_BG);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_BG);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DATE);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DATE);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->btn);
_lv_style_list_add_style(list, &styles->tight);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_HEADER);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_HEADER);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
list = lv_obj_get_style_list(obj, LV_CALENDAR_PART_DAY_NAMES);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->tight);
@ -901,11 +822,9 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_CPICKER
case LV_THEME_CPICKER:
lv_obj_clean_style_list(obj, LV_CPICKER_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
lv_obj_clean_style_list(obj, LV_CPICKER_PART_KNOB);
list = lv_obj_get_style_list(obj, LV_CPICKER_PART_KNOB);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
@ -914,7 +833,6 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#if LV_USE_LINEMETER
case LV_THEME_LINEMETER:
lv_obj_clean_style_list(obj, LV_LINEMETER_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
@ -922,16 +840,13 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
#endif
#if LV_USE_GAUGE
case LV_THEME_GAUGE:
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAIN);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
_lv_style_list_add_style(list, &styles->bg);
_lv_style_list_add_style(list, &styles->round);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_MAJOR);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
_lv_style_list_add_style(list, &styles->tick_line);
lv_obj_clean_style_list(obj, LV_GAUGE_PART_NEEDLE);
list = lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
_lv_style_list_add_style(list, &styles->bg);
break;
@ -940,10 +855,7 @@ void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
break;
}
lv_obj_refresh_style(obj, LV_STYLE_PROP_ALL);
}
/**********************