.. index:: pair: class; EE::Window::DragAndDrop .. _doxid-class_e_e_1_1_window_1_1_drag_and_drop: class EE::Window::DragAndDrop ============================= .. toctree:: :hidden: Overview ~~~~~~~~ Native cross-application file dragging. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class DragAndDrop { public: // methods static DragAndDrop :target:`forWindow`(:ref:`Window`& window); static bool :ref:`encodeFileUriList`(const :ref:`DragOffer`& offer, std::string& output, std::string* error = nullptr); :ref:`DragCapabilities` :target:`getCapabilities`() const; :ref:`DragStartResult` :ref:`startDrag`(const :ref:`DragOffer`& offer, :ref:`DragCompletionCallback` completion = {}); void :target:`cancelDrag`(); bool :target:`isDragging`() const; }; .. _details-class_e_e_1_1_window_1_1_drag_and_drop: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ Native cross-application file dragging. All methods must run on the window/UI thread. This lightweight facade borrows its :ref:`Window ` and must not outlive it. A started session owns its serialized payload and completion callback. Rejected starts never invoke completion. Completions run once, outside native event hooks, when input is updated; they may start another drag. Cancellation/closing a source window also completes the session. Callbacks must not borrow objects that may be destroyed before completion (use weak ownership when appropriate). :ref:`Engine ` teardown cancels and releases pending sessions without invoking their callbacks. Initially only Copy is supported. Dropped means the native transfer finished, not that a browser uploaded or a file manager copied a file. Existing internal :ref:`UI ` dragging is independent. Methods ------- .. index:: pair: function; encodeFileUriList .. _doxid-class_e_e_1_1_window_1_1_drag_and_drop_1a4837260c7874093f66402105ff93d58b: .. ref-code-block:: cpp :class: doxyrest-title-code-block static bool encodeFileUriList(const :ref:`DragOffer`& offer, std::string& output, std::string* error = nullptr) Serialize an offer as text/uri-list (CRLF). Rejects empty, relative, invalid UTF-8 and NUL paths. Preserves order and duplicate entries. On failure output is empty. .. index:: pair: function; startDrag .. _doxid-class_e_e_1_1_window_1_1_drag_and_drop_1a4726f8947be89013401216888a5ee727: .. ref-code-block:: cpp :class: doxyrest-title-code-block :ref:`DragStartResult` startDrag(const :ref:`DragOffer`& offer, :ref:`DragCompletionCallback` completion = {}) Call after a movement threshold, while the initiating left mouse button is still down. Preview images must be RGB/RGBA, at most 2048 pixels per side and 1,048,576 pixels total. The offer is read synchronously; the session retains only its own native representation.