start the new theme system
This commit is contained in:
@@ -279,8 +279,6 @@ typedef void * lv_indev_drv_user_data_t; /*Type of user data in the i
|
||||
/*================
|
||||
* THEME USAGE
|
||||
*================*/
|
||||
#define LV_THEME_LIVE_UPDATE 0 /*1: Allow theme switching at run time. Uses 8..10 kB of RAM*/
|
||||
|
||||
#define LV_USE_THEME_TEMPL 0 /*Just for test*/
|
||||
#define LV_USE_THEME_DEFAULT 0 /*Built mainly from the built-in styles. Consumes very few RAM*/
|
||||
#define LV_USE_THEME_ALIEN 0 /*Dark futuristic theme*/
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
**********************/
|
||||
static void style_mod_def(lv_group_t * group, lv_style_t * style);
|
||||
static void style_mod_edit_def(lv_group_t * group, lv_style_t * style);
|
||||
static void refresh_theme(lv_group_t * g, lv_theme_t * th);
|
||||
static void refresh_theme(lv_group_t * g, lv_theme_style_t * th);
|
||||
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *),
|
||||
void * (*move)(const lv_ll_t *, const void *));
|
||||
static void lv_group_refocus(lv_group_t * g);
|
||||
@@ -79,9 +79,6 @@ lv_group_t * lv_group_create(void)
|
||||
memset(&group->user_data, 0, sizeof(lv_group_user_data_t));
|
||||
#endif
|
||||
|
||||
/*Initialize style modification callbacks from current theme*/
|
||||
refresh_theme(group, lv_theme_get_current());
|
||||
|
||||
return group;
|
||||
}
|
||||
|
||||
@@ -501,27 +498,6 @@ bool lv_group_get_wrap(lv_group_t * group)
|
||||
return group->wrap ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the group that current theme changed and style modification callbacks need to be
|
||||
* refreshed.
|
||||
* @param group pointer to group. If NULL then all groups are notified.
|
||||
*/
|
||||
void lv_group_report_style_mod(lv_group_t * group)
|
||||
{
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
|
||||
if(group != NULL) {
|
||||
refresh_theme(group, th);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_group_t * i;
|
||||
LV_LL_READ(LV_GC_ROOT(_lv_group_ll), i)
|
||||
{
|
||||
refresh_theme(i, th);
|
||||
}
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
@@ -540,89 +516,6 @@ static void lv_group_refocus(lv_group_t * g)
|
||||
g->wrap = temp_wrap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default style modifier function
|
||||
* @param group pointer to the caller group
|
||||
* @param style pointer to a style to modify. (Typically group.style_tmp) It will be OVERWRITTEN.
|
||||
*/
|
||||
static void style_mod_def(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#if LV_COLOR_DEPTH != 1
|
||||
|
||||
// /*Make the style to be a little bit orange*/
|
||||
// style->body.border.opa = LV_OPA_COVER;
|
||||
// style->body.border.color = LV_COLOR_ORANGE;
|
||||
//
|
||||
// /*If not transparent or has border then emphasis the border*/
|
||||
// if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
//
|
||||
// style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_ORANGE, LV_OPA_70);
|
||||
// style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_ORANGE, LV_OPA_70);
|
||||
// style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_ORANGE, LV_OPA_60);
|
||||
//
|
||||
// style->text.color = lv_color_mix(style->text.color, LV_COLOR_ORANGE, LV_OPA_70);
|
||||
//
|
||||
// /*Add some recolor to the images*/
|
||||
// if(style->image.intense < LV_OPA_MIN) {
|
||||
// style->image.color = LV_COLOR_ORANGE;
|
||||
// style->image.intense = LV_OPA_40;
|
||||
// }
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 2;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Default style modifier function
|
||||
* @param group pointer to the caller group
|
||||
* @param style pointer to a style to modify. (Typically group.style_tmp) It will be OVERWRITTEN.
|
||||
*/
|
||||
static void style_mod_edit_def(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#if LV_COLOR_DEPTH != 1
|
||||
|
||||
// /*Make the style to be a little bit orange*/
|
||||
// style->body.border.opa = LV_OPA_COVER;
|
||||
// style->body.border.color = LV_COLOR_GREEN;
|
||||
//
|
||||
// /*If not empty or has border then emphasis the border*/
|
||||
// if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
//
|
||||
// style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_GREEN, LV_OPA_70);
|
||||
// style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_GREEN, LV_OPA_70);
|
||||
// style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_GREEN, LV_OPA_60);
|
||||
//
|
||||
// style->text.color = lv_color_mix(style->text.color, LV_COLOR_GREEN, LV_OPA_70);
|
||||
//
|
||||
// /*Add some recolor to the images*/
|
||||
// if(style->image.intense < LV_OPA_MIN) {
|
||||
// style->image.color = LV_COLOR_GREEN;
|
||||
// style->image.intense = LV_OPA_40;
|
||||
// }
|
||||
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 3;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void refresh_theme(lv_group_t * g, lv_theme_t * th)
|
||||
{
|
||||
g->style_mod_cb = style_mod_def;
|
||||
g->style_mod_edit_cb = style_mod_edit_def;
|
||||
if(th) {
|
||||
if(th->group.style_mod_xcb) g->style_mod_cb = th->group.style_mod_xcb;
|
||||
if(th->group.style_mod_edit_xcb) g->style_mod_edit_cb = th->group.style_mod_edit_xcb;
|
||||
}
|
||||
}
|
||||
|
||||
static void focus_next_core(lv_group_t * group, void * (*begin)(const lv_ll_t *),
|
||||
void * (*move)(const lv_ll_t *, const void *))
|
||||
{
|
||||
|
||||
@@ -107,7 +107,10 @@ void lv_init(void)
|
||||
#endif
|
||||
|
||||
/*Init. the sstyles*/
|
||||
lv_style_built_in_init();
|
||||
// lv_style_built_in_init();
|
||||
|
||||
lv_theme_t * th = lv_theme_alien_init(0, NULL);
|
||||
lv_theme_set_act(th);
|
||||
|
||||
/*Initialize the screen refresh system*/
|
||||
lv_refr_init();
|
||||
@@ -260,13 +263,11 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
|
||||
lv_style_dsc_init(&new_obj->style_dsc);
|
||||
|
||||
if(parent != NULL) {
|
||||
lv_obj_add_style_class(new_obj, LV_OBJ_PART_MAIN, &lv_style_panel);
|
||||
lv_obj_add_style_class(new_obj, LV_OBJ_PART_MAIN, _t(PANEL));
|
||||
} else {
|
||||
lv_obj_update_style_cache(new_obj, LV_OBJ_PART_MAIN);
|
||||
lv_obj_add_style_class(new_obj, LV_OBJ_PART_MAIN, _t(SCR));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*Copy the attributes if required*/
|
||||
if(copy != NULL) {
|
||||
lv_area_copy(&new_obj->coords, ©->coords);
|
||||
|
||||
@@ -45,27 +45,6 @@ static void style_animation_common_end_cb(lv_anim_t * a);
|
||||
* GLOABAL VARIABLES
|
||||
**********************/
|
||||
|
||||
/*Basic styles*/
|
||||
lv_style_t lv_style_plain;
|
||||
lv_style_t lv_style_panel;
|
||||
lv_style_t lv_style_panel;
|
||||
lv_style_t lv_style_btn;
|
||||
|
||||
/*Color styles*/
|
||||
lv_style_t lv_style_dark;
|
||||
lv_style_t lv_style_light;
|
||||
lv_style_t lv_style_red;
|
||||
lv_style_t lv_style_green;
|
||||
lv_style_t lv_style_blue;
|
||||
|
||||
/*Transparent styles*/
|
||||
lv_style_t lv_style_transp;
|
||||
lv_style_t lv_style_frame;
|
||||
|
||||
/*Padding styles*/
|
||||
lv_style_t lv_style_tight;
|
||||
lv_style_t lv_style_fit;
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
@@ -78,115 +57,6 @@ lv_style_t lv_style_fit;
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
/**
|
||||
* Init. the built-in styles
|
||||
*/
|
||||
void lv_style_built_in_init(void)
|
||||
{
|
||||
|
||||
lv_mem_monitor_t mon;
|
||||
lv_mem_monitor(&mon);
|
||||
printf("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d\n", (int)mon.total_size - mon.free_size,
|
||||
mon.used_pct,
|
||||
mon.frag_pct,
|
||||
(int)mon.free_biggest_size);
|
||||
|
||||
|
||||
/*Basic styles*/
|
||||
lv_style_init(&lv_style_plain);
|
||||
lv_style_set_value(&lv_style_plain, LV_STYLE_PAD_LEFT, LV_DPI / 12);
|
||||
lv_style_set_value(&lv_style_plain, LV_STYLE_PAD_RIGHT, LV_DPI / 12);
|
||||
lv_style_set_value(&lv_style_plain, LV_STYLE_PAD_TOP, LV_DPI / 12);
|
||||
lv_style_set_value(&lv_style_plain, LV_STYLE_PAD_BOTTOM, LV_DPI / 12);
|
||||
lv_style_set_value(&lv_style_plain, LV_STYLE_PAD_INNER, LV_DPI / 16);
|
||||
|
||||
lv_style_init(&lv_style_panel);
|
||||
lv_style_set_value(&lv_style_panel, LV_STYLE_PAD_LEFT, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_panel, LV_STYLE_PAD_RIGHT, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_panel, LV_STYLE_PAD_TOP, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_panel, LV_STYLE_PAD_BOTTOM, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_panel, LV_STYLE_PAD_INNER, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_panel, LV_STYLE_RADIUS, LV_DPI / 16);
|
||||
lv_style_set_value(&lv_style_panel, LV_STYLE_BORDER_WIDTH, LV_DPI / 50 > 0 ? LV_DPI / 50 : 1);
|
||||
lv_style_set_color(&lv_style_panel, LV_STYLE_BG_COLOR, LV_COLOR_SILVER);
|
||||
lv_style_set_color(&lv_style_panel, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_GRAY);
|
||||
lv_style_set_color(&lv_style_panel, LV_STYLE_BORDER_COLOR, LV_COLOR_GRAY);
|
||||
|
||||
lv_style_init(&lv_style_btn);
|
||||
lv_style_set_value(&lv_style_btn, LV_STYLE_PAD_LEFT, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_btn, LV_STYLE_PAD_RIGHT, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_btn, LV_STYLE_PAD_TOP, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_btn, LV_STYLE_PAD_BOTTOM, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_btn, LV_STYLE_PAD_INNER, LV_DPI / 16);
|
||||
lv_style_set_value(&lv_style_btn, LV_STYLE_RADIUS, LV_DPI / 20);
|
||||
lv_style_set_value(&lv_style_btn, LV_STYLE_BORDER_WIDTH, LV_DPI / 50 > 0 ? LV_DPI / 50 : 1);
|
||||
lv_style_set_value(&lv_style_btn, LV_STYLE_BG_GRAD_DIR, LV_GRAD_DIR_VER);
|
||||
lv_style_set_color(&lv_style_btn, LV_STYLE_BG_COLOR, LV_COLOR_BLUE);
|
||||
lv_style_set_color(&lv_style_btn, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_NAVY);
|
||||
lv_style_set_color(&lv_style_btn, LV_STYLE_BORDER_COLOR, LV_COLOR_NAVY);
|
||||
lv_style_set_color(&lv_style_btn, LV_STYLE_BG_GRAD_COLOR | LV_STYLE_STATE_PRESSED, LV_COLOR_BLACK);
|
||||
lv_style_set_color(&lv_style_btn, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE);
|
||||
|
||||
/*Color styles*/
|
||||
lv_style_init(&lv_style_light);
|
||||
lv_style_set_color(&lv_style_light, LV_STYLE_BG_COLOR, LV_COLOR_SILVER);
|
||||
lv_style_set_color(&lv_style_light, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_GRAY);
|
||||
lv_style_set_color(&lv_style_light, LV_STYLE_BORDER_COLOR, LV_COLOR_GRAY);
|
||||
|
||||
lv_style_init(&lv_style_dark);
|
||||
lv_style_set_color(&lv_style_dark, LV_STYLE_BG_COLOR, lv_color_hex3(0x444));
|
||||
lv_style_set_color(&lv_style_dark, LV_STYLE_BG_GRAD_COLOR, lv_color_hex3(0x222));
|
||||
lv_style_set_color(&lv_style_dark, LV_STYLE_BORDER_COLOR, LV_COLOR_GRAY);
|
||||
lv_style_set_color(&lv_style_blue, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE);
|
||||
|
||||
lv_style_init(&lv_style_red);
|
||||
lv_style_set_color(&lv_style_red, LV_STYLE_BG_COLOR, LV_COLOR_RED);
|
||||
lv_style_set_color(&lv_style_red, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_MAROON);
|
||||
lv_style_set_color(&lv_style_red, LV_STYLE_BORDER_COLOR, LV_COLOR_MAROON);
|
||||
lv_style_set_color(&lv_style_blue, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE);
|
||||
|
||||
lv_style_init(&lv_style_green);
|
||||
lv_style_set_color(&lv_style_green, LV_STYLE_BG_COLOR, LV_COLOR_LIME);
|
||||
lv_style_set_color(&lv_style_green, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_GREEN);
|
||||
lv_style_set_color(&lv_style_green, LV_STYLE_BORDER_COLOR, LV_COLOR_GREEN);
|
||||
lv_style_set_color(&lv_style_blue, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE);
|
||||
|
||||
lv_style_init(&lv_style_blue);
|
||||
lv_style_set_color(&lv_style_blue, LV_STYLE_BG_COLOR, LV_COLOR_BLUE);
|
||||
lv_style_set_color(&lv_style_blue, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_NAVY);
|
||||
lv_style_set_color(&lv_style_blue, LV_STYLE_BORDER_COLOR, LV_COLOR_NAVY);
|
||||
lv_style_set_color(&lv_style_blue, LV_STYLE_BG_GRAD_COLOR | LV_STYLE_STATE_PRESSED, LV_COLOR_BLACK);
|
||||
lv_style_set_color(&lv_style_blue, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE);
|
||||
|
||||
/*Transparent styles*/
|
||||
lv_style_init(&lv_style_transp);
|
||||
lv_style_set_opa(&lv_style_transp, LV_STYLE_BG_OPA, LV_OPA_TRANSP);
|
||||
lv_style_set_opa(&lv_style_transp, LV_STYLE_BORDER_OPA, LV_OPA_TRANSP);
|
||||
|
||||
lv_style_init(&lv_style_frame);
|
||||
lv_style_set_opa(&lv_style_frame, LV_STYLE_BG_OPA, LV_OPA_TRANSP);
|
||||
|
||||
/*Padding styles*/
|
||||
lv_style_init(&lv_style_tight);
|
||||
lv_style_set_value(&lv_style_tight, LV_STYLE_PAD_LEFT, 0);
|
||||
lv_style_set_value(&lv_style_tight, LV_STYLE_PAD_RIGHT, 0);
|
||||
lv_style_set_value(&lv_style_tight, LV_STYLE_PAD_TOP, 0);
|
||||
lv_style_set_value(&lv_style_tight, LV_STYLE_PAD_BOTTOM, 0);
|
||||
lv_style_set_value(&lv_style_tight, LV_STYLE_PAD_INNER, 0);
|
||||
|
||||
lv_style_init(&lv_style_fit);
|
||||
lv_style_set_value(&lv_style_fit, LV_STYLE_PAD_LEFT, 0);
|
||||
lv_style_set_value(&lv_style_fit, LV_STYLE_PAD_RIGHT, 0);
|
||||
lv_style_set_value(&lv_style_fit, LV_STYLE_PAD_TOP, 0);
|
||||
lv_style_set_value(&lv_style_fit, LV_STYLE_PAD_BOTTOM, 0);
|
||||
|
||||
lv_mem_monitor(&mon);
|
||||
printf("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d\n", (int)mon.total_size - mon.free_size,
|
||||
mon.used_pct,
|
||||
mon.frag_pct,
|
||||
(int)mon.free_biggest_size);
|
||||
}
|
||||
|
||||
void lv_style_init(lv_style_t * style)
|
||||
{
|
||||
style->map = NULL;
|
||||
|
||||
@@ -390,27 +390,6 @@ static inline void lv_style_anim_create(lv_anim_t * a)
|
||||
* GLOBAL VARIABLES
|
||||
*************************/
|
||||
|
||||
/*Basic styles*/
|
||||
extern lv_style_t lv_style_plain;
|
||||
extern lv_style_t lv_style_panel;
|
||||
extern lv_style_t lv_style_panel;
|
||||
extern lv_style_t lv_style_btn;
|
||||
|
||||
/*Color styles*/
|
||||
extern lv_style_t lv_style_dark;
|
||||
extern lv_style_t lv_style_light;
|
||||
extern lv_style_t lv_style_red;
|
||||
extern lv_style_t lv_style_green;
|
||||
extern lv_style_t lv_style_blue;
|
||||
|
||||
/*Transparent styles*/
|
||||
extern lv_style_t lv_style_transp;
|
||||
extern lv_style_t lv_style_frame;
|
||||
|
||||
/*Padding styles*/
|
||||
extern lv_style_t lv_style_tight;
|
||||
extern lv_style_t lv_style_fit;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
@@ -421,11 +400,9 @@ extern lv_style_t lv_style_fit;
|
||||
* LV_STYLE_CREATE(my_style, &lv_style_plain);
|
||||
* is equivalent to
|
||||
* static lv_style_t my_style;
|
||||
* lv_style_copy(my_style, &lv_style_plain);
|
||||
*
|
||||
* If the style to copy is `NULL` `lv_style_plain` will be used.
|
||||
* lv_style_init(&my_style);
|
||||
*/
|
||||
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_copy(&name, copy_p == NULL ? &lv_style_plain : copy_p);
|
||||
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
|
||||
@@ -12,11 +12,12 @@
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include "lv_hal.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_misc/lv_mem.h"
|
||||
#include "../lv_misc/lv_gc.h"
|
||||
#include "../lv_core/lv_debug.h"
|
||||
#include "../lv_core/lv_obj.h"
|
||||
#include "../lv_core/lv_refr.h"
|
||||
#include "../lv_misc/lv_gc.h"
|
||||
#include "../lv_themes/lv_theme.h"
|
||||
|
||||
#if defined(LV_GC_INCLUDE)
|
||||
#include LV_GC_INCLUDE
|
||||
@@ -139,8 +140,8 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
disp->act_scr = lv_obj_create(NULL, NULL); /*Create a default screen on the display*/
|
||||
disp->top_layer = lv_obj_create(NULL, NULL); /*Create top layer on the display*/
|
||||
disp->sys_layer = lv_obj_create(NULL, NULL); /*Create sys layer on the display*/
|
||||
lv_obj_add_style_class(disp->top_layer, LV_OBJ_PART_MAIN, &lv_style_transp);
|
||||
lv_obj_add_style_class(disp->sys_layer, LV_OBJ_PART_MAIN, &lv_style_transp);
|
||||
lv_obj_add_style_class(disp->top_layer, LV_OBJ_PART_MAIN, _t(SCR_TRANSP));
|
||||
lv_obj_add_style_class(disp->sys_layer, LV_OBJ_PART_MAIN, _t(SCR_TRANSP));
|
||||
|
||||
lv_obj_invalidate(disp->act_scr);
|
||||
|
||||
|
||||
@@ -113,17 +113,8 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_click(new_btn, true); /*Be sure the button is clickable*/
|
||||
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
// lv_btn_set_style(new_btn, LV_BTN_STYLE_REL, th->style.btn.rel);
|
||||
// lv_btn_set_style(new_btn, LV_BTN_STYLE_PR, th->style.btn.pr);
|
||||
// lv_btn_set_style(new_btn, LV_BTN_STYLE_TGL_REL, th->style.btn.tgl_rel);
|
||||
// lv_btn_set_style(new_btn, LV_BTN_STYLE_TGL_PR, th->style.btn.tgl_pr);
|
||||
// lv_btn_set_style(new_btn, LV_BTN_STYLE_INA, th->style.btn.ina);
|
||||
} else {
|
||||
lv_obj_reset_style(new_btn, LV_BTN_PART_MAIN);
|
||||
lv_obj_add_style_class(new_btn, LV_BTN_PART_MAIN, &lv_style_btn);
|
||||
}
|
||||
lv_obj_reset_style(new_btn, LV_BTN_PART_MAIN);
|
||||
lv_obj_add_style_class(new_btn, LV_BTN_PART_MAIN, _t(BTN));
|
||||
}
|
||||
/*Copy 'copy'*/
|
||||
else {
|
||||
|
||||
@@ -108,23 +108,13 @@ lv_obj_t * lv_btnm_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
lv_obj_set_size(new_btnm, LV_DPI * 3, LV_DPI * 2);
|
||||
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
// lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BG, th->style.btnm.bg);
|
||||
// lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_REL, th->style.btnm.btn.rel);
|
||||
// lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_PR, th->style.btnm.btn.pr);
|
||||
// lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_TGL_REL, th->style.btnm.btn.tgl_rel);
|
||||
// lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_TGL_PR, th->style.btnm.btn.tgl_pr);
|
||||
// lv_btnm_set_style(new_btnm, LV_BTNM_STYLE_BTN_INA, th->style.btnm.btn.ina);
|
||||
} else {
|
||||
lv_obj_reset_style(new_btnm, LV_BTNM_PART_MAIN);
|
||||
lv_obj_add_style_class(new_btnm, LV_BTNM_PART_MAIN, &lv_style_panel);
|
||||
lv_obj_reset_style(new_btnm, LV_BTNM_PART_MAIN);
|
||||
lv_obj_add_style_class(new_btnm, LV_BTNM_PART_MAIN, _t(BTNM));
|
||||
|
||||
/* Do not cache the button style because it's independent from the object's style.
|
||||
* (Therefore it can't be cached)*/
|
||||
ext->style_btn.cache.enabled = 0;
|
||||
lv_obj_add_style_class(new_btnm, LV_BTNM_PART_BTN, &lv_style_btn);
|
||||
}
|
||||
/* Do not cache the button style because it's independent from the object's style.
|
||||
* (Therefore it can't be cached)*/
|
||||
ext->style_btn.cache.enabled = 0;
|
||||
lv_obj_add_style_class(new_btnm, LV_BTNM_PART_BTN, _t(BTNM_BTN));
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
else {
|
||||
|
||||
@@ -97,12 +97,8 @@ lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
if(copy == NULL) {
|
||||
/*Set the default styles if it's not screen*/
|
||||
if(par != NULL) {
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
// lv_cont_set_style(new_cont, LV_CONT_PART_MAIN, th->style_dsc.cont);
|
||||
} else {
|
||||
lv_obj_add_style_class(new_cont, LV_CONT_PART_MAIN, &lv_style_panel);
|
||||
}
|
||||
lv_obj_reset_style(new_cont, LV_CONT_PART_MAIN);
|
||||
lv_obj_add_style_class(new_cont, LV_CONT_PART_MAIN, _t(PANEL));
|
||||
}
|
||||
}
|
||||
/*Copy an existing object*/
|
||||
|
||||
@@ -95,23 +95,25 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
}
|
||||
|
||||
ext->scrl = NULL;
|
||||
lv_style_dsc_init(&ext->sb.style);
|
||||
ext->sb.hor_draw = 0;
|
||||
ext->sb.ver_draw = 0;
|
||||
// ext->sb.style = &lv_style_pretty;
|
||||
ext->sb.mode = LV_SB_MODE_AUTO;
|
||||
#if LV_USE_ANIMATION
|
||||
lv_style_dsc_init(&ext->edge_flash.style);
|
||||
ext->edge_flash.enabled = 0;
|
||||
ext->edge_flash.bottom_ip = 0;
|
||||
ext->edge_flash.top_ip = 0;
|
||||
ext->edge_flash.left_ip = 0;
|
||||
ext->edge_flash.right_ip = 0;
|
||||
ext->edge_flash.state = 0;
|
||||
ext->edge_flash.style = &lv_style_plain_color;
|
||||
ext->anim_time = LV_PAGE_DEF_ANIM_TIME;
|
||||
#endif
|
||||
ext->scroll_prop = 0;
|
||||
ext->scroll_prop_obj = NULL;
|
||||
|
||||
|
||||
|
||||
/*Init the new page object*/
|
||||
if(copy == NULL) {
|
||||
ext->scrl = lv_cont_create(new_page, NULL);
|
||||
@@ -132,23 +134,6 @@ lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
|
||||
|
||||
lv_obj_refresh_style(new_page, LV_OBJ_PART_ALL);
|
||||
|
||||
/*Set the default styles*/
|
||||
lv_theme_t * th = lv_theme_get_current();
|
||||
if(th) {
|
||||
if(par == NULL) { /*Different styles if it is screen*/
|
||||
// lv_page_set_style(new_page, LV_PAGE_STYLE_BG, th->style.bg);
|
||||
// lv_page_set_style(new_page, LV_PAGE_STYLE_SCRL, &lv_style_transp);
|
||||
} else {
|
||||
// lv_page_set_style(new_page, LV_PAGE_STYLE_BG, th->style.page.bg);
|
||||
// lv_page_set_style(new_page, LV_PAGE_STYLE_SCRL, th->style.page.scrl);
|
||||
}
|
||||
// lv_page_set_style(new_page, LV_PAGE_STYLE_SCRL_BAR, th->style.page.sb);
|
||||
} else {
|
||||
// lv_page_set_style(new_page, LV_PAGE_STYLE_BG, &lv_style_pretty_color);
|
||||
// lv_page_set_style(new_page, LV_PAGE_STYLE_SCRL, &lv_style_pretty);
|
||||
// lv_page_set_style(new_page, LV_PAGE_STYLE_SB, &lv_style_pretty_color);
|
||||
}
|
||||
|
||||
} else {
|
||||
lv_page_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
|
||||
ext->scrl = lv_cont_create(new_page, copy_ext->scrl);
|
||||
|
||||
@@ -24,21 +24,7 @@
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
#if LV_THEME_LIVE_UPDATE == 0
|
||||
static lv_theme_t * current_theme;
|
||||
#else
|
||||
/* If live update is used then a big `lv_style_t` array is used to store the real styles of the
|
||||
* theme not only pointers. On `lv_theme_set_current` the styles of the theme are copied to this
|
||||
* array. The pointers in `current_theme` are initialized to point to the styles in the array. This
|
||||
* way the theme styles will always point to the same memory address even after theme is change.
|
||||
* (The pointers in the theme points to the styles declared by the theme itself) */
|
||||
|
||||
/* Store the styles in this array. */
|
||||
static lv_style_t th_styles[LV_THEME_STYLE_COUNT];
|
||||
static bool inited = false;
|
||||
static lv_theme_t current_theme;
|
||||
#endif
|
||||
static lv_theme_t * act_theme;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
@@ -53,70 +39,23 @@ static lv_theme_t current_theme;
|
||||
* From now, all the created objects will use styles from this theme by default
|
||||
* @param th pointer to theme (return value of: 'lv_theme_init_xxx()')
|
||||
*/
|
||||
void lv_theme_set_current(lv_theme_t * th)
|
||||
void lv_theme_set_act(lv_theme_t * th)
|
||||
{
|
||||
#if LV_THEME_LIVE_UPDATE == 0
|
||||
current_theme = th;
|
||||
|
||||
#if LV_USE_GROUP
|
||||
/*Copy group style modification callback functions*/
|
||||
memcpy(¤t_theme->group, &th->group, sizeof(th->group));
|
||||
#endif
|
||||
|
||||
/*Let the object know their style might change*/
|
||||
lv_obj_report_style_mod(NULL);
|
||||
|
||||
#else
|
||||
uint32_t style_num = sizeof(th->style) / sizeof(lv_style_t *); /*Number of styles in a theme*/
|
||||
|
||||
if(!inited) {
|
||||
/*Initialize the style pointers `current_theme` to point to the `th_styles` style array */
|
||||
uint16_t i;
|
||||
lv_style_t ** cur_th_style_p = (lv_style_t **)¤t_theme.style;
|
||||
for(i = 0; i < style_num; i++) {
|
||||
uintptr_t adr = (uintptr_t)&th_styles[i];
|
||||
memcpy(&cur_th_style_p[i], &adr, sizeof(lv_style_t *));
|
||||
}
|
||||
inited = true;
|
||||
}
|
||||
|
||||
/*Copy the styles pointed by the new theme to the `th_styles` style array*/
|
||||
uint16_t i;
|
||||
lv_style_t ** th_style = (lv_style_t **)&th->style;
|
||||
for(i = 0; i < style_num; i++) {
|
||||
uintptr_t s = (uintptr_t)th_style[i];
|
||||
if(s) memcpy(&th_styles[i], (void *)s, sizeof(lv_style_t));
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
/*Copy group style modification callback functions*/
|
||||
memcpy(¤t_theme.group, &th->group, sizeof(th->group));
|
||||
#endif
|
||||
|
||||
/*Let the object know their style might change*/
|
||||
lv_obj_report_style_mod(NULL);
|
||||
|
||||
#endif
|
||||
|
||||
#if LV_USE_GROUP
|
||||
lv_group_report_style_mod(NULL);
|
||||
#endif
|
||||
act_theme = th;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current system theme.
|
||||
* @return pointer to the current system theme. NULL if not set.
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_current(void)
|
||||
lv_theme_t * lv_theme_get_act(void)
|
||||
{
|
||||
#if LV_THEME_LIVE_UPDATE == 0
|
||||
return current_theme;
|
||||
#else
|
||||
if(!inited)
|
||||
return NULL;
|
||||
else
|
||||
return ¤t_theme;
|
||||
#endif
|
||||
return act_theme;
|
||||
}
|
||||
|
||||
lv_style_t * lv_theme_get_style(lv_theme_style_t name)
|
||||
{
|
||||
return act_theme->get_style_cb(name);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
||||
@@ -16,7 +16,6 @@ extern "C" {
|
||||
#include "../lv_conf_internal.h"
|
||||
|
||||
#include "../lv_core/lv_style.h"
|
||||
#include "../lv_core/lv_group.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
@@ -32,308 +31,37 @@ extern "C" {
|
||||
* There is a style for each object type, as well as a generic style for
|
||||
* backgrounds and panels.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
struct
|
||||
{
|
||||
lv_style_t * scr;
|
||||
lv_style_t * bg;
|
||||
lv_style_t * panel;
|
||||
typedef enum {
|
||||
LV_THEME_SCR,
|
||||
LV_THEME_SCR_TRANSP,
|
||||
|
||||
#if LV_USE_CONT != 0
|
||||
lv_style_t * cont;
|
||||
#endif
|
||||
LV_THEME_PANEL,
|
||||
LV_THEME_PANEL_TRANSP,
|
||||
LV_THEME_PANEL_FRAME,
|
||||
LV_THEME_PANEL_TIGHT,
|
||||
LV_THEME_PANEL_FIT,
|
||||
|
||||
#if LV_USE_BTN != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
lv_style_t * tgl_rel;
|
||||
lv_style_t * tgl_pr;
|
||||
lv_style_t * ina;
|
||||
} btn;
|
||||
#endif
|
||||
LV_THEME_BTN,
|
||||
LV_THEME_BTN_DANGER,
|
||||
LV_THEME_BTN_APPROVE,
|
||||
LV_THEME_BTN_TRANSP,
|
||||
LV_THEME_BTN_FRAME,
|
||||
LV_THEME_BTN_LARGE,
|
||||
LV_THEME_BTN_SMALL,
|
||||
|
||||
#if LV_USE_IMGBTN != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
lv_style_t * tgl_rel;
|
||||
lv_style_t * tgl_pr;
|
||||
lv_style_t * ina;
|
||||
} imgbtn;
|
||||
#endif
|
||||
LV_THEME_LABEL,
|
||||
LV_THEME_LABEL_TITLE,
|
||||
LV_THEME_LABEL_HINT,
|
||||
|
||||
#if LV_USE_LABEL != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * prim;
|
||||
lv_style_t * sec;
|
||||
lv_style_t * hint;
|
||||
} label;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMG != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * light;
|
||||
lv_style_t * dark;
|
||||
} img;
|
||||
#endif
|
||||
LV_THEME_BTNM,
|
||||
LV_THEME_BTNM_BTN,
|
||||
|
||||
#if LV_USE_LINE != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * decor;
|
||||
} line;
|
||||
#endif
|
||||
}lv_theme_style_t;
|
||||
|
||||
#if LV_USE_LED != 0
|
||||
lv_style_t * led;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BAR != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * indic;
|
||||
} bar;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SLIDER != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * indic;
|
||||
lv_style_t * knob;
|
||||
} slider;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LMETER != 0
|
||||
lv_style_t * lmeter;
|
||||
#endif
|
||||
|
||||
#if LV_USE_GAUGE != 0
|
||||
lv_style_t * gauge;
|
||||
#endif
|
||||
|
||||
#if LV_USE_ARC != 0
|
||||
lv_style_t * arc;
|
||||
#endif
|
||||
|
||||
#if LV_USE_PRELOAD != 0
|
||||
lv_style_t * preload;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SW != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * indic;
|
||||
lv_style_t * knob_off;
|
||||
lv_style_t * knob_on;
|
||||
} sw;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHART != 0
|
||||
lv_style_t * chart;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CALENDAR != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * header;
|
||||
lv_style_t * header_pr;
|
||||
lv_style_t * day_names;
|
||||
lv_style_t * highlighted_days;
|
||||
lv_style_t * inactive_days;
|
||||
lv_style_t * week_box;
|
||||
lv_style_t * today_box;
|
||||
} calendar;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CB != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
struct
|
||||
{
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
lv_style_t * tgl_rel;
|
||||
lv_style_t * tgl_pr;
|
||||
lv_style_t * ina;
|
||||
} box;
|
||||
} cb;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTNM != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
struct
|
||||
{
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
lv_style_t * tgl_rel;
|
||||
lv_style_t * tgl_pr;
|
||||
lv_style_t * ina;
|
||||
} btn;
|
||||
} btnm;
|
||||
#endif
|
||||
|
||||
#if LV_USE_KB != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
struct
|
||||
{
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
lv_style_t * tgl_rel;
|
||||
lv_style_t * tgl_pr;
|
||||
lv_style_t * ina;
|
||||
} btn;
|
||||
} kb;
|
||||
#endif
|
||||
|
||||
#if LV_USE_MBOX != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
} btn;
|
||||
} mbox;
|
||||
#endif
|
||||
|
||||
#if LV_USE_PAGE != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * scrl;
|
||||
lv_style_t * sb;
|
||||
} page;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TA != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * area;
|
||||
lv_style_t * oneline;
|
||||
lv_style_t * cursor;
|
||||
lv_style_t * sb;
|
||||
} ta;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SPINBOX != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * cursor;
|
||||
lv_style_t * sb;
|
||||
} spinbox;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LIST
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * scrl;
|
||||
lv_style_t * sb;
|
||||
struct
|
||||
{
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
lv_style_t * tgl_rel;
|
||||
lv_style_t * tgl_pr;
|
||||
lv_style_t * ina;
|
||||
} btn;
|
||||
} list;
|
||||
#endif
|
||||
|
||||
#if LV_USE_DDLIST != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * sel;
|
||||
lv_style_t * sb;
|
||||
} ddlist;
|
||||
#endif
|
||||
|
||||
#if LV_USE_ROLLER != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * sel;
|
||||
} roller;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TABVIEW != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * indic;
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
lv_style_t * tgl_rel;
|
||||
lv_style_t * tgl_pr;
|
||||
} btn;
|
||||
} tabview;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * scrl;
|
||||
lv_style_t * sb;
|
||||
} tileview;
|
||||
#endif
|
||||
|
||||
#if LV_USE_TABLE != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * cell;
|
||||
} table;
|
||||
#endif
|
||||
|
||||
#if LV_USE_WIN != 0
|
||||
struct
|
||||
{
|
||||
lv_style_t * bg;
|
||||
lv_style_t * sb;
|
||||
lv_style_t * header;
|
||||
lv_style_t * content;
|
||||
struct
|
||||
{
|
||||
lv_style_t * rel;
|
||||
lv_style_t * pr;
|
||||
} btn;
|
||||
} win;
|
||||
#endif
|
||||
} style;
|
||||
|
||||
#if LV_USE_GROUP
|
||||
struct
|
||||
{
|
||||
/* The `x` in the names inidicates that inconsistence becasue
|
||||
* the group related function are stored in the theme.*/
|
||||
lv_group_style_mod_cb_t style_mod_xcb;
|
||||
lv_group_style_mod_cb_t style_mod_edit_xcb;
|
||||
} group;
|
||||
#endif
|
||||
} lv_theme_t;
|
||||
typedef struct {
|
||||
lv_style_t * (*get_style_cb)(lv_theme_style_t);
|
||||
}lv_theme_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@@ -344,20 +72,20 @@ typedef struct
|
||||
* From now, all the created objects will use styles from this theme by default
|
||||
* @param th pointer to theme (return value of: 'lv_theme_init_xxx()')
|
||||
*/
|
||||
void lv_theme_set_current(lv_theme_t * th);
|
||||
void lv_theme_set_act(lv_theme_t * th);
|
||||
|
||||
/**
|
||||
* Get the current system theme.
|
||||
* @return pointer to the current system theme. NULL if not set.
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_current(void);
|
||||
lv_theme_t * lv_theme_get_act(void);
|
||||
|
||||
lv_style_t * lv_theme_get_style(lv_theme_style_t name);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/* Returns number of styles within the `lv_theme_t` structure. */
|
||||
#define LV_THEME_STYLE_COUNT (sizeof(((lv_theme_t *)0)->style) / sizeof(lv_style_t *))
|
||||
#define _t(name) lv_theme_get_style(LV_THEME_ ## name)
|
||||
|
||||
/**********************
|
||||
* POST INCLUDE
|
||||
|
||||
@@ -26,13 +26,12 @@
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static uint16_t _hue;
|
||||
static lv_font_t * _font;
|
||||
|
||||
static lv_theme_t theme;
|
||||
|
||||
static lv_style_t scr;
|
||||
static lv_style_t transp;
|
||||
static lv_style_t def;
|
||||
static lv_style_t bg;
|
||||
static lv_style_t scr;
|
||||
static lv_style_t panel; /*General fancy background (e.g. to chart or ta)*/
|
||||
static lv_style_t sb;
|
||||
static lv_style_t btn_rel, btn_pr, btn_trel, btn_tpr, btn_ina;
|
||||
@@ -67,169 +66,118 @@ static lv_style_t btnm_bg, btnm_rel, btnm_pr, btnm_trel, btnm_ina;
|
||||
|
||||
static void basic_init(void)
|
||||
{
|
||||
/*Default*/
|
||||
lv_style_copy(&def, &lv_style_plain);
|
||||
def.body.opa = LV_OPA_COVER;
|
||||
def.glass = 0;
|
||||
lv_style_init(&scr);
|
||||
lv_style_set_color(&scr, LV_STYLE_BG_COLOR, LV_COLOR_MAKE(0xF0, 0x90, 0x20));
|
||||
lv_style_set_color(&scr, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE);
|
||||
|
||||
def.body.main_color = lv_color_hex3(0x222);
|
||||
def.body.grad_color = lv_color_hex3(0x222);
|
||||
def.body.radius = 0;
|
||||
def.body.padding.left = LV_DPI / 8;
|
||||
def.body.padding.right = LV_DPI / 8;
|
||||
def.body.padding.top = LV_DPI / 8;
|
||||
def.body.padding.bottom = LV_DPI / 8;
|
||||
def.body.padding.inner = LV_DPI / 8;
|
||||
def.body.border.color = LV_COLOR_SILVER;
|
||||
def.body.border.width = 1;
|
||||
def.body.border.opa = LV_OPA_COVER;
|
||||
def.body.shadow.color = LV_COLOR_SILVER;
|
||||
def.body.shadow.width = 0;
|
||||
|
||||
def.text.color = lv_color_hex3(0xDDD);
|
||||
def.text.font = _font;
|
||||
def.text.letter_space = 1;
|
||||
def.text.line_space = 2;
|
||||
lv_style_init(&transp);
|
||||
lv_style_set_value(&transp, LV_STYLE_BG_OPA, LV_OPA_TRANSP);
|
||||
lv_style_set_value(&transp, LV_STYLE_BORDER_WIDTH, 0);
|
||||
|
||||
def.image.color = lv_color_hex3(0xDDD);
|
||||
def.image.intense = LV_OPA_TRANSP;
|
||||
lv_style_init(&panel);
|
||||
lv_style_set_value(&panel, LV_STYLE_PAD_LEFT, LV_DPI / 20);
|
||||
lv_style_set_value(&panel, LV_STYLE_PAD_RIGHT, LV_DPI / 20);
|
||||
lv_style_set_value(&panel, LV_STYLE_PAD_TOP, LV_DPI / 20);
|
||||
lv_style_set_value(&panel, LV_STYLE_PAD_BOTTOM, LV_DPI / 20);
|
||||
lv_style_set_value(&panel, LV_STYLE_PAD_INNER, LV_DPI / 20);
|
||||
lv_style_set_value(&panel, LV_STYLE_RADIUS, LV_DPI / 16);
|
||||
lv_style_set_value(&panel, LV_STYLE_BORDER_WIDTH, LV_DPI / 50 > 0 ? LV_DPI / 50 : 1);
|
||||
lv_style_set_color(&panel, LV_STYLE_BG_COLOR, LV_COLOR_SILVER);
|
||||
lv_style_set_color(&panel, LV_STYLE_BG_GRAD_COLOR, LV_COLOR_GRAY);
|
||||
lv_style_set_color(&panel, LV_STYLE_BORDER_COLOR, LV_COLOR_GRAY);
|
||||
lv_style_set_color(&panel, LV_STYLE_TEXT_COLOR, LV_COLOR_BLACK);
|
||||
|
||||
def.line.color = lv_color_hex3(0xDDD);
|
||||
def.line.width = 1;
|
||||
|
||||
/*Background*/
|
||||
lv_style_copy(&bg, &def);
|
||||
bg.body.main_color = lv_color_hex3(0x333);
|
||||
bg.body.grad_color = lv_color_hex3(0x333);
|
||||
bg.body.border.width = 2;
|
||||
bg.body.border.color = lv_color_hex3(0x666);
|
||||
bg.body.shadow.color = LV_COLOR_SILVER;
|
||||
|
||||
lv_style_copy(&scr, &bg);
|
||||
scr.body.padding.bottom = 0;
|
||||
scr.body.padding.top = 0;
|
||||
scr.body.padding.left = 0;
|
||||
scr.body.padding.right = 0;
|
||||
|
||||
/*Panel*/
|
||||
lv_style_copy(&panel, &def);
|
||||
panel.body.radius = LV_DPI / 10;
|
||||
panel.body.main_color = lv_color_hex3(0x666);
|
||||
panel.body.grad_color = lv_color_hex3(0x666);
|
||||
panel.body.border.color = lv_color_hex3(0xccc);
|
||||
panel.body.border.width = 2;
|
||||
panel.body.border.opa = LV_OPA_60;
|
||||
panel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
panel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
panel.line.color = lv_color_hsv_to_rgb(_hue, 20, 70);
|
||||
|
||||
/*Scrollbar*/
|
||||
lv_style_copy(&sb, &def);
|
||||
sb.body.opa = LV_OPA_50;
|
||||
sb.body.radius = LV_RADIUS_CIRCLE;
|
||||
sb.body.border.color = LV_COLOR_SILVER;
|
||||
sb.body.border.opa = LV_OPA_40;
|
||||
sb.body.border.width = 1;
|
||||
sb.body.main_color = lv_color_hsv_to_rgb(_hue, 33, 92);
|
||||
sb.body.grad_color = lv_color_hsv_to_rgb(_hue, 33, 92);
|
||||
sb.body.padding.left = 1;
|
||||
sb.body.padding.right = 1;
|
||||
sb.body.padding.top = 1;
|
||||
sb.body.padding.bottom = 1;
|
||||
sb.body.padding.inner = LV_DPI / 15; /*Scrollbar width*/
|
||||
|
||||
theme.style.bg = &bg;
|
||||
theme.style.scr = &scr;
|
||||
theme.style.panel = &panel;
|
||||
}
|
||||
|
||||
static void cont_init(void)
|
||||
{
|
||||
#if LV_USE_CONT != 0
|
||||
theme.style.cont = &panel;
|
||||
// theme.style.cont = &panel;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void btn_init(void)
|
||||
{
|
||||
#if LV_USE_BTN != 0
|
||||
lv_style_copy(&btn_rel, &def);
|
||||
btn_rel.glass = 0;
|
||||
btn_rel.body.opa = LV_OPA_TRANSP;
|
||||
btn_rel.body.radius = LV_RADIUS_CIRCLE;
|
||||
btn_rel.body.border.width = 2;
|
||||
btn_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 70, 90);
|
||||
btn_rel.body.border.opa = LV_OPA_80;
|
||||
btn_rel.body.padding.left = LV_DPI / 4;
|
||||
btn_rel.body.padding.right = LV_DPI / 4;
|
||||
btn_rel.body.padding.top = LV_DPI / 6;
|
||||
btn_rel.body.padding.bottom = LV_DPI / 6;
|
||||
btn_rel.body.padding.inner = LV_DPI / 10;
|
||||
btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
btn_rel.text.font = _font;
|
||||
btn_rel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
|
||||
lv_style_copy(&btn_pr, &btn_rel);
|
||||
btn_pr.body.opa = LV_OPA_COVER;
|
||||
btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 50);
|
||||
btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 50);
|
||||
btn_pr.body.border.opa = LV_OPA_60;
|
||||
btn_pr.text.font = _font;
|
||||
btn_pr.text.color = lv_color_hsv_to_rgb(_hue, 10, 100);
|
||||
btn_pr.image.color = lv_color_hsv_to_rgb(_hue, 10, 100);
|
||||
|
||||
lv_style_copy(&btn_trel, &btn_pr);
|
||||
btn_trel.body.opa = LV_OPA_COVER;
|
||||
btn_trel.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 60);
|
||||
btn_trel.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 60);
|
||||
btn_trel.body.border.opa = LV_OPA_60;
|
||||
btn_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 90);
|
||||
btn_trel.text.font = _font;
|
||||
btn_trel.text.color = lv_color_hsv_to_rgb(_hue, 0, 100);
|
||||
btn_trel.image.color = lv_color_hsv_to_rgb(_hue, 0, 100);
|
||||
|
||||
lv_style_copy(&btn_tpr, &btn_trel);
|
||||
btn_tpr.body.opa = LV_OPA_COVER;
|
||||
btn_tpr.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 50);
|
||||
btn_tpr.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 50);
|
||||
btn_tpr.body.border.opa = LV_OPA_60;
|
||||
btn_tpr.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
btn_tpr.text.font = _font;
|
||||
btn_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
btn_tpr.image.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
|
||||
lv_style_copy(&btn_ina, &btn_rel);
|
||||
btn_ina.body.border.opa = LV_OPA_60;
|
||||
btn_ina.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 50);
|
||||
btn_ina.text.font = _font;
|
||||
btn_ina.text.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
|
||||
theme.style.btn.rel = &btn_rel;
|
||||
theme.style.btn.pr = &btn_pr;
|
||||
theme.style.btn.tgl_rel = &btn_trel;
|
||||
theme.style.btn.tgl_pr = &btn_tpr;
|
||||
theme.style.btn.ina = &btn_ina;
|
||||
// lv_style_copy(&btn_rel, &def);
|
||||
// btn_rel.glass = 0;
|
||||
// btn_rel.body.opa = LV_OPA_TRANSP;
|
||||
// btn_rel.body.radius = LV_RADIUS_CIRCLE;
|
||||
// btn_rel.body.border.width = 2;
|
||||
// btn_rel.body.border.color = lv_color_hsv_to_rgb(_hue, 70, 90);
|
||||
// btn_rel.body.border.opa = LV_OPA_80;
|
||||
// btn_rel.body.padding.left = LV_DPI / 4;
|
||||
// btn_rel.body.padding.right = LV_DPI / 4;
|
||||
// btn_rel.body.padding.top = LV_DPI / 6;
|
||||
// btn_rel.body.padding.bottom = LV_DPI / 6;
|
||||
// btn_rel.body.padding.inner = LV_DPI / 10;
|
||||
// btn_rel.text.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
// btn_rel.text.font = _font;
|
||||
// btn_rel.image.color = lv_color_hsv_to_rgb(_hue, 8, 96);
|
||||
//
|
||||
// lv_style_copy(&btn_pr, &btn_rel);
|
||||
// btn_pr.body.opa = LV_OPA_COVER;
|
||||
// btn_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 50);
|
||||
// btn_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 50);
|
||||
// btn_pr.body.border.opa = LV_OPA_60;
|
||||
// btn_pr.text.font = _font;
|
||||
// btn_pr.text.color = lv_color_hsv_to_rgb(_hue, 10, 100);
|
||||
// btn_pr.image.color = lv_color_hsv_to_rgb(_hue, 10, 100);
|
||||
//
|
||||
// lv_style_copy(&btn_trel, &btn_pr);
|
||||
// btn_trel.body.opa = LV_OPA_COVER;
|
||||
// btn_trel.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 60);
|
||||
// btn_trel.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 60);
|
||||
// btn_trel.body.border.opa = LV_OPA_60;
|
||||
// btn_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 90);
|
||||
// btn_trel.text.font = _font;
|
||||
// btn_trel.text.color = lv_color_hsv_to_rgb(_hue, 0, 100);
|
||||
// btn_trel.image.color = lv_color_hsv_to_rgb(_hue, 0, 100);
|
||||
//
|
||||
// lv_style_copy(&btn_tpr, &btn_trel);
|
||||
// btn_tpr.body.opa = LV_OPA_COVER;
|
||||
// btn_tpr.body.main_color = lv_color_hsv_to_rgb(_hue, 50, 50);
|
||||
// btn_tpr.body.grad_color = lv_color_hsv_to_rgb(_hue, 50, 50);
|
||||
// btn_tpr.body.border.opa = LV_OPA_60;
|
||||
// btn_tpr.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 70);
|
||||
// btn_tpr.text.font = _font;
|
||||
// btn_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
// btn_tpr.image.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
//
|
||||
// lv_style_copy(&btn_ina, &btn_rel);
|
||||
// btn_ina.body.border.opa = LV_OPA_60;
|
||||
// btn_ina.body.border.color = lv_color_hsv_to_rgb(_hue, 10, 50);
|
||||
// btn_ina.text.font = _font;
|
||||
// btn_ina.text.color = lv_color_hsv_to_rgb(_hue, 10, 90);
|
||||
//
|
||||
// theme.style.btn.rel = &btn_rel;
|
||||
// theme.style.btn.pr = &btn_pr;
|
||||
// theme.style.btn.tgl_rel = &btn_trel;
|
||||
// theme.style.btn.tgl_pr = &btn_tpr;
|
||||
// theme.style.btn.ina = &btn_ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void label_init(void)
|
||||
{
|
||||
#if LV_USE_LABEL != 0
|
||||
static lv_style_t label_prim, label_sec, label_hint;
|
||||
|
||||
lv_style_copy(&label_prim, &def);
|
||||
label_prim.text.font = _font;
|
||||
label_prim.text.color = lv_color_hsv_to_rgb(_hue, 80, 96);
|
||||
|
||||
lv_style_copy(&label_sec, &label_prim);
|
||||
label_sec.text.color = lv_color_hsv_to_rgb(_hue, 40, 85);
|
||||
|
||||
lv_style_copy(&label_hint, &label_prim);
|
||||
label_hint.text.color = lv_color_hsv_to_rgb(_hue, 20, 70);
|
||||
|
||||
theme.style.label.prim = &label_prim;
|
||||
theme.style.label.sec = &label_sec;
|
||||
theme.style.label.hint = &label_hint;
|
||||
// static lv_style_t label_prim, label_sec, label_hint;
|
||||
//
|
||||
// lv_style_copy(&label_prim, &def);
|
||||
// label_prim.text.font = _font;
|
||||
// label_prim.text.color = lv_color_hsv_to_rgb(_hue, 80, 96);
|
||||
//
|
||||
// lv_style_copy(&label_sec, &label_prim);
|
||||
// label_sec.text.color = lv_color_hsv_to_rgb(_hue, 40, 85);
|
||||
//
|
||||
// lv_style_copy(&label_hint, &label_prim);
|
||||
// label_hint.text.color = lv_color_hsv_to_rgb(_hue, 20, 70);
|
||||
//
|
||||
// theme.style.label.prim = &label_prim;
|
||||
// theme.style.label.sec = &label_sec;
|
||||
// theme.style.label.hint = &label_hint;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -543,38 +491,38 @@ static void cb_init(void)
|
||||
static void btnm_init(void)
|
||||
{
|
||||
#if LV_USE_BTNM
|
||||
lv_style_copy(&btnm_bg, &lv_style_transp_tight);
|
||||
btnm_bg.body.border.width = 1;
|
||||
btnm_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 80);
|
||||
btnm_bg.body.border.opa = LV_OPA_COVER;
|
||||
btnm_bg.body.radius = LV_DPI / 8;
|
||||
|
||||
lv_style_copy(&btnm_rel, &lv_style_plain);
|
||||
btnm_rel.body.opa = LV_OPA_TRANSP;
|
||||
btnm_rel.body.radius = LV_DPI / 8;
|
||||
btnm_rel.text.color = lv_color_hsv_to_rgb(_hue, 60, 80);
|
||||
btnm_rel.text.font = _font;
|
||||
|
||||
lv_style_copy(&btnm_pr, &lv_style_plain);
|
||||
btnm_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 70);
|
||||
btnm_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 40, 70);
|
||||
btnm_pr.body.radius = LV_DPI / 8;
|
||||
btnm_pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 40);
|
||||
btnm_pr.text.font = _font;
|
||||
|
||||
lv_style_copy(&btnm_trel, &btnm_rel);
|
||||
btnm_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 80);
|
||||
btnm_trel.body.border.width = 3;
|
||||
|
||||
lv_style_copy(&btnm_ina, &btnm_rel);
|
||||
btnm_ina.text.color = lv_color_hsv_to_rgb(_hue, 10, 60);
|
||||
|
||||
theme.style.btnm.bg = &btnm_bg;
|
||||
theme.style.btnm.btn.rel = &btnm_rel;
|
||||
theme.style.btnm.btn.pr = &btnm_pr;
|
||||
theme.style.btnm.btn.tgl_rel = &btnm_trel;
|
||||
theme.style.btnm.btn.tgl_pr = &btnm_pr;
|
||||
theme.style.btnm.btn.ina = &btnm_ina;
|
||||
// lv_style_copy(&btnm_bg, &lv_style_transp_tight);
|
||||
// btnm_bg.body.border.width = 1;
|
||||
// btnm_bg.body.border.color = lv_color_hsv_to_rgb(_hue, 60, 80);
|
||||
// btnm_bg.body.border.opa = LV_OPA_COVER;
|
||||
// btnm_bg.body.radius = LV_DPI / 8;
|
||||
//
|
||||
// lv_style_copy(&btnm_rel, &lv_style_plain);
|
||||
// btnm_rel.body.opa = LV_OPA_TRANSP;
|
||||
// btnm_rel.body.radius = LV_DPI / 8;
|
||||
// btnm_rel.text.color = lv_color_hsv_to_rgb(_hue, 60, 80);
|
||||
// btnm_rel.text.font = _font;
|
||||
//
|
||||
// lv_style_copy(&btnm_pr, &lv_style_plain);
|
||||
// btnm_pr.body.main_color = lv_color_hsv_to_rgb(_hue, 40, 70);
|
||||
// btnm_pr.body.grad_color = lv_color_hsv_to_rgb(_hue, 40, 70);
|
||||
// btnm_pr.body.radius = LV_DPI / 8;
|
||||
// btnm_pr.text.color = lv_color_hsv_to_rgb(_hue, 40, 40);
|
||||
// btnm_pr.text.font = _font;
|
||||
//
|
||||
// lv_style_copy(&btnm_trel, &btnm_rel);
|
||||
// btnm_trel.body.border.color = lv_color_hsv_to_rgb(_hue, 80, 80);
|
||||
// btnm_trel.body.border.width = 3;
|
||||
//
|
||||
// lv_style_copy(&btnm_ina, &btnm_rel);
|
||||
// btnm_ina.text.color = lv_color_hsv_to_rgb(_hue, 10, 60);
|
||||
//
|
||||
// theme.style.btnm.bg = &btnm_bg;
|
||||
// theme.style.btnm.btn.rel = &btnm_rel;
|
||||
// theme.style.btnm.btn.pr = &btnm_pr;
|
||||
// theme.style.btnm.btn.tgl_rel = &btnm_trel;
|
||||
// theme.style.btnm.btn.tgl_pr = &btnm_pr;
|
||||
// theme.style.btnm.btn.ina = &btnm_ina;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -607,9 +555,9 @@ static void mbox_init(void)
|
||||
static void page_init(void)
|
||||
{
|
||||
#if LV_USE_PAGE
|
||||
theme.style.page.bg = &panel;
|
||||
theme.style.page.scrl = &lv_style_transp_fit;
|
||||
theme.style.page.sb = &sb;
|
||||
// theme.style.page.bg = &panel;
|
||||
// theme.style.page.scrl = &lv_style_transp_fit;
|
||||
// theme.style.page.sb = &sb;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -840,46 +788,6 @@ static void win_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_GROUP
|
||||
|
||||
static void style_mod(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#if LV_COLOR_DEPTH != 1
|
||||
/*Make the style to be a little bit orange*/
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = lv_color_hsv_to_rgb(_hue, 70, 90);
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 2;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
{
|
||||
(void)group; /*Unused*/
|
||||
#if LV_COLOR_DEPTH != 1
|
||||
/*Make the style to be a little bit orange*/
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_GREEN;
|
||||
|
||||
/*If not empty or has border then emphasis the border*/
|
||||
if(style->body.opa != LV_OPA_TRANSP || style->body.border.width != 0) style->body.border.width = LV_DPI / 20;
|
||||
|
||||
style->body.main_color = lv_color_mix(style->body.main_color, LV_COLOR_GREEN, LV_OPA_70);
|
||||
style->body.grad_color = lv_color_mix(style->body.grad_color, LV_COLOR_GREEN, LV_OPA_70);
|
||||
style->body.shadow.color = lv_color_mix(style->body.shadow.color, LV_COLOR_GREEN, LV_OPA_60);
|
||||
|
||||
style->text.color = lv_color_mix(style->text.color, LV_COLOR_GREEN, LV_OPA_70);
|
||||
#else
|
||||
style->body.border.opa = LV_OPA_COVER;
|
||||
style->body.border.color = LV_COLOR_BLACK;
|
||||
style->body.border.width = 3;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /*LV_USE_GROUP*/
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
@@ -889,23 +797,9 @@ static void style_mod_edit(lv_group_t * group, lv_style_t * style)
|
||||
* Initialize the alien theme
|
||||
* @param hue [0..360] hue value from HSV color space to define the theme's base color
|
||||
* @param font pointer to a font (NULL to use the default)
|
||||
* @return pointer to the initialized theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font)
|
||||
{
|
||||
if(font == NULL) font = LV_FONT_DEFAULT;
|
||||
|
||||
_hue = hue;
|
||||
_font = font;
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **)&theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
||||
basic_init();
|
||||
cont_init();
|
||||
btn_init();
|
||||
@@ -937,11 +831,8 @@ lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font)
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
#if LV_USE_GROUP
|
||||
theme.group.style_mod_xcb = style_mod;
|
||||
theme.group.style_mod_edit_xcb = style_mod_edit;
|
||||
#endif
|
||||
|
||||
theme.get_style_cb = lv_theme_alien_get_style;
|
||||
return &theme;
|
||||
}
|
||||
|
||||
@@ -949,11 +840,25 @@ lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font)
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_alien(void)
|
||||
lv_theme_t * lv_theme_alien_get(void)
|
||||
{
|
||||
return &theme;
|
||||
}
|
||||
|
||||
lv_style_t * lv_theme_alien_get_style(lv_theme_style_t name)
|
||||
{
|
||||
switch(name) {
|
||||
case LV_THEME_SCR:
|
||||
return &scr;
|
||||
case LV_THEME_SCR_TRANSP:
|
||||
return &transp;
|
||||
case LV_THEME_PANEL:
|
||||
return &panel;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
@@ -33,14 +33,12 @@ extern "C" {
|
||||
* Initialize the alien theme
|
||||
* @param hue [0..360] hue value from HSV color space to define the theme's base color
|
||||
* @param font pointer to a font (NULL to use the default)
|
||||
* @return pointer to the initialized theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font);
|
||||
/**
|
||||
* Get a pointer to the theme
|
||||
* @return pointer to the theme
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_alien(void);
|
||||
|
||||
lv_theme_t * lv_theme_alien_get(void);
|
||||
|
||||
lv_style_t * lv_theme_alien_get_style(lv_theme_style_t name);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
Reference in New Issue
Block a user