Updates containers minimum size when some constants are modified

This commit is contained in:
groud 2019-01-24 22:31:33 +01:00
parent 7fa41f17a6
commit a1f955a1d3
6 changed files with 124 additions and 98 deletions

View File

@ -255,6 +255,10 @@ void BoxContainer::_notification(int p_what) {
_resort(); _resort();
} break; } break;
case NOTIFICATION_THEME_CHANGED: {
minimum_size_changed();
} break;
} }
} }

View File

@ -192,7 +192,8 @@ bool GraphNode::has_point(const Point2 &p_point) const {
void GraphNode::_notification(int p_what) { void GraphNode::_notification(int p_what) {
if (p_what == NOTIFICATION_DRAW) { switch (p_what) {
case NOTIFICATION_DRAW: {
Ref<StyleBox> sb; Ref<StyleBox> sb;
@ -278,11 +279,17 @@ void GraphNode::_notification(int p_what) {
if (resizable) { if (resizable) {
draw_texture(resizer, get_size() - resizer->get_size()); draw_texture(resizer, get_size() - resizer->get_size());
} }
} } break;
if (p_what == NOTIFICATION_SORT_CHILDREN) { case NOTIFICATION_SORT_CHILDREN: {
_resort(); _resort();
} break;
case NOTIFICATION_THEME_CHANGED: {
minimum_size_changed();
} break;
} }
} }

View File

@ -164,6 +164,10 @@ void GridContainer::_notification(int p_what) {
} }
} break; } break;
case NOTIFICATION_THEME_CHANGED: {
minimum_size_changed();
} break;
} }
} }

View File

@ -64,7 +64,8 @@ Size2 MarginContainer::get_minimum_size() const {
void MarginContainer::_notification(int p_what) { 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_left = get_constant("margin_left");
int margin_top = get_constant("margin_top"); int margin_top = get_constant("margin_top");
@ -85,6 +86,11 @@ void MarginContainer::_notification(int p_what) {
int h = s.height - margin_top - margin_bottom; int h = s.height - margin_top - margin_bottom;
fit_child_in_rect(c, Rect2(margin_left, margin_top, w, h)); fit_child_in_rect(c, Rect2(margin_left, margin_top, w, h));
} }
} break;
case NOTIFICATION_THEME_CHANGED: {
minimum_size_changed();
} break;
} }
} }

View File

@ -193,6 +193,10 @@ void SplitContainer::_notification(int p_what) {
draw_texture(tex, Point2i(middle_sep + (sep - tex->get_width()) / 2, (size.y - tex->get_height()) / 2)); draw_texture(tex, Point2i(middle_sep + (sep - tex->get_width()) / 2, (size.y - tex->get_height()) / 2));
} }
} break; } break;
case NOTIFICATION_THEME_CHANGED: {
minimum_size_changed();
} break;
} }
} }

View File

@ -338,6 +338,7 @@ void TabContainer::_notification(int p_what) {
} }
} break; } break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
minimum_size_changed();
call_deferred("_on_theme_changed"); //wait until all changed theme call_deferred("_on_theme_changed"); //wait until all changed theme
} break; } break;
} }