|
@@ -474,21 +474,24 @@ void TabContainer::remove_child_notify(Node *p_child) {
|
|
|
|
|
|
Control::remove_child_notify(p_child);
|
|
Control::remove_child_notify(p_child);
|
|
|
|
|
|
- int tc = get_tab_count();
|
|
|
|
- if (current == tc - 1) {
|
|
|
|
- current--;
|
|
|
|
- if (current < 0)
|
|
|
|
- current = 0;
|
|
|
|
- else {
|
|
|
|
- call_deferred("set_current_tab", current);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ call_deferred("_update_current_tab");
|
|
|
|
|
|
p_child->disconnect("renamed", this, "_child_renamed_callback");
|
|
p_child->disconnect("renamed", this, "_child_renamed_callback");
|
|
|
|
|
|
update();
|
|
update();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+void TabContainer::_update_current_tab() {
|
|
|
|
+
|
|
|
|
+ int tc = get_tab_count();
|
|
|
|
+ if (current >= tc)
|
|
|
|
+ current = tc - 1;
|
|
|
|
+ if (current < 0)
|
|
|
|
+ current = 0;
|
|
|
|
+ else
|
|
|
|
+ set_current_tab(current);
|
|
|
|
+}
|
|
|
|
+
|
|
void TabContainer::set_tab_align(TabAlign p_align) {
|
|
void TabContainer::set_tab_align(TabAlign p_align) {
|
|
|
|
|
|
ERR_FAIL_INDEX(p_align, 3);
|
|
ERR_FAIL_INDEX(p_align, 3);
|
|
@@ -664,6 +667,7 @@ void TabContainer::_bind_methods() {
|
|
|
|
|
|
ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback);
|
|
ClassDB::bind_method(D_METHOD("_child_renamed_callback"), &TabContainer::_child_renamed_callback);
|
|
ClassDB::bind_method(D_METHOD("_on_theme_changed"), &TabContainer::_on_theme_changed);
|
|
ClassDB::bind_method(D_METHOD("_on_theme_changed"), &TabContainer::_on_theme_changed);
|
|
|
|
+ ClassDB::bind_method(D_METHOD("_update_current_tab"), &TabContainer::_update_current_tab);
|
|
|
|
|
|
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
|
|
ADD_SIGNAL(MethodInfo("tab_changed", PropertyInfo(Variant::INT, "tab")));
|
|
ADD_SIGNAL(MethodInfo("tab_selected", PropertyInfo(Variant::INT, "tab")));
|
|
ADD_SIGNAL(MethodInfo("tab_selected", PropertyInfo(Variant::INT, "tab")));
|