summaryrefslogtreecommitdiffstats
path: root/scene/gui/tab_bar.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/tab_bar.cpp')
-rw-r--r--scene/gui/tab_bar.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/scene/gui/tab_bar.cpp b/scene/gui/tab_bar.cpp
index 90bb0799b1..6cc7ec3bd5 100644
--- a/scene/gui/tab_bar.cpp
+++ b/scene/gui/tab_bar.cpp
@@ -354,6 +354,8 @@ void TabBar::_notification(int p_what) {
if (scroll_to_selected) {
ensure_tab_visible(current);
}
+ // Set initialized even if no tabs were set.
+ initialized = true;
} break;
case NOTIFICATION_INTERNAL_PROCESS: {
@@ -655,10 +657,10 @@ void TabBar::set_tab_count(int p_count) {
}
if (!initialized) {
- if (queued_current != current) {
- current = queued_current;
- }
initialized = true;
+ if (queued_current != CURRENT_TAB_UNINITIALIZED && queued_current != current) {
+ set_current_tab(queued_current);
+ }
}
queue_redraw();
@@ -740,6 +742,13 @@ bool TabBar::select_next_available() {
return false;
}
+void TabBar::set_tab_offset(int p_offset) {
+ ERR_FAIL_INDEX(p_offset, tabs.size());
+ offset = p_offset;
+ _update_cache();
+ queue_redraw();
+}
+
int TabBar::get_tab_offset() const {
return offset;
}