mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Added DockSpaceOverViewport() call, not sure about this because of the menu bar limitation. (#2109)
This commit is contained in:
parent
56ba60ee68
commit
c547b2e8ee
35
imgui.cpp
35
imgui.cpp
@ -11711,6 +11711,41 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags doc
|
|||||||
End();
|
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
|
// Docking: Builder Functions
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
1
imgui.h
1
imgui.h
@ -528,6 +528,7 @@ namespace ImGui
|
|||||||
// To dock windows: hold SHIFT anywhere while moving windows (if io.ConfigDockingWithShift == true) or drag windows from their title bar (if io.ConfigDockingWithShift = false)
|
// To dock windows: hold SHIFT anywhere while moving windows (if io.ConfigDockingWithShift == true) or drag windows from their title bar (if io.ConfigDockingWithShift = false)
|
||||||
// Use DockSpace() to create an explicit dock node _within_ an existing window. See Docking demo for details.
|
// Use DockSpace() to create an explicit dock node _within_ an existing window. See Docking demo for details.
|
||||||
IMGUI_API void DockSpace(ImGuiID id, const ImVec2& size = ImVec2(0, 0), ImGuiDockNodeFlags flags = 0, const ImGuiDockFamily* dock_family = NULL);
|
IMGUI_API void DockSpace(ImGuiID id, const ImVec2& size = ImVec2(0, 0), ImGuiDockNodeFlags flags = 0, const ImGuiDockFamily* dock_family = NULL);
|
||||||
|
IMGUI_API ImGuiID DockSpaceOverViewport(ImGuiViewport* viewport = NULL, ImGuiDockNodeFlags dockspace_flags = 0, const ImGuiDockFamily* dock_family = NULL);
|
||||||
IMGUI_API void SetNextWindowDockId(ImGuiID dock_id, ImGuiCond cond = 0); // set next window dock id (FIXME-DOCK)
|
IMGUI_API void SetNextWindowDockId(ImGuiID dock_id, ImGuiCond cond = 0); // set next window dock id (FIXME-DOCK)
|
||||||
IMGUI_API void SetNextWindowDockFamily(const ImGuiDockFamily* dock_family); // set next window user type (docking filters by same user_type)
|
IMGUI_API void SetNextWindowDockFamily(const ImGuiDockFamily* dock_family); // set next window user type (docking filters by same user_type)
|
||||||
IMGUI_API ImGuiID GetWindowDockId();
|
IMGUI_API ImGuiID GetWindowDockId();
|
||||||
|
@ -3768,7 +3768,7 @@ void ShowExampleAppDockSpace(bool* p_open)
|
|||||||
|
|
||||||
// When using ImGuiDockNodeFlags_PassthruDockspace, DockSpace() will render our background and handle the pass-thru hole, so we ask Begin() to not render a background.
|
// When using ImGuiDockNodeFlags_PassthruDockspace, DockSpace() will render our background and handle the pass-thru hole, so we ask Begin() to not render a background.
|
||||||
if (opt_flags & ImGuiDockNodeFlags_PassthruDockspace)
|
if (opt_flags & ImGuiDockNodeFlags_PassthruDockspace)
|
||||||
ImGui::SetNextWindowBgAlpha(0.0f);
|
window_flags |= ImGuiWindowFlags_NoBackground;
|
||||||
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||||
ImGui::Begin("DockSpace Demo", p_open, window_flags);
|
ImGui::Begin("DockSpace Demo", p_open, window_flags);
|
||||||
|
Loading…
Reference in New Issue
Block a user