From 4ba2e8574433b049ce643eb13fc2fbfb3d222d33 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 28 Dec 2017 23:50:37 +0100 Subject: [PATCH] Demo: Tweak. Comments. Metrics: Added some Drag and Drop info. --- imgui.cpp | 9 +++++---- imgui_demo.cpp | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/imgui.cpp b/imgui.cpp index 10ef65be..2e16fb3f 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -2914,7 +2914,7 @@ void ImGui::EndFrame() IM_ASSERT(g.CurrentWindowStack.Size == 1); // Mismatched Begin()/End() calls if (g.CurrentWindow && !g.CurrentWindow->WriteAccessed) g.CurrentWindow->Active = false; - ImGui::End(); + End(); if (g.ActiveId == 0 && g.HoveredId == 0) { @@ -3715,7 +3715,7 @@ void ImGui::BeginTooltip() void ImGui::EndTooltip() { IM_ASSERT(GetCurrentWindowRead()->Flags & ImGuiWindowFlags_Tooltip); // Mismatched BeginTooltip()/EndTooltip() calls - ImGui::End(); + End(); } // Mark popup as open (toggle toward open state). @@ -4011,7 +4011,7 @@ void ImGui::EndChild() IM_ASSERT(window->Flags & ImGuiWindowFlags_ChildWindow); // Mismatched BeginChild()/EndChild() callss if (window->BeginCount > 1) { - ImGui::End(); + End(); } else { @@ -4021,7 +4021,7 @@ void ImGui::EndChild() sz.x = ImMax(4.0f, sz.x); if (window->AutoFitChildAxises & (1 << ImGuiAxis_Y)) sz.y = ImMax(4.0f, sz.y); - ImGui::End(); + End(); ImGuiWindow* parent_window = GetCurrentWindow(); ImRect bb(parent_window->DC.CursorPos, parent_window->DC.CursorPos + sz); @@ -11730,6 +11730,7 @@ void ImGui::ShowMetricsWindow(bool* p_open) ImGui::Text("ActiveId: 0x%08X/0x%08X (%.2f sec)", g.ActiveId, g.ActiveIdPreviousFrame, g.ActiveIdTimer); ImGui::Text("ActiveIdWindow: '%s'", g.ActiveIdWindow ? g.ActiveIdWindow->Name : "NULL"); ImGui::Text("NavWindow: '%s'", g.NavWindow ? g.NavWindow->Name : "NULL"); + ImGui::Text("DragDrop: %d, SourceId = 0x%08X, Payload \"%s\" (%d bytes)", g.DragDropActive, g.DragDropPayload.SourceId, g.DragDropPayload.DataType, g.DragDropPayload.DataSize); ImGui::TreePop(); } } diff --git a/imgui_demo.cpp b/imgui_demo.cpp index 94531a10..1ccc2990 100644 --- a/imgui_demo.cpp +++ b/imgui_demo.cpp @@ -2365,6 +2365,7 @@ static void ShowExampleAppFixedOverlay(bool* p_open) if (ImGui::MenuItem("Top-right", NULL, corner == 1)) corner = 1; if (ImGui::MenuItem("Bottom-left", NULL, corner == 2)) corner = 2; if (ImGui::MenuItem("Bottom-right", NULL, corner == 3)) corner = 3; + if (p_open && ImGui::MenuItem("Close")) *p_open = false; ImGui::EndPopup(); } ImGui::End();