From d3bcdcb8fbbfa970d89984379ffef29ccb9361ec Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Sat, 29 Feb 2020 13:35:53 +0100 Subject: [PATCH] add theme template and empty --- lv_conf_template.h | 2 + scripts/lv_conf_checker.py | 24 +- src/lv_conf_internal.h | 126 ++-- src/lv_core/lv_style.h | 4 +- src/lv_themes/lv_theme.h | 2 + src/lv_themes/lv_theme_empty.c | 76 +++ src/lv_themes/lv_theme_empty.h | 56 ++ src/lv_themes/lv_theme_material.c | 4 +- src/lv_themes/lv_theme_template.c | 949 ++++++++++++++++++++++++++++++ src/lv_themes/lv_theme_template.h | 56 ++ src/lv_widgets/lv_chart.c | 1 + src/lv_widgets/lv_tabview.c | 19 +- src/lv_widgets/lv_tabview.h | 2 +- tests/build.py | 2 + 14 files changed, 1269 insertions(+), 54 deletions(-) create mode 100644 src/lv_themes/lv_theme_empty.c create mode 100644 src/lv_themes/lv_theme_empty.h create mode 100644 src/lv_themes/lv_theme_template.c create mode 100644 src/lv_themes/lv_theme_template.h mode change 100644 => 100755 tests/build.py diff --git a/lv_conf_template.h b/lv_conf_template.h index fc6967ac5..23d591f2b 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -349,6 +349,8 @@ typedef void * lv_font_user_data_t; *================*/ /*Always enable at least on theme*/ +#define LV_USE_THEME_EMPTY 0 /*No theme, you can apply your styles as you need*/ +#define LV_USE_THEME_TEMPLATE 0 /*Simple to the create your theme based on it*/ #define LV_USE_THEME_MATERIAL 1 /*A fast and impressive theme*/ #define LV_THEME_DEFAULT_INIT lv_theme_material_init diff --git a/scripts/lv_conf_checker.py b/scripts/lv_conf_checker.py index c2171ff8a..709d68108 100755 --- a/scripts/lv_conf_checker.py +++ b/scripts/lv_conf_checker.py @@ -8,18 +8,34 @@ Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not d import re fin = open("../lv_conf_template.h", "r") -fout = open("../src/lv_conf_checker.h", "w") +fout = open("../src/lv_conf_internal.h", "w") fout.write( '''/** * GENERATED FILE, DO NOT EDIT IT! - * @file lv_conf_checker.h + * @file lv_conf_internal.h * Make sure all the defines of lv_conf.h have a default value **/ -#ifndef LV_CONF_CHECKER_H -#define LV_CONF_CHECKER_H +#ifndef LV_CONF_INTERNAL_H +#define LV_CONF_INTERNAL_H +/* clang-format off */ + +#include + +#if defined(LV_CONF_PATH) +#define __LV_TO_STR_AUX(x) #x +#define __LV_TO_STR(x) __LV_TO_STR_AUX(x) +#include __LV_TO_STR(LV_CONF_PATH) +#undef __LV_TO_STR_AUX +#undef __LV_TO_STR +#elif defined(LV_CONF_INCLUDE_SIMPLE) +#include "lv_conf.h" +#else +#include "../../lv_conf.h" +#endif + ''' ) diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index daac2c91a..ad9615569 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -22,6 +22,10 @@ #include "../../lv_conf.h" #endif +/* clang-format off */ + +#include + /*==================== Graphical settings *====================*/ @@ -212,6 +216,16 @@ #define LV_USE_SHADOW 1 #endif +/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/ +#ifndef LV_USE_BLEND_MODES +#define LV_USE_BLEND_MODES 1 +#endif + +/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/ +#ifndef LV_USE_OPA_SCALE +#define LV_USE_OPA_SCALE 1 +#endif + /* 1: Enable object groups (for keyboard/encoder navigation) */ #ifndef LV_USE_GROUP #define LV_USE_GROUP 1 @@ -237,10 +251,25 @@ #define LV_USE_USER_DATA 0 #endif +/*1: Show CPU usage and FPS count in the right bottom corner*/ +#ifndef LV_USE_PERF_MONITOR +#define LV_USE_PERF_MONITOR 1 +#endif + /*======================== * Image decoder and cache *========================*/ +/* 1: Enable indexed (palette) images */ +#ifndef LV_IMG_CF_INDEXED +#define LV_IMG_CF_INDEXED 1 +#endif + +/* 1: Enable alpha indexed images */ +#ifndef LV_IMG_CF_ALPHA +#define LV_IMG_CF_ALPHA 1 +#endif + /* Default image cache size. Image caching keeps the images opened. * If only the built-in image formats are used there is no real advantage of caching. * (I.e. no new image decoder is added) @@ -365,8 +394,10 @@ /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ #ifndef LV_USE_ASSERT_MEM_INTEGRITY +#ifndef LV_USE_ASSERT_MEM_INTEGRITY #define LV_USE_ASSERT_MEM_INTEGRITY 0 #endif +#endif /* Check the strings. * Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow) @@ -388,38 +419,6 @@ #endif /*LV_USE_DEBUG*/ -/*================ - * THEME USAGE - *================*/ -#ifndef LV_THEME_LIVE_UPDATE -#define LV_THEME_LIVE_UPDATE 0 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/ -#endif - -#ifndef LV_USE_THEME_TEMPL -#define LV_USE_THEME_TEMPL 0 /*Just for test*/ -#endif -#ifndef LV_USE_THEME_DEFAULT -#define LV_USE_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/ -#endif -#ifndef LV_USE_THEME_ALIEN -#define LV_USE_THEME_ALIEN 0 /*Dark futuristic theme*/ -#endif -#ifndef LV_USE_THEME_NIGHT -#define LV_USE_THEME_NIGHT 0 /*Dark elegant theme*/ -#endif -#ifndef LV_USE_THEME_MONO -#define LV_USE_THEME_MONO 0 /*Mono color theme for monochrome displays*/ -#endif -#ifndef LV_USE_THEME_MATERIAL -#define LV_USE_THEME_MATERIAL 0 /*Flat theme with bold colors and light shadows*/ -#endif -#ifndef LV_USE_THEME_ZEN -#define LV_USE_THEME_ZEN 0 /*Peaceful, mainly light theme */ -#endif -#ifndef LV_USE_THEME_NEMO -#define LV_USE_THEME_NEMO 0 /*Water-like theme based on the movie "Finding Nemo"*/ -#endif - /*================== * FONT USAGE *===================*/ @@ -486,6 +485,46 @@ /*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ +/*================ + * THEME USAGE + *================*/ + +/*Always enable at least on theme*/ +#ifndef LV_USE_THEME_EMPTY +#define LV_USE_THEME_EMPTY 0 /*No theme, you can apply your styles as you need*/ +#endif +#ifndef LV_USE_THEME_TEMPLATE +#define LV_USE_THEME_TEMPLATE 0 /*Simple to the create your theme based on it*/ +#endif +#ifndef LV_USE_THEME_MATERIAL +#define LV_USE_THEME_MATERIAL 1 /*A fast and impressive theme*/ +#endif + +#ifndef LV_THEME_DEFAULT_INIT +#define LV_THEME_DEFAULT_INIT lv_theme_material_init +#endif +#ifndef LV_THEME_DEFAULT_COLOR_PRIMARY +#define LV_THEME_DEFAULT_COLOR_PRIMARY LV_COLOR_RED +#endif +#ifndef LV_THEME_DEFAULT_COLOR_SECONDARY +#define LV_THEME_DEFAULT_COLOR_SECONDARY LV_COLOR_BLUE +#endif +#ifndef LV_THEME_DEFAULT_FLAGS +#define LV_THEME_DEFAULT_FLAGS LV_THEME_MATERIAL_FLAG_NONE +#endif +#ifndef LV_THEME_DEFAULT_FONT_SMALL +#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_roboto_16 +#endif +#ifndef LV_THEME_DEFAULT_FONT_NORMAL +#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_roboto_16 +#endif +#ifndef LV_THEME_DEFAULT_FONT_SUBTITLE +#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_roboto_16 +#endif +#ifndef LV_THEME_DEFAULT_FONT_TITLE +#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_roboto_16 +#endif + /*================= * Text settings *=================*/ @@ -507,7 +546,7 @@ /* If a word is at least this long, will break wherever "prettiest" * To disable, set to a value <= 0 */ #ifndef LV_TXT_LINE_BREAK_LONG_LEN -#define LV_TXT_LINE_BREAK_LONG_LEN 12 +#define LV_TXT_LINE_BREAK_LONG_LEN 0 #endif /* Minimum number of characters in a long word to put on a line before a break. @@ -564,7 +603,22 @@ * LV_OBJ SETTINGS *==================*/ +#if LV_USE_USER_DATA /*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ +/*Provide a function to free user data*/ +#ifndef LV_USE_USER_DATA_FREE +#define LV_USE_USER_DATA_FREE 0 +#endif +#if LV_USE_USER_DATA_FREE +#ifndef LV_USER_DATA_FREE_INCLUDE +# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/ +#endif +/* Function prototype : void user_data_free(lv_obj_t * obj); */ +#ifndef LV_USER_DATA_FREE +# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/ +#endif +#endif +#endif /*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ #ifndef LV_USE_OBJ_REALIGN @@ -577,7 +631,7 @@ * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) */ #ifndef LV_USE_EXT_CLICK_AREA -#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_OFF +#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY #endif /*================== @@ -733,8 +787,8 @@ #endif /*Line meter (dependencies: *;)*/ -#ifndef LV_USE_LMETER -#define LV_USE_LMETER 1 +#ifndef LV_USE_LINEMETER +#define LV_USE_LINEMETER 1 #endif /*Mask (dependencies: -)*/ diff --git a/src/lv_core/lv_style.h b/src/lv_core/lv_style.h index 7c9a34a2a..b2f2ee11d 100644 --- a/src/lv_core/lv_style.h +++ b/src/lv_core/lv_style.h @@ -96,8 +96,8 @@ enum { LV_STYLE_PROP_INIT(LV_STYLE_RADIUS, 0x0, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_CLIP_CORNER, 0x0, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_SIZE, 0x0, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE), - LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_WIDTH, 0x0, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE), - LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_HEIGHT, 0x0, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE), + LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_WIDTH, 0x0, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE), + LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_HEIGHT, 0x0, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE), LV_STYLE_PROP_INIT(LV_STYLE_OPA_SCALE, 0x0, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT), LV_STYLE_PROP_INIT(LV_STYLE_PAD_TOP, 0x1, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE), diff --git a/src/lv_themes/lv_theme.h b/src/lv_themes/lv_theme.h index 1963f0ae7..0a6d1ab49 100644 --- a/src/lv_themes/lv_theme.h +++ b/src/lv_themes/lv_theme.h @@ -112,6 +112,8 @@ lv_style_t * lv_theme_get_style_part(lv_theme_style_t name, uint8_t part); /********************** * POST INCLUDE *********************/ +#include "lv_theme_empty.h" +#include "lv_theme_template.h" #include "lv_theme_material.h" #ifdef __cplusplus diff --git a/src/lv_themes/lv_theme_empty.c b/src/lv_themes/lv_theme_empty.c new file mode 100644 index 000000000..5e49a8f22 --- /dev/null +++ b/src/lv_themes/lv_theme_empty.c @@ -0,0 +1,76 @@ +/** + * @file lv_theme_empty.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include +#include "lv_theme.h" +#include "../lv_widgets/lv_img.h" +#include "../lv_misc/lv_types.h" + +#if LV_USE_THEME_EMPTY + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ +static void lv_theme_empty_apply(lv_obj_t * obj, lv_theme_style_t name); + + +/********************** + * STATIC VARIABLES + **********************/ +static lv_theme_t theme; + +/********************** + * MACROS + **********************/ + +/********************** + * STATIC FUNCTIONS + **********************/ + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Initialize the default + * @param color_primary the primary color of the theme + * @param color_secondary the secondary color for the theme + * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` + * @param font_small pointer to a small font + * @param font_normal pointer to a normal font + * @param font_subtitle pointer to a large font + * @param font_title pointer to a extra large font + * @return a pointer to reference this theme later + */ +lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, + lv_font_t * font_small, lv_font_t * font_normal, lv_font_t * font_subtitle, lv_font_t * font_title) +{ + theme.apply_cb = lv_theme_empty_apply; + return &theme; +} + + +void lv_theme_empty_apply(lv_obj_t * obj, lv_theme_style_t name) +{ + +} + +/********************** + * STATIC FUNCTIONS + **********************/ + + +#endif diff --git a/src/lv_themes/lv_theme_empty.h b/src/lv_themes/lv_theme_empty.h new file mode 100644 index 000000000..9e71c9574 --- /dev/null +++ b/src/lv_themes/lv_theme_empty.h @@ -0,0 +1,56 @@ +/** + * @file lv_theme_material.h + * + */ + +#ifndef LV_THEME_EMPTY_H +#define LV_THEME_EMPTY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_conf_internal.h" + +#if LV_USE_THEME_EMPTY + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + + +/** + * Initialize the default + * @param color_primary the primary color of the theme + * @param color_secondary the secondary color for the theme + * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` + * @param font_small pointer to a small font + * @param font_normal pointer to a normal font + * @param font_subtitle pointer to a large font + * @param font_title pointer to a extra large font + * @return a pointer to reference this theme later + */ +lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, + lv_font_t * font_small, lv_font_t * font_normal, lv_font_t * font_subtitle, lv_font_t * font_title); +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_THEME_ALIEN_H*/ diff --git a/src/lv_themes/lv_theme_material.c b/src/lv_themes/lv_theme_material.c index 502a1fa05..086093a67 100644 --- a/src/lv_themes/lv_theme_material.c +++ b/src/lv_themes/lv_theme_material.c @@ -1119,8 +1119,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name) list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_INDIC); lv_style_list_add_style(list, &tabview_indic); - lv_obj_clean_style_list(obj, LV_TABVIEW_PART_TAB); - list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_TAB); + 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, &tabview_btns); break; diff --git a/src/lv_themes/lv_theme_template.c b/src/lv_themes/lv_theme_template.c new file mode 100644 index 000000000..87ad3e372 --- /dev/null +++ b/src/lv_themes/lv_theme_template.c @@ -0,0 +1,949 @@ +/** + * @file lv_theme_template.c + * + */ + +/********************* + * INCLUDES + *********************/ +#include +#include "lv_theme.h" +#include "../lv_widgets/lv_img.h" +#include "../lv_misc/lv_types.h" + +#if LV_USE_THEME_TEMPLATE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * STATIC PROTOTYPES + **********************/ +static void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name); + + +/********************** + * STATIC VARIABLES + **********************/ +static lv_theme_t theme; +static lv_color_t _color_primary; +static lv_color_t _color_secondary; +static lv_font_t * _font_small; +static lv_font_t * _font_normal; +static lv_font_t * _font_subtitle; +static lv_font_t * _font_title; + +static lv_style_t style_bg; +static lv_style_t style_btn; +static lv_style_t style_round; +static lv_style_t style_color; +static lv_style_t style_gray; +static lv_style_t style_tick_line; +static lv_style_t style_tight; + +/********************** + * MACROS + **********************/ + +/********************** + * STATIC FUNCTIONS + **********************/ + + +static void basic_init(void) +{ + lv_style_init(&style_bg); + lv_style_set_bg_opa(&style_bg, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_border_width(&style_bg, LV_STATE_DEFAULT, 1); + lv_style_set_border_color(&style_bg, LV_STATE_FOCUSED, _color_secondary); + lv_style_set_border_color(&style_bg, LV_STATE_EDITED, lv_color_darken(_color_secondary, LV_OPA_30)); + lv_style_set_line_width(&style_bg, LV_STATE_DEFAULT, 1); + lv_style_set_scale_end_line_width(&style_bg, LV_STATE_DEFAULT, 1); + lv_style_set_scale_end_color(&style_bg, LV_STATE_DEFAULT, _color_primary); + lv_style_set_text_color(&style_bg, LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_style_set_pad_left(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10); + lv_style_set_pad_right(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10); + lv_style_set_pad_top(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10); + lv_style_set_pad_bottom(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10); + lv_style_set_pad_inner(&style_bg, LV_STATE_DEFAULT, LV_DPI / 10); + + lv_style_init(&style_btn); + lv_style_set_bg_color(&style_btn, LV_STATE_PRESSED, lv_color_hex3(0xccc)); + lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED, _color_primary); + lv_style_set_bg_color(&style_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(_color_primary, LV_OPA_30)); + lv_style_set_bg_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_SILVER); + lv_style_set_text_color(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY); + lv_style_set_image_recolor(&style_btn, LV_STATE_DISABLED, LV_COLOR_GRAY); + + + lv_style_init(&style_round); + lv_style_set_radius(&style_round, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + + lv_style_init(&style_color); + lv_style_set_bg_color(&style_color, LV_STATE_DEFAULT, _color_primary); + lv_style_set_line_color(&style_color, LV_STATE_DEFAULT, _color_primary); + + lv_style_init(&style_gray); + lv_style_set_bg_color(&style_gray, LV_STATE_DEFAULT, LV_COLOR_SILVER); + lv_style_set_line_color(&style_gray, LV_STATE_DEFAULT, LV_COLOR_SILVER); + lv_style_set_text_color(&style_gray, LV_STATE_DEFAULT, LV_COLOR_GRAY); + + lv_style_init(&style_tick_line); + lv_style_set_line_width(&style_tick_line, LV_STATE_DEFAULT, 5); + lv_style_set_scale_end_line_width(&style_tick_line, LV_STATE_DEFAULT, 5); + lv_style_set_scale_end_color(&style_tick_line, LV_STATE_DEFAULT, _color_primary); + + lv_style_init(&style_tight); + lv_style_set_pad_left(&style_tight, LV_STATE_DEFAULT, 0); + lv_style_set_pad_right(&style_tight, LV_STATE_DEFAULT, 0); + lv_style_set_pad_top(&style_tight, LV_STATE_DEFAULT, 0); + lv_style_set_pad_bottom(&style_tight, LV_STATE_DEFAULT, 0); + lv_style_set_pad_inner(&style_tight, LV_STATE_DEFAULT, 0); +} + +static void arc_init(void) +{ +#if LV_USE_ARC != 0 + +#endif +} + +static void bar_init(void) +{ +#if LV_USE_BAR + +#endif +} + +static void btn_init(void) +{ +#if LV_USE_BTN != 0 + +#endif +} + + +static void btnmatrix_init(void) +{ +#if LV_USE_BTNMATRIX + +#endif +} + + +static void calendar_init(void) +{ +#if LV_USE_CALENDAR + +#endif +} + +static void chart_init(void) +{ +#if LV_USE_CHART + +#endif +} + + +static void cpicker_init(void) +{ +#if LV_USE_CPICKER + +#endif +} + +static void checkbox_init(void) +{ +#if LV_USE_CHECKBOX != 0 + +#endif +} + + +static void cont_init(void) +{ +#if LV_USE_CONT != 0 + +#endif +} + + +static void gauge_init(void) +{ +#if LV_USE_GAUGE != 0 + +#endif +} + +static void img_init(void) +{ +#if LV_USE_IMG != 0 + +#endif +} + +static void label_init(void) +{ +#if LV_USE_LABEL != 0 + +#endif +} + + +static void linemeter_init(void) +{ +#if LV_USE_LINEMETER != 0 + +#endif +} + +static void line_init(void) +{ +#if LV_USE_LINE != 0 + +#endif +} + +static void led_init(void) +{ +#if LV_USE_LED != 0 + + #endif +} + +static void page_init(void) +{ +#if LV_USE_PAGE + +#endif +} + +static void slider_init(void) +{ +#if LV_USE_SLIDER != 0 + +#endif +} + +static void switch_init(void) +{ +#if LV_USE_SWITCH != 0 + +#endif +} + + +static void spinbox_init(void) +{ +#if LV_USE_SPINBOX + +#endif +} + + +static void spinner_init(void) +{ +#if LV_USE_SPINNER != 0 + + #endif +} + +static void keyboard_init(void) +{ +#if LV_USE_KEYBOARD + +#endif +} + +static void msgbox_init(void) +{ +#if LV_USE_MSGBOX + + #endif +} + +static void textarea_init(void) +{ +#if LV_USE_TEXTAREA + + #endif +} + +static void list_init(void) +{ +#if LV_USE_LIST != 0 + + #endif +} + +static void ddlist_init(void) +{ +#if LV_USE_DROPDOWN != 0 + +#endif +} + +static void roller_init(void) +{ +#if LV_USE_ROLLER != 0 + + #endif +} + +static void tabview_init(void) +{ +#if LV_USE_TABVIEW != 0 + + #endif +} + +static void tileview_init(void) +{ +#if LV_USE_TILEVIEW != 0 +#endif +} + +static void table_init(void) +{ +#if LV_USE_TABLE != 0 + +#endif +} + +static void win_init(void) +{ +#if LV_USE_WIN != 0 + +#endif +} + + +/********************** + * GLOBAL FUNCTIONS + **********************/ + +/** + * Initialize the default + * @param color_primary the primary color of the theme + * @param color_secondary the secondary color for the theme + * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` + * @param font_small pointer to a small font + * @param font_normal pointer to a normal font + * @param font_subtitle pointer to a large font + * @param font_title pointer to a extra large font + * @return a pointer to reference this theme later + */ +lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, + lv_font_t * font_small, lv_font_t * font_normal, lv_font_t * font_subtitle, lv_font_t * font_title) +{ + + _color_primary = color_primary; + _color_secondary = color_secondary; + _font_small = font_small; + _font_normal = font_normal; + _font_subtitle = font_subtitle; + _font_title = font_title; + + basic_init(); + cont_init(); + btn_init(); + label_init(); + bar_init(); + img_init(); + line_init(); + led_init(); + slider_init(); + switch_init(); + linemeter_init(); + gauge_init(); + arc_init(); + spinner_init(); + chart_init(); + calendar_init(); + cpicker_init(); + checkbox_init(); + btnmatrix_init(); + keyboard_init(); + msgbox_init(); + page_init(); + textarea_init(); + spinbox_init(); + list_init(); + ddlist_init(); + roller_init(); + tabview_init(); + tileview_init(); + table_init(); + win_init(); + + theme.apply_cb = lv_theme_material_apply; + + return &theme; +} + + +void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name) +{ + lv_style_list_t * list; + + switch(name) { + case LV_THEME_NONE: + 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, &style_bg); + lv_style_list_add_style(list, &style_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, &style_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, &style_bg); + break; +#endif + +#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, &style_bg); + lv_style_list_add_style(list, &style_btn); + break; +#endif + +#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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_btn); + break; +#endif + +#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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_btn); + break; +#endif + +#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, &style_bg); + lv_style_list_add_style(list, &style_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, &style_bg); + lv_style_list_add_style(list, &style_color); + break; +#endif + +#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, &style_bg); + lv_style_list_add_style(list, &style_tight); + lv_style_list_add_style(list, &style_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, &style_bg); + lv_style_list_add_style(list, &style_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, &style_bg); + lv_style_list_add_style(list, &style_tight); + lv_style_list_add_style(list, &style_round); + break; +#endif + +#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, &style_bg); + lv_style_list_add_style(list, &style_tick_line); + lv_style_list_add_style(list, &style_round); + + lv_obj_clean_style_list(obj, LV_ARC_PART_ARC); + list = lv_obj_get_style_list(obj, LV_ARC_PART_ARC); + lv_style_list_add_style(list, &style_bg); + lv_style_list_add_style(list, &style_color); + lv_style_list_add_style(list, &style_tick_line); + break; +#endif + +#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, &style_bg); + lv_style_list_add_style(list, &style_tick_line); + + lv_obj_clean_style_list(obj, LV_SPINNER_PART_ARC); + list = lv_obj_get_style_list(obj, LV_SPINNER_PART_ARC); + lv_style_list_add_style(list, &style_bg); + lv_style_list_add_style(list, &style_color); + lv_style_list_add_style(list, &style_tick_line); + break; +#endif + +#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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_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, &style_bg); + lv_style_list_add_style(list, &style_round); + break; +#endif + +#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, &style_bg); + lv_style_list_add_style(list, &style_btn); + break; +#endif + +#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, &style_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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_btn); + break; + +#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, &style_bg); + lv_style_list_add_style(list, &style_color); + lv_style_list_add_style(list, &style_round); + 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, &style_bg); + lv_style_list_add_style(list, &style_gray); + + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL); + lv_style_list_add_style(list, &style_bg); + + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR); + lv_style_list_add_style(list, &style_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, &style_bg); + + lv_obj_clean_style_list(obj, LV_TABVIEW_PART_BG_SCRL); + list = lv_obj_get_style_list(obj, LV_TABVIEW_PART_BG_SCRL); + lv_style_list_add_style(list, &style_bg); + lv_style_list_add_style(list, &style_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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_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, &style_bg); + lv_style_list_add_style(list, &style_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, &style_bg); + lv_style_list_add_style(list, &style_gray); + + lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL); + list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL); + lv_style_list_add_style(list, &style_bg); + + break; +#endif + +#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, &style_bg); + + lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_SCRLBAR); + list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCRLBAR); + lv_style_list_add_style(list, &style_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, &style_bg); + break; +#endif + + +#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, &style_bg); + + lv_obj_clean_style_list(obj, LV_ROLLER_PART_SEL); + list = lv_obj_get_style_list(obj, LV_ROLLER_PART_SEL); + lv_style_list_add_style(list, &style_bg); + lv_style_list_add_style(list, &style_color); + break; +#endif + + +#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, &style_bg); + + lv_obj_clean_style_list(obj, LV_LIST_PART_SCRL); + list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRL); + + lv_obj_clean_style_list(obj, LV_LIST_PART_SCRLBAR); + list = lv_obj_get_style_list(obj, LV_LIST_PART_SCRLBAR); + lv_style_list_add_style(list, &style_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, &style_bg); + lv_style_list_add_style(list, &style_btn); + break; +#endif + +#if LV_USE_DROPDOWN + case LV_THEME_DROPDOWN: + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_BTN); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_BTN); + lv_style_list_add_style(list, &style_bg); + lv_style_list_add_style(list, &style_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, &style_bg); + + lv_obj_clean_style_list(obj, LV_DROPDOWN_PART_SCRLBAR); + list = lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SCRLBAR); + lv_style_list_add_style(list, &style_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, &style_bg); + lv_style_list_add_style(list, &style_color); + break; +#endif + +#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, &style_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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_tight); + 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, &style_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, &style_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, &style_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, &style_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, &style_bg); + break; +#endif + +#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, &style_bg); + + lv_obj_clean_style_list(obj, LV_WIN_PART_SCRLBAR); + list = lv_obj_get_style_list(obj, LV_WIN_PART_SCRLBAR); + lv_style_list_add_style(list, &style_bg); + + lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCRL); + list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCRL); + lv_style_list_add_style(list, &style_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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_btn); + break; +#endif + +#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, &style_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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_tight); + + lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); + list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); + lv_style_list_add_style(list, &style_bg); + break; + + case LV_THEME_TEXTAREA_ONELINE: + 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, &style_bg); + + lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER); + list = lv_obj_get_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, &style_bg); + lv_style_list_add_style(list, &style_tight); + + lv_obj_clean_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); + list = lv_obj_get_style_list(obj, LV_TEXTAREA_PART_SCRLBAR); + lv_style_list_add_style(list, &style_bg); + break; +#endif + + +#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, &style_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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_btn); + break; +#endif + +#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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_btn); + lv_style_list_add_style(list, &style_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, &style_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, &style_bg); + lv_style_list_add_style(list, &style_tight); + 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, &style_bg); + + lv_obj_clean_style_list(obj, LV_CPICKER_PART_INDIC); + list = lv_obj_get_style_list(obj, LV_CPICKER_PART_INDIC); + lv_style_list_add_style(list, &style_bg); + lv_style_list_add_style(list, &style_round); + break; +#endif + +#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, &style_bg); + lv_style_list_add_style(list, &style_round); + break; +#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, &style_bg); + lv_style_list_add_style(list, &style_round); + + lv_obj_clean_style_list(obj, LV_GAUGE_PART_STRONG); + list = lv_obj_get_style_list(obj, LV_GAUGE_PART_STRONG); + lv_style_list_add_style(list, &style_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, &style_bg); + break; +#endif + default: + break; + } + + + lv_obj_refresh_style(obj); + + +} + +/********************** + * STATIC FUNCTIONS + **********************/ + + +#endif diff --git a/src/lv_themes/lv_theme_template.h b/src/lv_themes/lv_theme_template.h new file mode 100644 index 000000000..542e0b17e --- /dev/null +++ b/src/lv_themes/lv_theme_template.h @@ -0,0 +1,56 @@ +/** + * @file lv_theme_template.h + * + */ + +#ifndef LV_THEME_TEMPLATE_H +#define LV_THEME_TEMPLATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ +#include "../lv_conf_internal.h" + +#if LV_USE_THEME_TEMPLATE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + + +/** + * Initialize the default + * @param color_primary the primary color of the theme + * @param color_secondary the secondary color for the theme + * @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...` + * @param font_small pointer to a small font + * @param font_normal pointer to a normal font + * @param font_subtitle pointer to a large font + * @param font_title pointer to a extra large font + * @return a pointer to reference this theme later + */ +lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags, + lv_font_t * font_small, lv_font_t * font_normal, lv_font_t * font_subtitle, lv_font_t * font_title); +/********************** + * MACROS + **********************/ + +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /*LV_THEME_TEMPLATE_H*/ diff --git a/src/lv_widgets/lv_chart.c b/src/lv_widgets/lv_chart.c index dc0cb20f3..34533d63a 100644 --- a/src/lv_widgets/lv_chart.c +++ b/src/lv_widgets/lv_chart.c @@ -799,6 +799,7 @@ static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, co if(has_area) { lv_draw_rect_dsc_init(&area_dsc); lv_obj_init_draw_rect_dsc(chart, LV_CHART_PART_SERIES, &area_dsc); + area_dsc.border_width = 0; has_fade = area_dsc.bg_grad_dir == LV_GRAD_DIR_VER ? true : false; if(has_fade) { diff --git a/src/lv_widgets/lv_tabview.c b/src/lv_widgets/lv_tabview.c index 1156196aa..904f55529 100644 --- a/src/lv_widgets/lv_tabview.c +++ b/src/lv_widgets/lv_tabview.c @@ -169,8 +169,8 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy) LV_TABVIEW_PART_BG_SCRL)); lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB_BG), lv_obj_get_style_list(copy, LV_TABVIEW_PART_TAB_BG)); - lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB), lv_obj_get_style_list(copy, - LV_TABVIEW_PART_TAB)); + lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB_BTN), lv_obj_get_style_list(copy, + LV_TABVIEW_PART_TAB_BTN)); uint16_t i; for(i = 0; i < copy_ext->tab_cnt; i++) { @@ -593,7 +593,7 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview); lv_get_state_info_t * info = param; if(info->part == LV_TABVIEW_PART_TAB_BG) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BG); - else if(info->part == LV_TABVIEW_PART_TAB) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BTN); + else if(info->part == LV_TABVIEW_PART_TAB_BTN) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BTN); else if(info->part == LV_TABVIEW_PART_INDIC) info->result = lv_obj_get_state(ext->indic, LV_OBJ_PART_MAIN); else if(info->part == LV_TABVIEW_PART_BG_SCRL) info->result = lv_obj_get_state(ext->content, LV_PAGE_PART_SCRL); return LV_RES_OK; @@ -693,6 +693,7 @@ static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, v res = lv_indev_finish_drag(indev); if(res != LV_RES_OK) return res; lv_obj_t * tab_page = lv_tabview_get_tab(tabview, ext->tab_cur); + if(tab_page == NULL) return LV_RES_OK; lv_coord_t page_x1 = tab_page->coords.x1 - tabview->coords.x1 + x_predict; lv_coord_t page_x2 = page_x1 + lv_obj_get_width(tabview); lv_coord_t treshold = lv_obj_get_width(tabview) / 2; @@ -745,7 +746,7 @@ static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part) case LV_TABVIEW_PART_TAB_BG: style_dsc_p = lv_obj_get_style_list(ext->btns, LV_BTNMATRIX_PART_BG); break; - case LV_TABVIEW_PART_TAB: + case LV_TABVIEW_PART_TAB_BTN: style_dsc_p = lv_obj_get_style_list(ext->btns, LV_BTNMATRIX_PART_BTN); break; case LV_TABVIEW_PART_INDIC: @@ -863,12 +864,12 @@ static void refr_btns_size(lv_obj_t * tabview) lv_style_int_t tab_bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB_BG); lv_style_int_t tab_bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB_BG); - lv_style_int_t tab_left = lv_obj_get_style_pad_left(tabview, LV_TABVIEW_PART_TAB); - lv_style_int_t tab_right = lv_obj_get_style_pad_right(tabview, LV_TABVIEW_PART_TAB); - lv_style_int_t tab_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB); - lv_style_int_t tab_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB); + lv_style_int_t tab_left = lv_obj_get_style_pad_left(tabview, LV_TABVIEW_PART_TAB_BTN); + lv_style_int_t tab_right = lv_obj_get_style_pad_right(tabview, LV_TABVIEW_PART_TAB_BTN); + lv_style_int_t tab_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB_BTN); + lv_style_int_t tab_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB_BTN); - const lv_font_t * font = lv_obj_get_style_text_font(tabview, LV_TABVIEW_PART_TAB); + const lv_font_t * font = lv_obj_get_style_text_font(tabview, LV_TABVIEW_PART_TAB_BTN); /*Set the tabs height/width*/ lv_coord_t btns_w; diff --git a/src/lv_widgets/lv_tabview.h b/src/lv_widgets/lv_tabview.h index 0d0ecb179..f966096c3 100644 --- a/src/lv_widgets/lv_tabview.h +++ b/src/lv_widgets/lv_tabview.h @@ -70,7 +70,7 @@ enum { _LV_TABVIEW_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST, LV_TABVIEW_PART_BG_SCRL = _LV_OBJ_PART_REAL_LAST, - LV_TABVIEW_PART_TAB, + LV_TABVIEW_PART_TAB_BTN, LV_TABVIEW_PART_TAB_BG, LV_TABVIEW_PART_INDIC, _LV_TABVIEW_PART_REAL_LAST, diff --git a/tests/build.py b/tests/build.py old mode 100644 new mode 100755 index 98c978878..43577543f --- a/tests/build.py +++ b/tests/build.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + import os lvgldirname = os.path.abspath('..')