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

Function DockNodeIsDropAllowedOne

imgui_tiny_app/imgui/imgui.cpp:19714–19744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19712}
19713
19714static bool DockNodeIsDropAllowedOne(ImGuiWindow* payload, ImGuiWindow* host_window)
19715{
19716 if (host_window->DockNodeAsHost && host_window->DockNodeAsHost->IsDockSpace() && payload->BeginOrderWithinContext < host_window->BeginOrderWithinContext)
19717 return false;
19718
19719 ImGuiWindowClass* host_class = host_window->DockNodeAsHost ? &host_window->DockNodeAsHost->WindowClass : &host_window->WindowClass;
19720 ImGuiWindowClass* payload_class = &payload->WindowClass;
19721 if (host_class->ClassId != payload_class->ClassId)
19722 {
19723 bool pass = false;
19724 if (host_class->ClassId != 0 && host_class->DockingAllowUnclassed && payload_class->ClassId == 0)
19725 pass = true;
19726 if (payload_class->ClassId != 0 && payload_class->DockingAllowUnclassed && host_class->ClassId == 0)
19727 pass = true;
19728 if (!pass)
19729 return false;
19730 }
19731
19732 // Prevent docking any window created above a popup
19733 // Technically we should support it (e.g. in the case of a long-lived modal window that had fancy docking features),
19734 // by e.g. adding a 'if (!ImGui::IsWindowWithinBeginStackOf(host_window, popup_window))' test.
19735 // But it would requires more work on our end because the dock host windows is technically created in NewFrame()
19736 // and our ->ParentXXX and ->RootXXX pointers inside windows are currently mislading or lacking.
19737 ImGuiContext& g = *GImGui;
19738 for (int i = g.OpenPopupStack.Size - 1; i >= 0; i--)
19739 if (ImGuiWindow* popup_window = g.OpenPopupStack[i].Window)
19740 if (ImGui::IsWindowWithinBeginStackOf(payload, popup_window)) // Payload is created from within a popup begin stack.
19741 return false;
19742
19743 return true;
19744}
19745
19746static bool ImGui::DockNodeIsDropAllowed(ImGuiWindow* host_window, ImGuiWindow* root_payload)
19747{

Callers 2

DockNodeIsDropAllowedMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected