Moved menu styles to theme
This commit is contained in:
committed by
Raphael Coeffic
parent
d17901f7ab
commit
bd691b4545
@@ -254,10 +254,13 @@ static lv_style_t btn_style;
|
||||
static lv_style_t btn_checked_style;
|
||||
static lv_style_t btn_focused_style;
|
||||
static lv_style_t btn_checked_focused_style;
|
||||
static lv_style_t menu_line_style;
|
||||
static lv_style_t menu_focused_style;
|
||||
|
||||
static void theme_apply_cb(lv_theme_t * th, lv_obj_t * obj)
|
||||
{
|
||||
LV_UNUSED(th);
|
||||
|
||||
lv_obj_add_style(obj, &generic_style, LV_PART_MAIN);
|
||||
|
||||
lv_obj_t* parent = lv_obj_get_parent(obj);
|
||||
@@ -272,6 +275,14 @@ static void theme_apply_cb(lv_theme_t * th, lv_obj_t * obj)
|
||||
lv_obj_add_style(obj, &btn_focused_style, LV_STATE_FOCUSED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lv_obj_check_type(obj, &lv_list_btn_class)) {
|
||||
// menu items do not use the generic style
|
||||
lv_obj_remove_style(obj, &generic_style, LV_PART_MAIN);
|
||||
lv_obj_add_style(obj, &menu_line_style, 0);
|
||||
lv_obj_add_style(obj, &menu_focused_style, LV_STATE_FOCUSED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
static void init_theme()
|
||||
@@ -291,14 +302,27 @@ static void init_theme()
|
||||
lv_style_set_bg_color(&btn_style, makeLvColor(COLOR_THEME_SECONDARY2));
|
||||
|
||||
// LV_STATE_CHECKED
|
||||
lv_style_init(&btn_checked_style);
|
||||
lv_style_set_bg_color(&btn_checked_style, makeLvColor(COLOR_THEME_ACTIVE));
|
||||
|
||||
// LV_STATE_FOCUSED
|
||||
lv_style_init(&btn_focused_style);
|
||||
lv_style_set_border_width(&btn_focused_style, 1);
|
||||
lv_style_set_border_color(&btn_focused_style, makeLvColor(COLOR_THEME_FOCUS));
|
||||
lv_style_set_text_color(&btn_focused_style, makeLvColor(COLOR_THEME_PRIMARY2));
|
||||
lv_style_set_bg_color(&btn_focused_style, makeLvColor(COLOR_THEME_FOCUS));
|
||||
|
||||
|
||||
// Menus
|
||||
lv_style_init(&menu_line_style);
|
||||
lv_style_set_bg_opa(&menu_line_style, LV_OPA_100);
|
||||
lv_style_set_bg_color(&menu_line_style, makeLvColor(COLOR_THEME_PRIMARY2));
|
||||
|
||||
lv_style_init(&menu_focused_style);
|
||||
lv_style_set_border_width(&menu_focused_style, 1);
|
||||
lv_style_set_border_color(&menu_focused_style, makeLvColor(COLOR_THEME_FOCUS));
|
||||
lv_style_set_text_color(&menu_focused_style, makeLvColor(COLOR_THEME_PRIMARY2));
|
||||
lv_style_set_bg_color(&menu_focused_style, makeLvColor(COLOR_THEME_FOCUS));
|
||||
|
||||
/*Initialize the new theme from the current theme*/
|
||||
lv_theme_t * th_act = lv_disp_get_theme(NULL);
|
||||
static lv_theme_t th_new;
|
||||
|
||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: dd5dc52327...844deb6c61
Reference in New Issue
Block a user