diff options
Diffstat (limited to 'scene')
-rw-r--r-- | scene/gui/button.cpp | 15 | ||||
-rw-r--r-- | scene/gui/file_dialog.cpp | 6 | ||||
-rw-r--r-- | scene/gui/link_button.cpp | 7 | ||||
-rw-r--r-- | scene/gui/option_button.cpp | 6 | ||||
-rw-r--r-- | scene/resources/default_theme/default_theme.cpp | 9 |
5 files changed, 38 insertions, 5 deletions
diff --git a/scene/gui/button.cpp b/scene/gui/button.cpp index e253a27e66..9818c8f0cc 100644 --- a/scene/gui/button.cpp +++ b/scene/gui/button.cpp @@ -111,9 +111,18 @@ void Button::_notification(int p_what) { if (!flat) { style->draw(ci, Rect2(Point2(0, 0), size)); } - color = get_theme_color(SNAME("font_color")); - if (has_theme_color(SNAME("icon_normal_color"))) { - color_icon = get_theme_color(SNAME("icon_normal_color")); + + // Focus colors only take precedence over normal state. + if (has_focus()) { + color = get_theme_color(SNAME("font_focus_color")); + if (has_theme_color(SNAME("icon_focus_color"))) { + color_icon = get_theme_color(SNAME("icon_focus_color")); + } + } else { + color = get_theme_color(SNAME("font_color")); + if (has_theme_color(SNAME("icon_normal_color"))) { + color_icon = get_theme_color(SNAME("icon_normal_color")); + } } } break; case DRAW_HOVER_PRESSED: { diff --git a/scene/gui/file_dialog.cpp b/scene/gui/file_dialog.cpp index 973b72973d..bb77da9548 100644 --- a/scene/gui/file_dialog.cpp +++ b/scene/gui/file_dialog.cpp @@ -51,26 +51,32 @@ VBoxContainer *FileDialog::get_vbox() { void FileDialog::_theme_changed() { Color font_color = vbox->get_theme_color(SNAME("font_color"), SNAME("Button")); Color font_hover_color = vbox->get_theme_color(SNAME("font_hover_color"), SNAME("Button")); + Color font_focus_color = vbox->get_theme_color(SNAME("font_focus_color"), SNAME("Button")); Color font_pressed_color = vbox->get_theme_color(SNAME("font_pressed_color"), SNAME("Button")); dir_up->add_theme_color_override("icon_normal_color", font_color); dir_up->add_theme_color_override("icon_hover_color", font_hover_color); + dir_up->add_theme_color_override("icon_focus_color", font_focus_color); dir_up->add_theme_color_override("icon_pressed_color", font_pressed_color); dir_prev->add_theme_color_override("icon_color_normal", font_color); dir_prev->add_theme_color_override("icon_color_hover", font_hover_color); + dir_prev->add_theme_color_override("icon_focus_color", font_focus_color); dir_prev->add_theme_color_override("icon_color_pressed", font_pressed_color); dir_next->add_theme_color_override("icon_color_normal", font_color); dir_next->add_theme_color_override("icon_color_hover", font_hover_color); + dir_next->add_theme_color_override("icon_focus_color", font_focus_color); dir_next->add_theme_color_override("icon_color_pressed", font_pressed_color); refresh->add_theme_color_override("icon_normal_color", font_color); refresh->add_theme_color_override("icon_hover_color", font_hover_color); + refresh->add_theme_color_override("icon_focus_color", font_focus_color); refresh->add_theme_color_override("icon_pressed_color", font_pressed_color); show_hidden->add_theme_color_override("icon_normal_color", font_color); show_hidden->add_theme_color_override("icon_hover_color", font_hover_color); + show_hidden->add_theme_color_override("icon_focus_color", font_focus_color); show_hidden->add_theme_color_override("icon_pressed_color", font_pressed_color); } diff --git a/scene/gui/link_button.cpp b/scene/gui/link_button.cpp index 925e6f5b97..c3201186ea 100644 --- a/scene/gui/link_button.cpp +++ b/scene/gui/link_button.cpp @@ -168,7 +168,12 @@ void LinkButton::_notification(int p_what) { switch (get_draw_mode()) { case DRAW_NORMAL: { - color = get_theme_color(SNAME("font_color")); + if (has_focus()) { + color = get_theme_color(SNAME("font_focus_color")); + } else { + color = get_theme_color(SNAME("font_color")); + } + do_underline = underline_mode == UNDERLINE_MODE_ALWAYS; } break; case DRAW_HOVER_PRESSED: diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index 2adeb2d947..c00c040048 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -71,7 +71,11 @@ void OptionButton::_notification(int p_what) { clr = get_theme_color(SNAME("font_disabled_color")); break; default: - clr = get_theme_color(SNAME("font_color")); + if (has_focus()) { + clr = get_theme_color(SNAME("font_focus_color")); + } else { + clr = get_theme_color(SNAME("font_color")); + } } } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index ed093d7ea3..f21a070133 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -147,6 +147,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const Color control_font_lower_color = Color(0.63, 0.63, 0.63); Color control_font_low_color = Color(0.69, 0.69, 0.69); Color control_font_hover_color = Color(0.94, 0.94, 0.94); + Color control_font_focus_color = Color(0.94, 0.94, 0.94); Color control_font_disabled_color = Color(0.9, 0.9, 0.9, 0.2); Color control_font_pressed_color = Color(1, 1, 1); @@ -185,6 +186,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("font_color", "Button", control_font_color); theme->set_color("font_pressed_color", "Button", control_font_pressed_color); theme->set_color("font_hover_color", "Button", control_font_hover_color); + theme->set_color("font_focus_color", "Button", control_font_focus_color); theme->set_color("font_hover_pressed_color", "Button", control_font_pressed_color); theme->set_color("font_disabled_color", "Button", control_font_disabled_color); theme->set_color("font_outline_color", "Button", Color(1, 1, 1)); @@ -193,6 +195,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("icon_pressed_color", "Button", Color(1, 1, 1, 1)); theme->set_color("icon_hover_color", "Button", Color(1, 1, 1, 1)); theme->set_color("icon_hover_pressed_color", "Button", Color(1, 1, 1, 1)); + theme->set_color("icon_focus_color", "Button", Color(1, 1, 1, 1)); theme->set_color("icon_disabled_color", "Button", Color(1, 1, 1, 1)); theme->set_constant("hseparation", "Button", 2 * scale); @@ -207,6 +210,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("font_color", "LinkButton", control_font_color); theme->set_color("font_pressed_color", "LinkButton", control_font_pressed_color); theme->set_color("font_hover_color", "LinkButton", control_font_hover_color); + theme->set_color("font_focus_color", "LinkButton", control_font_focus_color); theme->set_color("font_outline_color", "LinkButton", Color(1, 1, 1)); theme->set_constant("outline_size", "LinkButton", 0); @@ -245,6 +249,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("font_color", "OptionButton", control_font_color); theme->set_color("font_pressed_color", "OptionButton", control_font_pressed_color); theme->set_color("font_hover_color", "OptionButton", control_font_hover_color); + theme->set_color("font_focus_color", "OptionButton", control_font_focus_color); theme->set_color("font_disabled_color", "OptionButton", control_font_disabled_color); theme->set_color("font_outline_color", "OptionButton", Color(1, 1, 1)); @@ -266,6 +271,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("font_color", "MenuButton", control_font_color); theme->set_color("font_pressed_color", "MenuButton", control_font_pressed_color); theme->set_color("font_hover_color", "MenuButton", control_font_hover_color); + theme->set_color("font_focus_color", "MenuButton", control_font_focus_color); theme->set_color("font_disabled_color", "MenuButton", Color(1, 1, 1, 0.3)); theme->set_color("font_outline_color", "MenuButton", Color(1, 1, 1)); @@ -308,6 +314,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("font_pressed_color", "CheckBox", control_font_pressed_color); theme->set_color("font_hover_color", "CheckBox", control_font_hover_color); theme->set_color("font_hover_pressed_color", "CheckBox", control_font_pressed_color); + theme->set_color("font_focus_color", "CheckBox", control_font_focus_color); theme->set_color("font_disabled_color", "CheckBox", control_font_disabled_color); theme->set_color("font_outline_color", "CheckBox", Color(1, 1, 1)); @@ -347,6 +354,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("font_pressed_color", "CheckButton", control_font_pressed_color); theme->set_color("font_hover_color", "CheckButton", control_font_hover_color); theme->set_color("font_hover_pressed_color", "CheckButton", control_font_pressed_color); + theme->set_color("font_focus_color", "CheckButton", control_font_focus_color); theme->set_color("font_disabled_color", "CheckButton", control_font_disabled_color); theme->set_color("font_outline_color", "CheckButton", Color(1, 1, 1)); @@ -867,6 +875,7 @@ void fill_default_theme(Ref<Theme> &theme, const Ref<Font> &default_font, const theme->set_color("font_color", "ColorPickerButton", Color(1, 1, 1, 1)); theme->set_color("font_pressed_color", "ColorPickerButton", Color(0.8, 0.8, 0.8, 1)); theme->set_color("font_hover_color", "ColorPickerButton", Color(1, 1, 1, 1)); + theme->set_color("font_focus_color", "ColorPickerButton", Color(1, 1, 1, 1)); theme->set_color("font_disabled_color", "ColorPickerButton", Color(0.9, 0.9, 0.9, 0.3)); theme->set_color("font_outline_color", "ColorPickerButton", Color(1, 1, 1)); |