From 9e0a1c88a025c741ed2a6cbeb6d55281e7a0e8d0 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Mon, 4 Apr 2022 12:14:20 +0800 Subject: [PATCH] Add missing CheckBox & CheckButton editor icons Co-authored-by: Silc 'Tokage' Renew Co-authored-by: Yuri Sizov --- editor/editor_themes.cpp | 4 ++++ editor/icons/icon_GUI_checked_disabled.svg | 1 + editor/icons/icon_GUI_radio_checked_disabled.svg | 1 + editor/icons/icon_GUI_radio_unchecked_disabled.svg | 1 + editor/icons/icon_GUI_toggle_off_disabled.svg | 1 + editor/icons/icon_GUI_toggle_on_disabled.svg | 1 + editor/icons/icon_GUI_unchecked_disabled.svg | 1 + scene/gui/check_box.cpp | 14 ++++++++++++++ 8 files changed, 24 insertions(+) create mode 100644 editor/icons/icon_GUI_checked_disabled.svg create mode 100644 editor/icons/icon_GUI_radio_checked_disabled.svg create mode 100644 editor/icons/icon_GUI_radio_unchecked_disabled.svg create mode 100644 editor/icons/icon_GUI_toggle_off_disabled.svg create mode 100644 editor/icons/icon_GUI_toggle_on_disabled.svg create mode 100644 editor/icons/icon_GUI_unchecked_disabled.svg diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 98075c3ad..6c6249036 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -713,8 +713,12 @@ Ref create_editor_theme(const Ref p_theme) { theme->set_stylebox("hover", "CheckBox", sb_checkbox); theme->set_icon("checked", "CheckBox", theme->get_icon("GuiChecked", "EditorIcons")); theme->set_icon("unchecked", "CheckBox", theme->get_icon("GuiUnchecked", "EditorIcons")); + theme->set_icon("checked_disabled", "CheckBox", theme->get_icon("GuiCheckedDisabled", "EditorIcons")); + theme->set_icon("unchecked_disabled", "CheckBox", theme->get_icon("GuiUncheckedDisabled", "EditorIcons")); theme->set_icon("radio_checked", "CheckBox", theme->get_icon("GuiRadioChecked", "EditorIcons")); theme->set_icon("radio_unchecked", "CheckBox", theme->get_icon("GuiRadioUnchecked", "EditorIcons")); + theme->set_icon("radio_checked_disabled", "CheckBox", theme->get_icon("GuiRadioCheckedDisabled", "EditorIcons")); + theme->set_icon("radio_unchecked_disabled", "CheckBox", theme->get_icon("GuiRadioUncheckedDisabled", "EditorIcons")); theme->set_color("font_color", "CheckBox", font_color); theme->set_color("font_color_hover", "CheckBox", font_color_hl); diff --git a/editor/icons/icon_GUI_checked_disabled.svg b/editor/icons/icon_GUI_checked_disabled.svg new file mode 100644 index 000000000..625217624 --- /dev/null +++ b/editor/icons/icon_GUI_checked_disabled.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_GUI_radio_checked_disabled.svg b/editor/icons/icon_GUI_radio_checked_disabled.svg new file mode 100644 index 000000000..94a1fffa0 --- /dev/null +++ b/editor/icons/icon_GUI_radio_checked_disabled.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_GUI_radio_unchecked_disabled.svg b/editor/icons/icon_GUI_radio_unchecked_disabled.svg new file mode 100644 index 000000000..3a75797c4 --- /dev/null +++ b/editor/icons/icon_GUI_radio_unchecked_disabled.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_GUI_toggle_off_disabled.svg b/editor/icons/icon_GUI_toggle_off_disabled.svg new file mode 100644 index 000000000..020ebdc3a --- /dev/null +++ b/editor/icons/icon_GUI_toggle_off_disabled.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_GUI_toggle_on_disabled.svg b/editor/icons/icon_GUI_toggle_on_disabled.svg new file mode 100644 index 000000000..df6b27c71 --- /dev/null +++ b/editor/icons/icon_GUI_toggle_on_disabled.svg @@ -0,0 +1 @@ + diff --git a/editor/icons/icon_GUI_unchecked_disabled.svg b/editor/icons/icon_GUI_unchecked_disabled.svg new file mode 100644 index 000000000..2b6515f9d --- /dev/null +++ b/editor/icons/icon_GUI_unchecked_disabled.svg @@ -0,0 +1 @@ + diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp index 8deee8c55..c96344974 100644 --- a/scene/gui/check_box.cpp +++ b/scene/gui/check_box.cpp @@ -39,6 +39,8 @@ Size2 CheckBox::get_icon_size() const { Ref unchecked_disabled = Control::get_icon("unchecked_disabled"); Ref radio_checked = Control::get_icon("radio_checked"); Ref radio_unchecked = Control::get_icon("radio_unchecked"); + Ref radio_checked_disabled = Control::get_icon("radio_checked_disabled"); + Ref radio_unchecked_disabled = Control::get_icon("radio_unchecked_disabled"); Size2 tex_size = Size2(0, 0); if (!checked.is_null()) { @@ -53,6 +55,18 @@ Size2 CheckBox::get_icon_size() const { if (!radio_unchecked.is_null()) { tex_size = Size2(MAX(tex_size.width, radio_unchecked->get_width()), MAX(tex_size.height, radio_unchecked->get_height())); } + if (!checked_disabled.is_null()) { + tex_size = Size2(MAX(tex_size.width, checked_disabled->get_width()), MAX(tex_size.height, checked_disabled->get_height())); + } + if (!unchecked_disabled.is_null()) { + tex_size = Size2(MAX(tex_size.width, unchecked_disabled->get_width()), MAX(tex_size.height, unchecked_disabled->get_height())); + } + if (!radio_checked_disabled.is_null()) { + tex_size = Size2(MAX(tex_size.width, radio_checked_disabled->get_width()), MAX(tex_size.height, radio_checked_disabled->get_height())); + } + if (!radio_unchecked_disabled.is_null()) { + tex_size = Size2(MAX(tex_size.width, radio_unchecked_disabled->get_width()), MAX(tex_size.height, radio_unchecked_disabled->get_height())); + } return tex_size; }