MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / DockNodeUpdateForRootNode

Method DockNodeUpdateForRootNode

imgui_tiny_app/imgui/imgui.cpp:18956–18991  ·  view source on GitHub ↗

Update CentralNode, OnlyNodeWithWindows, LastFocusedNodeID. Copy window class.

Source from the content-addressed store, hash-verified

18954
18955// Update CentralNode, OnlyNodeWithWindows, LastFocusedNodeID. Copy window class.
18956static void ImGui::DockNodeUpdateForRootNode(ImGuiDockNode* node)
18957{
18958 DockNodeUpdateFlagsAndCollapse(node);
18959
18960 // - Setup central node pointers
18961 // - Find if there's only a single visible window in the hierarchy (in which case we need to display a regular title bar -> FIXME-DOCK: that last part is not done yet!)
18962 // Cannot merge this with DockNodeUpdateFlagsAndCollapse() because FirstNodeWithWindows is found after window removal and child collapsing
18963 ImGuiDockNodeTreeInfo info;
18964 DockNodeFindInfo(node, &info);
18965 node->CentralNode = info.CentralNode;
18966 node->OnlyNodeWithWindows = (info.CountNodesWithWindows == 1) ? info.FirstNodeWithWindows : NULL;
18967 node->CountNodeWithWindows = info.CountNodesWithWindows;
18968 if (node->LastFocusedNodeId == 0 && info.FirstNodeWithWindows != NULL)
18969 node->LastFocusedNodeId = info.FirstNodeWithWindows->ID;
18970
18971 // Copy the window class from of our first window so it can be used for proper dock filtering.
18972 // When node has mixed windows, prioritize the class with the most constraint (DockingAllowUnclassed = false) as the reference to copy.
18973 // FIXME-DOCK: We don't recurse properly, this code could be reworked to work from DockNodeUpdateScanRec.
18974 if (ImGuiDockNode* first_node_with_windows = info.FirstNodeWithWindows)
18975 {
18976 node->WindowClass = first_node_with_windows->Windows[0]->WindowClass;
18977 for (int n = 1; n < first_node_with_windows->Windows.Size; n++)
18978 if (first_node_with_windows->Windows[n]->WindowClass.DockingAllowUnclassed == false)
18979 {
18980 node->WindowClass = first_node_with_windows->Windows[n]->WindowClass;
18981 break;
18982 }
18983 }
18984
18985 ImGuiDockNode* mark_node = node->CentralNode;
18986 while (mark_node)
18987 {
18988 mark_node->HasCentralNodeChild = true;
18989 mark_node = mark_node->ParentNode;
18990 }
18991}
18992
18993static void DockNodeSetupHostWindow(ImGuiDockNode* node, ImGuiWindow* host_window)
18994{

Callers

nothing calls this directly

Calls 1

DockNodeFindInfoFunction · 0.85

Tested by

no test coverage detected