diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/pugl/pugl.h | 40 |
1 files changed, 38 insertions, 2 deletions
diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h index e57f6aa..89415f6 100644 --- a/include/pugl/pugl.h +++ b/include/pugl/pugl.h @@ -152,10 +152,12 @@ typedef enum { A system clipboard. A clipboard provides a mechanism for transferring data between views, - including views in different processes. + including views in different processes. Clipboards are used for both "copy + and paste" and "drag and drop" interactions. */ typedef enum { PUGL_CLIPBOARD_GENERAL, ///< General clipboard for copy/pasted data + PUGL_CLIPBOARD_DRAG, ///< Drag clipboard for drag and drop data } PuglClipboard; /** @@ -977,10 +979,11 @@ typedef enum { PUGL_REFRESH_RATE, ///< Refresh rate in Hz PUGL_VIEW_TYPE, ///< View type (a #PuglViewType) PUGL_DARK_FRAME, ///< True if window frame should be dark + PUGL_ACCEPT_DROP, ///< True if view accepts dropped data } PuglViewHint; /// The number of #PuglViewHint values -#define PUGL_NUM_VIEW_HINTS ((unsigned)PUGL_DARK_FRAME + 1U) +#define PUGL_NUM_VIEW_HINTS ((unsigned)PUGL_ACCEPT_DROP + 1U) /// A special view hint value typedef enum { @@ -1195,6 +1198,16 @@ double puglGetScaleFactor(const PuglView* view); /** + Register a type as supported for drag and drop. + + Before realizing the view, this function should be called for every type the + view may accept as a drop target. +*/ +PUGL_API +PuglStatus +puglRegisterDragType(PuglView* view, const char* type); + +/** @} @defgroup pugl_frame Frame Functions for working with the position and size of a view. @@ -1569,6 +1582,29 @@ puglAcceptOffer(PuglView* view, PuglRect region); /** + 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 view The view. + + @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. +*/ +PUGL_API +PuglStatus +puglRejectOffer(PuglView* view, + const PuglDataOfferEvent* offer, + PuglRect region); + +/** Set the clipboard contents. This sets the system clipboard contents, which can be retrieved with |