Add theme->apply_cb to replace theme->apply_xcb to make it compatible with the Micropython binding
This commit is contained in:
@@ -12,6 +12,7 @@ Available in the `dev` branch
|
||||
- Add `lv_chart_get_point_id()` funtion - Get an individual point value in the chart series directly based on index
|
||||
- Add `ext_buf_assigned` bit field to `lv_chart_series_t` structure - it's true if external buffer is assigned to series
|
||||
- Allow setting different font for the selected text in `lv_roller`
|
||||
- Add `theme->apply_cb` to replace `theme->apply_xcb` to make it compatible with the Micropython binding
|
||||
|
||||
## v7.1.0 (planned on 07.07.2020)
|
||||
*Available in the `master` branch*
|
||||
|
||||
@@ -118,7 +118,13 @@ uint32_t lv_theme_get_flags(void)
|
||||
|
||||
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
act_theme->apply_xcb(obj, name);
|
||||
/*apply_xcb is deprecated, use apply_cb instead*/
|
||||
if (act_theme->apply_xcb) {
|
||||
act_theme->apply_xcb(obj, name);
|
||||
}
|
||||
else if(act_theme->apply_cb) {
|
||||
act_theme->apply_cb(act_theme, obj, name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -141,13 +141,14 @@ typedef enum {
|
||||
#endif
|
||||
|
||||
_LV_THEME_BUILTIN_LAST,
|
||||
_LV_THEME_CUSTOM_START = _LV_THEME_BUILTIN_LAST,
|
||||
LV_THEME_CUSTOM_START = _LV_THEME_BUILTIN_LAST,
|
||||
_LV_THEME_CUSTOM_LAST = 0xFFFF,
|
||||
|
||||
} lv_theme_style_t;
|
||||
|
||||
typedef struct {
|
||||
void (*apply_xcb)(lv_obj_t *, lv_theme_style_t);
|
||||
typedef struct _lv_theme_t {
|
||||
void (*apply_xcb)(lv_obj_t *, lv_theme_style_t); /*Deprecated: use `apply_cb` instead*/
|
||||
void (*apply_cb)(struct _lv_theme_t *, lv_obj_t *, lv_theme_style_t);
|
||||
lv_color_t color_primary;
|
||||
lv_color_t color_secondary;
|
||||
const lv_font_t * font_small;
|
||||
|
||||
@@ -31,7 +31,7 @@ typedef struct {
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void style_init_reset(lv_style_t * style);
|
||||
|
||||
/**********************
|
||||
@@ -89,13 +89,15 @@ lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_seco
|
||||
style_init_reset(&styles->opa_cover);
|
||||
lv_style_set_bg_opa(&styles->opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
|
||||
|
||||
theme.apply_xcb = theme_apply;
|
||||
theme.apply_xcb = NULL;
|
||||
theme.apply_cb = theme_apply;
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
||||
void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name)
|
||||
{
|
||||
LV_UNUSED(th);
|
||||
if(name == LV_THEME_SCR) {
|
||||
lv_obj_clean_style_list(obj, LV_OBJ_PART_MAIN);
|
||||
lv_obj_add_style(obj, LV_OBJ_PART_MAIN, &styles->opa_cover);
|
||||
|
||||
@@ -176,7 +176,7 @@ typedef struct {
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void style_init_reset(lv_style_t * style);
|
||||
|
||||
/**********************
|
||||
@@ -928,7 +928,8 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
theme.apply_xcb = theme_apply;
|
||||
theme.apply_xcb = NULL;
|
||||
theme.apply_cb = theme_apply;
|
||||
|
||||
inited = true;
|
||||
|
||||
@@ -938,8 +939,10 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
|
||||
}
|
||||
|
||||
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
static 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) {
|
||||
|
||||
@@ -83,7 +83,7 @@ typedef struct {
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void style_init_reset(lv_style_t * style);
|
||||
|
||||
/**********************
|
||||
@@ -552,14 +552,17 @@ lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secon
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
theme.apply_xcb = theme_apply;
|
||||
theme.apply_xcb = NULL;
|
||||
theme.apply_cb = theme_apply;
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
static 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) {
|
||||
|
||||
@@ -37,7 +37,7 @@ typedef struct {
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void theme_apply(lv_obj_t * obj, lv_theme_style_t name);
|
||||
static void theme_apply(lv_theme_t * th, lv_obj_t * obj, lv_theme_style_t name);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@@ -402,14 +402,17 @@ lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_s
|
||||
table_init();
|
||||
win_init();
|
||||
|
||||
theme.apply_xcb = theme_apply;
|
||||
theme.apply_xcb = NULL;
|
||||
theme.apply_cb = theme_apply;
|
||||
|
||||
return &theme;
|
||||
}
|
||||
|
||||
|
||||
void theme_apply(lv_obj_t * obj, lv_theme_style_t name)
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user