mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fi warnigns to make tests run succesfully
This commit is contained in:
parent
0ba7dedeeb
commit
fdfb69f066
@ -536,6 +536,18 @@ typedef void * lv_font_user_data_t;
|
||||
# define LV_SPRINTF_DISABLE_FLOAT 1
|
||||
#endif /*LV_SPRINTF_CUSTOM*/
|
||||
|
||||
/*=================
|
||||
* STYLE SETTINGS
|
||||
*================*/
|
||||
|
||||
/* Enable/Disable caching some information about the most common style properties.
|
||||
* Results in faster drawing but has some memory cost per object per part.
|
||||
* LEVEL 0: no caching
|
||||
* LEVEL 1: mark if a property is different from its default value (uses 4 extra byte)
|
||||
* LEVEL 2: LEVEL 1 + cache the value of some common properties (uses 8 extra bytes)
|
||||
*/
|
||||
#define LV_STYLE_CACHE_LEVEL 0 /*Cache level*/
|
||||
|
||||
/*===================
|
||||
* LV_OBJ SETTINGS
|
||||
*==================*/
|
||||
@ -631,7 +643,16 @@ typedef void * lv_obj_user_data_t;
|
||||
|
||||
/*Linemeter (dependencies: -*/
|
||||
#define LV_USE_LINEMETER 1
|
||||
#if LV_USE_LINEMETER
|
||||
|
||||
/* Set how precisely should the lines of the line meter be calculated.
|
||||
* Higher precision means slower rendering.
|
||||
* 0: normal
|
||||
* 1: extra precision in the inner ring
|
||||
* 2. extra precision on the outer ring too
|
||||
*/
|
||||
# define LV_LINEMETER_PRECISE 1
|
||||
#endif
|
||||
/*Mask (dependencies: -)*/
|
||||
#define LV_USE_OBJMASK 1
|
||||
|
||||
|
11
lvgl.mk
11
lvgl.mk
@ -1 +1,10 @@
|
||||
CSRCS += $(shell find -L lvgl -name \*.c)
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core/lv_core.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_hal/lv_hal.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets/lv_widgets.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_font/lv_font.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_misc/lv_misc.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes/lv_themes.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_draw/lv_draw.mk
|
||||
include $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_gpu/lv_gpu.mk
|
||||
|
||||
|
||||
|
@ -52,18 +52,18 @@
|
||||
*====================*/
|
||||
|
||||
/* Maximal horizontal and vertical resolution to support by the library.*/
|
||||
#ifndef LV_HOR_RES_MAX
|
||||
# ifdef CONFIG_LV_HOR_RES_MAX
|
||||
# define LV_HOR_RES_MAX CONFIG_LV_HOR_RES_MAX
|
||||
#ifndef LV_HOR_RES_DEF
|
||||
# ifdef CONFIG_LV_HOR_RES_DEF
|
||||
# define LV_HOR_RES_DEF CONFIG_LV_HOR_RES_DEF
|
||||
# else
|
||||
# define LV_HOR_RES_MAX (480)
|
||||
# define LV_HOR_RES_DEF (480)
|
||||
# endif
|
||||
#endif
|
||||
#ifndef LV_VER_RES_MAX
|
||||
# ifdef CONFIG_LV_VER_RES_MAX
|
||||
# define LV_VER_RES_MAX CONFIG_LV_VER_RES_MAX
|
||||
#ifndef LV_VER_RES_DEF
|
||||
# ifdef CONFIG_LV_VER_RES_DEF
|
||||
# define LV_VER_RES_DEF CONFIG_LV_VER_RES_DEF
|
||||
# else
|
||||
# define LV_VER_RES_MAX (320)
|
||||
# define LV_VER_RES_DEF (320)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -1149,16 +1149,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*Simple to the create your theme based on it
|
||||
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
|
||||
#ifndef LV_USE_THEME_TEMPLATE
|
||||
# ifdef CONFIG_LV_USE_THEME_TEMPLATE
|
||||
# define LV_USE_THEME_TEMPLATE CONFIG_LV_USE_THEME_TEMPLATE
|
||||
# else
|
||||
# define LV_USE_THEME_TEMPLATE 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* A fast and impressive theme.
|
||||
* Flags:
|
||||
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
|
||||
@ -1392,6 +1382,24 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
#endif
|
||||
#endif /*LV_SPRINTF_CUSTOM*/
|
||||
|
||||
/*=================
|
||||
* STYLE SETTINGS
|
||||
*================*/
|
||||
|
||||
/* Enable/Disable caching some information about the most common style properties.
|
||||
* Results in faster drawing but has some memory cost per object per part.
|
||||
* LEVEL 0: no caching
|
||||
* LEVEL 1: mark if a property is different from its default value (uses 4 extra byte)
|
||||
* LEVEL 2: LEVEL 1 + cache the value of some common properties (uses 8 extra bytes)
|
||||
*/
|
||||
#ifndef LV_STYLE_CACHE_LEVEL
|
||||
# ifdef CONFIG_LV_STYLE_CACHE_LEVEL
|
||||
# define LV_STYLE_CACHE_LEVEL CONFIG_LV_STYLE_CACHE_LEVEL
|
||||
# else
|
||||
# define LV_STYLE_CACHE_LEVEL 0 /*Cache level*/
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*===================
|
||||
* LV_OBJ SETTINGS
|
||||
*==================*/
|
||||
@ -1425,15 +1433,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
|
||||
#ifndef LV_USE_OBJ_REALIGN
|
||||
# ifdef CONFIG_LV_USE_OBJ_REALIGN
|
||||
# define LV_USE_OBJ_REALIGN CONFIG_LV_USE_OBJ_REALIGN
|
||||
# else
|
||||
# define LV_USE_OBJ_REALIGN 1
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Enable to make the object clickable on a larger area.
|
||||
* LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
|
||||
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
|
||||
@ -1637,6 +1636,30 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*Linemeter (dependencies: -*/
|
||||
#ifndef LV_USE_LINEMETER
|
||||
# ifdef CONFIG_LV_USE_LINEMETER
|
||||
# define LV_USE_LINEMETER CONFIG_LV_USE_LINEMETER
|
||||
# else
|
||||
# define LV_USE_LINEMETER 1
|
||||
# endif
|
||||
#endif
|
||||
#if LV_USE_LINEMETER
|
||||
|
||||
/* Set how precisely should the lines of the line meter be calculated.
|
||||
* Higher precision means slower rendering.
|
||||
* 0: normal
|
||||
* 1: extra precision in the inner ring
|
||||
* 2. extra precision on the outer ring too
|
||||
*/
|
||||
#ifndef LV_LINEMETER_PRECISE
|
||||
# ifdef CONFIG_LV_LINEMETER_PRECISE
|
||||
# define LV_LINEMETER_PRECISE CONFIG_LV_LINEMETER_PRECISE
|
||||
# else
|
||||
# define LV_LINEMETER_PRECISE 1
|
||||
# endif
|
||||
#endif
|
||||
#endif
|
||||
/*Mask (dependencies: -)*/
|
||||
#ifndef LV_USE_OBJMASK
|
||||
# ifdef CONFIG_LV_USE_OBJMASK
|
||||
@ -1742,7 +1765,6 @@ e.g. "stm32f769xx.h" or "stm32f429xx.h" */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*==================
|
||||
* Non-user section
|
||||
*==================*/
|
||||
|
@ -10,6 +10,7 @@ CSRCS += lv_obj_draw.c
|
||||
CSRCS += lv_obj_scroll.c
|
||||
CSRCS += lv_refr.c
|
||||
CSRCS += lv_style.c
|
||||
CSRCS += lv_flex.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_core
|
||||
|
@ -314,7 +314,7 @@ static void children_repos(lv_obj_t * cont, lv_obj_t * item_first, lv_obj_t * it
|
||||
lv_ll_t * ll = _lv_obj_get_child_ll(cont);
|
||||
lv_coord_t main_pos = 0;
|
||||
|
||||
lv_coord_t place_gap;
|
||||
lv_coord_t place_gap = 0;
|
||||
place_content(main_place, max_main_size, t->track_main_size, t->item_cnt, &main_pos, &place_gap);
|
||||
/*Reposition the children*/
|
||||
lv_obj_t * item = item_first; /*Just to use a shorter name*/
|
||||
|
@ -143,6 +143,12 @@ lv_flex_place_t lv_obj_get_flex_item_place(const struct _lv_obj_t * obj);
|
||||
*/
|
||||
lv_flex_place_t lv_obj_get_flex_track_place(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Get the minimal gap between flex item in the main direction
|
||||
* @param obj pointer to a flex container
|
||||
* @return the gap
|
||||
*/
|
||||
lv_coord_t lv_obj_get_flex_gap(const struct _lv_obj_t * obj);
|
||||
/**
|
||||
* Get how the flex item is placed in its track in the cross direction.
|
||||
* For ROW direction it means how the item is placed vertically in its row.
|
||||
|
@ -28,7 +28,7 @@ typedef struct {
|
||||
**********************/
|
||||
static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * calc);
|
||||
static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * calc);
|
||||
static void item_repos(lv_obj_t * cont, lv_obj_t * item, _lv_grid_calc_t * calc, item_repos_hint_t * hint);
|
||||
static void item_repos(lv_obj_t * item, _lv_grid_calc_t * calc, item_repos_hint_t * hint);
|
||||
static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t place, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse);
|
||||
static void report_grid_change_core(const lv_grid_t * grid, lv_obj_t * obj);
|
||||
|
||||
@ -231,7 +231,7 @@ void _lv_grid_full_refresh(lv_obj_t * cont)
|
||||
lv_obj_t * item = lv_obj_get_child_back(cont, NULL);
|
||||
while(item) {
|
||||
if(LV_COORD_IS_GRID(item->x_set) && LV_COORD_IS_GRID(item->y_set)) {
|
||||
item_repos(cont, item, &calc, &hint);
|
||||
item_repos(item, &calc, &hint);
|
||||
}
|
||||
item = lv_obj_get_child_back(cont, item);
|
||||
}
|
||||
@ -256,7 +256,7 @@ void lv_grid_item_refr_pos(lv_obj_t * item)
|
||||
_lv_grid_calc_t calc;
|
||||
_lv_grid_calc(cont, &calc);
|
||||
|
||||
item_repos(cont, item, &calc, NULL);
|
||||
item_repos(item, &calc, NULL);
|
||||
|
||||
_lv_grid_calc_free(&calc);
|
||||
}
|
||||
@ -345,13 +345,12 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * calc)
|
||||
|
||||
/**
|
||||
* Reposition a grid item in its cell
|
||||
* @param cont a grid container object
|
||||
* @param item a grid item to reposition
|
||||
* @param calc the calculated grid of `cont`
|
||||
* @param child_id_ext helper value if the ID of the child is know (order from the oldest) else -1
|
||||
* @param grid_abs helper value, the absolute position of the grid, NULL if unknown
|
||||
*/
|
||||
static void item_repos(lv_obj_t * cont, lv_obj_t * item, _lv_grid_calc_t * calc, item_repos_hint_t * hint)
|
||||
static void item_repos(lv_obj_t * item, _lv_grid_calc_t * calc, item_repos_hint_t * hint)
|
||||
{
|
||||
if(_lv_obj_is_grid_item(item) == false) return;
|
||||
|
||||
@ -388,6 +387,7 @@ static void item_repos(lv_obj_t * cont, lv_obj_t * item, _lv_grid_calc_t * calc,
|
||||
lv_coord_t margin_right = lv_obj_get_style_margin_right(item, LV_OBJ_PART_MAIN);
|
||||
|
||||
switch(x_flag) {
|
||||
default:
|
||||
case LV_GRID_START:
|
||||
x = calc->x[col_pos] + margin_left;
|
||||
break;
|
||||
@ -405,6 +405,7 @@ static void item_repos(lv_obj_t * cont, lv_obj_t * item, _lv_grid_calc_t * calc,
|
||||
}
|
||||
|
||||
switch(y_flag) {
|
||||
default:
|
||||
case LV_GRID_START:
|
||||
y = calc->y[row_pos] + margin_top;
|
||||
break;
|
||||
@ -455,7 +456,7 @@ static void item_repos(lv_obj_t * cont, lv_obj_t * item, _lv_grid_calc_t * calc,
|
||||
static lv_coord_t grid_place(lv_coord_t cont_size, bool auto_size, uint8_t place, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse)
|
||||
{
|
||||
lv_coord_t grid_size = 0;
|
||||
int32_t i;
|
||||
uint32_t i;
|
||||
|
||||
if(auto_size) {
|
||||
pos_array[0] = 0;
|
||||
|
@ -624,10 +624,10 @@ void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right
|
||||
|
||||
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
||||
if(obj->spec_attr == NULL) lv_obj_allocate_spec_attr(obj);
|
||||
objrare_attr->->ext_click_pad.x1 = left;
|
||||
objrare_attr->->ext_click_pad.x2 = right;
|
||||
objrare_attr->->ext_click_pad.y1 = top;
|
||||
objrare_attr->->ext_click_pad.y2 = bottom;
|
||||
obj->spec_attr->ext_click_pad.x1 = left;
|
||||
obj->spec_attr->ext_click_pad.x2 = right;
|
||||
obj->spec_attr->ext_click_pad.y1 = top;
|
||||
obj->spec_attr->ext_click_pad.y2 = bottom;
|
||||
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
||||
if(obj->spec_attr == NULL) lv_obj_allocate_spec_attr(obj);
|
||||
obj->spec_attr->ext_click_pad = LV_MATH_MAX4(left, right, top, bottom);
|
||||
@ -1255,13 +1255,13 @@ lv_coord_t lv_obj_get_ext_click_area(const lv_obj_t * obj, lv_dir_t dir)
|
||||
#else
|
||||
switch(dir) {
|
||||
case LV_DIR_LEFT:
|
||||
return obj->ext_click_pad.x1;
|
||||
return obj->spec_attr->ext_click_pad.x1;
|
||||
case LV_DIR_RIGHT:
|
||||
return obj->ext_click_pad.x2;
|
||||
return obj->spec_attr->ext_click_pad.x2;
|
||||
case LV_DIR_TOP:
|
||||
return obj->ext_click_pad.y1;
|
||||
return obj->spec_attr->ext_click_pad.y1;
|
||||
case LV_DIR_BOTTOM:
|
||||
return obj->ext_click_pad.y2;
|
||||
return obj->spec_attr->ext_click_pad.y2;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@ -1406,8 +1406,6 @@ lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj)
|
||||
*/
|
||||
void * lv_obj_get_ext_attr(const lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
|
||||
return obj->ext_attr;
|
||||
}
|
||||
|
||||
|
@ -266,8 +266,8 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
|
||||
|
||||
LV_ASSERT_OBJ(base, LV_OBJX_NAME);
|
||||
|
||||
lv_coord_t x;
|
||||
lv_coord_t y;
|
||||
lv_coord_t x = 0;
|
||||
lv_coord_t y = 0;
|
||||
switch(align) {
|
||||
case LV_ALIGN_CENTER:
|
||||
x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
|
@ -23,8 +23,10 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#if LV_USE_ANIMATION
|
||||
static void scroll_anim_x_cb(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void scroll_anim_y_cb(lv_obj_t * obj, lv_anim_value_t v);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -223,12 +225,17 @@ lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj)
|
||||
|
||||
void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end)
|
||||
{
|
||||
#if LV_USE_ANIMATION
|
||||
lv_anim_t * a;
|
||||
a = lv_anim_get(obj, (lv_anim_exec_xcb_t)scroll_anim_x_cb);
|
||||
end->x = a ? -a->end : lv_obj_get_scroll_x(obj);
|
||||
|
||||
a = lv_anim_get(obj, (lv_anim_exec_xcb_t)scroll_anim_y_cb);
|
||||
end->y = a ? -a->end : lv_obj_get_scroll_y(obj);
|
||||
#else
|
||||
end->x = lv_obj_get_scroll_x(obj);
|
||||
end->y = lv_obj_get_scroll_y(obj);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*=====================
|
||||
@ -254,8 +261,11 @@ void _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
{
|
||||
if(x == 0 && y == 0) return;
|
||||
|
||||
#if LV_USE_ANIMATION == 0
|
||||
anim_en = LV_ANIM_OFF;
|
||||
#endif
|
||||
if(anim_en == LV_ANIM_ON) {
|
||||
#if LV_USE_ANIMATION
|
||||
lv_disp_t * d = lv_obj_get_disp(obj);
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
@ -288,6 +298,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
|
||||
lv_anim_set_path(&a, &path);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
_lv_obj_scroll_by_raw(obj, x, y);
|
||||
}
|
||||
@ -313,6 +324,7 @@ void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en)
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
static void scroll_anim_x_cb(lv_obj_t * obj, lv_anim_value_t v)
|
||||
{
|
||||
_lv_obj_scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0);
|
||||
@ -322,3 +334,4 @@ static void scroll_anim_y_cb(lv_obj_t * obj, lv_anim_value_t v)
|
||||
{
|
||||
_lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj));
|
||||
}
|
||||
#endif
|
||||
|
@ -84,17 +84,17 @@ static void trans_del(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv
|
||||
static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v);
|
||||
static void trans_anim_start_cb(lv_anim_t * a);
|
||||
static void trans_anim_ready_cb(lv_anim_t * a);
|
||||
static void fade_anim_cb(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void fade_in_anim_ready(lv_anim_t * a);
|
||||
#endif
|
||||
static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot);
|
||||
static _lv_style_state_cmp_t style_snapshot_compare(style_snapshot_t * shot1, style_snapshot_t * shot2);
|
||||
#endif
|
||||
|
||||
#if LV_STYLE_CACHE_LEVEL >= 1
|
||||
static bool style_prop_is_cacheable(lv_style_property_t prop);
|
||||
static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop);
|
||||
static void update_style_cache_children(lv_obj_t * obj);
|
||||
#endif
|
||||
static void fade_anim_cb(lv_obj_t * obj, lv_anim_value_t v);
|
||||
static void fade_in_anim_ready(lv_anim_t * a);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -839,6 +839,8 @@ void _lv_obj_refresh_style(lv_obj_t * obj, uint8_t part, lv_style_property_t pro
|
||||
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
|
||||
#if LV_STYLE_CACHE_LEVEL >= 1
|
||||
_lv_obj_invalidate_style_cache(obj, part, prop);
|
||||
#else
|
||||
LV_UNUSED(part);
|
||||
#endif
|
||||
|
||||
/*If a real style refresh is required*/
|
||||
@ -915,7 +917,11 @@ void _lv_obj_refresh_style(lv_obj_t * obj, uint8_t part, lv_style_property_t pro
|
||||
*/
|
||||
void _lv_obj_remove_style_trans(lv_obj_t * obj)
|
||||
{
|
||||
#if LV_USE_ANIMATION
|
||||
trans_del(obj, 0xFF, 0xFF, NULL);
|
||||
#else
|
||||
LV_UNUSED(obj);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if LV_USE_ANIMATION
|
||||
@ -1263,6 +1269,18 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
lv_mem_free(tr);
|
||||
}
|
||||
|
||||
static void fade_anim_cb(lv_obj_t * obj, lv_anim_value_t v)
|
||||
{
|
||||
lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
|
||||
}
|
||||
|
||||
static void fade_in_anim_ready(lv_anim_t * a)
|
||||
{
|
||||
lv_style_remove_prop(_lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void style_snapshot(lv_obj_t * obj, uint8_t part, style_snapshot_t * shot)
|
||||
{
|
||||
_lv_obj_disable_style_caching(obj, true);
|
||||
@ -1337,7 +1355,7 @@ static _lv_style_state_cmp_t style_snapshot_compare(style_snapshot_t * shot1, st
|
||||
/*If not returned earlier its just a visual difference, a simple redraw is enough*/
|
||||
return _LV_STYLE_STATE_CMP_VISUAL_DIFF;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if LV_STYLE_CACHE_LEVEL >= 1
|
||||
|
||||
@ -1524,13 +1542,3 @@ static void update_style_cache_children(lv_obj_t * obj)
|
||||
|
||||
#endif /*LV_STYLE_CACHE_LEVEL >= 1*/
|
||||
|
||||
|
||||
static void fade_anim_cb(lv_obj_t * obj, lv_anim_value_t v)
|
||||
{
|
||||
lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, v);
|
||||
}
|
||||
|
||||
static void fade_in_anim_ready(lv_anim_t * a)
|
||||
{
|
||||
lv_style_remove_prop(_lv_obj_get_local_style(a->var, LV_OBJ_PART_MAIN), LV_STYLE_OPA_SCALE);
|
||||
}
|
||||
|
@ -309,6 +309,8 @@ void _lv_obj_remove_style_trans(lv_obj_t * obj);
|
||||
void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, uint8_t part, lv_state_t prev_state,
|
||||
lv_state_t new_state, uint32_t time, uint32_t delay, lv_anim_path_t * path);
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Compare the style properties of an object in 2 different states
|
||||
* @param obj pointer to an object
|
||||
@ -318,7 +320,6 @@ void _lv_obj_create_style_transition(lv_obj_t * obj, lv_style_property_t prop, u
|
||||
*/
|
||||
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/**********************
|
||||
|
@ -223,7 +223,6 @@ uint32_t lv_theme_get_flags(void);
|
||||
* POST INCLUDE
|
||||
*********************/
|
||||
#include "lv_theme_empty.h"
|
||||
#include "lv_theme_template.h"
|
||||
#include "lv_theme_material.h"
|
||||
#include "lv_theme_mono.h"
|
||||
|
||||
|
@ -242,28 +242,6 @@ static void btnmatrix_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void calendar_init(void)
|
||||
{
|
||||
#if LV_USE_CALENDAR
|
||||
style_init_reset(&styles->calendar_date);
|
||||
lv_style_set_value_str(&styles->calendar_date, LV_STATE_CHECKED, LV_SYMBOL_BULLET);
|
||||
lv_style_set_value_font(&styles->calendar_date, LV_STATE_CHECKED, LV_THEME_DEFAULT_FONT_TITLE);
|
||||
lv_style_set_value_align(&styles->calendar_date, LV_STATE_CHECKED, LV_ALIGN_IN_TOP_RIGHT);
|
||||
lv_style_set_value_color(&styles->calendar_date, LV_STATE_CHECKED, FG_COLOR);
|
||||
lv_style_set_value_ofs_y(&styles->calendar_date, LV_STATE_CHECKED,
|
||||
- lv_font_get_line_height(LV_THEME_DEFAULT_FONT_TITLE) / 4);
|
||||
lv_style_set_bg_color(&styles->calendar_date, LV_STATE_CHECKED, BG_COLOR);
|
||||
lv_style_set_text_color(&styles->calendar_date, LV_STATE_CHECKED, FG_COLOR);
|
||||
lv_style_set_value_color(&styles->calendar_date, LV_STATE_CHECKED | LV_STATE_PRESSED, BG_COLOR);
|
||||
lv_style_set_bg_color(&styles->calendar_date, LV_STATE_CHECKED | LV_STATE_PRESSED, FG_COLOR);
|
||||
lv_style_set_text_color(&styles->calendar_date, LV_STATE_CHECKED | LV_STATE_PRESSED, BG_COLOR);
|
||||
lv_style_set_border_width(&styles->calendar_date, LV_STATE_FOCUSED, BORDER_WIDTH);
|
||||
lv_style_set_pad_inner(&styles->calendar_date, LV_STATE_DEFAULT, LV_MATH_MAX(LV_DPI / 100, 1));
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void chart_init(void)
|
||||
{
|
||||
#if LV_USE_CHART
|
||||
@ -275,14 +253,6 @@ static void chart_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void cpicker_init(void)
|
||||
{
|
||||
#if LV_USE_CPICKER
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void checkbox_init(void)
|
||||
{
|
||||
#if LV_USE_CHECKBOX != 0
|
||||
@ -290,15 +260,6 @@ static void checkbox_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void cont_init(void)
|
||||
{
|
||||
#if LV_USE_CONT != 0
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static void gauge_init(void)
|
||||
{
|
||||
#if LV_USE_GAUGE != 0
|
||||
@ -351,20 +312,6 @@ static void line_init(void)
|
||||
#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
|
||||
@ -379,36 +326,6 @@ static void switch_init(void)
|
||||
#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
|
||||
@ -421,18 +338,6 @@ static void textarea_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void list_init(void)
|
||||
{
|
||||
#if LV_USE_LIST != 0
|
||||
style_init_reset(&styles->list_btn);
|
||||
lv_style_set_bg_opa(&styles->list_btn, LV_STATE_DEFAULT, LV_OPA_TRANSP);
|
||||
lv_style_set_bg_opa(&styles->list_btn, LV_STATE_PRESSED, LV_OPA_COVER);
|
||||
lv_style_set_bg_opa(&styles->list_btn, LV_STATE_CHECKED, LV_OPA_COVER);
|
||||
lv_style_set_radius(&styles->list_btn, LV_STATE_DEFAULT, 0);
|
||||
lv_style_set_border_side(&styles->list_btn, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void ddlist_init(void)
|
||||
{
|
||||
#if LV_USE_DROPDOWN != 0
|
||||
@ -447,23 +352,6 @@ static void roller_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tabview_init(void)
|
||||
{
|
||||
#if LV_USE_TABVIEW != 0
|
||||
style_init_reset(&styles->tab_bg);
|
||||
lv_style_set_border_width(&styles->tab_bg, LV_STATE_DEFAULT, BORDER_WIDTH);
|
||||
lv_style_set_border_color(&styles->tab_bg, LV_STATE_DEFAULT, FG_COLOR);
|
||||
lv_style_set_border_side(&styles->tab_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static void tileview_init(void)
|
||||
{
|
||||
#if LV_USE_TILEVIEW != 0
|
||||
#endif
|
||||
}
|
||||
|
||||
static void table_init(void)
|
||||
{
|
||||
#if LV_USE_TABLE != 0
|
||||
@ -471,14 +359,6 @@ static void table_init(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void win_init(void)
|
||||
{
|
||||
#if LV_USE_WIN != 0
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/**********************
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
@ -516,36 +396,23 @@ lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secon
|
||||
theme.flags = flags;
|
||||
|
||||
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_xcb = NULL;
|
||||
theme.apply_cb = theme_apply;
|
||||
|
@ -1,661 +0,0 @@
|
||||
/**
|
||||
* @file lv_theme_template.c
|
||||
*
|
||||
*/
|
||||
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "../../lvgl.h" /*To see all the widgets*/
|
||||
|
||||
#if LV_USE_THEME_TEMPLATE
|
||||
|
||||
#include "../lv_misc/lv_gc.h"
|
||||
|
||||
#if defined(LV_GC_INCLUDE)
|
||||
#include LV_GC_INCLUDE
|
||||
#endif /* LV_ENABLE_GC */
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct {
|
||||
lv_style_t bg;
|
||||
lv_style_t btn;
|
||||
lv_style_t round;
|
||||
lv_style_t color;
|
||||
lv_style_t gray;
|
||||
lv_style_t tick_line;
|
||||
lv_style_t tight;
|
||||
} theme_styles_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
|
||||
static lv_theme_t theme;
|
||||
static theme_styles_t * styles;
|
||||
|
||||
static bool inited;
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
static void style_init_reset(lv_style_t * style);
|
||||
|
||||
|
||||
static void basic_init(void)
|
||||
{
|
||||
style_init_reset(&styles->bg);
|
||||
lv_style_set_bg_opa(&styles->bg, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
lv_style_set_border_width(&styles->bg, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_border_width(&styles->bg, LV_STATE_FOCUSED, 2);
|
||||
lv_style_set_border_color(&styles->bg, LV_STATE_FOCUSED, theme.color_secondary);
|
||||
lv_style_set_border_color(&styles->bg, LV_STATE_EDITED, lv_color_darken(theme.color_secondary, LV_OPA_30));
|
||||
lv_style_set_line_width(&styles->bg, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_scale_end_line_width(&styles->bg, LV_STATE_DEFAULT, 1);
|
||||
lv_style_set_scale_end_color(&styles->bg, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_text_color(&styles->bg, LV_STATE_DEFAULT, LV_COLOR_BLACK);
|
||||
lv_style_set_pad_left(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
lv_style_set_pad_right(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
lv_style_set_pad_top(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
lv_style_set_pad_bottom(&styles->bg, LV_STATE_DEFAULT, LV_DPI / 10);
|
||||
|
||||
style_init_reset(&styles->btn);
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, lv_color_hex3(0xccc));
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, theme.color_primary);
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, lv_color_darken(theme.color_primary,
|
||||
LV_OPA_30));
|
||||
lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_SILVER);
|
||||
lv_style_set_text_color(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
lv_style_set_image_recolor(&styles->btn, LV_STATE_DISABLED, LV_COLOR_GRAY);
|
||||
|
||||
style_init_reset(&styles->round);
|
||||
lv_style_set_radius(&styles->round, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
|
||||
|
||||
style_init_reset(&styles->color);
|
||||
lv_style_set_bg_color(&styles->color, LV_STATE_DEFAULT, theme.color_primary);
|
||||
lv_style_set_line_color(&styles->color, LV_STATE_DEFAULT, theme.color_primary);
|
||||
|
||||
style_init_reset(&styles->gray);
|
||||
lv_style_set_bg_color(&styles->gray, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
lv_style_set_line_color(&styles->gray, LV_STATE_DEFAULT, LV_COLOR_SILVER);
|
||||
lv_style_set_text_color(&styles->gray, LV_STATE_DEFAULT, LV_COLOR_GRAY);
|
||||
|
||||
style_init_reset(&styles->tick_line);
|
||||
lv_style_set_line_width(&styles->tick_line, LV_STATE_DEFAULT, 5);
|
||||
lv_style_set_scale_end_line_width(&styles->tick_line, LV_STATE_DEFAULT, 5);
|
||||
lv_style_set_scale_end_color(&styles->tick_line, LV_STATE_DEFAULT, theme.color_primary);
|
||||
|
||||
style_init_reset(&styles->tight);
|
||||
lv_style_set_pad_left(&styles->tight, LV_STATE_DEFAULT, 0);
|
||||
lv_style_set_pad_right(&styles->tight, LV_STATE_DEFAULT, 0);
|
||||
lv_style_set_pad_top(&styles->tight, LV_STATE_DEFAULT, 0);
|
||||
lv_style_set_pad_bottom(&styles->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,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title)
|
||||
{
|
||||
|
||||
/* This trick is required only to avoid the garbage collection of
|
||||
* styles' data if LVGL is used in a binding (e.g. Micropython)
|
||||
* In a general case styles could be simple `static lv_style_t my style` variables or allocated directly into `styles`*/
|
||||
if(!inited) {
|
||||
#if defined(LV_GC_INCLUDE)
|
||||
LV_GC_ROOT(_lv_theme_template_styles) = lv_mem_alloc(sizeof(theme_styles_t));
|
||||
styles = (theme_styles_t *)LV_GC_ROOT(_lv_theme_template_styles);
|
||||
#else
|
||||
styles = lv_mem_alloc(sizeof(theme_styles_t));
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
theme.color_primary = color_primary;
|
||||
theme.color_secondary = color_secondary;
|
||||
theme.font_small = font_small;
|
||||
theme.font_normal = font_normal;
|
||||
theme.font_subtitle = font_subtitle;
|
||||
theme.font_title = font_title;
|
||||
theme.flags = flags;
|
||||
|
||||
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_xcb = NULL;
|
||||
theme.apply_cb = theme_apply;
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
||||
void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
LV_UNUSED(th);
|
||||
|
||||
lv_style_list_t * list;
|
||||
|
||||
switch(name) {
|
||||
case LV_THEME_NONE:
|
||||
break;
|
||||
|
||||
case LV_THEME_SCR:
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
break;
|
||||
case LV_THEME_OBJ:
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
|
||||
#if LV_USE_BTN
|
||||
case LV_THEME_BTN:
|
||||
list = _lv_obj_get_style_list(obj, LV_BTN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BTNMATRIX
|
||||
case LV_THEME_BTNMATRIX:
|
||||
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_BTNMATRIX_PART_BTN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_BAR
|
||||
case LV_THEME_BAR:
|
||||
list = _lv_obj_get_style_list(obj, LV_BAR_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_BAR_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SWITCH
|
||||
case LV_THEME_SWITCH:
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_SWITCH_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CANVAS
|
||||
case LV_THEME_CANVAS:
|
||||
list = _lv_obj_get_style_list(obj, LV_CANVAS_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMG
|
||||
case LV_THEME_IMAGE:
|
||||
list = _lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_IMGBTN
|
||||
case LV_THEME_IMGBTN:
|
||||
list = _lv_obj_get_style_list(obj, LV_IMG_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LABEL
|
||||
case LV_THEME_LABEL:
|
||||
list = _lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINE
|
||||
case LV_THEME_LINE:
|
||||
list = _lv_obj_get_style_list(obj, LV_LABEL_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_ARC
|
||||
case LV_THEME_ARC:
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_ARC_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_SLIDER
|
||||
case LV_THEME_SLIDER:
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_INDIC);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_SLIDER_PART_KNOB);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHECKBOX
|
||||
case LV_THEME_CHECKBOX:
|
||||
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_MAIN);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_CHECKBOX_PART_BULLET);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_ROLLER
|
||||
case LV_THEME_ROLLER:
|
||||
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_ROLLER_PART_SELECTED);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
break;
|
||||
#endif
|
||||
|
||||
|
||||
#if LV_USE_OBJMASK
|
||||
case LV_THEME_OBJMASK:
|
||||
list = _lv_obj_get_style_list(obj, LV_OBJMASK_PART_MAIN);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_DROPDOWN
|
||||
case LV_THEME_DROPDOWN:
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->btn);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_LIST);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_DROPDOWN_PART_SELECTED);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->color);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_CHART
|
||||
case LV_THEME_CHART:
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_CHART_PART_SERIES);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_TABLE
|
||||
case LV_THEME_TABLE: {
|
||||
list = _lv_obj_get_style_list(obj, LV_TABLE_PART_BG);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
int idx = 1; /* start value should be 1, not zero, since cell styles
|
||||
start at 1 due to presence of LV_TABLE_PART_BG=0
|
||||
in the enum (lv_table.h) */
|
||||
/* declaring idx outside loop to work with older compilers */
|
||||
for(; idx <= LV_TABLE_CELL_STYLE_CNT; idx ++) {
|
||||
list = _lv_obj_get_style_list(obj, idx);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LV_USE_TEXTAREA
|
||||
case LV_THEME_TEXTAREA:
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_PLACEHOLDER);
|
||||
_lv_style_list_add_style(list, &styles->gray);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_TEXTAREA_PART_CURSOR);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->tight);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if LV_USE_LINEMETER
|
||||
case LV_THEME_LINEMETER:
|
||||
list = _lv_obj_get_style_list(obj, LV_LINEMETER_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
break;
|
||||
#endif
|
||||
#if LV_USE_GAUGE
|
||||
case LV_THEME_GAUGE:
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAIN);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
_lv_style_list_add_style(list, &styles->round);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_MAJOR);
|
||||
_lv_style_list_add_style(list, &styles->tick_line);
|
||||
|
||||
list = _lv_obj_get_style_list(obj, LV_GAUGE_PART_NEEDLE);
|
||||
_lv_style_list_add_style(list, &styles->bg);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
_lv_obj_refresh_style(obj, LV_OBJ_PART_ALL, LV_STYLE_PROP_ALL);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void style_init_reset(lv_style_t * style)
|
||||
{
|
||||
if(inited) lv_style_reset(style);
|
||||
else lv_style_init(style);
|
||||
}
|
||||
|
||||
#endif
|
@ -1,57 +0,0 @@
|
||||
/**
|
||||
* @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,
|
||||
const lv_font_t * font_small, const lv_font_t * font_normal, const lv_font_t * font_subtitle,
|
||||
const lv_font_t * font_title);
|
||||
/**********************
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /*LV_THEME_TEMPLATE_H*/
|
@ -2,7 +2,6 @@ CSRCS += lv_theme.c
|
||||
CSRCS += lv_theme_material.c
|
||||
CSRCS += lv_theme_mono.c
|
||||
CSRCS += lv_theme_empty.c
|
||||
CSRCS += lv_theme_template.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes
|
||||
VPATH += :$(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_themes
|
||||
|
@ -133,7 +133,7 @@ void lv_checkbox_set_text_static(lv_obj_t * cb, const char * txt)
|
||||
|
||||
if(!ext->static_txt) lv_mem_free(ext->txt);
|
||||
|
||||
ext->txt = txt;
|
||||
ext->txt = (char*)txt;
|
||||
ext->static_txt = 1;
|
||||
|
||||
_lv_obj_handle_self_size_chg(cb);
|
||||
|
@ -151,7 +151,12 @@ lv_label_align_t lv_roller_get_align(const lv_obj_t * roller);
|
||||
*/
|
||||
const char * lv_roller_get_options(const lv_obj_t * roller);
|
||||
|
||||
|
||||
/**
|
||||
* Get the animation time of the roller
|
||||
* @param roller pointer to a roller object
|
||||
* @return the animation time in milliseconds
|
||||
*/
|
||||
uint32_t lv_roller_get_anim_time(lv_obj_t * roller);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
@ -1,35 +1,22 @@
|
||||
CSRCS += lv_arc.c
|
||||
CSRCS += lv_bar.c
|
||||
CSRCS += lv_checkbox.c
|
||||
CSRCS += lv_cpicker.c
|
||||
CSRCS += lv_dropdown.c
|
||||
CSRCS += lv_keyboard.c
|
||||
CSRCS += lv_line.c
|
||||
CSRCS += lv_msgbox.c
|
||||
CSRCS += lv_spinner.c
|
||||
CSRCS += lv_roller.c
|
||||
CSRCS += lv_table.c
|
||||
CSRCS += lv_tabview.c
|
||||
CSRCS += lv_tileview.c
|
||||
CSRCS += lv_btn.c
|
||||
CSRCS += lv_calendar.c
|
||||
CSRCS += lv_chart.c
|
||||
CSRCS += lv_canvas.c
|
||||
CSRCS += lv_gauge.c
|
||||
CSRCS += lv_label.c
|
||||
CSRCS += lv_list.c
|
||||
CSRCS += lv_slider.c
|
||||
CSRCS += lv_textarea.c
|
||||
CSRCS += lv_spinbox.c
|
||||
CSRCS += lv_btnmatrix.c
|
||||
CSRCS += lv_cont.c
|
||||
CSRCS += lv_img.c
|
||||
CSRCS += lv_imgbtn.c
|
||||
CSRCS += lv_led.c
|
||||
CSRCS += lv_linemeter.c
|
||||
CSRCS += lv_page.c
|
||||
CSRCS += lv_switch.c
|
||||
CSRCS += lv_win.c
|
||||
CSRCS += lv_objmask.c
|
||||
|
||||
DEPPATH += --dep-path $(LVGL_DIR)/$(LVGL_DIR_NAME)/src/lv_widgets
|
||||
|
@ -70,7 +70,6 @@ minimal_monochrome = {
|
||||
"LV_USE_THEME_EMPTY":0,
|
||||
"LV_USE_THEME_MATERIAL":0,
|
||||
"LV_USE_THEME_MONO":1,
|
||||
"LV_USE_THEME_TEMPLATE":0,
|
||||
"LV_THEME_DEFAULT_INIT": "\\\"lv_theme_mono_init\\\"",
|
||||
"LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"",
|
||||
"LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"",
|
||||
@ -226,7 +225,6 @@ all_obj_all_features = {
|
||||
"LV_USE_THEME_MATERIAL":1,
|
||||
"LV_USE_THEME_EMPTY":1,
|
||||
"LV_USE_THEME_MONO":1,
|
||||
"LV_USE_THEME_TEMPLATE":1,
|
||||
"LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"",
|
||||
"LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"",
|
||||
"LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"",
|
||||
@ -306,7 +304,6 @@ advanced_features = {
|
||||
"LV_USE_LOG":1,
|
||||
"LV_USE_THEME_MATERIAL":1,
|
||||
"LV_USE_THEME_EMPTY":1,
|
||||
"LV_USE_THEME_TEMPLATE":1,
|
||||
"LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"",
|
||||
"LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"",
|
||||
"LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"",
|
||||
|
Loading…
x
Reference in New Issue
Block a user