pub enum ExternalDragEvent {
Entered {
data: ExternalDropData,
position: Point,
},
Moved {
position: Point,
},
Left,
Cancelled,
Dropped {
data: ExternalDropData,
position: Point,
},
DragEnded {
outcome: DropOutcome,
},
}Expand description
One phase of an external (OS) drag over a window. Positions are in the window’s logical coordinate space (top-left origin), already converted from the platform’s native coordinates.
Variants§
Entered
The drag entered the window. data is the best-effort payload the
source offers (fully populated where the platform exposes it during
hover — e.g. macOS; possibly empty until drop on backends that only
transfer bytes at drop time). Lets a drop target validate on hover.
Fields
data: ExternalDropDataOffered payload (files / text / URLs); may be empty until drop.
Moved
The pointer moved while the drag is over the window.
Left
The drag left the window without a drop, and may come back.
For an app-originated drag currently re-entered into this window this is
not the end: the OS drag is still in flight, so the framework parks
the typed payload for whichever window the drag enters next. Use
Cancelled for an ending.
Cancelled
The drag over this window has been aborted: no drop will follow, and nothing is coming back.
Distinct from Left in exactly one way, and it is the
reason both exist: a leave re-parks a re-entered app drag’s typed
payload because the OS drag continues, while an abort must not — a parked
payload belonging to a drag that has ended could be misclaimed by the
next genuine drag from another application.
Which backends produce it. No OS tells a destination that a
foreign drag was aborted rather than merely leaving: wl_data_device
sends leave, XDND sends XdndLeave, OLE calls DragLeave, and AppKit
calls draggingExited:, in both cases. What a backend does know is that
its own outbound drag has ended while it was over one of this app’s
windows, and the Wayland and X11 backends report that here.
Dropped
The user dropped. Carries the extracted payload and the drop position.
Fields
data: ExternalDropDataFiles / text / URLs / raw MIME bytes extracted from the OS payload.
DragEnded
An outbound (app → OS) drag this window started has finished. Posted
by the platform backend’s drag-source callback so the framework can
notify the source widget’s on_drag_ended.
Fields
outcome: DropOutcomeHow the OS drag resolved (copy / move into another app, or cancel).
Trait Implementations§
Source§impl Clone for ExternalDragEvent
impl Clone for ExternalDragEvent
Auto Trait Implementations§
impl Freeze for ExternalDragEvent
impl RefUnwindSafe for ExternalDragEvent
impl Send for ExternalDragEvent
impl Sync for ExternalDragEvent
impl Unpin for ExternalDragEvent
impl UnsafeUnpin for ExternalDragEvent
impl UnwindSafe for ExternalDragEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.