Add theming support for hovered tabs

Tabs can now be styled differently when hovered by the mouse pointer.
This commit is contained in:
David Giardi
2023-03-09 03:52:57 +01:00
parent 06f5b09ca4
commit 9f1e18e64c
8 changed files with 44 additions and 1 deletions

View File

@@ -825,8 +825,11 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
style_tab_unselected->set_border_color(style_popup_border_color);
Ref<StyleBoxFlat> style_tab_disabled = style_tab_unselected->duplicate();
style_tab_disabled->set_bg_color(style_disabled_color);
Ref<StyleBoxFlat> style_tab_hovered = style_tab_unselected->duplicate();
style_tab_hovered->set_bg_color(Color(0.1, 0.1, 0.1, 0.3));
theme->set_stylebox("tab_selected", "TabContainer", style_tab_selected);
theme->set_stylebox("tab_hovered", "TabContainer", style_tab_hovered);
theme->set_stylebox("tab_unselected", "TabContainer", style_tab_unselected);
theme->set_stylebox("tab_disabled", "TabContainer", style_tab_disabled);
theme->set_stylebox("panel", "TabContainer", make_flat_stylebox(style_normal_color, 0, 0, 0, 0));
@@ -844,6 +847,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_font_size("font_size", "TabContainer", -1);
theme->set_color("font_selected_color", "TabContainer", control_font_hover_color);
theme->set_color("font_hovered_color", "TabContainer", control_font_hover_color);
theme->set_color("font_unselected_color", "TabContainer", control_font_low_color);
theme->set_color("font_disabled_color", "TabContainer", control_font_disabled_color);
theme->set_color("font_outline_color", "TabContainer", Color(1, 1, 1));
@@ -857,6 +861,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
// TabBar
theme->set_stylebox("tab_selected", "TabBar", style_tab_selected);
theme->set_stylebox("tab_hovered", "TabBar", style_tab_hovered);
theme->set_stylebox("tab_unselected", "TabBar", style_tab_unselected);
theme->set_stylebox("tab_disabled", "TabBar", style_tab_disabled);
theme->set_stylebox("button_pressed", "TabBar", button_pressed);
@@ -873,6 +878,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const
theme->set_font_size("font_size", "TabBar", -1);
theme->set_color("font_selected_color", "TabBar", control_font_hover_color);
theme->set_color("font_hovered_color", "TabBar", control_font_hover_color);
theme->set_color("font_unselected_color", "TabBar", control_font_low_color);
theme->set_color("font_disabled_color", "TabBar", control_font_disabled_color);
theme->set_color("font_outline_color", "TabBar", Color(1, 1, 1));