Переглянути джерело

Drag and Drop: Added ImGuiDragDropFlags_PayloadNoCrossContext and ImGuiDragDropFlags_PayloadNoCrossProcess flags.

ocornut 1 рік тому
батько
коміт
77d9f80754
3 змінених файлів з 10 додано та 0 видалено
  1. 3 0
      docs/CHANGELOG.txt
  2. 5 0
      imgui.cpp
  3. 2 0
      imgui.h

+ 3 - 0
docs/CHANGELOG.txt

@@ -66,6 +66,9 @@ Other changes:
   active id so a multi-frame extern source doesn't interfere with hovered widgets. (#143)
 - Drag and Drop: BeginDragDropSource() with ImGuiDragDropFlags_SourceExtern does not assume
   a mouse button being pressed. Facilitate implementing cross-context drag and drop. (#143)
+- Drag and Drop: Added ImGuiDragDropFlags_PayloadNoCrossContext/_PayloadNoCrossProcess flags
+  as metadata to specify that a payload may not be copied outside the context/process by
+  some logic aiming to copy payloads around.
 - Drag and Drop: Fixes an issue when elapsing payload would be based on last payload
   frame instead of last drag source frame, which makes a difference if not resubmitting
   payload every frame. (#143)

+ 5 - 0
imgui.cpp

@@ -14569,6 +14569,11 @@ void ImGui::ShowMetricsWindow(bool* p_open)
 
     // Basic info
     Text("Dear ImGui %s", GetVersion());
+    if (g.ContextName[0] != NULL)
+    {
+        SameLine();
+        Text("(Context Name: \"%s\")", g.ContextName);
+    }
     Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / io.Framerate, io.Framerate);
     Text("%d vertices, %d indices (%d triangles)", io.MetricsRenderVertices, io.MetricsRenderIndices, io.MetricsRenderIndices / 3);
     Text("%d visible windows, %d current allocations", io.MetricsRenderWindows, g.DebugAllocInfo.TotalAllocCount - g.DebugAllocInfo.TotalFreeCount);

+ 2 - 0
imgui.h

@@ -1297,6 +1297,8 @@ enum ImGuiDragDropFlags_
     ImGuiDragDropFlags_SourceAllowNullID            = 1 << 3,   // Allow items such as Text(), Image() that have no unique identifier to be used as drag source, by manufacturing a temporary identifier based on their window-relative position. This is extremely unusual within the dear imgui ecosystem and so we made it explicit.
     ImGuiDragDropFlags_SourceExtern                 = 1 << 4,   // External source (from outside of dear imgui), won't attempt to read current item/window info. Will always return true. Only one Extern source can be active simultaneously.
     ImGuiDragDropFlags_PayloadAutoExpire            = 1 << 5,   // Automatically expire the payload if the source cease to be submitted (otherwise payloads are persisting while being dragged)
+    ImGuiDragDropFlags_PayloadNoCrossContext        = 1 << 6,   // Hint to specify that the payload may not be copied outside current dear imgui context.
+    ImGuiDragDropFlags_PayloadNoCrossProcess        = 1 << 7,   // Hint to specify that the payload may not be copied outside current process.
     // AcceptDragDropPayload() flags
     ImGuiDragDropFlags_AcceptBeforeDelivery         = 1 << 10,  // AcceptDragDropPayload() will returns true even before the mouse button is released. You can then call IsDelivery() to test if the payload needs to be delivered.
     ImGuiDragDropFlags_AcceptNoDrawDefaultRect      = 1 << 11,  // Do not draw the default highlight rectangle when hovering over target.