aboutsummaryrefslogtreecommitdiffstats
path: root/bindings
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2022-05-22 16:02:04 -0400
committerDavid Robillard <d@drobilla.net>2023-11-11 10:20:03 -0500
commit91ba4a52701db0a43ffc7769d2fda510ca2ebfa3 (patch)
treebe2dca91d457f28e0c9c324736f24d85a5ed57c2 /bindings
parent91051e9059b67b8d633e385afb48a36d4f9467ba (diff)
downloadpugl-dragdrop.tar.gz
pugl-dragdrop.tar.bz2
pugl-dragdrop.zip
[WIP] Add support for drag and dropdragdrop
Diffstat (limited to 'bindings')
-rw-r--r--bindings/cpp/include/pugl/pugl.hpp28
1 files changed, 27 insertions, 1 deletions
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<PuglCursor>(cursor)));
}
+ /// @copydoc puglRegisterDragType
+ Status registerDragType(const char* const type)
+ {
+ return static_cast<Status>(puglRegisterDragType(cobj(), type));
+ }
+
/// @copydoc puglGetNumClipboardTypes
- uint32_t numClipboardTypes(const Clipboard clipboard) const
+ size_t numClipboardTypes(const Clipboard clipboard) const
{
return puglGetNumClipboardTypes(cobj(), clipboard);
}
@@ -693,6 +699,26 @@ public:
}
/**
+ 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<Status>(puglRejectOffer(cobj(), &offer, region));
+ }
+
+ /**
Activate a repeating timer event.
This starts a timer which will send a timer event to `view` every