diff --git a/lv_objx/lv_spinbox.c b/lv_objx/lv_spinbox.c index 896e1d1704..5284706452 100644 --- a/lv_objx/lv_spinbox.c +++ b/lv_objx/lv_spinbox.c @@ -9,6 +9,7 @@ #include "lv_spinbox.h" #if USE_LV_SPINBOX != 0 +#include "../lv_themes/lv_theme.h" /********************* * DEFINES @@ -83,7 +84,13 @@ lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new spinbox spinbox*/ if(copy == NULL) { - /*Already inited above*/ + /*Set the default styles*/ + lv_theme_t * th = lv_theme_get_current(); + if(th) { + lv_spinbox_set_style(new_spinbox, LV_SPINBOX_STYLE_BG, th->spinbox.bg); + lv_spinbox_set_style(new_spinbox, LV_SPINBOX_STYLE_CURSOR, th->spinbox.cursor); + lv_spinbox_set_style(new_spinbox, LV_SPINBOX_STYLE_SB, th->spinbox.sb); + } } /*Copy an existing spinbox*/ else { diff --git a/lv_objx/lv_ta.c b/lv_objx/lv_ta.c index 5342afbba0..bedc171b6a 100644 --- a/lv_objx/lv_ta.c +++ b/lv_objx/lv_ta.c @@ -900,21 +900,22 @@ void lv_ta_cursor_up(lv_obj_t * ta) * LV_DESIGN_DRAW_POST: drawing after every children are drawn * @param return true/false, depends on 'mode' */ -static bool lv_ta_design(lv_obj_t * ta, const lv_area_t * masp, lv_design_mode_t mode) +static bool lv_ta_design(lv_obj_t * ta, const lv_area_t * mask, lv_design_mode_t mode) { if(mode == LV_DESIGN_COVER_CHK) { /*Return false if the object is not covers the mask_p area*/ - return ancestor_design(ta, masp, mode); + return ancestor_design(ta, mask, mode); } else if(mode == LV_DESIGN_DRAW_MAIN) { /*Draw the object*/ - ancestor_design(ta, masp, mode); + ancestor_design(ta, mask, mode); } else if(mode == LV_DESIGN_DRAW_POST) { - ancestor_design(ta, masp, mode); + ancestor_design(ta, mask, mode); } return true; } + /** * An extended scrollable design of the page. Calls the normal design function and draws a cursor. * @param scrl pointer to the scrollable part of the Text area diff --git a/lv_objx/lv_table.c b/lv_objx/lv_table.c index 49384c4385..7354a4971e 100644 --- a/lv_objx/lv_table.c +++ b/lv_objx/lv_table.c @@ -12,6 +12,7 @@ #include "../lv_misc/lv_txt.h" #include "../lv_misc/lv_math.h" #include "../lv_draw/lv_draw_label.h" +#include "../lv_themes/lv_theme.h" /********************* * DEFINES @@ -82,7 +83,14 @@ lv_obj_t * lv_table_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new table table*/ if(copy == NULL) { - lv_table_set_style(new_table, LV_TABLE_STYLE_BG, &lv_style_plain_color); + /*Set the default styles*/ + lv_theme_t * th = lv_theme_get_current(); + if(th) { + lv_table_set_style(new_table, LV_TABLE_STYLE_BG, th->table.bg); + lv_table_set_style(new_table, LV_TABLE_STYLE_CELL, th->table.cell); + } else { + lv_table_set_style(new_table, LV_TABLE_STYLE_BG, &lv_style_plain_color); + } } /*Copy an existing table*/ else { diff --git a/lv_objx/lv_tileview.c b/lv_objx/lv_tileview.c index cdc82c9bc0..c80cfecad4 100644 --- a/lv_objx/lv_tileview.c +++ b/lv_objx/lv_tileview.c @@ -11,6 +11,7 @@ #include #include "lv_cont.h" +#include "../lv_themes/lv_theme.h" /********************* * DEFINES @@ -89,11 +90,18 @@ lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy) /*Init the new tileview*/ if(copy == NULL) { lv_obj_set_size(new_tileview, LV_HOR_RES, LV_VER_RES); - lv_obj_set_drag_throw(lv_page_get_scrl(new_tileview), false); lv_page_set_scrl_fit(new_tileview, true, true); - lv_page_set_style(new_tileview, LV_PAGE_STYLE_BG, &lv_style_transp_tight); - lv_page_set_style(new_tileview, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight); + /*Set the default styles*/ + lv_theme_t * th = lv_theme_get_current(); + if(th) { + lv_page_set_style(new_tileview, LV_PAGE_STYLE_BG, th->tileview.bg); + lv_page_set_style(new_tileview, LV_PAGE_STYLE_SCRL, th->tileview.scrl); + lv_page_set_style(new_tileview, LV_PAGE_STYLE_SB, th->tileview.sb); + } else { + lv_page_set_style(new_tileview, LV_PAGE_STYLE_BG, &lv_style_transp_tight); + lv_page_set_style(new_tileview, LV_PAGE_STYLE_SCRL, &lv_style_transp_tight); + } } /*Copy an existing tileview*/ else { diff --git a/lv_themes/lv_theme.c b/lv_themes/lv_theme.c index e344fd2725..59a0489919 100644 --- a/lv_themes/lv_theme.c +++ b/lv_themes/lv_theme.c @@ -37,7 +37,7 @@ static lv_theme_t * current_theme; /* Store the styles in this array. * Can't determine the size in compile time because sizeof is not evaluated (should be `sizeof(lv_theme_t) / sizeof(lv_style_t*)`). * Error will be generated in run time if too small.*/ -static lv_style_t th_styles[100]; +static lv_style_t th_styles[120]; static bool inited = false; static lv_theme_t current_theme; #endif diff --git a/lv_themes/lv_theme.h b/lv_themes/lv_theme.h index 4fc93d26b3..72c40aec5d 100644 --- a/lv_themes/lv_theme.h +++ b/lv_themes/lv_theme.h @@ -207,6 +207,14 @@ typedef struct { } ta; #endif +#if USE_LV_SPINBOX != 0 + struct { + lv_style_t *bg; + lv_style_t *cursor; + lv_style_t *sb; + } spinbox; +#endif + #if USE_LV_LIST struct { lv_style_t *bg; @@ -251,6 +259,21 @@ typedef struct { } tabview; #endif +#if USE_LV_TILEVIEW != 0 + struct { + lv_style_t *bg; + lv_style_t *scrl; + lv_style_t *sb; + } tileview; +#endif + +#if USE_LV_TABLE != 0 + struct { + lv_style_t *bg; + lv_style_t *cell; + } table; +#endif + #if USE_LV_WIN != 0 struct { lv_style_t *bg; diff --git a/lv_themes/lv_theme_alien.c b/lv_themes/lv_theme_alien.c index d271f86100..7b4ea60266 100644 --- a/lv_themes/lv_theme_alien.c +++ b/lv_themes/lv_theme_alien.c @@ -595,6 +595,15 @@ static void ta_init(void) #endif } +static void spinbox_init(void) +{ +#if USE_LV_SPINBOX + theme.spinbox.bg= &panel; + theme.spinbox.cursor = theme.ta.cursor; + theme.spinbox.sb = theme.ta.sb; +#endif +} + static void list_init(void) { #if USE_LV_LIST != 0 @@ -737,6 +746,31 @@ static void tabview_init(void) #endif } +static void tileview_init(void) +{ +#if USE_LV_TILEVIEW != 0 + theme.tileview.bg = &lv_style_transp_tight; + theme.tileview.scrl = &lv_style_transp_tight; + theme.tileview.sb = theme.page.sb; +#endif +} + +static void table_init(void) +{ +#if USE_LV_TABLE != 0 + static lv_style_t cell; + lv_style_copy(&cell, &panel); + cell.body.radius = 0; + cell.body.border.width = 1; + cell.body.padding.hor = LV_DPI / 12; + cell.body.padding.ver = LV_DPI / 12; + + + theme.table.bg = &lv_style_transp_tight; + theme.table.cell = &cell; +#endif +} + static void win_init(void) { #if USE_LV_WIN != 0 @@ -811,10 +845,13 @@ lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font) mbox_init(); page_init(); ta_init(); + spinbox_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); + tileview_init(); + table_init(); win_init(); return &theme; diff --git a/lv_themes/lv_theme_material.c b/lv_themes/lv_theme_material.c index e21da8f02d..1365869d46 100644 --- a/lv_themes/lv_theme_material.c +++ b/lv_themes/lv_theme_material.c @@ -29,6 +29,7 @@ **********************/ static lv_theme_t theme; static lv_style_t def; +static lv_style_t bg, panel; /*Static style definitions*/ static lv_style_t sb; @@ -51,7 +52,6 @@ static void basic_init(void) def.text.font = _font; def.body.radius = DEF_RADIUS; - static lv_style_t bg, panel; lv_style_copy(&bg, &def); bg.body.main_color = LV_COLOR_HEX(0xf0f0f0); bg.body.grad_color = bg.body.main_color; @@ -540,6 +540,15 @@ static void ta_init(void) #endif } +static void spinbox_init(void) +{ +#if USE_LV_SPINBOX + theme.spinbox.bg= &panel; + theme.spinbox.cursor = theme.ta.cursor; + theme.spinbox.sb = theme.ta.sb; +#endif +} + static void list_init(void) { #if USE_LV_LIST != 0 @@ -708,6 +717,30 @@ static void tabview_init(void) #endif } +static void tileview_init(void) +{ +#if USE_LV_TILEVIEW != 0 + theme.tileview.bg = &lv_style_transp_tight; + theme.tileview.scrl = &lv_style_transp_tight; + theme.tileview.sb = theme.page.sb; +#endif +} + +static void table_init(void) +{ +#if USE_LV_TABLE != 0 + static lv_style_t cell; + lv_style_copy(&cell, &panel); + cell.body.radius = 0; + cell.body.border.width = 1; + cell.body.padding.hor = LV_DPI / 12; + cell.body.padding.ver = LV_DPI / 12; + + + theme.table.bg = &lv_style_transp_tight; + theme.table.cell = &cell; +#endif +} static void win_init(void) { @@ -795,10 +828,13 @@ lv_theme_t * lv_theme_material_init(uint16_t hue, lv_font_t * font) mbox_init(); page_init(); ta_init(); + spinbox_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); + tileview_init(); + table_init(); win_init(); return &theme; diff --git a/lv_themes/lv_theme_nemo.c b/lv_themes/lv_theme_nemo.c index 9852ce6e07..0e6cb0a88e 100644 --- a/lv_themes/lv_theme_nemo.c +++ b/lv_themes/lv_theme_nemo.c @@ -584,6 +584,15 @@ static void ta_init(void) #endif } +static void spinbox_init(void) +{ +#if USE_LV_SPINBOX + theme.spinbox.bg= &panel; + theme.spinbox.cursor = theme.ta.cursor; + theme.spinbox.sb = theme.ta.sb; +#endif +} + static void list_init(void) { #if USE_LV_LIST != 0 @@ -726,6 +735,28 @@ static void tabview_init(void) #endif } +static void tileview_init(void) +{ +#if USE_LV_TILEVIEW != 0 + theme.tileview.bg = &lv_style_transp_tight; + theme.tileview.scrl = &lv_style_transp_tight; + theme.tileview.sb = theme.page.sb; +#endif +} + +static void table_init(void) +{ +#if USE_LV_TABLE != 0 + static lv_style_t cell; + lv_style_copy(&cell, &panel); + cell.body.radius = 0; + cell.body.border.width = 1; + + theme.table.bg = &lv_style_transp_tight; + theme.table.cell = &cell; +#endif +} + static void win_init(void) { #if USE_LV_WIN != 0 @@ -796,10 +827,13 @@ lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t * font) mbox_init(); page_init(); ta_init(); + spinbox_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); + tileview_init(); + table_init(); win_init(); return &theme; diff --git a/lv_themes/lv_theme_night.c b/lv_themes/lv_theme_night.c index 5bae3de214..ed3823fdc2 100644 --- a/lv_themes/lv_theme_night.c +++ b/lv_themes/lv_theme_night.c @@ -522,6 +522,15 @@ static void ta_init(void) #endif } +static void spinbox_init(void) +{ +#if USE_LV_SPINBOX + theme.spinbox.bg= &panel; + theme.spinbox.cursor = theme.ta.cursor; + theme.spinbox.sb = theme.ta.sb; +#endif +} + static void list_init(void) { #if USE_LV_LIST != 0 @@ -539,6 +548,7 @@ static void list_init(void) list_btn_rel.body.border.width = 1; list_btn_rel.body.radius = LV_DPI / 10; list_btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 5, 80); + list_btn_rel.image.color = lv_color_hsv_to_rgb(_hue, 5, 80); list_btn_rel.body.padding.ver = LV_DPI / 6; list_btn_rel.body.padding.hor = LV_DPI / 8; @@ -547,16 +557,15 @@ static void list_init(void) list_btn_pr.body.grad_color = btn_pr.body.main_color; list_btn_pr.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 5); list_btn_pr.body.border.width = 0; - list_btn_pr.body.radius = LV_DPI / 30; list_btn_pr.body.padding.ver = LV_DPI / 6; list_btn_pr.body.padding.hor = LV_DPI / 8; list_btn_pr.text.color = lv_color_hsv_to_rgb(_hue, 5, 80); + list_btn_pr.image.color = lv_color_hsv_to_rgb(_hue, 5, 80); lv_style_copy(&list_btn_tgl_rel, &list_btn_rel); list_btn_tgl_rel.body.empty = 0; list_btn_tgl_rel.body.main_color = lv_color_hsv_to_rgb(_hue, 10, 8); list_btn_tgl_rel.body.grad_color = lv_color_hsv_to_rgb(_hue, 10, 8); - list_btn_tgl_rel.body.radius = LV_DPI / 30; lv_style_copy(&list_btn_tgl_pr, &list_btn_tgl_rel); list_btn_tgl_pr.body.main_color = btn_tgl_pr.body.main_color; @@ -622,6 +631,30 @@ static void tabview_init(void) #endif } +static void tileview_init(void) +{ +#if USE_LV_TILEVIEW != 0 + theme.tileview.bg = &lv_style_transp_tight; + theme.tileview.scrl = &lv_style_transp_tight; + theme.tileview.sb = theme.page.sb; +#endif +} + +static void table_init(void) +{ +#if USE_LV_TABLE != 0 + static lv_style_t cell; + lv_style_copy(&cell, &panel); + cell.body.radius = 0; + cell.body.border.width = 1; + cell.body.padding.hor = LV_DPI / 12; + cell.body.padding.ver = LV_DPI / 12; + + + theme.table.bg = &lv_style_transp_tight; + theme.table.cell = &cell; +#endif +} static void win_init(void) { @@ -705,10 +738,13 @@ lv_theme_t * lv_theme_night_init(uint16_t hue, lv_font_t * font) mbox_init(); page_init(); ta_init(); + spinbox_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); + tileview_init(); + table_init(); win_init(); return &theme; diff --git a/lv_themes/lv_theme_zen.c b/lv_themes/lv_theme_zen.c index ad8e9543c9..9f960e73dd 100644 --- a/lv_themes/lv_theme_zen.c +++ b/lv_themes/lv_theme_zen.c @@ -27,8 +27,10 @@ * STATIC VARIABLES **********************/ static lv_theme_t theme; -static lv_style_t def; /*Static style definitions*/ +static lv_style_t def; +static lv_style_t bg; +static lv_style_t panel; static lv_style_t sb; /*Saved input parameters*/ @@ -45,8 +47,6 @@ static lv_font_t * _font; static void basic_init(void) { - static lv_style_t bg; - static lv_style_t panel; lv_style_copy(&def, &lv_style_pretty); /*Initialize the default style*/ def.body.border.opa = LV_OPA_COVER; @@ -560,6 +560,15 @@ static void ta_init(void) #endif } +static void spinbox_init(void) +{ +#if USE_LV_SPINBOX + theme.spinbox.bg= &panel; + theme.spinbox.cursor = theme.ta.cursor; + theme.spinbox.sb = theme.ta.sb; +#endif +} + static void list_init(void) { #if USE_LV_LIST != 0 @@ -682,6 +691,30 @@ static void tabview_init(void) #endif } +static void tileview_init(void) +{ +#if USE_LV_TILEVIEW != 0 + theme.tileview.bg = &lv_style_transp_tight; + theme.tileview.scrl = &lv_style_transp_tight; + theme.tileview.sb = theme.page.sb; +#endif +} + +static void table_init(void) +{ +#if USE_LV_TABLE != 0 + static lv_style_t cell; + lv_style_copy(&cell, &panel); + cell.body.radius = 0; + cell.body.border.width = 1; + cell.body.shadow.width = 0; + cell.body.padding.hor = LV_DPI / 12; + cell.body.padding.ver = LV_DPI / 12; + + theme.table.bg = &lv_style_transp_tight; + theme.table.cell = &cell; +#endif +} static void win_init(void) { @@ -762,10 +795,13 @@ lv_theme_t * lv_theme_zen_init(uint16_t hue, lv_font_t * font) mbox_init(); page_init(); ta_init(); + spinbox_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); + tileview_init(); + table_init(); win_init(); return &theme;