Skip to main content

DragModifiers

Trait DragModifiers 

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, T>(self, content: C) -> Self
       where C: Fn(&mut Context) -> Handle<'_, T> + 'static,
             T: View;
}
Expand description

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

Required Methods§

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.

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.

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.

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.

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.

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

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§

§

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