Add as_sortable_control() to unify Container checks

This commit is contained in:
kobewi
2024-05-06 12:38:51 +02:00
parent 17a81260cb
commit 5c28814b39
15 changed files with 65 additions and 170 deletions

View File

@@ -160,14 +160,10 @@ void GraphFrame::_resort() {
Point2 offset = Point2(sb_panel->get_margin(SIDE_LEFT), sb_panel->get_margin(SIDE_TOP) + titlebar_min_size.height + sb_titlebar->get_minimum_size().height);
for (int i = 0; i < get_child_count(false); i++) {
Control *child = Object::cast_to<Control>(get_child(i, false));
if (!child || !child->is_visible_in_tree()) {
Control *child = as_sortable_control(get_child(i, false));
if (!child) {
continue;
}
if (child->is_set_as_top_level()) {
continue;
}
fit_child_in_rect(child, Rect2(offset, size));
}
}
@@ -325,8 +321,8 @@ Size2 GraphFrame::get_minimum_size() const {
Size2 minsize = titlebar_hbox->get_minimum_size() + sb_titlebar->get_minimum_size();
for (int i = 0; i < get_child_count(false); i++) {
Control *child = Object::cast_to<Control>(get_child(i, false));
if (!child || !child->is_visible() || child->is_set_as_top_level()) {
Control *child = as_sortable_control(get_child(i, false));
if (!child) {
continue;
}