summaryrefslogtreecommitdiffstats
path: root/scene/gui/tab_container.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-06-07 23:29:48 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-06-07 23:29:48 +0200
commita6bb8b00d7debeb86f908db57be60d5d713ea18b (patch)
treefe3db8a1272e97f9b2aee9ee76406f6843302ab1 /scene/gui/tab_container.cpp
parent2c01573fdf70a6a8f99210ad6c41ac164d1cf014 (diff)
parent02e1e6d1ecb2f152589215145dd16e622d6aa8da (diff)
downloadredot-engine-a6bb8b00d7debeb86f908db57be60d5d713ea18b.tar.gz
Merge pull request #92664 from KoBeWi/ultimate_final_solution_for_containers
Add visibilty mode to `as_sortable_control()`
Diffstat (limited to 'scene/gui/tab_container.cpp')
-rw-r--r--scene/gui/tab_container.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/scene/gui/tab_container.cpp b/scene/gui/tab_container.cpp
index d0c3f3d65e..58724cf4e9 100644
--- a/scene/gui/tab_container.cpp
+++ b/scene/gui/tab_container.cpp
@@ -362,8 +362,8 @@ void TabContainer::_on_mouse_exited() {
Vector<Control *> TabContainer::_get_tab_controls() const {
Vector<Control *> controls;
for (int i = 0; i < get_child_count(); i++) {
- Control *control = Object::cast_to<Control>(get_child(i));
- if (!control || control->is_set_as_top_level() || control == tab_bar || children_removing.has(control)) {
+ Control *control = as_sortable_control(get_child(i), SortableVisbilityMode::IGNORE);
+ if (!control || control == tab_bar || children_removing.has(control)) {
continue;
}
@@ -539,8 +539,8 @@ void TabContainer::add_child_notify(Node *p_child) {
return;
}
- Control *c = Object::cast_to<Control>(p_child);
- if (!c || c->is_set_as_top_level()) {
+ Control *c = as_sortable_control(p_child, SortableVisbilityMode::IGNORE);
+ if (!c) {
return;
}
c->hide();
@@ -569,8 +569,8 @@ void TabContainer::move_child_notify(Node *p_child) {
return;
}
- Control *c = Object::cast_to<Control>(p_child);
- if (c && !c->is_set_as_top_level()) {
+ Control *c = as_sortable_control(p_child, SortableVisbilityMode::IGNORE);
+ if (c) {
tab_bar->move_tab(c->get_meta("_tab_index"), get_tab_idx_from_control(c));
}
@@ -584,8 +584,8 @@ void TabContainer::remove_child_notify(Node *p_child) {
return;
}
- Control *c = Object::cast_to<Control>(p_child);
- if (!c || c->is_set_as_top_level()) {
+ Control *c = as_sortable_control(p_child, SortableVisbilityMode::IGNORE);
+ if (!c) {
return;
}