MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / DockNodeUpdateTabBar

Method DockNodeUpdateTabBar

extern/imgui/imgui.cpp:16075–16342  ·  view source on GitHub ↗

Submit the tab bar corresponding to a dock node and various housekeeping details.

Source from the content-addressed store, hash-verified

16073
16074// Submit the tab bar corresponding to a dock node and various housekeeping details.
16075static void ImGui::DockNodeUpdateTabBar(ImGuiDockNode* node, ImGuiWindow* host_window)
16076{
16077 ImGuiContext& g = *GImGui;
16078 ImGuiStyle& style = g.Style;
16079
16080 const bool node_was_active = (node->LastFrameActive + 1 == g.FrameCount);
16081 const bool closed_all = node->WantCloseAll && node_was_active;
16082 const ImGuiID closed_one = node->WantCloseTabId && node_was_active;
16083 node->WantCloseAll = false;
16084 node->WantCloseTabId = 0;
16085
16086 // Decide if we should use a focused title bar color
16087 bool is_focused = false;
16088 ImGuiDockNode* root_node = DockNodeGetRootNode(node);
16089 if (IsDockNodeTitleBarHighlighted(node, root_node))
16090 is_focused = true;
16091
16092 // Hidden tab bar will show a triangle on the upper-left (in Begin)
16093 if (node->IsHiddenTabBar() || node->IsNoTabBar())
16094 {
16095 node->VisibleWindow = (node->Windows.Size > 0) ? node->Windows[0] : NULL;
16096 node->IsFocused = is_focused;
16097 if (is_focused)
16098 node->LastFrameFocused = g.FrameCount;
16099 if (node->VisibleWindow)
16100 {
16101 // Notify root of visible window (used to display title in OS task bar)
16102 if (is_focused || root_node->VisibleWindow == NULL)
16103 root_node->VisibleWindow = node->VisibleWindow;
16104 if (node->TabBar)
16105 node->TabBar->VisibleTabId = node->VisibleWindow->TabId;
16106 }
16107 return;
16108 }
16109
16110 // Move ourselves to the Menu layer (so we can be accessed by tapping Alt) + undo SkipItems flag in order to draw over the title bar even if the window is collapsed
16111 bool backup_skip_item = host_window->SkipItems;
16112 if (!node->IsDockSpace())
16113 {
16114 host_window->SkipItems = false;
16115 host_window->DC.NavLayerCurrent = ImGuiNavLayer_Menu;
16116 }
16117
16118 // Use PushOverrideID() instead of PushID() to use the node id _without_ the host window ID.
16119 // This is to facilitate computing those ID from the outside, and will affect more or less only the ID of the collapse button, popup and tabs,
16120 // as docked windows themselves will override the stack with their own root ID.
16121 PushOverrideID(node->ID);
16122 ImGuiTabBar* tab_bar = node->TabBar;
16123 bool tab_bar_is_recreated = (tab_bar == NULL); // Tab bar are automatically destroyed when a node gets hidden
16124 if (tab_bar == NULL)
16125 {
16126 DockNodeAddTabBar(node);
16127 tab_bar = node->TabBar;
16128 }
16129
16130 ImGuiID focus_tab_id = 0;
16131 node->IsFocused = is_focused;
16132

Callers

nothing calls this directly

Calls 6

DockNodeGetRootNodeFunction · 0.85
ImQsortFunction · 0.85
ImVec4Class · 0.85
AddRectFilledMethod · 0.80
GetIDMethod · 0.80

Tested by

no test coverage detected