From 06bea369c0ce977c1cb71e085d860a6644330297 Mon Sep 17 00:00:00 2001 From: omar Date: Thu, 28 Dec 2017 16:54:16 +0100 Subject: [PATCH] DragDrop: Added IsDragDropActive() helper which is useful for binding to decide how to handle mouse inputs. --- imgui.cpp | 6 ++++++ imgui.h | 1 + 2 files changed, 7 insertions(+) diff --git a/imgui.cpp b/imgui.cpp index 50059632e..45ed8ad8d 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -11478,6 +11478,12 @@ void ImGui::EndDragDropTarget() IM_ASSERT(g.DragDropActive); } +bool ImGui::IsDragDropActive() +{ + ImGuiContext& g = *GImGui; + return g.DragDropActive; +} + //----------------------------------------------------------------------------- // PLATFORM DEPENDENT HELPERS //----------------------------------------------------------------------------- diff --git a/imgui.h b/imgui.h index 711e0271f..4972443a2 100644 --- a/imgui.h +++ b/imgui.h @@ -433,6 +433,7 @@ namespace ImGui IMGUI_API bool BeginDragDropTarget(); // call after submitting an item that may receive an item. If this returns true, you can call AcceptDragDropPayload() + EndDragDropTarget() IMGUI_API const ImGuiPayload* AcceptDragDropPayload(const char* type, ImGuiDragDropFlags flags = 0); // accept contents of a given type. If ImGuiDragDropFlags_AcceptBeforeDelivery is set you can peek into the payload before the mouse button is released. IMGUI_API void EndDragDropTarget(); + IMGUI_API bool IsDragDropActive(); // Clipping IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect);