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

Method DockContextProcessUndockNode

imgui_tiny_app/imgui/imgui.cpp:18457–18496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18455}
18456
18457void ImGui::DockContextProcessUndockNode(ImGuiContext* ctx, ImGuiDockNode* node)
18458{
18459 ImGuiContext& g = *ctx;
18460 IMGUI_DEBUG_LOG_DOCKING("[docking] DockContextProcessUndockNode node %08X\n", node->ID);
18461 IM_ASSERT(node->IsLeafNode());
18462 IM_ASSERT(node->Windows.Size >= 1);
18463
18464 if (node->IsRootNode() || node->IsCentralNode())
18465 {
18466 // In the case of a root node or central node, the node will have to stay in place. Create a new node to receive the payload.
18467 ImGuiDockNode* new_node = DockContextAddNode(ctx, 0);
18468 new_node->Pos = node->Pos;
18469 new_node->Size = node->Size;
18470 new_node->SizeRef = node->SizeRef;
18471 DockNodeMoveWindows(new_node, node);
18472 DockSettingsRenameNodeReferences(node->ID, new_node->ID);
18473 node = new_node;
18474 }
18475 else
18476 {
18477 // Otherwise extract our node and merge our sibling back into the parent node.
18478 IM_ASSERT(node->ParentNode->ChildNodes[0] == node || node->ParentNode->ChildNodes[1] == node);
18479 int index_in_parent = (node->ParentNode->ChildNodes[0] == node) ? 0 : 1;
18480 node->ParentNode->ChildNodes[index_in_parent] = NULL;
18481 DockNodeTreeMerge(ctx, node->ParentNode, node->ParentNode->ChildNodes[index_in_parent ^ 1]);
18482 node->ParentNode->AuthorityForViewport = ImGuiDataAuthority_Window; // The node that stays in place keeps the viewport, so our newly dragged out node will create a new viewport
18483 node->ParentNode = NULL;
18484 }
18485 for (ImGuiWindow* window : node->Windows)
18486 {
18487 window->Flags &= ~ImGuiWindowFlags_ChildWindow;
18488 if (window->ParentWindow)
18489 window->ParentWindow->DC.ChildWindows.find_erase(window);
18490 UpdateWindowParentAndRootLinks(window, window->Flags, NULL);
18491 }
18492 node->AuthorityForPos = node->AuthorityForSize = ImGuiDataAuthority_DockNode;
18493 node->Size = FixLargeWindowsWhenUndocking(node->Size, node->Windows[0]->Viewport);
18494 node->WantMouseMove = true;
18495 MarkIniSettingsDirty();
18496}
18497
18498// This is mostly used for automation.
18499bool ImGui::DockContextCalcDropPosForDocking(ImGuiWindow* target, ImGuiDockNode* target_node, ImGuiWindow* payload_window, ImGuiDockNode* payload_node, ImGuiDir split_dir, bool split_outer, ImVec2* out_pos)

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected