From 91ba4a52701db0a43ffc7769d2fda510ca2ebfa3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 22 May 2022 16:02:04 -0400 Subject: [WIP] Add support for drag and drop --- bindings/cpp/include/pugl/pugl.hpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'bindings/cpp/include') diff --git a/bindings/cpp/include/pugl/pugl.hpp b/bindings/cpp/include/pugl/pugl.hpp index d691123..a3c26e0 100644 --- a/bindings/cpp/include/pugl/pugl.hpp +++ b/bindings/cpp/include/pugl/pugl.hpp @@ -641,8 +641,14 @@ public: puglSetCursor(cobj(), static_cast(cursor))); } + /// @copydoc puglRegisterDragType + Status registerDragType(const char* const type) + { + return static_cast(puglRegisterDragType(cobj(), type)); + } + /// @copydoc puglGetNumClipboardTypes - uint32_t numClipboardTypes(const Clipboard clipboard) const + size_t numClipboardTypes(const Clipboard clipboard) const { return puglGetNumClipboardTypes(cobj(), clipboard); } @@ -692,6 +698,26 @@ public: return static_cast(puglSetViewStyle(cobj(), flags)); } + /** + Reject data offered from a clipboard. + + This can be called instead of puglAcceptOffer() to explicitly reject the + offer. Note that drag-and-drop will still work if this isn't called, but + applications should always explicitly accept or reject each data offer for + optimal behaviour. + + @param offer The data offer event. + + @param region The region of the view that will refuse this drop. This may + be used by the system to avoid sending redundant events when the item is + dragged within the region. This is only an optimization, an all-zero + region can safely be passed. + */ + Status rejectOffer(const DataOfferEvent& offer, const Rect& region) + { + return static_cast(puglRejectOffer(cobj(), &offer, region)); + } + /** Activate a repeating timer event. -- cgit v1.2.1