Procházet zdrojové kódy

Docking: Renamed SetNextWindowDock() to SetNextWindowDockId(). Added GetWindowDockId().

omar před 7 roky
rodič
revize
d3e8e5731a
3 změnil soubory, kde provedl 11 přidání a 4 odebrání
  1. 8 2
      imgui.cpp
  2. 2 1
      imgui.h
  3. 1 1
      imgui_demo.cpp

+ 8 - 2
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;

+ 2 - 1
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.

+ 1 - 1
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);