mirror of
https://github.com/Drezil/imgui.git
synced 2024-12-19 06:26:35 +00:00
Docking: Demo: Displaying a message if master docking flag is disabled. + DockSpace() early out + comments.
This commit is contained in:
parent
6ebc63d3ef
commit
9cfc40c2cc
@ -11475,6 +11475,8 @@ void ImGui::DockSpace(ImGuiID id, const ImVec2& size_arg, ImGuiDockNodeFlags doc
|
|||||||
ImGuiContext* ctx = GImGui;
|
ImGuiContext* ctx = GImGui;
|
||||||
ImGuiContext& g = *ctx;
|
ImGuiContext& g = *ctx;
|
||||||
ImGuiWindow* window = GetCurrentWindow();
|
ImGuiWindow* window = GetCurrentWindow();
|
||||||
|
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable))
|
||||||
|
return;
|
||||||
|
|
||||||
ImGuiDockNode* node = DockContextFindNodeByID(ctx, id);
|
ImGuiDockNode* node = DockContextFindNodeByID(ctx, id);
|
||||||
if (!node)
|
if (!node)
|
||||||
|
5
imgui.h
5
imgui.h
@ -524,11 +524,12 @@ 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.
|
// Note: you DO NOT need to call DockSpace() to use most Docking facilities!
|
||||||
|
// To dock windows: hold SHIFT anywhere while moving windows (if io.ConfigDockingWithKeyMod == true) or drag windows from their title bar (if io.ConfigDockingWithKeyMod = 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 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); // FIXME-DOCK: 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();
|
||||||
IMGUI_API bool IsWindowDocked(); // is current window docked into another window?
|
IMGUI_API bool IsWindowDocked(); // is current window docked into another window?
|
||||||
|
|
||||||
|
@ -129,6 +129,16 @@ static void ShowHelpMarker(const char* desc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void ShowDockingDisabledMessage()
|
||||||
|
{
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
ImGui::Text("ERROR: Docking is not enabled! See Demo > Configuration.");
|
||||||
|
ImGui::Text("Set io.ConfigFlags |= ImGuiConfigFlags_DockingEnable in your code, or ");
|
||||||
|
ImGui::SameLine(0.0f, 0.0f);
|
||||||
|
if (ImGui::SmallButton("click here"))
|
||||||
|
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
|
}
|
||||||
|
|
||||||
// Helper to display basic user controls.
|
// Helper to display basic user controls.
|
||||||
void ImGui::ShowUserGuide()
|
void ImGui::ShowUserGuide()
|
||||||
{
|
{
|
||||||
@ -3752,10 +3762,18 @@ void ShowExampleAppDockSpace(bool* p_open)
|
|||||||
ImGui::EndMenuBar();
|
ImGui::EndMenuBar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGuiIO& io = ImGui::GetIO();
|
||||||
|
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
||||||
|
{
|
||||||
//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));
|
||||||
ImGuiID dockspace_id = ImGui::GetID("MyDockspace");
|
ImGuiID dockspace_id = ImGui::GetID("MyDockspace");
|
||||||
ImGui::DockSpace(dockspace_id);
|
ImGui::DockSpace(dockspace_id);
|
||||||
//ImGui::PopStyleColor();
|
//ImGui::PopStyleColor();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowDockingDisabledMessage();
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
if (opt_fullscreen)
|
if (opt_fullscreen)
|
||||||
@ -3963,6 +3981,8 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
ImGui::EndTabBar();
|
ImGui::EndTabBar();
|
||||||
}
|
}
|
||||||
else if (opt_target == Target_Window)
|
else if (opt_target == Target_Window)
|
||||||
|
{
|
||||||
|
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
||||||
{
|
{
|
||||||
NotifyOfDocumentsClosedElsewhere(app);
|
NotifyOfDocumentsClosedElsewhere(app);
|
||||||
|
|
||||||
@ -3998,6 +4018,11 @@ void ShowExampleAppDocuments(bool* p_open)
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ShowDockingDisabledMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Update closing queue
|
// Update closing queue
|
||||||
static ImVector<MyDocument*> close_queue;
|
static ImVector<MyDocument*> close_queue;
|
||||||
|
Loading…
Reference in New Issue
Block a user