mirror of
https://github.com/Drezil/imgui.git
synced 2025-07-14 00:39:55 +02:00
Added DockSpaceOverViewport() call, not sure about this because of the menu bar limitation. (#2109)
This commit is contained in:
35
imgui.cpp
35
imgui.cpp
@ -11711,6 +11711,41 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags doc
|
||||
End();
|
||||
}
|
||||
|
||||
// Tips: Use with ImGuiDockNodeFlags_PassthruDockspace!
|
||||
// The limitation with this call is that your window won't have a menu bar.
|
||||
// Even though we could pass window flags, it would also require the user to be able to call BeginMenuBar() somehow meaning we can't Begin/End in a single function.
|
||||
// So if you want a menu bar you need to repeat this code manually ourselves. As with advanced other Docking API, we may change this function signature.
|
||||
ImGuiID ImGui::DockSpaceOverViewport(ImGuiViewport* viewport, ImGuiDockNodeFlags dockspace_flags, const ImGuiDockFamily* dock_family)
|
||||
{
|
||||
if (viewport == NULL)
|
||||
viewport = GetMainViewport();
|
||||
|
||||
SetNextWindowPos(viewport->Pos);
|
||||
SetNextWindowSize(viewport->Size);
|
||||
SetNextWindowViewport(viewport->ID);
|
||||
|
||||
ImGuiWindowFlags host_window_flags = 0;
|
||||
host_window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoDocking;
|
||||
host_window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
|
||||
if (dockspace_flags & ImGuiDockNodeFlags_PassthruDockspace)
|
||||
host_window_flags |= ImGuiWindowFlags_NoBackground;
|
||||
|
||||
char label[32];
|
||||
ImFormatString(label, IM_ARRAYSIZE(label), "DockspaceViewport_%08X", viewport->ID);
|
||||
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||
ImGui::Begin(label, NULL, host_window_flags);
|
||||
ImGui::PopStyleVar(3);
|
||||
|
||||
ImGuiID dockspace_id = ImGui::GetID("Dockspace");
|
||||
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags, dock_family);
|
||||
ImGui::End();
|
||||
|
||||
return dockspace_id;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Docking: Builder Functions
|
||||
//-----------------------------------------------------------------------------
|
||||
|
Reference in New Issue
Block a user