MCPcopy Create free account
hub / github.com/RenderKit/embree / EndTabBar

Method EndTabBar

tutorials/common/imgui/imgui_widgets.cpp:7431–7468  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7429}
7430
7431void ImGui::EndTabBar()
7432{
7433 ImGuiContext& g = *GImGui;
7434 ImGuiWindow* window = g.CurrentWindow;
7435 if (window->SkipItems)
7436 return;
7437
7438 ImGuiTabBar* tab_bar = g.CurrentTabBar;
7439 if (tab_bar == NULL)
7440 {
7441 IM_ASSERT_USER_ERROR(tab_bar != NULL, "Mismatched BeginTabBar()/EndTabBar()!");
7442 return;
7443 }
7444
7445 // Fallback in case no TabItem have been submitted
7446 if (tab_bar->WantLayout)
7447 TabBarLayout(tab_bar);
7448
7449 // Restore the last visible height if no tab is visible, this reduce vertical flicker/movement when a tabs gets removed without calling SetTabItemClosed().
7450 const bool tab_bar_appearing = (tab_bar->PrevFrameVisible + 1 < g.FrameCount);
7451 if (tab_bar->VisibleTabWasSubmitted || tab_bar->VisibleTabId == 0 || tab_bar_appearing)
7452 {
7453 tab_bar->CurrTabsContentsHeight = ImMax(window->DC.CursorPos.y - tab_bar->BarRect.Max.y, tab_bar->CurrTabsContentsHeight);
7454 window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->CurrTabsContentsHeight;
7455 }
7456 else
7457 {
7458 window->DC.CursorPos.y = tab_bar->BarRect.Max.y + tab_bar->PrevTabsContentsHeight;
7459 }
7460 if (tab_bar->BeginCount > 1)
7461 window->DC.CursorPos = tab_bar->BackupCursorPos;
7462
7463 if ((tab_bar->Flags & ImGuiTabBarFlags_DockNode) == 0)
7464 PopID();
7465
7466 g.CurrentTabBarStack.pop_back();
7467 g.CurrentTabBar = g.CurrentTabBarStack.empty() ? NULL : GetTabBarFromTabBarRef(g.CurrentTabBarStack.back());
7468}
7469
7470// This is called only once a frame before by the first call to ItemTab()
7471// The reason we're not calling it in BeginTabBar() is to leave a chance to the user to call the SetTabItemClosed() functions.

Callers

nothing calls this directly

Calls 4

ImMaxFunction · 0.85
GetTabBarFromTabBarRefFunction · 0.85
pop_backMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected