Skip to main content

DragModifiers

Trait DragModifiers 

Source
pub trait DragModifiers<V> {
    // Required methods
    fn on_drag<F>(self, action: F) -> Self
       where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync;
    fn on_drag_enter<F>(self, action: F) -> Self
       where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync;
    fn on_drag_leave<F>(self, action: F) -> Self
       where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync;
    fn on_drag_move<F>(self, action: F) -> Self
       where F: 'static + Fn(&mut EventContext<'_>, f32, f32) + Send + Sync;
    fn on_drop<F>(self, action: F) -> Self
       where F: 'static + Fn(&mut EventContext<'_>, DropData) + Send + Sync;
    fn on_drag_view<C: Fn(&mut Context) -> Handle<'_, T> + 'static, T: View>(
        self,
        content: C,
    ) -> Self;
}
Expand description

Modifiers which add drag-and-drop callbacks to a view.

Required Methods§

Source

fn on_drag<F>(self, action: F) -> Self
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the view begins to be dragged.

The callback should call set_drop_data to supply the data that will be delivered to the drop target.

Source

fn on_drag_enter<F>(self, action: F) -> Self
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the cursor enters this view while carrying drag data.

Source

fn on_drag_leave<F>(self, action: F) -> Self
where F: 'static + Fn(&mut EventContext<'_>) + Send + Sync,

Adds a callback which is performed when the cursor leaves this view while carrying drag data.

Source

fn on_drag_move<F>(self, action: F) -> Self
where F: 'static + Fn(&mut EventContext<'_>, f32, f32) + Send + Sync,

Adds a callback which is performed when the cursor moves over this view while carrying drag data.

Source

fn on_drop<F>(self, action: F) -> Self
where F: 'static + Fn(&mut EventContext<'_>, DropData) + Send + Sync,

Adds a callback which is performed when data is dropped on the view during a drag-and-drop operation.

Source

fn on_drag_view<C: Fn(&mut Context) -> Handle<'_, T> + 'static, T: View>( self, content: C, ) -> Self

Adds a view that is rendered under the mouse cursor while this view is being dragged.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<V: View> DragModifiers<V> for Handle<'_, V>