move styles from textedit to theme
This commit is contained in:
committed by
Raphael Coeffic
parent
d515e57fc4
commit
0cbf0fbf6c
@@ -199,6 +199,11 @@ 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_checked_style;
|
||||
static lv_style_t textedit_style_main;
|
||||
static lv_style_t textedit_style_focused;
|
||||
static lv_style_t textedit_style_cursor;
|
||||
static lv_style_t textedit_style_cursor_edit;
|
||||
|
||||
|
||||
static void theme_apply_cb(lv_theme_t * th, lv_obj_t * obj)
|
||||
{
|
||||
@@ -212,6 +217,14 @@ static void theme_apply_cb(lv_theme_t * th, lv_obj_t * obj)
|
||||
return;
|
||||
}
|
||||
|
||||
if (lv_obj_check_type(obj, &lv_textarea_class)) {
|
||||
lv_obj_add_style(obj, &textedit_style_main, LV_PART_MAIN);
|
||||
lv_obj_add_style(obj, &textedit_style_focused, LV_PART_MAIN | LV_STATE_FOCUSED);
|
||||
lv_obj_add_style(obj, &textedit_style_cursor, LV_PART_CURSOR);
|
||||
lv_obj_add_style(obj, &textedit_style_cursor_edit, LV_PART_CURSOR | LV_STATE_EDITED);
|
||||
return;
|
||||
}
|
||||
|
||||
if (lv_obj_check_type(obj, &lv_btn_class)) {
|
||||
lv_obj_add_style(obj, &btn_style, 0);
|
||||
lv_obj_add_style(obj, &btn_checked_style, LV_STATE_CHECKED);
|
||||
@@ -239,6 +252,33 @@ static void init_theme()
|
||||
lv_style_set_border_width(&generic_style, 0);
|
||||
lv_style_set_radius(&generic_style, 0);
|
||||
|
||||
// textedit
|
||||
lv_style_init(&textedit_style_main);
|
||||
lv_style_init(&textedit_style_focused);
|
||||
lv_style_init(&textedit_style_cursor);
|
||||
lv_style_init(&textedit_style_cursor_edit);
|
||||
|
||||
// textedit style main
|
||||
lv_style_set_border_width(&textedit_style_main, 1);
|
||||
lv_style_set_border_color(&textedit_style_main, makeLvColor(COLOR_THEME_SECONDARY2));
|
||||
lv_style_set_bg_color(&textedit_style_main, makeLvColor(COLOR_THEME_PRIMARY2));
|
||||
lv_style_set_bg_opa(&textedit_style_main, LV_OPA_COVER);
|
||||
lv_style_set_text_font(&textedit_style_main, &lv_font_roboto_13);
|
||||
lv_style_set_text_color(&textedit_style_main, makeLvColor(COLOR_THEME_SECONDARY1));
|
||||
lv_style_set_pad_left(&textedit_style_main, FIELD_PADDING_LEFT);
|
||||
lv_style_set_pad_top(&textedit_style_main, FIELD_PADDING_TOP);
|
||||
|
||||
//textedit style focused
|
||||
lv_style_set_bg_color(&textedit_style_focused, makeLvColor(COLOR_THEME_FOCUS));
|
||||
lv_style_set_text_color(&textedit_style_focused, makeLvColor(COLOR_THEME_PRIMARY2));
|
||||
|
||||
// hide cursor when not editing
|
||||
lv_style_set_opa(&textedit_style_cursor, LV_OPA_0);
|
||||
|
||||
// Show Cursor in "Edit" mode
|
||||
lv_style_set_opa(&textedit_style_cursor_edit, LV_OPA_COVER);
|
||||
lv_style_set_bg_opa(&textedit_style_cursor_edit, LV_OPA_50);
|
||||
|
||||
// Buttons
|
||||
lv_style_init(&btn_style);
|
||||
lv_style_set_bg_opa(&btn_style, LV_OPA_100);
|
||||
|
||||
Vendored
+1
-1
Submodule radio/src/thirdparty/libopenui updated: 0c03b487d6...e717e3b85b
Reference in New Issue
Block a user