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

Method DockContextBuildNodesFromSettings

imgui_tiny_app/imgui/imgui.cpp:18175–18209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18173}
18174
18175static void ImGui::DockContextBuildNodesFromSettings(ImGuiContext* ctx, ImGuiDockNodeSettings* node_settings_array, int node_settings_count)
18176{
18177 // Build nodes
18178 ImGuiContext& g = *ctx; IM_UNUSED(g);
18179 for (int node_n = 0; node_n < node_settings_count; node_n++)
18180 {
18181 ImGuiDockNodeSettings* settings = &node_settings_array[node_n];
18182 if (settings->ID == 0)
18183 continue;
18184 if (DockContextFindNodeByID(ctx, settings->ID) != NULL)
18185 {
18186 IMGUI_DEBUG_LOG_DOCKING("[docking] DockContextBuildNodesFromSettings: skip duplicate node 0x%08X\n", settings->ID);
18187 continue;
18188 }
18189 ImGuiDockNode* node = DockContextAddNode(ctx, settings->ID);
18190 node->ParentNode = settings->ParentNodeId ? DockContextFindNodeByID(ctx, settings->ParentNodeId) : NULL;
18191 node->Pos = ImVec2(settings->Pos.x, settings->Pos.y);
18192 node->Size = ImVec2(settings->Size.x, settings->Size.y);
18193 node->SizeRef = ImVec2(settings->SizeRef.x, settings->SizeRef.y);
18194 node->AuthorityForPos = node->AuthorityForSize = node->AuthorityForViewport = ImGuiDataAuthority_DockNode;
18195 if (node->ParentNode && node->ParentNode->ChildNodes[0] == NULL)
18196 node->ParentNode->ChildNodes[0] = node;
18197 else if (node->ParentNode && node->ParentNode->ChildNodes[1] == NULL)
18198 node->ParentNode->ChildNodes[1] = node;
18199 node->SelectedTabId = settings->SelectedTabId;
18200 node->SplitAxis = (ImGuiAxis)settings->SplitAxis;
18201 node->SetLocalFlags(settings->Flags & ImGuiDockNodeFlags_SavedFlagsMask_);
18202
18203 // Bind host window immediately if it already exist (in case of a rebuild)
18204 // This is useful as the RootWindowForTitleBarHighlight links necessary to highlight the currently focused node requires node->HostWindow to be set.
18205 char host_window_title[20];
18206 ImGuiDockNode* root_node = DockNodeGetRootNode(node);
18207 node->HostWindow = FindWindowByName(DockNodeGetHostWindowTitle(root_node, host_window_title, IM_COUNTOF(host_window_title)));
18208 }
18209}
18210
18211void ImGui::DockContextBuildAddWindowsToNodes(ImGuiContext* ctx, ImGuiID root_id)
18212{

Callers

nothing calls this directly

Calls 3

ImVec2Function · 0.85
DockNodeGetRootNodeFunction · 0.85

Tested by

no test coverage detected