mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 19:05:07 +00:00
1974 lines
81 KiB
C
1974 lines
81 KiB
C
/* Generated by LSS. Do not edit. */
|
|
|
|
#define LV_USE_PRIVATE_API 1 /* For lv_theme_t */
|
|
|
|
#include "lv_theme_material_mono.h"
|
|
|
|
/*********************
|
|
* DEFINES
|
|
*********************/
|
|
|
|
extern const lv_obj_class_t lvgl_toolbar_class;
|
|
extern const lv_obj_class_t lvgl_icon_button_class;
|
|
extern const lv_obj_class_t lvgl_icon_button_filled_class;
|
|
extern const lv_obj_class_t lvgl_icon_button_tonal_class;
|
|
extern const lv_obj_class_t lvgl_sliderbox_class;
|
|
extern const lv_obj_class_t lvgl_card_class;
|
|
extern const lv_obj_class_t lvgl_focus_container_class;
|
|
extern const lv_obj_class_t lvgl_chip_class;
|
|
extern const lv_obj_class_t lvgl_badge_class;
|
|
extern const lv_obj_class_t lvgl_page_indicator_class;
|
|
extern const lv_obj_class_t lvgl_page_indicator_dot_class;
|
|
extern const lv_obj_class_t lvgl_step_indicator_class;
|
|
extern const lv_obj_class_t lvgl_step_indicator_segment_class;
|
|
extern const lv_obj_class_t lvgl_list_class;
|
|
extern const lv_obj_class_t lvgl_list_text_class;
|
|
extern const lv_obj_class_t lvgl_list_button_class;
|
|
extern const lv_obj_class_t lvgl_text_button_class;
|
|
|
|
#define BLACK lv_color_black()
|
|
#define WHITE lv_color_white()
|
|
#define CORNER_NONE 0
|
|
#define CORNER_SMALL (LV_DPX_CALC(theme->disp_dpi, 4))
|
|
#define CORNER_MEDIUM (LV_DPX_CALC(theme->disp_dpi, 8))
|
|
#define CORNER_LARGE (LV_DPX_CALC(theme->disp_dpi, 12))
|
|
#define CORNER_FULL LV_RADIUS_CIRCLE
|
|
#define CORNER_COMPACT 4
|
|
#define SPACE_1 (LV_DPX_CALC(theme->disp_dpi, 2))
|
|
#define SPACE_2 (LV_DPX_CALC(theme->disp_dpi, 4))
|
|
#define SPACE_3 (LV_DPX_CALC(theme->disp_dpi, 6))
|
|
#define SPACE_4 (LV_DPX_CALC(theme->disp_dpi, 8))
|
|
#define SPACE_6 (LV_DPX_CALC(theme->disp_dpi, 12))
|
|
#define LINE_THIN 1
|
|
#define LINE_MEDIUM 2
|
|
#define LINE_THICK 3
|
|
#define DURATION_SHORT 100
|
|
#define DURATION_MEDIUM 250
|
|
#define DURATION_LONG 500
|
|
#define INK (theme->config.is_dark ? WHITE : BLACK)
|
|
#define PAPER (theme->config.is_dark ? BLACK : WHITE)
|
|
#define COLOR_PRIMARY INK
|
|
#define COLOR_ON_PRIMARY PAPER
|
|
#define COLOR_SURFACE PAPER
|
|
#define COLOR_ON_SURFACE INK
|
|
#define COLOR_OUTLINE INK
|
|
#define SHAPE_CONTROL (theme->config.is_compact ? CORNER_COMPACT : CORNER_FULL)
|
|
#define SHAPE_CONTAINER (theme->config.is_compact ? CORNER_COMPACT : CORNER_MEDIUM)
|
|
#define SHAPE_FIELD (theme->config.is_compact ? CORNER_COMPACT : CORNER_SMALL)
|
|
#define SHAPE_KEY (theme->config.is_compact ? CORNER_COMPACT : CORNER_SMALL)
|
|
#define SHAPE_DIALOG (theme->config.is_compact ? CORNER_COMPACT : CORNER_LARGE)
|
|
#define DENSITY_CONTAINER_PAD (theme->config.is_compact ? 2 : SPACE_4)
|
|
#define DENSITY_CONTAINER_GAP (theme->config.is_compact ? 2 : SPACE_3)
|
|
#define DENSITY_CONTROL_PAD_HOR (theme->config.is_compact ? 3 : SPACE_6)
|
|
#define DENSITY_CONTROL_PAD_VER (theme->config.is_compact ? 2 : SPACE_3)
|
|
#define DENSITY_CONTROL_GAP (theme->config.is_compact ? 2 : SPACE_2)
|
|
#define DENSITY_FIELD_PAD (theme->config.is_compact ? 2 : SPACE_3)
|
|
#define DENSITY_LIST_PAD (theme->config.is_compact ? 1 : SPACE_2)
|
|
#define DENSITY_LIST_ITEM_PAD_HOR (theme->config.is_compact ? 2 : SPACE_4)
|
|
#define DENSITY_LIST_ITEM_PAD_VER (theme->config.is_compact ? 2 : SPACE_3)
|
|
#define DENSITY_DIALOG_PAD (theme->config.is_compact ? 2 : SPACE_6)
|
|
#define DENSITY_KEY_GAP (theme->config.is_compact ? 1 : SPACE_1)
|
|
#define BORDER LINE_THIN
|
|
#define FOCUS_WIDTH (theme->config.is_compact ? LINE_THIN : LINE_MEDIUM)
|
|
#define FOCUS_OFFSET (theme->config.is_compact ? LINE_THIN : LINE_MEDIUM)
|
|
#define EDIT_WIDTH (theme->config.is_compact ? LINE_MEDIUM : LINE_THICK)
|
|
#define FOCUS_INSET_WIDTH (theme->config.is_compact ? LINE_THIN : LINE_MEDIUM)
|
|
#define MOTION_DURATION_SHORT (theme->config.animations_enabled ? DURATION_SHORT : 0)
|
|
#define MOTION_DURATION_MEDIUM (theme->config.animations_enabled ? DURATION_MEDIUM : 0)
|
|
#define MOTION_DURATION_LONG (theme->config.animations_enabled ? DURATION_LONG : 0)
|
|
#define SCREEN_COLOR COLOR_SURFACE
|
|
#define SCREEN_TEXT_COLOR COLOR_ON_SURFACE
|
|
#define SCREEN_GAP DENSITY_CONTAINER_GAP
|
|
#define CONTAINER_COLOR COLOR_SURFACE
|
|
#define CONTAINER_TEXT_COLOR COLOR_ON_SURFACE
|
|
#define CONTAINER_BORDER_COLOR COLOR_OUTLINE
|
|
#define CONTAINER_BORDER_WIDTH BORDER
|
|
#define CONTAINER_SHAPE SHAPE_CONTAINER
|
|
#define CONTAINER_PAD DENSITY_CONTAINER_PAD
|
|
#define CONTAINER_GAP DENSITY_CONTAINER_GAP
|
|
#define CARD_COLOR COLOR_SURFACE
|
|
#define CARD_TEXT_COLOR COLOR_ON_SURFACE
|
|
#define CARD_BORDER_COLOR COLOR_OUTLINE
|
|
#define CARD_BORDER_WIDTH LINE_MEDIUM
|
|
#define CARD_SHAPE SHAPE_CONTAINER
|
|
#define CARD_PAD DENSITY_CONTAINER_PAD
|
|
#define CARD_GAP DENSITY_CONTAINER_GAP
|
|
#define CHIP_SHAPE (theme->config.is_compact ? CORNER_COMPACT : CORNER_SMALL)
|
|
#define CHIP_PAD_HOR (theme->config.is_compact ? 3 : SPACE_4)
|
|
#define CHIP_PAD_VER (theme->config.is_compact ? 2 : SPACE_2)
|
|
#define PAGE_INDICATOR_COLOR COLOR_ON_SURFACE
|
|
#define PAGE_INDICATOR_DOT_SIZE (theme->config.is_compact ? 6 : LV_DPX_CALC(theme->disp_dpi, 8))
|
|
#define PAGE_INDICATOR_GAP (theme->config.is_compact ? 4 : LV_DPX_CALC(theme->disp_dpi, 6))
|
|
#define STEP_INDICATOR_COLOR COLOR_ON_SURFACE
|
|
#define STEP_INDICATOR_THICKNESS (LV_DPX_CALC(theme->disp_dpi, 6))
|
|
#define STEP_INDICATOR_MARGIN (LV_DPX_CALC(theme->disp_dpi, 6))
|
|
#define STEP_INDICATOR_GAP STEP_INDICATOR_MARGIN
|
|
#define BADGE_COLOR COLOR_ON_SURFACE
|
|
#define BADGE_SIZE (theme->config.is_compact ? 4 : LV_DPX_CALC(theme->disp_dpi, 6))
|
|
#define SCROLLBAR_COLOR COLOR_ON_SURFACE
|
|
#define SCROLLBAR_WIDTH (theme->config.is_compact ? 2 : LV_DPX_CALC(theme->disp_dpi, 3))
|
|
#define SCROLLBAR_PAD 1
|
|
#define BUTTON_CONTAINER_COLOR COLOR_SURFACE
|
|
#define BUTTON_LABEL_COLOR COLOR_ON_SURFACE
|
|
#define BUTTON_BORDER_COLOR COLOR_OUTLINE
|
|
#define BUTTON_BORDER_WIDTH BORDER
|
|
#define BUTTON_INVERTED_CONTAINER_COLOR COLOR_PRIMARY
|
|
#define BUTTON_INVERTED_LABEL_COLOR COLOR_ON_PRIMARY
|
|
#define BUTTON_SHAPE SHAPE_CONTROL
|
|
#define BUTTON_PAD_HOR DENSITY_CONTROL_PAD_HOR
|
|
#define BUTTON_PAD_VER DENSITY_CONTROL_PAD_VER
|
|
#define BUTTON_GAP DENSITY_CONTROL_GAP
|
|
#define ICON_BUTTON_CONTAINER_SHAPE (theme->config.is_compact ? CORNER_COMPACT : CORNER_LARGE)
|
|
#define ICON_BUTTON_FILLED_COLOR COLOR_PRIMARY
|
|
#define ICON_BUTTON_FILLED_ICON_COLOR COLOR_ON_PRIMARY
|
|
#define ICON_BUTTON_TONAL_COLOR COLOR_SURFACE
|
|
#define ICON_BUTTON_TONAL_ICON_COLOR COLOR_ON_SURFACE
|
|
#define ICON_BUTTON_TONAL_BORDER_COLOR COLOR_OUTLINE
|
|
#define APP_BAR_TITLE_COLOR COLOR_ON_SURFACE
|
|
#define APP_BAR_PAD_HOR (theme->config.is_compact ? 0 : SPACE_1)
|
|
#define APP_BAR_PAD_RIGHT (theme->config.is_compact ? APP_BAR_PAD_HOR + 2 : APP_BAR_PAD_HOR)
|
|
#define APP_BAR_GAP (theme->config.is_compact ? 2 : SPACE_1)
|
|
#define APP_BAR_FOCUS_WIDTH FOCUS_INSET_WIDTH
|
|
#define FOCUS_RING_COLOR COLOR_ON_SURFACE
|
|
#define FOCUS_RING_WIDTH FOCUS_WIDTH
|
|
#define FOCUS_RING_OFFSET FOCUS_OFFSET
|
|
#define EDIT_RING_WIDTH EDIT_WIDTH
|
|
#define SWITCH_WIDTH (theme->config.is_compact ? 25 : LV_DPX_CALC(theme->disp_dpi, 40))
|
|
#define SWITCH_HEIGHT (theme->config.is_compact ? 15 : LV_DPX_CALC(theme->disp_dpi, 24))
|
|
#define SWITCH_TRACK_COLOR COLOR_SURFACE
|
|
#define SWITCH_TRACK_BORDER_COLOR COLOR_OUTLINE
|
|
#define SWITCH_TRACK_BORDER_WIDTH BORDER
|
|
#define SWITCH_TRACK_SELECTED_COLOR COLOR_PRIMARY
|
|
#define SWITCH_HANDLE_COLOR COLOR_ON_SURFACE
|
|
#define SWITCH_HANDLE_SELECTED_COLOR COLOR_ON_PRIMARY
|
|
#define SWITCH_HANDLE_PAD (theme->config.is_compact ? -3 : -LV_DPX_CALC(theme->disp_dpi, 5))
|
|
#define SWITCH_HANDLE_SELECTED_PAD (theme->config.is_compact ? -2 : -LV_DPX_CALC(theme->disp_dpi, 3))
|
|
#define CHECKBOX_GAP (theme->config.is_compact ? 3 : SPACE_4)
|
|
#define CHECKBOX_BOX_COLOR COLOR_SURFACE
|
|
#define CHECKBOX_BOX_BORDER_COLOR COLOR_OUTLINE
|
|
#define CHECKBOX_BOX_BORDER_WIDTH BORDER
|
|
#define CHECKBOX_BOX_SHAPE 2
|
|
#define CHECKBOX_BOX_PAD 1
|
|
#define CHECKBOX_BOX_SELECTED_COLOR COLOR_PRIMARY
|
|
#define CHECKBOX_ICON_COLOR COLOR_ON_PRIMARY
|
|
#define SLIDER_TRACK_COLOR COLOR_SURFACE
|
|
#define SLIDER_TRACK_BORDER_COLOR COLOR_OUTLINE
|
|
#define SLIDER_ACTIVE_TRACK_COLOR COLOR_PRIMARY
|
|
#define SLIDER_HANDLE_COLOR COLOR_PRIMARY
|
|
#define SLIDER_TRACK_HEIGHT (LV_DPX_CALC(theme->disp_dpi, 8))
|
|
#define SLIDER_HANDLE_PAD ((theme->config.is_compact ? 1 : LV_DPX_CALC(theme->disp_dpi, 3)) + LV_DPX_CALC(theme->disp_dpi, 4))
|
|
#define SLIDERBOX_GAP (theme->config.is_compact ? 4 : ((SLIDER_TRACK_HEIGHT / 2) + SLIDER_HANDLE_PAD) + SPACE_2)
|
|
#define ARC_TRACK_COLOR COLOR_ON_SURFACE
|
|
#define ARC_TRACK_WIDTH LINE_THIN
|
|
#define ARC_INDICATOR_COLOR COLOR_PRIMARY
|
|
#define ARC_INDICATOR_WIDTH (theme->config.is_compact ? LINE_MEDIUM : LV_DPX_CALC(theme->disp_dpi, 4))
|
|
#define ARC_HANDLE_COLOR COLOR_PRIMARY
|
|
#define ARC_HANDLE_PAD (theme->config.is_compact ? 1 : LV_DPX_CALC(theme->disp_dpi, 3))
|
|
#define FIELD_COLOR COLOR_SURFACE
|
|
#define FIELD_TEXT_COLOR COLOR_ON_SURFACE
|
|
#define FIELD_BORDER_COLOR COLOR_OUTLINE
|
|
#define FIELD_BORDER_WIDTH BORDER
|
|
#define FIELD_FOCUSED_BORDER_WIDTH LINE_MEDIUM
|
|
#define FIELD_SHAPE SHAPE_FIELD
|
|
#define FIELD_PAD DENSITY_FIELD_PAD
|
|
#define FIELD_CURSOR_COLOR COLOR_ON_SURFACE
|
|
#define FIELD_CURSOR_WIDTH LINE_MEDIUM
|
|
#define FIELD_SELECTION_COLOR COLOR_PRIMARY
|
|
#define FIELD_SELECTION_TEXT_COLOR COLOR_ON_PRIMARY
|
|
#define MENU_COLOR COLOR_SURFACE
|
|
#define MENU_BORDER_COLOR COLOR_OUTLINE
|
|
#define MENU_SHAPE SHAPE_FIELD
|
|
#define MENU_MAX_HEIGHT (LV_DPI_DEF * 2)
|
|
#define MENU_ITEM_LINE_SPACE (theme->config.is_compact ? 2 : SPACE_3)
|
|
#define ROLLER_LINE_SPACE (theme->config.is_compact ? 2 : SPACE_3)
|
|
#define KEYS_PAD DENSITY_KEY_GAP
|
|
#define KEYS_GAP DENSITY_KEY_GAP
|
|
#define KEY_COLOR COLOR_SURFACE
|
|
#define KEY_TEXT_COLOR COLOR_ON_SURFACE
|
|
#define KEY_BORDER_COLOR COLOR_OUTLINE
|
|
#define KEY_SHAPE SHAPE_KEY
|
|
#define LIST_PAD DENSITY_LIST_PAD
|
|
#define LIST_ITEM_PAD_HOR DENSITY_LIST_ITEM_PAD_HOR
|
|
#define LIST_ITEM_PAD_VER DENSITY_LIST_ITEM_PAD_VER
|
|
#define LIST_ITEM_GAP (theme->config.is_compact ? 3 : SPACE_4)
|
|
#define LIST_DIVIDER_COLOR COLOR_OUTLINE
|
|
#define TABS_PAD (theme->config.is_compact ? 2 : SPACE_1)
|
|
#define TABS_GAP (theme->config.is_compact ? 2 : SPACE_1)
|
|
#define TAB_PAD (theme->config.is_compact ? 2 : SPACE_1)
|
|
#define TAB_SHAPE SHAPE_CONTROL
|
|
#define TAB_PAGE_PAD DENSITY_CONTAINER_PAD
|
|
#define DIALOG_COLOR COLOR_SURFACE
|
|
#define DIALOG_BORDER_COLOR COLOR_OUTLINE
|
|
#define DIALOG_BORDER_WIDTH LINE_MEDIUM
|
|
#define DIALOG_SHAPE SHAPE_DIALOG
|
|
#define DIALOG_PAD DENSITY_DIALOG_PAD
|
|
#define DIALOG_GAP (theme->config.is_compact ? 2 : SPACE_2)
|
|
#define WINDOW_HEADER_BORDER_COLOR COLOR_OUTLINE
|
|
#define WINDOW_HEADER_PAD (theme->config.is_compact ? 2 : SPACE_2)
|
|
#define WINDOW_CONTENT_PAD DENSITY_CONTAINER_PAD
|
|
#define TABLE_CELL_PAD (theme->config.is_compact ? 2 : SPACE_3)
|
|
#define TABLE_DIVIDER_COLOR COLOR_OUTLINE
|
|
#define CHART_GRID_COLOR COLOR_ON_SURFACE
|
|
#define CHART_POINT_SIZE (theme->config.is_compact ? 3 : LV_DPX_CALC(theme->disp_dpi, 6))
|
|
#define CALENDAR_PAD (theme->config.is_compact ? 2 : SPACE_2)
|
|
#define SCALE_COLOR COLOR_ON_SURFACE
|
|
#define SCALE_TICK_LENGTH (theme->config.is_compact ? 3 : LV_DPX_CALC(theme->disp_dpi, 6))
|
|
#define DIVIDER_COLOR COLOR_OUTLINE
|
|
|
|
/**********************
|
|
* TYPEDEFS
|
|
**********************/
|
|
|
|
typedef struct {
|
|
lv_style_t focus_ring;
|
|
lv_style_t edit_ring;
|
|
lv_style_t focus_ring_inset;
|
|
lv_style_t edit_ring_inset;
|
|
lv_style_t inverted;
|
|
lv_style_t disabled;
|
|
lv_style_t scrollbar;
|
|
#if LV_USE_TABVIEW || LV_USE_TILEVIEW || LV_USE_WIN
|
|
lv_style_t page;
|
|
#endif
|
|
lv_style_t screen;
|
|
lv_style_t container;
|
|
lv_style_t card;
|
|
lv_style_t page_indicator;
|
|
#if LV_USE_LABEL
|
|
lv_style_t page_indicator_label;
|
|
#endif
|
|
lv_style_t page_indicator_dot;
|
|
lv_style_t page_indicator_dot_current;
|
|
lv_style_t step_indicator;
|
|
lv_style_t step_indicator_segment;
|
|
lv_style_t step_indicator_segment_finished;
|
|
lv_style_t badge;
|
|
lv_style_t chip;
|
|
#if LV_USE_BUTTON || LV_USE_MSGBOX
|
|
lv_style_t button;
|
|
#endif
|
|
lv_style_t text_button;
|
|
lv_style_t icon_button;
|
|
lv_style_t icon_button_filled;
|
|
lv_style_t icon_button_filled_pressed;
|
|
lv_style_t icon_button_tonal;
|
|
lv_style_t app_bar;
|
|
lv_style_t app_bar_nav_button;
|
|
lv_style_t app_bar_button_focus_ring;
|
|
lv_style_t app_bar_button;
|
|
lv_style_t app_bar_focus_ring;
|
|
#if LV_USE_SWITCH
|
|
lv_style_t switch_track;
|
|
#endif
|
|
#if LV_USE_SWITCH
|
|
lv_style_t switch_indicator_selected;
|
|
#endif
|
|
#if LV_USE_SWITCH
|
|
lv_style_t switch_handle;
|
|
#endif
|
|
#if LV_USE_SWITCH
|
|
lv_style_t switch_handle_selected;
|
|
#endif
|
|
#if LV_USE_CHECKBOX
|
|
lv_style_t checkbox;
|
|
#endif
|
|
#if LV_USE_CHECKBOX
|
|
lv_style_t checkbox_box;
|
|
#endif
|
|
#if LV_USE_CHECKBOX
|
|
lv_style_t checkbox_box_selected;
|
|
#endif
|
|
lv_style_t sliderbox;
|
|
#if LV_USE_BAR || LV_USE_SLIDER
|
|
lv_style_t slider_track_size;
|
|
#endif
|
|
#if LV_USE_SLIDER
|
|
lv_style_t slider_knob_room;
|
|
#endif
|
|
#if LV_USE_BAR || LV_USE_SLIDER
|
|
lv_style_t slider_track;
|
|
#endif
|
|
#if LV_USE_BAR || LV_USE_SLIDER
|
|
lv_style_t slider_active_track;
|
|
#endif
|
|
#if LV_USE_SLIDER
|
|
lv_style_t slider_handle;
|
|
#endif
|
|
#if LV_USE_ARC || LV_USE_SPINNER
|
|
lv_style_t arc_track;
|
|
#endif
|
|
#if LV_USE_ARC || LV_USE_SPINNER
|
|
lv_style_t arc_indicator;
|
|
#endif
|
|
#if LV_USE_ARC
|
|
lv_style_t arc_handle;
|
|
#endif
|
|
#if LV_USE_DROPDOWN || LV_USE_SPINBOX || LV_USE_TEXTAREA
|
|
lv_style_t field;
|
|
#endif
|
|
#if LV_USE_SPINBOX || LV_USE_TEXTAREA
|
|
lv_style_t field_focused;
|
|
#endif
|
|
#if LV_USE_TEXTAREA
|
|
lv_style_t field_cursor;
|
|
#endif
|
|
#if LV_USE_LABEL && LV_USE_TEXTAREA
|
|
lv_style_t field_selection;
|
|
#endif
|
|
#if LV_USE_DROPDOWN
|
|
lv_style_t menu;
|
|
#endif
|
|
#if LV_USE_DROPDOWN
|
|
lv_style_t menu_item;
|
|
#endif
|
|
#if LV_USE_ROLLER
|
|
lv_style_t roller;
|
|
#endif
|
|
#if LV_USE_BUTTONMATRIX || LV_USE_KEYBOARD
|
|
lv_style_t keys;
|
|
#endif
|
|
#if LV_USE_BUTTONMATRIX || LV_USE_KEYBOARD
|
|
lv_style_t key;
|
|
#endif
|
|
lv_style_t list;
|
|
lv_style_t list_item;
|
|
lv_style_t list_subheader;
|
|
#if LV_USE_TABVIEW
|
|
lv_style_t tabs;
|
|
#endif
|
|
#if LV_USE_BUTTON && LV_USE_TABVIEW
|
|
lv_style_t tab;
|
|
#endif
|
|
#if LV_USE_TABVIEW
|
|
lv_style_t tab_page;
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
lv_style_t dialog;
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
lv_style_t dialog_header;
|
|
#endif
|
|
#if LV_USE_LABEL && LV_USE_MSGBOX
|
|
lv_style_t dialog_title;
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
lv_style_t dialog_content;
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
lv_style_t dialog_actions;
|
|
#endif
|
|
#if LV_USE_MENU
|
|
lv_style_t settings;
|
|
#endif
|
|
#if LV_USE_MENU
|
|
lv_style_t settings_sidebar;
|
|
#endif
|
|
#if LV_USE_MENU
|
|
lv_style_t settings_content;
|
|
#endif
|
|
#if LV_USE_MENU
|
|
lv_style_t settings_page;
|
|
#endif
|
|
#if LV_USE_MENU
|
|
lv_style_t settings_header;
|
|
#endif
|
|
#if LV_USE_MENU
|
|
lv_style_t settings_section;
|
|
#endif
|
|
#if LV_USE_MENU
|
|
lv_style_t settings_item;
|
|
#endif
|
|
#if LV_USE_MENU
|
|
lv_style_t settings_separator;
|
|
#endif
|
|
#if LV_USE_WIN
|
|
lv_style_t window_header;
|
|
#endif
|
|
#if LV_USE_LABEL && LV_USE_WIN
|
|
lv_style_t window_title;
|
|
#endif
|
|
#if LV_USE_WIN
|
|
lv_style_t window_content;
|
|
#endif
|
|
#if LV_USE_TABLE
|
|
lv_style_t table;
|
|
#endif
|
|
#if LV_USE_TABLE
|
|
lv_style_t table_cell;
|
|
#endif
|
|
#if LV_USE_CHART
|
|
lv_style_t chart;
|
|
#endif
|
|
#if LV_USE_CHART
|
|
lv_style_t chart_series;
|
|
#endif
|
|
#if LV_USE_CHART
|
|
lv_style_t chart_indicator;
|
|
#endif
|
|
#if LV_USE_CALENDAR
|
|
lv_style_t calendar;
|
|
#endif
|
|
#if LV_USE_BUTTONMATRIX && LV_USE_CALENDAR
|
|
lv_style_t calendar_day;
|
|
#endif
|
|
#if LV_USE_SCALE
|
|
lv_style_t scale;
|
|
#endif
|
|
#if LV_USE_LINE
|
|
lv_style_t divider;
|
|
#endif
|
|
#if LV_USE_LED
|
|
lv_style_t led;
|
|
#endif
|
|
} my_theme_styles_t;
|
|
|
|
typedef enum {
|
|
DISP_SMALL = 3,
|
|
DISP_MEDIUM = 2,
|
|
DISP_LARGE = 1,
|
|
} disp_size_t;
|
|
|
|
typedef struct {
|
|
lv_theme_t base;
|
|
disp_size_t disp_size;
|
|
int32_t disp_dpi;
|
|
lv_theme_material_mono_config_t config;
|
|
bool inited;
|
|
my_theme_styles_t styles;
|
|
|
|
} my_theme_t;
|
|
|
|
/**********************
|
|
* STATIC PROTOTYPES
|
|
**********************/
|
|
|
|
static void style_init_reset(lv_style_t * style);
|
|
static void theme_apply(lv_theme_t * th, lv_obj_t * obj);
|
|
static void resolution_change_event_cb(lv_event_t * e);
|
|
|
|
/**********************
|
|
* STATIC VARIABLES
|
|
**********************/
|
|
|
|
static my_theme_t * theme_def = NULL;
|
|
|
|
/**********************
|
|
* STATIC FUNCTIONS
|
|
**********************/
|
|
|
|
static inline lv_obj_t * lss_ancestor(lv_obj_t * obj, uint32_t depth)
|
|
{
|
|
while(obj != NULL && depth > 0) {
|
|
obj = lv_obj_get_parent(obj);
|
|
depth--;
|
|
}
|
|
return obj;
|
|
}
|
|
|
|
static inline bool lss_is_child(lv_obj_t * parent, int32_t index, lv_obj_t * child)
|
|
{
|
|
return parent != NULL && lv_obj_get_child(parent, index) == child;
|
|
}
|
|
|
|
static bool config_equals(const lv_theme_material_mono_config_t * a, const lv_theme_material_mono_config_t * b)
|
|
{
|
|
return a->is_dark == b->is_dark &&
|
|
a->is_compact == b->is_compact &&
|
|
a->animations_enabled == b->animations_enabled &&
|
|
lv_color_eq(a->color_primary, b->color_primary) &&
|
|
lv_color_eq(a->color_secondary, b->color_secondary) &&
|
|
a->font_small == b->font_small &&
|
|
a->font_normal == b->font_normal &&
|
|
a->font_large == b->font_large;
|
|
}
|
|
|
|
static void style_init(my_theme_t * theme)
|
|
{
|
|
style_init_reset(&theme->styles.focus_ring);
|
|
lv_style_set_outline_color(&theme->styles.focus_ring, FOCUS_RING_COLOR);
|
|
lv_style_set_outline_width(&theme->styles.focus_ring, FOCUS_RING_WIDTH);
|
|
lv_style_set_outline_pad(&theme->styles.focus_ring, FOCUS_RING_OFFSET);
|
|
lv_style_set_outline_opa(&theme->styles.focus_ring, LV_OPA_COVER);
|
|
|
|
style_init_reset(&theme->styles.edit_ring);
|
|
lv_style_set_outline_color(&theme->styles.edit_ring, FOCUS_RING_COLOR);
|
|
lv_style_set_outline_width(&theme->styles.edit_ring, EDIT_RING_WIDTH);
|
|
lv_style_set_outline_pad(&theme->styles.edit_ring, FOCUS_RING_OFFSET);
|
|
lv_style_set_outline_opa(&theme->styles.edit_ring, LV_OPA_COVER);
|
|
|
|
style_init_reset(&theme->styles.focus_ring_inset);
|
|
lv_style_set_outline_color(&theme->styles.focus_ring_inset, FOCUS_RING_COLOR);
|
|
lv_style_set_outline_width(&theme->styles.focus_ring_inset, FOCUS_INSET_WIDTH);
|
|
lv_style_set_outline_pad(&theme->styles.focus_ring_inset, -FOCUS_INSET_WIDTH);
|
|
lv_style_set_outline_opa(&theme->styles.focus_ring_inset, LV_OPA_COVER);
|
|
|
|
style_init_reset(&theme->styles.edit_ring_inset);
|
|
lv_style_set_outline_color(&theme->styles.edit_ring_inset, FOCUS_RING_COLOR);
|
|
lv_style_set_outline_width(&theme->styles.edit_ring_inset, EDIT_RING_WIDTH);
|
|
lv_style_set_outline_pad(&theme->styles.edit_ring_inset, -EDIT_RING_WIDTH);
|
|
lv_style_set_outline_opa(&theme->styles.edit_ring_inset, LV_OPA_COVER);
|
|
|
|
style_init_reset(&theme->styles.inverted);
|
|
lv_style_set_bg_color(&theme->styles.inverted, BUTTON_INVERTED_CONTAINER_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.inverted, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.inverted, BUTTON_INVERTED_LABEL_COLOR);
|
|
lv_style_set_border_color(&theme->styles.inverted, BUTTON_INVERTED_LABEL_COLOR);
|
|
lv_style_set_line_color(&theme->styles.inverted, BUTTON_INVERTED_LABEL_COLOR);
|
|
lv_style_set_arc_color(&theme->styles.inverted, BUTTON_INVERTED_LABEL_COLOR);
|
|
lv_style_set_outline_color(&theme->styles.inverted, BUTTON_INVERTED_LABEL_COLOR);
|
|
|
|
style_init_reset(&theme->styles.disabled);
|
|
lv_style_set_border_width(&theme->styles.disabled, 0);
|
|
|
|
style_init_reset(&theme->styles.scrollbar);
|
|
lv_style_set_bg_color(&theme->styles.scrollbar, SCROLLBAR_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.scrollbar, LV_OPA_COVER);
|
|
lv_style_set_radius(&theme->styles.scrollbar, LV_RADIUS_CIRCLE);
|
|
lv_style_set_width(&theme->styles.scrollbar, SCROLLBAR_WIDTH);
|
|
lv_style_set_pad_all(&theme->styles.scrollbar, SCROLLBAR_PAD);
|
|
|
|
#if LV_USE_TABVIEW || LV_USE_TILEVIEW || LV_USE_WIN
|
|
style_init_reset(&theme->styles.page);
|
|
lv_style_set_bg_opa(&theme->styles.page, LV_OPA_TRANSP);
|
|
lv_style_set_border_width(&theme->styles.page, 0);
|
|
lv_style_set_radius(&theme->styles.page, 0);
|
|
lv_style_set_pad_all(&theme->styles.page, 0);
|
|
lv_style_set_pad_gap(&theme->styles.page, 0);
|
|
#endif
|
|
|
|
style_init_reset(&theme->styles.screen);
|
|
lv_style_set_bg_color(&theme->styles.screen, SCREEN_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.screen, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.screen, SCREEN_TEXT_COLOR);
|
|
lv_style_set_text_font(&theme->styles.screen, theme->config.font_normal);
|
|
lv_style_set_pad_row(&theme->styles.screen, SCREEN_GAP);
|
|
lv_style_set_pad_column(&theme->styles.screen, SCREEN_GAP);
|
|
|
|
style_init_reset(&theme->styles.container);
|
|
lv_style_set_bg_color(&theme->styles.container, CONTAINER_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.container, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.container, CONTAINER_TEXT_COLOR);
|
|
lv_style_set_border_color(&theme->styles.container, CONTAINER_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.container, CONTAINER_BORDER_WIDTH);
|
|
lv_style_set_radius(&theme->styles.container, CONTAINER_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.container, CONTAINER_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.container, CONTAINER_GAP);
|
|
lv_style_set_line_color(&theme->styles.container, DIVIDER_COLOR);
|
|
lv_style_set_line_width(&theme->styles.container, BORDER);
|
|
lv_style_set_arc_color(&theme->styles.container, COLOR_ON_SURFACE);
|
|
lv_style_set_arc_width(&theme->styles.container, LINE_MEDIUM);
|
|
|
|
style_init_reset(&theme->styles.card);
|
|
lv_style_set_bg_color(&theme->styles.card, CARD_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.card, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.card, CARD_TEXT_COLOR);
|
|
lv_style_set_border_color(&theme->styles.card, CARD_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.card, CARD_BORDER_WIDTH);
|
|
lv_style_set_radius(&theme->styles.card, CARD_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.card, CARD_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.card, CARD_GAP);
|
|
|
|
style_init_reset(&theme->styles.page_indicator);
|
|
lv_style_set_bg_opa(&theme->styles.page_indicator, LV_OPA_TRANSP);
|
|
lv_style_set_border_width(&theme->styles.page_indicator, 0);
|
|
lv_style_set_pad_all(&theme->styles.page_indicator, 0);
|
|
lv_style_set_pad_gap(&theme->styles.page_indicator, PAGE_INDICATOR_GAP);
|
|
|
|
#if LV_USE_LABEL
|
|
style_init_reset(&theme->styles.page_indicator_label);
|
|
lv_style_set_text_color(&theme->styles.page_indicator_label, PAGE_INDICATOR_COLOR);
|
|
#endif
|
|
|
|
style_init_reset(&theme->styles.page_indicator_dot);
|
|
lv_style_set_width(&theme->styles.page_indicator_dot, PAGE_INDICATOR_DOT_SIZE);
|
|
lv_style_set_height(&theme->styles.page_indicator_dot, PAGE_INDICATOR_DOT_SIZE);
|
|
lv_style_set_radius(&theme->styles.page_indicator_dot, LV_RADIUS_CIRCLE);
|
|
lv_style_set_bg_color(&theme->styles.page_indicator_dot, PAGE_INDICATOR_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.page_indicator_dot, LV_OPA_TRANSP);
|
|
lv_style_set_border_color(&theme->styles.page_indicator_dot, PAGE_INDICATOR_COLOR);
|
|
lv_style_set_border_width(&theme->styles.page_indicator_dot, 1);
|
|
|
|
style_init_reset(&theme->styles.page_indicator_dot_current);
|
|
lv_style_set_bg_opa(&theme->styles.page_indicator_dot_current, LV_OPA_COVER);
|
|
|
|
style_init_reset(&theme->styles.step_indicator);
|
|
lv_style_set_bg_opa(&theme->styles.step_indicator, LV_OPA_TRANSP);
|
|
lv_style_set_border_width(&theme->styles.step_indicator, 0);
|
|
lv_style_set_pad_all(&theme->styles.step_indicator, STEP_INDICATOR_MARGIN);
|
|
lv_style_set_pad_gap(&theme->styles.step_indicator, STEP_INDICATOR_GAP);
|
|
|
|
style_init_reset(&theme->styles.step_indicator_segment);
|
|
lv_style_set_height(&theme->styles.step_indicator_segment, STEP_INDICATOR_THICKNESS);
|
|
lv_style_set_radius(&theme->styles.step_indicator_segment, LV_RADIUS_CIRCLE);
|
|
lv_style_set_bg_color(&theme->styles.step_indicator_segment, STEP_INDICATOR_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.step_indicator_segment, LV_OPA_TRANSP);
|
|
lv_style_set_border_color(&theme->styles.step_indicator_segment, STEP_INDICATOR_COLOR);
|
|
lv_style_set_border_width(&theme->styles.step_indicator_segment, 1);
|
|
|
|
style_init_reset(&theme->styles.step_indicator_segment_finished);
|
|
lv_style_set_bg_opa(&theme->styles.step_indicator_segment_finished, LV_OPA_COVER);
|
|
|
|
style_init_reset(&theme->styles.badge);
|
|
lv_style_set_width(&theme->styles.badge, BADGE_SIZE);
|
|
lv_style_set_height(&theme->styles.badge, BADGE_SIZE);
|
|
lv_style_set_radius(&theme->styles.badge, LV_RADIUS_CIRCLE);
|
|
lv_style_set_bg_color(&theme->styles.badge, BADGE_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.badge, LV_OPA_COVER);
|
|
|
|
style_init_reset(&theme->styles.chip);
|
|
lv_style_set_bg_color(&theme->styles.chip, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.chip, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.chip, COLOR_ON_SURFACE);
|
|
lv_style_set_border_color(&theme->styles.chip, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.chip, BORDER);
|
|
lv_style_set_radius(&theme->styles.chip, CHIP_SHAPE);
|
|
lv_style_set_pad_hor(&theme->styles.chip, CHIP_PAD_HOR);
|
|
lv_style_set_pad_ver(&theme->styles.chip, CHIP_PAD_VER);
|
|
lv_style_set_margin_all(&theme->styles.chip, FOCUS_WIDTH + FOCUS_OFFSET);
|
|
|
|
#if LV_USE_BUTTON || LV_USE_MSGBOX
|
|
style_init_reset(&theme->styles.button);
|
|
lv_style_set_bg_color(&theme->styles.button, BUTTON_CONTAINER_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.button, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.button, BUTTON_LABEL_COLOR);
|
|
lv_style_set_border_color(&theme->styles.button, BUTTON_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.button, BUTTON_BORDER_WIDTH);
|
|
lv_style_set_radius(&theme->styles.button, BUTTON_SHAPE);
|
|
lv_style_set_pad_hor(&theme->styles.button, BUTTON_PAD_HOR);
|
|
lv_style_set_pad_ver(&theme->styles.button, BUTTON_PAD_VER);
|
|
lv_style_set_pad_gap(&theme->styles.button, BUTTON_GAP);
|
|
lv_style_set_margin_all(&theme->styles.button, FOCUS_WIDTH + FOCUS_OFFSET);
|
|
#endif
|
|
|
|
style_init_reset(&theme->styles.text_button);
|
|
lv_style_set_bg_opa(&theme->styles.text_button, LV_OPA_TRANSP);
|
|
lv_style_set_text_color(&theme->styles.text_button, BUTTON_LABEL_COLOR);
|
|
lv_style_set_border_width(&theme->styles.text_button, 0);
|
|
lv_style_set_radius(&theme->styles.text_button, BUTTON_SHAPE);
|
|
lv_style_set_pad_hor(&theme->styles.text_button, BUTTON_PAD_HOR);
|
|
lv_style_set_pad_ver(&theme->styles.text_button, BUTTON_PAD_VER);
|
|
lv_style_set_pad_gap(&theme->styles.text_button, BUTTON_GAP);
|
|
lv_style_set_margin_all(&theme->styles.text_button, FOCUS_WIDTH + FOCUS_OFFSET);
|
|
|
|
style_init_reset(&theme->styles.icon_button);
|
|
lv_style_set_bg_opa(&theme->styles.icon_button, LV_OPA_TRANSP);
|
|
lv_style_set_text_color(&theme->styles.icon_button, COLOR_ON_SURFACE);
|
|
lv_style_set_border_width(&theme->styles.icon_button, 0);
|
|
lv_style_set_radius(&theme->styles.icon_button, BUTTON_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.icon_button, BUTTON_PAD_VER);
|
|
|
|
style_init_reset(&theme->styles.icon_button_filled);
|
|
lv_style_set_bg_color(&theme->styles.icon_button_filled, ICON_BUTTON_FILLED_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.icon_button_filled, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.icon_button_filled, ICON_BUTTON_FILLED_ICON_COLOR);
|
|
lv_style_set_border_width(&theme->styles.icon_button_filled, 0);
|
|
lv_style_set_radius(&theme->styles.icon_button_filled, ICON_BUTTON_CONTAINER_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.icon_button_filled, BUTTON_PAD_VER);
|
|
|
|
style_init_reset(&theme->styles.icon_button_filled_pressed);
|
|
lv_style_set_bg_color(&theme->styles.icon_button_filled_pressed, ICON_BUTTON_TONAL_COLOR);
|
|
lv_style_set_text_color(&theme->styles.icon_button_filled_pressed, ICON_BUTTON_TONAL_ICON_COLOR);
|
|
lv_style_set_border_color(&theme->styles.icon_button_filled_pressed, ICON_BUTTON_TONAL_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.icon_button_filled_pressed, BORDER);
|
|
|
|
style_init_reset(&theme->styles.icon_button_tonal);
|
|
lv_style_set_bg_color(&theme->styles.icon_button_tonal, ICON_BUTTON_TONAL_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.icon_button_tonal, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.icon_button_tonal, ICON_BUTTON_TONAL_ICON_COLOR);
|
|
lv_style_set_border_color(&theme->styles.icon_button_tonal, ICON_BUTTON_TONAL_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.icon_button_tonal, BORDER);
|
|
lv_style_set_radius(&theme->styles.icon_button_tonal, ICON_BUTTON_CONTAINER_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.icon_button_tonal, BUTTON_PAD_VER);
|
|
|
|
style_init_reset(&theme->styles.app_bar);
|
|
lv_style_set_bg_opa(&theme->styles.app_bar, LV_OPA_TRANSP);
|
|
lv_style_set_text_color(&theme->styles.app_bar, APP_BAR_TITLE_COLOR);
|
|
lv_style_set_radius(&theme->styles.app_bar, 0);
|
|
lv_style_set_border_width(&theme->styles.app_bar, 0);
|
|
lv_style_set_pad_hor(&theme->styles.app_bar, APP_BAR_PAD_HOR);
|
|
lv_style_set_pad_right(&theme->styles.app_bar, APP_BAR_PAD_RIGHT);
|
|
lv_style_set_pad_ver(&theme->styles.app_bar, 0);
|
|
lv_style_set_pad_gap(&theme->styles.app_bar, APP_BAR_GAP);
|
|
|
|
style_init_reset(&theme->styles.app_bar_nav_button);
|
|
if(theme->config.is_compact) {
|
|
lv_style_set_margin_left(&theme->styles.app_bar_nav_button, 4);
|
|
}
|
|
|
|
style_init_reset(&theme->styles.app_bar_button_focus_ring);
|
|
if(theme->config.is_compact) {
|
|
lv_style_set_outline_pad(&theme->styles.app_bar_button_focus_ring, 0);
|
|
}
|
|
|
|
style_init_reset(&theme->styles.app_bar_button);
|
|
lv_style_set_pad_all(&theme->styles.app_bar_button, 0);
|
|
|
|
style_init_reset(&theme->styles.app_bar_focus_ring);
|
|
lv_style_set_outline_color(&theme->styles.app_bar_focus_ring, FOCUS_RING_COLOR);
|
|
lv_style_set_outline_width(&theme->styles.app_bar_focus_ring, APP_BAR_FOCUS_WIDTH);
|
|
lv_style_set_outline_pad(&theme->styles.app_bar_focus_ring, -APP_BAR_FOCUS_WIDTH);
|
|
lv_style_set_outline_opa(&theme->styles.app_bar_focus_ring, LV_OPA_COVER);
|
|
|
|
#if LV_USE_SWITCH
|
|
style_init_reset(&theme->styles.switch_track);
|
|
lv_style_set_width(&theme->styles.switch_track, SWITCH_WIDTH);
|
|
lv_style_set_height(&theme->styles.switch_track, SWITCH_HEIGHT);
|
|
lv_style_set_margin_all(&theme->styles.switch_track, FOCUS_WIDTH + FOCUS_OFFSET);
|
|
lv_style_set_bg_color(&theme->styles.switch_track, SWITCH_TRACK_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.switch_track, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.switch_track, SWITCH_TRACK_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.switch_track, SWITCH_TRACK_BORDER_WIDTH);
|
|
lv_style_set_radius(&theme->styles.switch_track, LV_RADIUS_CIRCLE);
|
|
lv_style_set_pad_all(&theme->styles.switch_track, 0);
|
|
lv_style_set_anim_duration(&theme->styles.switch_track, MOTION_DURATION_SHORT);
|
|
#endif
|
|
|
|
#if LV_USE_SWITCH
|
|
style_init_reset(&theme->styles.switch_indicator_selected);
|
|
lv_style_set_bg_color(&theme->styles.switch_indicator_selected, SWITCH_TRACK_SELECTED_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.switch_indicator_selected, LV_OPA_COVER);
|
|
lv_style_set_radius(&theme->styles.switch_indicator_selected, LV_RADIUS_CIRCLE);
|
|
#endif
|
|
|
|
#if LV_USE_SWITCH
|
|
style_init_reset(&theme->styles.switch_handle);
|
|
lv_style_set_bg_color(&theme->styles.switch_handle, SWITCH_HANDLE_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.switch_handle, LV_OPA_COVER);
|
|
lv_style_set_radius(&theme->styles.switch_handle, LV_RADIUS_CIRCLE);
|
|
lv_style_set_pad_all(&theme->styles.switch_handle, SWITCH_HANDLE_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_SWITCH
|
|
style_init_reset(&theme->styles.switch_handle_selected);
|
|
lv_style_set_bg_color(&theme->styles.switch_handle_selected, SWITCH_HANDLE_SELECTED_COLOR);
|
|
lv_style_set_pad_all(&theme->styles.switch_handle_selected, SWITCH_HANDLE_SELECTED_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_CHECKBOX
|
|
style_init_reset(&theme->styles.checkbox);
|
|
lv_style_set_pad_gap(&theme->styles.checkbox, CHECKBOX_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_CHECKBOX
|
|
style_init_reset(&theme->styles.checkbox_box);
|
|
lv_style_set_bg_color(&theme->styles.checkbox_box, CHECKBOX_BOX_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.checkbox_box, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.checkbox_box, CHECKBOX_BOX_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.checkbox_box, CHECKBOX_BOX_BORDER_WIDTH);
|
|
lv_style_set_radius(&theme->styles.checkbox_box, CHECKBOX_BOX_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.checkbox_box, CHECKBOX_BOX_PAD);
|
|
lv_style_set_text_font(&theme->styles.checkbox_box, theme->config.font_small);
|
|
lv_style_set_text_color(&theme->styles.checkbox_box, CHECKBOX_ICON_COLOR);
|
|
#endif
|
|
|
|
#if LV_USE_CHECKBOX
|
|
style_init_reset(&theme->styles.checkbox_box_selected);
|
|
lv_style_set_bg_color(&theme->styles.checkbox_box_selected, CHECKBOX_BOX_SELECTED_COLOR);
|
|
lv_style_set_bg_image_src(&theme->styles.checkbox_box_selected, LV_SYMBOL_OK);
|
|
#endif
|
|
|
|
style_init_reset(&theme->styles.sliderbox);
|
|
lv_style_set_pad_column(&theme->styles.sliderbox, SLIDERBOX_GAP);
|
|
lv_style_set_pad_all(&theme->styles.sliderbox, FOCUS_WIDTH + FOCUS_OFFSET);
|
|
|
|
#if LV_USE_BAR || LV_USE_SLIDER
|
|
style_init_reset(&theme->styles.slider_track_size);
|
|
lv_style_set_height(&theme->styles.slider_track_size, SLIDER_TRACK_HEIGHT);
|
|
#endif
|
|
|
|
#if LV_USE_SLIDER
|
|
style_init_reset(&theme->styles.slider_knob_room);
|
|
lv_style_set_margin_ver(&theme->styles.slider_knob_room, SLIDER_HANDLE_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_BAR || LV_USE_SLIDER
|
|
style_init_reset(&theme->styles.slider_track);
|
|
lv_style_set_bg_color(&theme->styles.slider_track, SLIDER_TRACK_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.slider_track, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.slider_track, SLIDER_TRACK_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.slider_track, BORDER);
|
|
lv_style_set_radius(&theme->styles.slider_track, LV_RADIUS_CIRCLE);
|
|
lv_style_set_pad_all(&theme->styles.slider_track, 0);
|
|
#endif
|
|
|
|
#if LV_USE_BAR || LV_USE_SLIDER
|
|
style_init_reset(&theme->styles.slider_active_track);
|
|
lv_style_set_bg_color(&theme->styles.slider_active_track, SLIDER_ACTIVE_TRACK_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.slider_active_track, LV_OPA_COVER);
|
|
lv_style_set_radius(&theme->styles.slider_active_track, LV_RADIUS_CIRCLE);
|
|
#endif
|
|
|
|
#if LV_USE_SLIDER
|
|
style_init_reset(&theme->styles.slider_handle);
|
|
lv_style_set_bg_color(&theme->styles.slider_handle, SLIDER_HANDLE_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.slider_handle, LV_OPA_COVER);
|
|
lv_style_set_radius(&theme->styles.slider_handle, LV_RADIUS_CIRCLE);
|
|
lv_style_set_pad_all(&theme->styles.slider_handle, SLIDER_HANDLE_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_ARC || LV_USE_SPINNER
|
|
style_init_reset(&theme->styles.arc_track);
|
|
lv_style_set_arc_color(&theme->styles.arc_track, ARC_TRACK_COLOR);
|
|
lv_style_set_arc_width(&theme->styles.arc_track, ARC_TRACK_WIDTH);
|
|
#endif
|
|
|
|
#if LV_USE_ARC || LV_USE_SPINNER
|
|
style_init_reset(&theme->styles.arc_indicator);
|
|
lv_style_set_arc_color(&theme->styles.arc_indicator, ARC_INDICATOR_COLOR);
|
|
lv_style_set_arc_width(&theme->styles.arc_indicator, ARC_INDICATOR_WIDTH);
|
|
lv_style_set_arc_rounded(&theme->styles.arc_indicator, true);
|
|
#endif
|
|
|
|
#if LV_USE_ARC
|
|
style_init_reset(&theme->styles.arc_handle);
|
|
lv_style_set_bg_color(&theme->styles.arc_handle, ARC_HANDLE_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.arc_handle, LV_OPA_COVER);
|
|
lv_style_set_radius(&theme->styles.arc_handle, LV_RADIUS_CIRCLE);
|
|
lv_style_set_pad_all(&theme->styles.arc_handle, ARC_HANDLE_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_DROPDOWN || LV_USE_SPINBOX || LV_USE_TEXTAREA
|
|
style_init_reset(&theme->styles.field);
|
|
lv_style_set_bg_color(&theme->styles.field, FIELD_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.field, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.field, FIELD_TEXT_COLOR);
|
|
lv_style_set_border_color(&theme->styles.field, FIELD_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.field, FIELD_BORDER_WIDTH);
|
|
lv_style_set_radius(&theme->styles.field, FIELD_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.field, FIELD_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.field, FIELD_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_SPINBOX || LV_USE_TEXTAREA
|
|
style_init_reset(&theme->styles.field_focused);
|
|
lv_style_set_border_width(&theme->styles.field_focused, FIELD_FOCUSED_BORDER_WIDTH);
|
|
#endif
|
|
|
|
#if LV_USE_TEXTAREA
|
|
style_init_reset(&theme->styles.field_cursor);
|
|
lv_style_set_border_color(&theme->styles.field_cursor, FIELD_CURSOR_COLOR);
|
|
lv_style_set_border_width(&theme->styles.field_cursor, FIELD_CURSOR_WIDTH);
|
|
lv_style_set_border_side(&theme->styles.field_cursor, LV_BORDER_SIDE_LEFT);
|
|
lv_style_set_bg_opa(&theme->styles.field_cursor, LV_OPA_TRANSP);
|
|
lv_style_set_anim_duration(&theme->styles.field_cursor, MOTION_DURATION_LONG);
|
|
#endif
|
|
|
|
#if LV_USE_LABEL && LV_USE_TEXTAREA
|
|
style_init_reset(&theme->styles.field_selection);
|
|
lv_style_set_bg_color(&theme->styles.field_selection, FIELD_SELECTION_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.field_selection, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.field_selection, FIELD_SELECTION_TEXT_COLOR);
|
|
#endif
|
|
|
|
#if LV_USE_DROPDOWN
|
|
style_init_reset(&theme->styles.menu);
|
|
lv_style_set_bg_color(&theme->styles.menu, MENU_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.menu, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.menu, MENU_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.menu, BORDER);
|
|
lv_style_set_radius(&theme->styles.menu, MENU_SHAPE);
|
|
lv_style_set_text_line_space(&theme->styles.menu, MENU_ITEM_LINE_SPACE);
|
|
lv_style_set_max_height(&theme->styles.menu, MENU_MAX_HEIGHT);
|
|
lv_style_set_clip_corner(&theme->styles.menu, true);
|
|
#endif
|
|
|
|
#if LV_USE_DROPDOWN
|
|
style_init_reset(&theme->styles.menu_item);
|
|
lv_style_set_bg_opa(&theme->styles.menu_item, LV_OPA_TRANSP);
|
|
#endif
|
|
|
|
#if LV_USE_ROLLER
|
|
style_init_reset(&theme->styles.roller);
|
|
lv_style_set_bg_color(&theme->styles.roller, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.roller, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.roller, COLOR_ON_SURFACE);
|
|
lv_style_set_border_color(&theme->styles.roller, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.roller, BORDER);
|
|
lv_style_set_radius(&theme->styles.roller, SHAPE_CONTAINER);
|
|
lv_style_set_text_line_space(&theme->styles.roller, ROLLER_LINE_SPACE);
|
|
lv_style_set_text_align(&theme->styles.roller, LV_TEXT_ALIGN_CENTER);
|
|
lv_style_set_anim_duration(&theme->styles.roller, MOTION_DURATION_MEDIUM);
|
|
#endif
|
|
|
|
#if LV_USE_BUTTONMATRIX || LV_USE_KEYBOARD
|
|
style_init_reset(&theme->styles.keys);
|
|
lv_style_set_bg_opa(&theme->styles.keys, LV_OPA_TRANSP);
|
|
lv_style_set_border_width(&theme->styles.keys, 0);
|
|
lv_style_set_pad_all(&theme->styles.keys, KEYS_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.keys, KEYS_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_BUTTONMATRIX || LV_USE_KEYBOARD
|
|
style_init_reset(&theme->styles.key);
|
|
lv_style_set_bg_color(&theme->styles.key, KEY_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.key, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.key, KEY_TEXT_COLOR);
|
|
lv_style_set_border_color(&theme->styles.key, KEY_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.key, BORDER);
|
|
lv_style_set_radius(&theme->styles.key, KEY_SHAPE);
|
|
#endif
|
|
|
|
style_init_reset(&theme->styles.list);
|
|
lv_style_set_bg_color(&theme->styles.list, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.list, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.list, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.list, BORDER);
|
|
lv_style_set_radius(&theme->styles.list, SHAPE_CONTAINER);
|
|
lv_style_set_pad_hor(&theme->styles.list, 0);
|
|
lv_style_set_pad_ver(&theme->styles.list, 0);
|
|
lv_style_set_pad_gap(&theme->styles.list, 0);
|
|
lv_style_set_clip_corner(&theme->styles.list, true);
|
|
|
|
style_init_reset(&theme->styles.list_item);
|
|
lv_style_set_bg_opa(&theme->styles.list_item, LV_OPA_TRANSP);
|
|
lv_style_set_text_color(&theme->styles.list_item, COLOR_ON_SURFACE);
|
|
lv_style_set_border_color(&theme->styles.list_item, LIST_DIVIDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.list_item, BORDER);
|
|
lv_style_set_border_side(&theme->styles.list_item, LV_BORDER_SIDE_BOTTOM);
|
|
lv_style_set_radius(&theme->styles.list_item, 0);
|
|
lv_style_set_pad_hor(&theme->styles.list_item, LIST_ITEM_PAD_HOR);
|
|
lv_style_set_pad_ver(&theme->styles.list_item, LIST_ITEM_PAD_VER);
|
|
lv_style_set_pad_column(&theme->styles.list_item, LIST_ITEM_GAP);
|
|
|
|
style_init_reset(&theme->styles.list_subheader);
|
|
lv_style_set_text_font(&theme->styles.list_subheader, theme->config.font_small);
|
|
lv_style_set_text_decor(&theme->styles.list_subheader, LV_TEXT_DECOR_UNDERLINE);
|
|
lv_style_set_pad_hor(&theme->styles.list_subheader, LIST_ITEM_PAD_HOR);
|
|
lv_style_set_pad_top(&theme->styles.list_subheader, LIST_ITEM_PAD_VER);
|
|
lv_style_set_pad_bottom(&theme->styles.list_subheader, LIST_PAD);
|
|
|
|
#if LV_USE_TABVIEW
|
|
style_init_reset(&theme->styles.tabs);
|
|
lv_style_set_bg_opa(&theme->styles.tabs, LV_OPA_TRANSP);
|
|
lv_style_set_border_width(&theme->styles.tabs, 0);
|
|
lv_style_set_pad_all(&theme->styles.tabs, TABS_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.tabs, TABS_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_BUTTON && LV_USE_TABVIEW
|
|
style_init_reset(&theme->styles.tab);
|
|
lv_style_set_bg_opa(&theme->styles.tab, LV_OPA_TRANSP);
|
|
lv_style_set_text_color(&theme->styles.tab, COLOR_ON_SURFACE);
|
|
lv_style_set_border_width(&theme->styles.tab, 0);
|
|
lv_style_set_radius(&theme->styles.tab, TAB_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.tab, TAB_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_TABVIEW
|
|
style_init_reset(&theme->styles.tab_page);
|
|
lv_style_set_pad_all(&theme->styles.tab_page, TAB_PAGE_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_MSGBOX
|
|
style_init_reset(&theme->styles.dialog);
|
|
lv_style_set_bg_color(&theme->styles.dialog, DIALOG_COLOR);
|
|
lv_style_set_bg_opa(&theme->styles.dialog, LV_OPA_COVER);
|
|
lv_style_set_text_color(&theme->styles.dialog, COLOR_ON_SURFACE);
|
|
lv_style_set_border_color(&theme->styles.dialog, DIALOG_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.dialog, DIALOG_BORDER_WIDTH);
|
|
lv_style_set_radius(&theme->styles.dialog, DIALOG_SHAPE);
|
|
lv_style_set_pad_all(&theme->styles.dialog, 0);
|
|
lv_style_set_pad_gap(&theme->styles.dialog, 0);
|
|
lv_style_set_clip_corner(&theme->styles.dialog, true);
|
|
#endif
|
|
|
|
#if LV_USE_MSGBOX
|
|
style_init_reset(&theme->styles.dialog_header);
|
|
lv_style_set_pad_hor(&theme->styles.dialog_header, DIALOG_PAD);
|
|
lv_style_set_pad_top(&theme->styles.dialog_header, DIALOG_PAD);
|
|
lv_style_set_pad_bottom(&theme->styles.dialog_header, DIALOG_GAP);
|
|
lv_style_set_pad_gap(&theme->styles.dialog_header, DIALOG_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_LABEL && LV_USE_MSGBOX
|
|
style_init_reset(&theme->styles.dialog_title);
|
|
lv_style_set_text_font(&theme->styles.dialog_title, theme->config.font_large);
|
|
#endif
|
|
|
|
#if LV_USE_MSGBOX
|
|
style_init_reset(&theme->styles.dialog_content);
|
|
lv_style_set_pad_hor(&theme->styles.dialog_content, DIALOG_PAD);
|
|
lv_style_set_pad_ver(&theme->styles.dialog_content, DIALOG_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_MSGBOX
|
|
style_init_reset(&theme->styles.dialog_actions);
|
|
lv_style_set_pad_all(&theme->styles.dialog_actions, DIALOG_PAD);
|
|
lv_style_set_pad_top(&theme->styles.dialog_actions, DIALOG_GAP);
|
|
lv_style_set_pad_gap(&theme->styles.dialog_actions, DIALOG_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_MENU
|
|
style_init_reset(&theme->styles.settings);
|
|
lv_style_set_bg_color(&theme->styles.settings, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.settings, LV_OPA_COVER);
|
|
lv_style_set_pad_all(&theme->styles.settings, 0);
|
|
lv_style_set_pad_gap(&theme->styles.settings, 0);
|
|
lv_style_set_radius(&theme->styles.settings, 0);
|
|
lv_style_set_clip_corner(&theme->styles.settings, true);
|
|
#endif
|
|
|
|
#if LV_USE_MENU
|
|
style_init_reset(&theme->styles.settings_sidebar);
|
|
lv_style_set_pad_all(&theme->styles.settings_sidebar, 0);
|
|
lv_style_set_pad_gap(&theme->styles.settings_sidebar, 0);
|
|
lv_style_set_border_color(&theme->styles.settings_sidebar, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.settings_sidebar, BORDER);
|
|
lv_style_set_border_side(&theme->styles.settings_sidebar, LV_BORDER_SIDE_RIGHT);
|
|
#endif
|
|
|
|
#if LV_USE_MENU
|
|
style_init_reset(&theme->styles.settings_content);
|
|
lv_style_set_pad_all(&theme->styles.settings_content, 0);
|
|
lv_style_set_pad_gap(&theme->styles.settings_content, 0);
|
|
#endif
|
|
|
|
#if LV_USE_MENU
|
|
style_init_reset(&theme->styles.settings_page);
|
|
lv_style_set_pad_hor(&theme->styles.settings_page, 0);
|
|
lv_style_set_pad_gap(&theme->styles.settings_page, 0);
|
|
#endif
|
|
|
|
#if LV_USE_MENU
|
|
style_init_reset(&theme->styles.settings_header);
|
|
lv_style_set_pad_hor(&theme->styles.settings_header, DENSITY_LIST_ITEM_PAD_HOR);
|
|
lv_style_set_pad_ver(&theme->styles.settings_header, DENSITY_LIST_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.settings_header, DENSITY_CONTAINER_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_MENU
|
|
style_init_reset(&theme->styles.settings_section);
|
|
lv_style_set_bg_color(&theme->styles.settings_section, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.settings_section, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.settings_section, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.settings_section, BORDER);
|
|
lv_style_set_radius(&theme->styles.settings_section, SHAPE_CONTAINER);
|
|
lv_style_set_clip_corner(&theme->styles.settings_section, true);
|
|
#endif
|
|
|
|
#if LV_USE_MENU
|
|
style_init_reset(&theme->styles.settings_item);
|
|
lv_style_set_pad_hor(&theme->styles.settings_item, DENSITY_LIST_ITEM_PAD_HOR);
|
|
lv_style_set_pad_ver(&theme->styles.settings_item, DENSITY_LIST_ITEM_PAD_VER);
|
|
lv_style_set_pad_gap(&theme->styles.settings_item, DENSITY_CONTAINER_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_MENU
|
|
style_init_reset(&theme->styles.settings_separator);
|
|
lv_style_set_bg_opa(&theme->styles.settings_separator, LV_OPA_TRANSP);
|
|
lv_style_set_pad_ver(&theme->styles.settings_separator, DENSITY_LIST_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_WIN
|
|
style_init_reset(&theme->styles.window_header);
|
|
lv_style_set_bg_color(&theme->styles.window_header, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.window_header, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.window_header, WINDOW_HEADER_BORDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.window_header, BORDER);
|
|
lv_style_set_border_side(&theme->styles.window_header, LV_BORDER_SIDE_BOTTOM);
|
|
lv_style_set_pad_all(&theme->styles.window_header, WINDOW_HEADER_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.window_header, WINDOW_HEADER_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_LABEL && LV_USE_WIN
|
|
style_init_reset(&theme->styles.window_title);
|
|
lv_style_set_text_font(&theme->styles.window_title, theme->config.font_large);
|
|
#endif
|
|
|
|
#if LV_USE_WIN
|
|
style_init_reset(&theme->styles.window_content);
|
|
lv_style_set_bg_opa(&theme->styles.window_content, LV_OPA_TRANSP);
|
|
lv_style_set_pad_all(&theme->styles.window_content, WINDOW_CONTENT_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.window_content, DENSITY_CONTAINER_GAP);
|
|
#endif
|
|
|
|
#if LV_USE_TABLE
|
|
style_init_reset(&theme->styles.table);
|
|
lv_style_set_bg_color(&theme->styles.table, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.table, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.table, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.table, BORDER);
|
|
lv_style_set_radius(&theme->styles.table, 0);
|
|
lv_style_set_pad_all(&theme->styles.table, 0);
|
|
#endif
|
|
|
|
#if LV_USE_TABLE
|
|
style_init_reset(&theme->styles.table_cell);
|
|
lv_style_set_bg_opa(&theme->styles.table_cell, LV_OPA_TRANSP);
|
|
lv_style_set_text_color(&theme->styles.table_cell, COLOR_ON_SURFACE);
|
|
lv_style_set_pad_all(&theme->styles.table_cell, TABLE_CELL_PAD);
|
|
lv_style_set_border_color(&theme->styles.table_cell, TABLE_DIVIDER_COLOR);
|
|
lv_style_set_border_width(&theme->styles.table_cell, BORDER);
|
|
lv_style_set_border_side(&theme->styles.table_cell, LV_BORDER_SIDE_BOTTOM);
|
|
#endif
|
|
|
|
#if LV_USE_CHART
|
|
style_init_reset(&theme->styles.chart);
|
|
lv_style_set_bg_color(&theme->styles.chart, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.chart, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.chart, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.chart, BORDER);
|
|
lv_style_set_radius(&theme->styles.chart, SHAPE_CONTAINER);
|
|
lv_style_set_pad_all(&theme->styles.chart, DENSITY_CONTAINER_PAD);
|
|
lv_style_set_line_color(&theme->styles.chart, CHART_GRID_COLOR);
|
|
#endif
|
|
|
|
#if LV_USE_CHART
|
|
style_init_reset(&theme->styles.chart_series);
|
|
lv_style_set_line_color(&theme->styles.chart_series, COLOR_ON_SURFACE);
|
|
lv_style_set_line_width(&theme->styles.chart_series, LINE_MEDIUM);
|
|
lv_style_set_size(&theme->styles.chart_series, CHART_POINT_SIZE, CHART_POINT_SIZE);
|
|
#endif
|
|
|
|
#if LV_USE_CHART
|
|
style_init_reset(&theme->styles.chart_indicator);
|
|
lv_style_set_bg_color(&theme->styles.chart_indicator, COLOR_PRIMARY);
|
|
lv_style_set_bg_opa(&theme->styles.chart_indicator, LV_OPA_COVER);
|
|
lv_style_set_radius(&theme->styles.chart_indicator, LV_RADIUS_CIRCLE);
|
|
lv_style_set_size(&theme->styles.chart_indicator, CHART_POINT_SIZE, CHART_POINT_SIZE);
|
|
#endif
|
|
|
|
#if LV_USE_CALENDAR
|
|
style_init_reset(&theme->styles.calendar);
|
|
lv_style_set_bg_color(&theme->styles.calendar, COLOR_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.calendar, LV_OPA_COVER);
|
|
lv_style_set_border_color(&theme->styles.calendar, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.calendar, BORDER);
|
|
lv_style_set_radius(&theme->styles.calendar, SHAPE_CONTAINER);
|
|
lv_style_set_pad_all(&theme->styles.calendar, CALENDAR_PAD);
|
|
lv_style_set_pad_gap(&theme->styles.calendar, CALENDAR_PAD);
|
|
#endif
|
|
|
|
#if LV_USE_BUTTONMATRIX && LV_USE_CALENDAR
|
|
style_init_reset(&theme->styles.calendar_day);
|
|
lv_style_set_bg_opa(&theme->styles.calendar_day, LV_OPA_TRANSP);
|
|
lv_style_set_border_width(&theme->styles.calendar_day, 0);
|
|
lv_style_set_radius(&theme->styles.calendar_day, LV_RADIUS_CIRCLE);
|
|
#endif
|
|
|
|
#if LV_USE_SCALE
|
|
style_init_reset(&theme->styles.scale);
|
|
lv_style_set_line_color(&theme->styles.scale, SCALE_COLOR);
|
|
lv_style_set_line_width(&theme->styles.scale, BORDER);
|
|
lv_style_set_arc_color(&theme->styles.scale, SCALE_COLOR);
|
|
lv_style_set_arc_width(&theme->styles.scale, BORDER);
|
|
lv_style_set_text_color(&theme->styles.scale, SCALE_COLOR);
|
|
lv_style_set_length(&theme->styles.scale, SCALE_TICK_LENGTH);
|
|
#endif
|
|
|
|
#if LV_USE_LINE
|
|
style_init_reset(&theme->styles.divider);
|
|
lv_style_set_line_color(&theme->styles.divider, DIVIDER_COLOR);
|
|
lv_style_set_line_width(&theme->styles.divider, BORDER);
|
|
#endif
|
|
|
|
#if LV_USE_LED
|
|
style_init_reset(&theme->styles.led);
|
|
lv_style_set_bg_color(&theme->styles.led, COLOR_ON_SURFACE);
|
|
lv_style_set_bg_opa(&theme->styles.led, LV_OPA_COVER);
|
|
lv_style_set_radius(&theme->styles.led, LV_RADIUS_CIRCLE);
|
|
lv_style_set_border_color(&theme->styles.led, COLOR_OUTLINE);
|
|
lv_style_set_border_width(&theme->styles.led, BORDER);
|
|
#endif
|
|
}
|
|
|
|
/**********************
|
|
* GLOBAL FUNCTIONS
|
|
**********************/
|
|
|
|
void lv_theme_material_mono_config_init(lv_theme_material_mono_config_t * config)
|
|
{
|
|
lv_memzero(config, sizeof(*config));
|
|
config->is_dark = false;
|
|
config->is_compact = false;
|
|
config->animations_enabled = true;
|
|
config->color_primary = lv_color_black();
|
|
config->color_secondary = lv_color_black();
|
|
config->font_small = LV_FONT_DEFAULT;
|
|
config->font_normal = LV_FONT_DEFAULT;
|
|
config->font_large = LV_FONT_DEFAULT;
|
|
}
|
|
|
|
lv_theme_t * lv_theme_material_mono_init(lv_display_t * disp, const lv_theme_material_mono_config_t * config)
|
|
{
|
|
if(!lv_theme_material_mono_is_inited()) {
|
|
theme_def = lv_malloc_zeroed(sizeof(my_theme_t));
|
|
LV_ASSERT_MALLOC(theme_def);
|
|
}
|
|
|
|
my_theme_t * theme = theme_def;
|
|
|
|
lv_display_t * new_disp = disp == NULL ? lv_display_get_default() : disp;
|
|
int32_t new_dpi = lv_display_get_dpi(new_disp);
|
|
int32_t hor_res = lv_display_get_horizontal_resolution(new_disp);
|
|
int32_t ver_res = lv_display_get_vertical_resolution(new_disp);
|
|
int32_t greater_res = LV_MAX(hor_res, ver_res);
|
|
disp_size_t new_size;
|
|
|
|
if(greater_res <= 320) new_size = DISP_SMALL;
|
|
else if(greater_res < 720) new_size = DISP_MEDIUM;
|
|
else new_size = DISP_LARGE;
|
|
|
|
if(theme->inited && theme->disp_dpi == new_dpi && theme->disp_size == new_size &&
|
|
config_equals(&theme->config, config)) {
|
|
return (lv_theme_t *) theme;
|
|
}
|
|
|
|
theme->disp_size = new_size;
|
|
theme->disp_dpi = new_dpi;
|
|
theme->config = *config;
|
|
theme->base.disp = new_disp;
|
|
theme->base.apply_cb = theme_apply;
|
|
theme->base.color_primary = config->color_primary;
|
|
theme->base.color_secondary = config->color_secondary;
|
|
theme->base.font_small = config->font_small;
|
|
theme->base.font_normal = config->font_normal;
|
|
theme->base.font_large = config->font_large;
|
|
|
|
style_init(theme);
|
|
|
|
if(disp == NULL || lv_display_get_theme(disp) == (lv_theme_t *)theme) {
|
|
lv_obj_report_style_change(NULL);
|
|
}
|
|
|
|
theme->inited = true;
|
|
|
|
/* Re-initialize the styles when the resolution changes, as the display size affects the styles */
|
|
lv_display_remove_event_cb_with_user_data(new_disp, resolution_change_event_cb, theme);
|
|
lv_display_add_event_cb(new_disp, resolution_change_event_cb, LV_EVENT_RESOLUTION_CHANGED, theme);
|
|
|
|
return (lv_theme_t *) theme;
|
|
}
|
|
|
|
bool lv_theme_material_mono_is_inited(void)
|
|
{
|
|
return theme_def != NULL && theme_def->inited;
|
|
}
|
|
|
|
lv_theme_t * lv_theme_material_mono_get(void)
|
|
{
|
|
if(!lv_theme_material_mono_is_inited()) {
|
|
return NULL;
|
|
}
|
|
return (lv_theme_t *) theme_def;
|
|
}
|
|
|
|
void lv_theme_material_mono_deinit(void)
|
|
{
|
|
my_theme_t * theme = theme_def;
|
|
if(theme) {
|
|
if(theme->inited) {
|
|
lv_style_t * theme_styles = (lv_style_t *)(&(theme->styles));
|
|
uint32_t i;
|
|
for(i = 0; i < sizeof(my_theme_styles_t) / sizeof(lv_style_t); i++) {
|
|
lv_style_reset(theme_styles + i);
|
|
}
|
|
}
|
|
lv_free(theme_def);
|
|
theme_def = NULL;
|
|
}
|
|
}
|
|
|
|
/**********************
|
|
* STATIC FUNCTIONS
|
|
**********************/
|
|
|
|
static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
|
{
|
|
LV_UNUSED(th);
|
|
|
|
my_theme_t * theme = theme_def;
|
|
lv_obj_t * parent = lv_obj_get_parent(obj);
|
|
LV_UNUSED(theme);
|
|
LV_UNUSED(parent);
|
|
|
|
/* null > * */
|
|
if(parent == NULL) {
|
|
lv_obj_add_style(obj, &theme->styles.screen, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lv_obj_class)) {
|
|
#if LV_USE_TABVIEW
|
|
/* tabview > obj[1] */
|
|
if(lv_obj_check_type(parent, &lv_tabview_class) && lss_is_child(parent, 1, obj)) {
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_TABVIEW
|
|
/* tabview > obj[0] */
|
|
if(lv_obj_check_type(parent, &lv_tabview_class) && lss_is_child(parent, 0, obj)) {
|
|
lv_obj_add_style(obj, &theme->styles.tabs, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_TABVIEW
|
|
/* tabview > * > obj */
|
|
if(lv_obj_check_type(lss_ancestor(obj, 2), &lv_tabview_class)) {
|
|
lv_obj_add_style(obj, &theme->styles.tab_page, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_WIN
|
|
/* win > obj[0] */
|
|
if(lv_obj_check_type(parent, &lv_win_class) && lss_is_child(parent, 0, obj)) {
|
|
lv_obj_add_style(obj, &theme->styles.window_header, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_WIN
|
|
/* win > obj[1] */
|
|
if(lv_obj_check_type(parent, &lv_win_class) && lss_is_child(parent, 1, obj)) {
|
|
lv_obj_add_style(obj, &theme->styles.window_content, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_CALENDAR
|
|
/* calendar > obj */
|
|
if(lv_obj_check_type(parent, &lv_calendar_class)) {
|
|
return;
|
|
}
|
|
#endif
|
|
/* obj */
|
|
lv_obj_add_style(obj, &theme->styles.container, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#if LV_USE_BUTTON
|
|
if(lv_obj_check_type(obj, &lv_button_class)) {
|
|
#if LV_USE_TABVIEW
|
|
/* tabview > *[0] > button */
|
|
if(lv_obj_check_type(lss_ancestor(obj, 2), &lv_tabview_class) && lss_is_child(lss_ancestor(obj, 2), 0, parent)) {
|
|
lv_obj_add_style(obj, &theme->styles.tab, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
/* menu_sidebar_header_cont > button */
|
|
if(lv_obj_check_type(parent, &lv_menu_sidebar_header_cont_class)) {
|
|
lv_obj_add_style(obj, &theme->styles.icon_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
/* menu_main_header_cont > button */
|
|
if(lv_obj_check_type(parent, &lv_menu_main_header_cont_class)) {
|
|
lv_obj_add_style(obj, &theme->styles.icon_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_WIN
|
|
/* win > obj[0] > button */
|
|
if(lv_obj_check_type(lss_ancestor(obj, 2), &lv_win_class) && lv_obj_check_type(parent, &lv_obj_class) && lss_is_child(lss_ancestor(obj, 2), 0, parent)) {
|
|
lv_obj_add_style(obj, &theme->styles.icon_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
#endif
|
|
/* button */
|
|
lv_obj_add_style(obj, &theme->styles.button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
if(lv_obj_check_type(obj, &lvgl_icon_button_class)) {
|
|
/* toolbar > icon_button[0] */
|
|
if(lv_obj_check_type(parent, &lvgl_toolbar_class) && lss_is_child(parent, 0, obj)) {
|
|
lv_obj_add_style(obj, &theme->styles.icon_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_nav_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_focus_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_button_focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_button_focus_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
/* toolbar > icon_button */
|
|
if(lv_obj_check_type(parent, &lvgl_toolbar_class)) {
|
|
lv_obj_add_style(obj, &theme->styles.icon_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_focus_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_button_focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.app_bar_button_focus_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
/* icon_button */
|
|
lv_obj_add_style(obj, &theme->styles.icon_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring_inset, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring_inset, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_toolbar_class)) {
|
|
/* toolbar */
|
|
lv_obj_add_style(obj, &theme->styles.app_bar, 0);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_icon_button_filled_class)) {
|
|
/* icon_button_filled */
|
|
lv_obj_add_style(obj, &theme->styles.icon_button_filled, 0);
|
|
lv_obj_add_style(obj, &theme->styles.icon_button_filled_pressed, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_icon_button_tonal_class)) {
|
|
/* icon_button_tonal */
|
|
lv_obj_add_style(obj, &theme->styles.icon_button_tonal, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#if LV_USE_MSGBOX
|
|
if(lv_obj_check_type(obj, &lv_msgbox_header_button_class)) {
|
|
/* msgbox_header_button */
|
|
lv_obj_add_style(obj, &theme->styles.icon_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
#endif
|
|
if(lv_obj_check_type(obj, &lvgl_text_button_class)) {
|
|
/* text_button */
|
|
lv_obj_add_style(obj, &theme->styles.text_button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#if LV_USE_MSGBOX
|
|
if(lv_obj_check_type(obj, &lv_msgbox_footer_button_class)) {
|
|
/* msgbox_footer_button */
|
|
lv_obj_add_style(obj, &theme->styles.button, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_LABEL
|
|
if(lv_obj_check_type(obj, &lv_label_class)) {
|
|
#if LV_USE_MSGBOX
|
|
/* msgbox_header > label */
|
|
if(lv_obj_check_type(parent, &lv_msgbox_header_class)) {
|
|
lv_obj_add_style(obj, &theme->styles.dialog_title, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_WIN
|
|
/* win > obj[0] > label */
|
|
if(lv_obj_check_type(lss_ancestor(obj, 2), &lv_win_class) && lv_obj_check_type(parent, &lv_obj_class) && lss_is_child(lss_ancestor(obj, 2), 0, parent)) {
|
|
lv_obj_add_style(obj, &theme->styles.window_title, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_TEXTAREA
|
|
/* textarea > label */
|
|
if(lv_obj_check_type(parent, &lv_textarea_class)) {
|
|
lv_obj_add_style(obj, &theme->styles.field_selection, LV_PART_SELECTED);
|
|
return;
|
|
}
|
|
#endif
|
|
/* page_indicator > label */
|
|
if(lv_obj_check_type(parent, &lvgl_page_indicator_class)) {
|
|
lv_obj_add_style(obj, &theme->styles.page_indicator_label, 0);
|
|
return;
|
|
}
|
|
/* label */
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_SWITCH
|
|
if(lv_obj_check_type(obj, &lv_switch_class)) {
|
|
/* switch */
|
|
lv_obj_add_style(obj, &theme->styles.switch_track, 0);
|
|
lv_obj_add_style(obj, &theme->styles.switch_indicator_selected, LV_PART_INDICATOR | LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.switch_handle, LV_PART_KNOB);
|
|
lv_obj_add_style(obj, &theme->styles.switch_handle_selected, LV_PART_KNOB | LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_CHECKBOX
|
|
if(lv_obj_check_type(obj, &lv_checkbox_class)) {
|
|
/* checkbox */
|
|
lv_obj_add_style(obj, &theme->styles.checkbox, 0);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.checkbox_box, LV_PART_INDICATOR);
|
|
lv_obj_add_style(obj, &theme->styles.checkbox_box_selected, LV_PART_INDICATOR | LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_INDICATOR | LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
if(lv_obj_check_type(obj, &lvgl_page_indicator_class)) {
|
|
/* page_indicator */
|
|
lv_obj_add_style(obj, &theme->styles.page_indicator, 0);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_page_indicator_dot_class)) {
|
|
/* page_indicator_dot */
|
|
lv_obj_add_style(obj, &theme->styles.page_indicator_dot, 0);
|
|
lv_obj_add_style(obj, &theme->styles.page_indicator_dot_current, LV_STATE_CHECKED);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_step_indicator_class)) {
|
|
/* step_indicator */
|
|
lv_obj_add_style(obj, &theme->styles.step_indicator, 0);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_step_indicator_segment_class)) {
|
|
/* step_indicator_segment */
|
|
lv_obj_add_style(obj, &theme->styles.step_indicator_segment, 0);
|
|
lv_obj_add_style(obj, &theme->styles.step_indicator_segment_finished, LV_STATE_CHECKED);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_badge_class)) {
|
|
/* badge */
|
|
lv_obj_add_style(obj, &theme->styles.badge, 0);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_chip_class)) {
|
|
/* chip */
|
|
lv_obj_add_style(obj, &theme->styles.chip, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_card_class)) {
|
|
/* card */
|
|
lv_obj_add_style(obj, &theme->styles.card, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_focus_container_class)) {
|
|
/* focus_container */
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_sliderbox_class)) {
|
|
/* sliderbox */
|
|
lv_obj_add_style(obj, &theme->styles.sliderbox, 0);
|
|
return;
|
|
}
|
|
#if LV_USE_SLIDER
|
|
if(lv_obj_check_type(obj, &lv_slider_class)) {
|
|
/* slider */
|
|
lv_obj_add_style(obj, &theme->styles.slider_track, 0);
|
|
lv_obj_add_style(obj, &theme->styles.slider_track_size, 0);
|
|
lv_obj_add_style(obj, &theme->styles.slider_knob_room, 0);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.slider_active_track, LV_PART_INDICATOR);
|
|
lv_obj_add_style(obj, &theme->styles.slider_handle, LV_PART_KNOB);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_BAR
|
|
if(lv_obj_check_type(obj, &lv_bar_class)) {
|
|
/* bar */
|
|
lv_obj_add_style(obj, &theme->styles.slider_track_size, 0);
|
|
lv_obj_add_style(obj, &theme->styles.slider_track, 0);
|
|
lv_obj_add_style(obj, &theme->styles.slider_active_track, LV_PART_INDICATOR);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_ARC
|
|
if(lv_obj_check_type(obj, &lv_arc_class)) {
|
|
/* arc */
|
|
lv_obj_add_style(obj, &theme->styles.arc_track, 0);
|
|
lv_obj_add_style(obj, &theme->styles.arc_indicator, LV_PART_INDICATOR);
|
|
lv_obj_add_style(obj, &theme->styles.arc_handle, LV_PART_KNOB);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_SPINNER
|
|
if(lv_obj_check_type(obj, &lv_spinner_class)) {
|
|
/* spinner */
|
|
lv_obj_add_style(obj, &theme->styles.arc_track, 0);
|
|
lv_obj_add_style(obj, &theme->styles.arc_indicator, LV_PART_INDICATOR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_TEXTAREA
|
|
if(lv_obj_check_type(obj, &lv_textarea_class)) {
|
|
/* textarea */
|
|
lv_obj_add_style(obj, &theme->styles.field, 0);
|
|
lv_obj_add_style(obj, &theme->styles.field_focused, LV_STATE_FOCUSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
lv_obj_add_style(obj, &theme->styles.field_cursor, LV_PART_CURSOR | LV_STATE_FOCUSED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_SPINBOX
|
|
if(lv_obj_check_type(obj, &lv_spinbox_class)) {
|
|
/* spinbox */
|
|
lv_obj_add_style(obj, &theme->styles.field, 0);
|
|
lv_obj_add_style(obj, &theme->styles.field_focused, LV_STATE_FOCUSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_CURSOR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_DROPDOWN
|
|
if(lv_obj_check_type(obj, &lv_dropdown_class)) {
|
|
/* dropdown */
|
|
lv_obj_add_style(obj, &theme->styles.field, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_DROPDOWN
|
|
if(lv_obj_check_type(obj, &lv_dropdownlist_class)) {
|
|
/* dropdownlist */
|
|
lv_obj_add_style(obj, &theme->styles.menu, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
lv_obj_add_style(obj, &theme->styles.menu_item, LV_PART_SELECTED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_SELECTED | LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_SELECTED | LV_STATE_PRESSED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_ROLLER
|
|
if(lv_obj_check_type(obj, &lv_roller_class)) {
|
|
/* roller */
|
|
lv_obj_add_style(obj, &theme->styles.roller, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_SELECTED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_BUTTONMATRIX
|
|
if(lv_obj_check_type(obj, &lv_buttonmatrix_class)) {
|
|
#if LV_USE_CALENDAR
|
|
/* calendar > buttonmatrix */
|
|
if(lv_obj_check_type(parent, &lv_calendar_class)) {
|
|
lv_obj_add_style(obj, &theme->styles.keys, 0);
|
|
lv_obj_add_style(obj, &theme->styles.calendar_day, LV_PART_ITEMS);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_ITEMS | LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_ITEMS | LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_ITEMS | LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
/* buttonmatrix */
|
|
lv_obj_add_style(obj, &theme->styles.keys, 0);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.key, LV_PART_ITEMS);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_ITEMS | LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_ITEMS | LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_ITEMS | LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_KEYBOARD
|
|
if(lv_obj_check_type(obj, &lv_keyboard_class)) {
|
|
/* keyboard */
|
|
lv_obj_add_style(obj, &theme->styles.keys, 0);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.key, LV_PART_ITEMS);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_ITEMS | LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_ITEMS | LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_PART_ITEMS | LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_LIST
|
|
if(lv_obj_check_type(obj, &lv_list_class)) {
|
|
/* list */
|
|
lv_obj_add_style(obj, &theme->styles.list, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_LIST
|
|
if(lv_obj_check_type(obj, &lv_list_text_class)) {
|
|
/* list_text */
|
|
lv_obj_add_style(obj, &theme->styles.list_subheader, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_LIST
|
|
if(lv_obj_check_type(obj, &lv_list_button_class)) {
|
|
/* list_button */
|
|
lv_obj_add_style(obj, &theme->styles.list_item, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#endif
|
|
if(lv_obj_check_type(obj, &lvgl_list_class)) {
|
|
/* flex_list */
|
|
lv_obj_add_style(obj, &theme->styles.list, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_list_text_class)) {
|
|
/* flex_list_text */
|
|
lv_obj_add_style(obj, &theme->styles.list_subheader, 0);
|
|
return;
|
|
}
|
|
if(lv_obj_check_type(obj, &lvgl_list_button_class)) {
|
|
/* flex_list_button */
|
|
lv_obj_add_style(obj, &theme->styles.list_item, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.disabled, LV_STATE_DISABLED);
|
|
return;
|
|
}
|
|
#if LV_USE_TABLE
|
|
if(lv_obj_check_type(obj, &lv_table_class)) {
|
|
/* table */
|
|
lv_obj_add_style(obj, &theme->styles.table, 0);
|
|
lv_obj_add_style(obj, &theme->styles.focus_ring, LV_STATE_FOCUS_KEY);
|
|
lv_obj_add_style(obj, &theme->styles.edit_ring, LV_STATE_EDITED);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
lv_obj_add_style(obj, &theme->styles.table_cell, LV_PART_ITEMS);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_ITEMS | LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_class)) {
|
|
/* menu */
|
|
lv_obj_add_style(obj, &theme->styles.settings, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_sidebar_cont_class)) {
|
|
/* menu_sidebar_cont */
|
|
lv_obj_add_style(obj, &theme->styles.settings_sidebar, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_main_cont_class)) {
|
|
/* menu_main_cont */
|
|
lv_obj_add_style(obj, &theme->styles.settings_content, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_page_class)) {
|
|
/* menu_page */
|
|
lv_obj_add_style(obj, &theme->styles.settings_page, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_sidebar_header_cont_class)) {
|
|
/* menu_sidebar_header_cont */
|
|
lv_obj_add_style(obj, &theme->styles.settings_header, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_main_header_cont_class)) {
|
|
/* menu_main_header_cont */
|
|
lv_obj_add_style(obj, &theme->styles.settings_header, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_section_class)) {
|
|
/* menu_section */
|
|
lv_obj_add_style(obj, &theme->styles.settings_section, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_cont_class)) {
|
|
/* menu_cont */
|
|
lv_obj_add_style(obj, &theme->styles.settings_item, 0);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_PRESSED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_CHECKED);
|
|
lv_obj_add_style(obj, &theme->styles.inverted, LV_STATE_FOCUS_KEY);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MENU
|
|
if(lv_obj_check_type(obj, &lv_menu_separator_class)) {
|
|
/* menu_separator */
|
|
lv_obj_add_style(obj, &theme->styles.settings_separator, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
if(lv_obj_check_type(obj, &lv_msgbox_class)) {
|
|
/* msgbox */
|
|
lv_obj_add_style(obj, &theme->styles.dialog, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
if(lv_obj_check_type(obj, &lv_msgbox_backdrop_class)) {
|
|
/* msgbox_backdrop */
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
if(lv_obj_check_type(obj, &lv_msgbox_header_class)) {
|
|
/* msgbox_header */
|
|
lv_obj_add_style(obj, &theme->styles.dialog_header, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
if(lv_obj_check_type(obj, &lv_msgbox_content_class)) {
|
|
/* msgbox_content */
|
|
lv_obj_add_style(obj, &theme->styles.dialog_content, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_MSGBOX
|
|
if(lv_obj_check_type(obj, &lv_msgbox_footer_class)) {
|
|
/* msgbox_footer */
|
|
lv_obj_add_style(obj, &theme->styles.dialog_actions, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_TABVIEW
|
|
if(lv_obj_check_type(obj, &lv_tabview_class)) {
|
|
/* tabview */
|
|
lv_obj_add_style(obj, &theme->styles.page, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_WIN
|
|
if(lv_obj_check_type(obj, &lv_win_class)) {
|
|
/* win */
|
|
lv_obj_add_style(obj, &theme->styles.page, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_TILEVIEW
|
|
if(lv_obj_check_type(obj, &lv_tileview_class)) {
|
|
/* tileview */
|
|
lv_obj_add_style(obj, &theme->styles.page, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_TILEVIEW
|
|
if(lv_obj_check_type(obj, &lv_tileview_tile_class)) {
|
|
/* tileview_tile */
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_CHART
|
|
if(lv_obj_check_type(obj, &lv_chart_class)) {
|
|
/* chart */
|
|
lv_obj_add_style(obj, &theme->styles.chart, 0);
|
|
lv_obj_add_style(obj, &theme->styles.scrollbar, LV_PART_SCROLLBAR);
|
|
lv_obj_add_style(obj, &theme->styles.chart_series, LV_PART_ITEMS);
|
|
lv_obj_add_style(obj, &theme->styles.chart_indicator, LV_PART_INDICATOR);
|
|
lv_obj_add_style(obj, &theme->styles.chart_series, LV_PART_CURSOR);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_CALENDAR
|
|
if(lv_obj_check_type(obj, &lv_calendar_class)) {
|
|
/* calendar */
|
|
lv_obj_add_style(obj, &theme->styles.calendar, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_SCALE
|
|
if(lv_obj_check_type(obj, &lv_scale_class)) {
|
|
/* scale */
|
|
lv_obj_add_style(obj, &theme->styles.scale, LV_PART_MAIN);
|
|
lv_obj_add_style(obj, &theme->styles.scale, LV_PART_INDICATOR);
|
|
lv_obj_add_style(obj, &theme->styles.scale, LV_PART_ITEMS);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_LINE
|
|
if(lv_obj_check_type(obj, &lv_line_class)) {
|
|
/* line */
|
|
lv_obj_add_style(obj, &theme->styles.divider, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
#if LV_USE_LED
|
|
if(lv_obj_check_type(obj, &lv_led_class)) {
|
|
/* led */
|
|
lv_obj_add_style(obj, &theme->styles.led, 0);
|
|
return;
|
|
}
|
|
#endif
|
|
}
|
|
|
|
static void style_init_reset(lv_style_t * style)
|
|
{
|
|
if(lv_theme_material_mono_is_inited()) {
|
|
lv_style_reset(style);
|
|
}
|
|
else {
|
|
lv_style_init(style);
|
|
}
|
|
}
|
|
|
|
static void resolution_change_event_cb(lv_event_t * e)
|
|
{
|
|
lv_display_t * disp = lv_event_get_target(e);
|
|
my_theme_t * theme = lv_event_get_user_data(e);
|
|
lv_theme_material_mono_init(disp, &theme->config);
|
|
}
|