summaryrefslogtreecommitdiff
path: root/scene/gui/check_box.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/check_box.cpp')
-rw-r--r--scene/gui/check_box.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/scene/gui/check_box.cpp b/scene/gui/check_box.cpp
index 8681b9bda7..df6f38f65d 100644
--- a/scene/gui/check_box.cpp
+++ b/scene/gui/check_box.cpp
@@ -39,14 +39,18 @@ Size2 CheckBox::get_icon_size() const {
Ref<Texture2D> radio_unchecked = Control::get_theme_icon("radio_unchecked");
Size2 tex_size = Size2(0, 0);
- if (!checked.is_null())
+ if (!checked.is_null()) {
tex_size = Size2(checked->get_width(), checked->get_height());
- if (!unchecked.is_null())
+ }
+ if (!unchecked.is_null()) {
tex_size = Size2(MAX(tex_size.width, unchecked->get_width()), MAX(tex_size.height, unchecked->get_height()));
- if (!radio_checked.is_null())
+ }
+ if (!radio_checked.is_null()) {
tex_size = Size2(MAX(tex_size.width, radio_checked->get_width()), MAX(tex_size.height, radio_checked->get_height()));
- if (!radio_unchecked.is_null())
+ }
+ if (!radio_unchecked.is_null()) {
tex_size = Size2(MAX(tex_size.width, radio_unchecked->get_width()), MAX(tex_size.height, radio_unchecked->get_height()));
+ }
return tex_size;
}
@@ -77,10 +81,11 @@ void CheckBox::_notification(int p_what) {
ofs.x = sb->get_margin(MARGIN_LEFT);
ofs.y = int((get_size().height - get_icon_size().height) / 2) + get_theme_constant("check_vadjust");
- if (is_pressed())
+ if (is_pressed()) {
on->draw(ci, ofs);
- else
+ } else {
off->draw(ci, ofs);
+ }
}
}