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& g = *ctx;
|
||||
ImGuiWindow* window = GetCurrentWindow();
|
||||
if (!(g.IO.ConfigFlags & ImGuiConfigFlags_DockingEnable))
|
||||
return;
|
||||
|
||||
ImGuiDockNode* node = DockContextFindNodeByID(ctx, id);
|
||||
if (!node)
|
||||
|
5
imgui.h
5
imgui.h
@ -524,11 +524,12 @@ namespace ImGui
|
||||
|
||||
// Docking
|
||||
// [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.
|
||||
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 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 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.
|
||||
void ImGui::ShowUserGuide()
|
||||
{
|
||||
@ -3752,10 +3762,18 @@ void ShowExampleAppDockSpace(bool* p_open)
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
ImGuiIO& io = ImGui::GetIO();
|
||||
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
||||
{
|
||||
//ImGui::PushStyleColor(ImGuiCol_DockingBg, ImVec4(0.2f, 0.2f, 0.2f, 1.0f));
|
||||
ImGuiID dockspace_id = ImGui::GetID("MyDockspace");
|
||||
ImGui::DockSpace(dockspace_id);
|
||||
//ImGui::PopStyleColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDockingDisabledMessage();
|
||||
}
|
||||
|
||||
ImGui::End();
|
||||
if (opt_fullscreen)
|
||||
@ -3963,6 +3981,8 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
else if (opt_target == Target_Window)
|
||||
{
|
||||
if (ImGui::GetIO().ConfigFlags & ImGuiConfigFlags_DockingEnable)
|
||||
{
|
||||
NotifyOfDocumentsClosedElsewhere(app);
|
||||
|
||||
@ -3998,6 +4018,11 @@ void ShowExampleAppDocuments(bool* p_open)
|
||||
ImGui::End();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ShowDockingDisabledMessage();
|
||||
}
|
||||
}
|
||||
|
||||
// Update closing queue
|
||||
static ImVector<MyDocument*> close_queue;
|
||||
|
Loading…
Reference in New Issue
Block a user