| 7609 | } |
| 7610 | |
| 7611 | void ImGui::EndTabBar() |
| 7612 | { |
| 7613 | ImGuiContext& g = *GImGui; |
| 7614 | ImGuiWindow* window = g.CurrentWindow; |
| 7615 | if (window->SkipItems) |
| 7616 | return; |
| 7617 | |
| 7618 | ImGuiTabBar* tab_bar = g.CurrentTabBar; |
| 7619 | if (tab_bar == NULL) |
| 7620 | { |
| 7621 | IM_ASSERT_USER_ERROR(tab_bar != NULL, "Mismatched BeginTabBar()/EndTabBar()!"); |
| 7622 | return; |
| 7623 | } |
| 7624 | |
| 7625 | // Fallback in case no TabItem have been submitted |
| 7626 | if (tab_bar->WantLayout) |
| 7627 | TabBarLayout(tab_bar); |
| 7628 | |
| 7629 | // Restore the last visible height if no tab is visible, this reduce vertical flicker/movement when a tabs gets removed without calling SetTabItemClosed(). |
| 7630 | const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount); |
| 7631 | if (tab_bar->VisibleTabWasSubmitted || tab_bar->VisibleTabId == 0 || tab_bar_appearing) |
| 7632 | { |
| 7633 | tab_bar->CurrTabsContentsHeight = ImMax(window->DC.CursorPos.y - tab_bar->BarRect.Max.y, tab_bar->CurrTabsContentsHeight); |
| 7634 | window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->CurrTabsContentsHeight; |
| 7635 | } |
| 7636 | else |
| 7637 | { |
| 7638 | window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->PrevTabsContentsHeight; |
| 7639 | } |
| 7640 | if (tab_bar->BeginCount > 1) |
| 7641 | window->DC.CursorPos = tab_bar->BackupCursorPos; |
| 7642 | |
| 7643 | tab_bar->LastTabItemIdx = -1; |
| 7644 | if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0) |
| 7645 | PopID(); |
| 7646 | |
| 7647 | g.CurrentTabBarStack.pop_back(); |
| 7648 | g.CurrentTabBar = g.CurrentTabBarStack.empty() ? NULL : GetTabBarFromTabBarRef(g.CurrentTabBarStack.back()); |
| 7649 | } |
| 7650 | |
| 7651 | // Scrolling happens only in the central section (leading/trailing sections are not scrolling) |
| 7652 | static float TabBarCalcScrollableWidth(ImGuiTabBar* tab_bar, ImGuiTabBarSection* sections) |
nothing calls this directly
no test coverage detected