mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-21 07:16:34 +00:00
Docking: DockSpace() emits ItemSize() properly + dockspace demo (works now since 05a25e5f3
)
This commit is contained in:
parent
ad8fdc917f
commit
9d20a5f0a5
@ -14183,6 +14183,7 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
|
|||||||
char title[256];
|
char title[256];
|
||||||
ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", window->Name, id);
|
ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", window->Name, id);
|
||||||
|
|
||||||
|
// FIXME-DOCK: What is the reason for not simply calling BeginChild()?
|
||||||
if (node->Windows.Size > 0 || node->IsSplitNode())
|
if (node->Windows.Size > 0 || node->IsSplitNode())
|
||||||
PushStyleColor(ImGuiCol_ChildBg, IM_COL32(0, 0, 0, 0));
|
PushStyleColor(ImGuiCol_ChildBg, IM_COL32(0, 0, 0, 0));
|
||||||
PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f);
|
PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f);
|
||||||
@ -14213,6 +14214,7 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags fla
|
|||||||
|
|
||||||
g.WithinEndChild = true;
|
g.WithinEndChild = true;
|
||||||
End();
|
End();
|
||||||
|
ItemSize(size);
|
||||||
g.WithinEndChild = false;
|
g.WithinEndChild = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5303,8 +5303,8 @@ static void ShowExampleAppCustomRendering(bool* p_open)
|
|||||||
// DockSpace() is only useful to construct to a central location for your application.
|
// DockSpace() is only useful to construct to a central location for your application.
|
||||||
void ShowExampleAppDockSpace(bool* p_open)
|
void ShowExampleAppDockSpace(bool* p_open)
|
||||||
{
|
{
|
||||||
static bool opt_fullscreen_persistant = true;
|
static bool opt_fullscreen = true;
|
||||||
bool opt_fullscreen = opt_fullscreen_persistant;
|
static bool opt_padding = false;
|
||||||
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;
|
static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;
|
||||||
|
|
||||||
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
|
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
|
||||||
@ -5321,6 +5321,10 @@ void ShowExampleAppDockSpace(bool* p_open)
|
|||||||
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
|
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
|
||||||
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
|
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dockspace_flags &= ~ImGuiDockNodeFlags_PassthruCentralNode;
|
||||||
|
}
|
||||||
|
|
||||||
// When using ImGuiDockNodeFlags_PassthruCentralNode, DockSpace() will render our background
|
// When using ImGuiDockNodeFlags_PassthruCentralNode, DockSpace() will render our background
|
||||||
// and handle the pass-thru hole, so we ask Begin() to not render a background.
|
// and handle the pass-thru hole, so we ask Begin() to not render a background.
|
||||||
@ -5332,8 +5336,10 @@ void ShowExampleAppDockSpace(bool* p_open)
|
|||||||
// all active windows docked into it will lose their parent and become undocked.
|
// all active windows docked into it will lose their parent and become undocked.
|
||||||
// We cannot preserve the docking relationship between an active window and an inactive docking, otherwise
|
// We cannot preserve the docking relationship between an active window and an inactive docking, otherwise
|
||||||
// any change of dockspace/settings would lead to windows being stuck in limbo and never being visible.
|
// any change of dockspace/settings would lead to windows being stuck in limbo and never being visible.
|
||||||
|
if (!opt_padding)
|
||||||
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);
|
||||||
|
if (!opt_padding)
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
|
|
||||||
if (opt_fullscreen)
|
if (opt_fullscreen)
|
||||||
@ -5353,19 +5359,22 @@ void ShowExampleAppDockSpace(bool* p_open)
|
|||||||
|
|
||||||
if (ImGui::BeginMenuBar())
|
if (ImGui::BeginMenuBar())
|
||||||
{
|
{
|
||||||
if (ImGui::BeginMenu("Docking"))
|
if (ImGui::BeginMenu("Options"))
|
||||||
{
|
{
|
||||||
// Disabling fullscreen would allow the window to be moved to the front of other windows,
|
// Disabling fullscreen would allow the window to be moved to the front of other windows,
|
||||||
// which we can't undo at the moment without finer window depth/z control.
|
// which we can't undo at the moment without finer window depth/z control.
|
||||||
//ImGui::MenuItem("Fullscreen", NULL, &opt_fullscreen_persistant);
|
ImGui::MenuItem("Fullscreen", NULL, &opt_fullscreen);
|
||||||
|
ImGui::MenuItem("Padding", NULL, &opt_padding);
|
||||||
if (ImGui::MenuItem("Flag: NoSplit", "", (dockspace_flags & ImGuiDockNodeFlags_NoSplit) != 0)) dockspace_flags ^= ImGuiDockNodeFlags_NoSplit;
|
|
||||||
if (ImGui::MenuItem("Flag: NoResize", "", (dockspace_flags & ImGuiDockNodeFlags_NoResize) != 0)) dockspace_flags ^= ImGuiDockNodeFlags_NoResize;
|
|
||||||
if (ImGui::MenuItem("Flag: NoDockingInCentralNode", "", (dockspace_flags & ImGuiDockNodeFlags_NoDockingInCentralNode) != 0)) dockspace_flags ^= ImGuiDockNodeFlags_NoDockingInCentralNode;
|
|
||||||
if (ImGui::MenuItem("Flag: PassthruCentralNode", "", (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode) != 0)) dockspace_flags ^= ImGuiDockNodeFlags_PassthruCentralNode;
|
|
||||||
if (ImGui::MenuItem("Flag: AutoHideTabBar", "", (dockspace_flags & ImGuiDockNodeFlags_AutoHideTabBar) != 0)) dockspace_flags ^= ImGuiDockNodeFlags_AutoHideTabBar;
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
if (ImGui::MenuItem("Close DockSpace", NULL, false, p_open != NULL))
|
|
||||||
|
if (ImGui::MenuItem("Flag: NoSplit", "", (dockspace_flags & ImGuiDockNodeFlags_NoSplit) != 0)) { dockspace_flags ^= ImGuiDockNodeFlags_NoSplit; }
|
||||||
|
if (ImGui::MenuItem("Flag: NoResize", "", (dockspace_flags & ImGuiDockNodeFlags_NoResize) != 0)) { dockspace_flags ^= ImGuiDockNodeFlags_NoResize; }
|
||||||
|
if (ImGui::MenuItem("Flag: NoDockingInCentralNode", "", (dockspace_flags & ImGuiDockNodeFlags_NoDockingInCentralNode) != 0)) { dockspace_flags ^= ImGuiDockNodeFlags_NoDockingInCentralNode; }
|
||||||
|
if (ImGui::MenuItem("Flag: AutoHideTabBar", "", (dockspace_flags & ImGuiDockNodeFlags_AutoHideTabBar) != 0)) { dockspace_flags ^= ImGuiDockNodeFlags_AutoHideTabBar; }
|
||||||
|
if (ImGui::MenuItem("Flag: PassthruCentralNode", "", (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode) != 0, opt_fullscreen)) { dockspace_flags ^= ImGuiDockNodeFlags_PassthruCentralNode; }
|
||||||
|
ImGui::Separator();
|
||||||
|
|
||||||
|
if (ImGui::MenuItem("Close", NULL, false, p_open != NULL))
|
||||||
*p_open = false;
|
*p_open = false;
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user