pub struct DragAndDrop { /* private fields */ }
Expand description
Tracking of drag-and-drop payload.
This is a low-level API.
For a higher-level API, see:
crate::Ui::dnd_drag_source
crate::Ui::dnd_drop_zone
crate::Response::dnd_set_drag_payload
crate::Response::dnd_hover_payload
crate::Response::dnd_release_payload
See this example.
Implementations§
Source§impl DragAndDrop
impl DragAndDrop
Sourcepub fn set_payload<Payload>(ctx: &Context, payload: Payload)
pub fn set_payload<Payload>(ctx: &Context, payload: Payload)
Set a drag-and-drop payload.
This can be read by Self::payload
until the pointer is released.
Sourcepub fn clear_payload(ctx: &Context)
pub fn clear_payload(ctx: &Context)
Clears the payload, setting it to None
.
Sourcepub fn payload<Payload>(ctx: &Context) -> Option<Arc<Payload>>
pub fn payload<Payload>(ctx: &Context) -> Option<Arc<Payload>>
Retrieve the payload, if any.
Returns None
if there is no payload, or if it is not of the requested type.
Returns Some
both during a drag and on the frame the pointer is released
(if there is a payload).
Sourcepub fn take_payload<Payload>(ctx: &Context) -> Option<Arc<Payload>>
pub fn take_payload<Payload>(ctx: &Context) -> Option<Arc<Payload>>
Retrieve and clear the payload, if any.
Returns None
if there is no payload, or if it is not of the requested type.
Returns Some
both during a drag and on the frame the pointer is released
(if there is a payload).
Sourcepub fn has_payload_of_type<Payload>(ctx: &Context) -> bool
pub fn has_payload_of_type<Payload>(ctx: &Context) -> bool
Are we carrying a payload of the given type?
Returns true
both during a drag and on the frame the pointer is released
(if there is a payload).
Sourcepub fn has_any_payload(ctx: &Context) -> bool
pub fn has_any_payload(ctx: &Context) -> bool
Are we carrying a payload?
Returns true
both during a drag and on the frame the pointer is released
(if there is a payload).
Trait Implementations§
Source§impl Clone for DragAndDrop
impl Clone for DragAndDrop
Source§fn clone(&self) -> DragAndDrop
fn clone(&self) -> DragAndDrop
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more