diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2019-12-13 00:36:29 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-13 00:36:29 +0100 |
commit | 0da0eec6cc42066626f867079700c10737092217 (patch) | |
tree | bdcbe37962bdf62127fb133f3a3a73cb38ac652d | |
parent | ec97535ea34456607c0c53607d41e34f272890ec (diff) | |
parent | 5004b8b81e96c7146ffe3f385748163d71a667c4 (diff) |
Merge pull request #34315 from YeldhamDev/editor_theme_optionbutton_arrow
Fix OptionButton's arrow margin in editor theme
-rw-r--r-- | editor/editor_themes.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index f05c7709d4..6b71ee14d5 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -587,11 +587,24 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) { theme->set_color("icon_color_pressed", "Button", icon_color_pressed); // OptionButton - theme->set_stylebox("normal", "OptionButton", style_widget); - theme->set_stylebox("hover", "OptionButton", style_widget_hover); - theme->set_stylebox("pressed", "OptionButton", style_widget_pressed); - theme->set_stylebox("focus", "OptionButton", style_widget_focus); - theme->set_stylebox("disabled", "OptionButton", style_widget_disabled); + Ref<StyleBoxFlat> style_option_button_normal = style_widget->duplicate(); + Ref<StyleBoxFlat> style_option_button_hover = style_widget_hover->duplicate(); + Ref<StyleBoxFlat> style_option_button_pressed = style_widget_pressed->duplicate(); + Ref<StyleBoxFlat> style_option_button_focus = style_widget_focus->duplicate(); + Ref<StyleBoxFlat> style_option_button_disabled = style_widget_disabled->duplicate(); + + int option_button_arrow_margin = theme->get_icon("GuiOptionArrow", "EditorIcons")->get_size().width + (default_margin_size + 4) * EDSCALE; + style_option_button_normal->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); + style_option_button_hover->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); + style_option_button_pressed->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); + style_option_button_focus->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); + style_option_button_disabled->set_default_margin(MARGIN_RIGHT, option_button_arrow_margin); + + theme->set_stylebox("normal", "OptionButton", style_option_button_normal); + theme->set_stylebox("hover", "OptionButton", style_option_button_hover); + theme->set_stylebox("pressed", "OptionButton", style_option_button_pressed); + theme->set_stylebox("focus", "OptionButton", style_option_button_focus); + theme->set_stylebox("disabled", "OptionButton", style_option_button_disabled); theme->set_color("font_color", "OptionButton", font_color); theme->set_color("font_color_hover", "OptionButton", font_color_hl); |