pub struct DragDropContext {
pub id: UiId,
pub dragging: bool,
pub payload: Option<DragPayload>,
pub dropped: Option<(DragPayload, UiId)>,
/* private fields */
}Expand description
Manages drag-and-drop interactions.
Fields§
§id: UiId§dragging: bool§payload: Option<DragPayload>§dropped: Option<(DragPayload, UiId)>Implementations§
Source§impl DragDropContext
impl DragDropContext
pub fn new(id: UiId) -> Self
Sourcepub fn begin_drag(
&mut self,
source_id: UiId,
data: impl Into<String>,
label: impl Into<String>,
)
pub fn begin_drag( &mut self, source_id: UiId, data: impl Into<String>, label: impl Into<String>, )
Begin a drag from source_id with data.
Sourcepub fn is_drop_target(
&mut self,
ctx: &UiContext,
rect: Rect,
accept: impl Fn(&DragPayload) -> bool,
) -> bool
pub fn is_drop_target( &mut self, ctx: &UiContext, rect: Rect, accept: impl Fn(&DragPayload) -> bool, ) -> bool
Check if this drop target accepts the current drag; returns true if dropped.
pub fn update(&mut self, ctx: &UiContext)
Sourcepub fn draw_ghost(&self, ctx: &mut UiContext, style: &UiStyle)
pub fn draw_ghost(&self, ctx: &mut UiContext, style: &UiStyle)
Draw the drag ghost near the cursor.
Auto Trait Implementations§
impl Freeze for DragDropContext
impl RefUnwindSafe for DragDropContext
impl Send for DragDropContext
impl Sync for DragDropContext
impl Unpin for DragDropContext
impl UnsafeUnpin for DragDropContext
impl UnwindSafe for DragDropContext
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
Mutably borrows from an owned value. Read more
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.