Adds base dropdown-list styles.

Fixes dropdown contents being painted directly on top of anything
sitting below them.
custom
Robin Howard 1 year ago committed by cooljqln
parent 08c6c5d322
commit 7d66572b0f
  1. 1
      src/ui/include/themes.hpp
  2. 10
      src/ui/themes.cpp

@ -32,6 +32,7 @@ class Theme {
lv_style_t button_style_;
lv_style_t bar_style_;
lv_style_t dropdown_style_;
lv_style_t dropdown_list_style_;
lv_style_t slider_indicator_style_;
lv_style_t slider_knob_style_;

@ -89,6 +89,14 @@ Theme::Theme() {
lv_style_set_border_color(&dropdown_style_, lv_palette_main(LV_PALETTE_BLUE));
lv_style_set_border_side(&dropdown_style_, LV_BORDER_SIDE_FULL);
lv_style_init(&dropdown_list_style_);
lv_style_set_radius(&dropdown_list_style_, 2);
lv_style_set_border_width(&dropdown_list_style_, 1);
lv_style_set_border_color(&dropdown_list_style_, lv_palette_main(LV_PALETTE_BLUE_GREY));
lv_style_set_bg_opa(&dropdown_list_style_, LV_OPA_COVER);
lv_style_set_bg_color(&dropdown_list_style_, lv_color_white());
lv_style_set_pad_all(&dropdown_list_style_, 2);
lv_theme_t* parent_theme = lv_disp_get_theme(NULL);
theme_ = *parent_theme;
theme_.user_data = this;
@ -124,6 +132,8 @@ void Theme::Callback(lv_obj_t* obj) {
lv_obj_add_style(obj, &switch_knob_style_, LV_PART_KNOB);
} else if (lv_obj_check_type(obj, &lv_dropdown_class)) {
lv_obj_add_style(obj, &dropdown_style_, LV_PART_MAIN);
} else if (lv_obj_check_type(obj, &lv_dropdownlist_class)) {
lv_obj_add_style(obj, &dropdown_list_style_, LV_PART_MAIN);
}
}

Loading…
Cancel
Save