summaryrefslogtreecommitdiff
path: root/scene/gui/margin_container.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/margin_container.cpp')
-rw-r--r--scene/gui/margin_container.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/scene/gui/margin_container.cpp b/scene/gui/margin_container.cpp
index a087b68d25..62ba45c484 100644
--- a/scene/gui/margin_container.cpp
+++ b/scene/gui/margin_container.cpp
@@ -64,27 +64,33 @@ Size2 MarginContainer::get_minimum_size() const {
void MarginContainer::_notification(int p_what) {
- if (p_what == NOTIFICATION_SORT_CHILDREN) {
+ switch (p_what) {
+ case NOTIFICATION_SORT_CHILDREN: {
- int margin_left = get_constant("margin_left");
- int margin_top = get_constant("margin_top");
- int margin_right = get_constant("margin_right");
- int margin_bottom = get_constant("margin_bottom");
+ int margin_left = get_constant("margin_left");
+ int margin_top = get_constant("margin_top");
+ int margin_right = get_constant("margin_right");
+ int margin_bottom = get_constant("margin_bottom");
- Size2 s = get_size();
+ Size2 s = get_size();
- for (int i = 0; i < get_child_count(); i++) {
+ for (int i = 0; i < get_child_count(); i++) {
- Control *c = Object::cast_to<Control>(get_child(i));
- if (!c)
- continue;
- if (c->is_set_as_toplevel())
- continue;
+ Control *c = Object::cast_to<Control>(get_child(i));
+ if (!c)
+ continue;
+ if (c->is_set_as_toplevel())
+ continue;
- int w = s.width - margin_left - margin_right;
- int h = s.height - margin_top - margin_bottom;
- fit_child_in_rect(c, Rect2(margin_left, margin_top, w, h));
- }
+ int w = s.width - margin_left - margin_right;
+ int h = s.height - margin_top - margin_bottom;
+ fit_child_in_rect(c, Rect2(margin_left, margin_top, w, h));
+ }
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
+
+ minimum_size_changed();
+ } break;
}
}