mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Docking: Changed DockSpace() signature to take an ID, as ID will frequently be used by other API it makes more sense to let the user compute it.
This commit is contained in:
parent
175bab4f5f
commit
0f1c21a6c9
@ -9717,7 +9717,7 @@ void ImGui::DockContextOnLoadSettings()
|
|||||||
DockContextBuildNodesFromSettings(ctx, ctx->SettingsNodes.Data, ctx->SettingsNodes.Size);
|
DockContextBuildNodesFromSettings(ctx, ctx->SettingsNodes.Data, ctx->SettingsNodes.Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function also acts as a defacto test to make sure we can rebuild from scratch without a glitch
|
// This function also acts as a de-facto test to make sure we can rebuild from scratch without a glitch
|
||||||
void ImGui::DockContextRebuild(ImGuiDockContext* ctx)
|
void ImGui::DockContextRebuild(ImGuiDockContext* ctx)
|
||||||
{
|
{
|
||||||
//IMGUI_DEBUG_LOG("[docking] full rebuild\n");
|
//IMGUI_DEBUG_LOG("[docking] full rebuild\n");
|
||||||
@ -11297,13 +11297,12 @@ void ImGui::SetWindowDock(ImGuiWindow* window, ImGuiID dock_id, ImGuiCond cond)
|
|||||||
window->DockId = dock_id;
|
window->DockId = dock_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ImGui::DockSpace(const char* str_id, const ImVec2& size_arg, ImGuiDockSpaceFlags dock_space_flags, ImGuiID user_type_filter)
|
void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockSpaceFlags dock_space_flags, ImGuiID user_type_filter)
|
||||||
{
|
{
|
||||||
ImGuiContext& g = *GImGui;
|
ImGuiContext& g = *GImGui;
|
||||||
ImGuiDockContext* ctx = g.DockContext;
|
ImGuiDockContext* ctx = g.DockContext;
|
||||||
|
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
ImGuiID id = window->GetID(str_id);
|
|
||||||
|
|
||||||
// It is possible that the node has already been claimed by a docked window which appeared before the DockSpace(), so we overwrite IsExplicit again.
|
// It is possible that the node has already been claimed by a docked window which appeared before the DockSpace(), so we overwrite IsExplicit again.
|
||||||
ImGuiDockNode* node = DockContextFindNodeByID(ctx, id);
|
ImGuiDockNode* node = DockContextFindNodeByID(ctx, id);
|
||||||
@ -11344,7 +11343,7 @@ void ImGui::DockSpace(const char* str_id, const ImVec2& size_arg, ImGuiDockSpace
|
|||||||
window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar;
|
window_flags |= ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar;
|
||||||
|
|
||||||
char title[256];
|
char title[256];
|
||||||
ImFormatString(title, IM_ARRAYSIZE(title), "%s/%s", window->Name, str_id);
|
ImFormatString(title, IM_ARRAYSIZE(title), "%s/DockSpace_%08X", window->Name, id);
|
||||||
|
|
||||||
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));
|
||||||
|
2
imgui.h
2
imgui.h
@ -520,7 +520,7 @@ namespace ImGui
|
|||||||
// Docking
|
// Docking
|
||||||
// [BETA API] Enable with io.ConfigFlags |= ImGuiConfigFlags_DockingEnable.
|
// [BETA API] Enable with io.ConfigFlags |= ImGuiConfigFlags_DockingEnable.
|
||||||
// Note: you DO NOT need to call DockSpace() to use most Docking facilities! You can hold SHIFT anywhere while moving windows. Use DockSpace() if you need to create an explicit docking space _within_ an existing window. See Docking demo for details)
|
// Note: you DO NOT need to call DockSpace() to use most Docking facilities! You can hold SHIFT anywhere while moving windows. Use DockSpace() if you need to create an explicit docking space _within_ an existing window. See Docking demo for details)
|
||||||
IMGUI_API void DockSpace(const char* str_id, const ImVec2& size = ImVec2(0, 0), ImGuiDockSpaceFlags flags = 0, ImGuiID user_type_filter = 0);
|
IMGUI_API void DockSpace(ImGuiID id, const ImVec2& size = ImVec2(0, 0), ImGuiDockSpaceFlags flags = 0, ImGuiID user_type_filter = 0);
|
||||||
IMGUI_API void SetNextWindowUserType(ImGuiID user_type); // FIXME-DOCK: set next window user type (docking filters by same user_type)
|
IMGUI_API void SetNextWindowUserType(ImGuiID user_type); // FIXME-DOCK: set next window user type (docking filters by same user_type)
|
||||||
|
|
||||||
// Logging/Capture: all text output from interface is captured to tty/file/clipboard. By default, tree nodes are automatically opened during logging.
|
// Logging/Capture: all text output from interface is captured to tty/file/clipboard. By default, tree nodes are automatically opened during logging.
|
||||||
|
@ -3746,7 +3746,8 @@ void ShowExampleAppDockSpace(bool* p_open)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//ImGui::PushStyleColor(ImGuiCol_DockingBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
//ImGui::PushStyleColor(ImGuiCol_DockingBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||||
ImGui::DockSpace("##MyCentralDockSpace");
|
ImGuiID dockspace_id = ImGui::GetID("MyDockspace");
|
||||||
|
ImGui::DockSpace(dockspace_id);
|
||||||
//ImGui::PopStyleColor();
|
//ImGui::PopStyleColor();
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
@ -3959,8 +3960,8 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
NotifyOfDocumentsClosedElsewhere(app);
|
NotifyOfDocumentsClosedElsewhere(app);
|
||||||
|
|
||||||
// Create a DockSpace where any window can be docked
|
// Create a DockSpace where any window can be docked
|
||||||
ImGui::DockSpace("##DockSpace");
|
ImGuiID dockspace_id = ImGui::GetID("MyDockSpace");
|
||||||
ImGuiID dockspace_id = ImGui::GetID("##DockSpace");
|
ImGui::DockSpace(dockspace_id);
|
||||||
|
|
||||||
// Create Windows
|
// Create Windows
|
||||||
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
for (int doc_n = 0; doc_n < app.Documents.Size; doc_n++)
|
||||||
|
Loading…
Reference in New Issue
Block a user