From d3e8e5731ac04131bd9f22e33b2b7cb27c354103 Mon Sep 17 00:00:00 2001 From: omar Date: Tue, 25 Sep 2018 17:45:06 +0200 Subject: [PATCH] Docking: Renamed SetNextWindowDock() to SetNextWindowDockId(). Added GetWindowDockId(). --- imgui.cpp | 10 ++++++++-- imgui.h | 3 ++- imgui_demo.cpp | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index a73b38c3..c4f94012 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -6103,10 +6103,16 @@ bool ImGui::IsWindowFocused(ImGuiFocusedFlags flags) } } +ImGuiID ImGui::GetWindowDockId() +{ + ImGuiContext& g = *GImGui; + return g.CurrentWindow->DockId; +} + bool ImGui::IsWindowDocked() { ImGuiContext& g = *GImGui; - return (g.CurrentWindow->DockIsActive); + return g.CurrentWindow->DockIsActive; } // Can we focus this window with CTRL+TAB (or PadMenu + PadFocusPrev/PadFocusNext) @@ -6349,7 +6355,7 @@ void ImGui::SetNextWindowViewport(ImGuiID id) g.NextWindowData.ViewportId = id; } -void ImGui::SetNextWindowDock(ImGuiID id, ImGuiCond cond) +void ImGui::SetNextWindowDockId(ImGuiID id, ImGuiCond cond) { ImGuiContext& g = *GImGui; g.NextWindowData.DockCond = cond ? cond : ImGuiCond_Always; diff --git a/imgui.h b/imgui.h index c91e29d8..98c56bee 100644 --- a/imgui.h +++ b/imgui.h @@ -521,8 +521,9 @@ namespace ImGui // Note: you DO NOT need to call DockSpace() to use most Docking facilities! You can hold SHIFT anywhere while moving windows. // 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 SetNextWindowDock(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); // FIXME-DOCK: set next window user type (docking filters by same user_type) + IMGUI_API ImGuiID GetWindowDockId(); IMGUI_API bool IsWindowDocked(); // is current window docked into another window? // Logging/Capture: all text output from interface is captured to tty/file/clipboard. By default, tree nodes are automatically opened during logging. diff --git a/imgui_demo.cpp b/imgui_demo.cpp index b1997012..4140cec1 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -3973,7 +3973,7 @@ void ShowExampleAppDocuments(bool* p_open) // FIXME-DOCK: SetNextWindowDock() //ImGuiID default_dock_id = GetDockspaceRootDocumentDockID(); //ImGuiID default_dock_id = GetDockspacePreferedDocumentDockID(); - ImGui::SetNextWindowDock(dockspace_id, redock_all ? ImGuiCond_Always : ImGuiCond_FirstUseEver); + ImGui::SetNextWindowDockId(dockspace_id, redock_all ? ImGuiCond_Always : ImGuiCond_FirstUseEver); ImGuiWindowFlags window_flags = (doc->Dirty ? ImGuiWindowFlags_UnsavedDocument : 0); bool visible = ImGui::Begin(doc->Name, &doc->Open, window_flags);