Skip to main content

DragHost

Trait DragHost 

Source
pub trait DragHost {
    // Required methods
    fn drag(&self, pointer_id: PointerId) -> Option<&DragSession>;
    fn drag_mut(&mut self, pointer_id: PointerId) -> Option<&mut DragSession>;
    fn cancel_drag(&mut self, pointer_id: PointerId);
    fn any_drag_session(
        &self,
        predicate: impl FnMut(&DragSession) -> bool,
    ) -> bool;
    fn find_drag_pointer_id(
        &self,
        predicate: impl FnMut(&DragSession) -> bool,
    ) -> Option<PointerId>;
    fn cancel_drag_sessions(
        &mut self,
        predicate: impl FnMut(&DragSession) -> bool,
    ) -> Vec<PointerId>;
    fn begin_drag_with_kind<T: Any>(
        &mut self,
        pointer_id: PointerId,
        kind: DragKindId,
        source_window: AppWindowId,
        start: Point,
        payload: T,
    );
    fn begin_cross_window_drag_with_kind<T: Any>(
        &mut self,
        pointer_id: PointerId,
        kind: DragKindId,
        source_window: AppWindowId,
        start: Point,
        payload: T,
    );
}

Required Methods§

Source

fn drag(&self, pointer_id: PointerId) -> Option<&DragSession>

Returns the drag session associated with the pointer, if any.

Source

fn drag_mut(&mut self, pointer_id: PointerId) -> Option<&mut DragSession>

Returns a mutable drag session associated with the pointer, if any.

Source

fn cancel_drag(&mut self, pointer_id: PointerId)

Cancels a drag session associated with the pointer, if any.

Source

fn any_drag_session(&self, predicate: impl FnMut(&DragSession) -> bool) -> bool

Returns true if any active drag session matches the predicate.

Source

fn find_drag_pointer_id( &self, predicate: impl FnMut(&DragSession) -> bool, ) -> Option<PointerId>

Finds the first pointer id whose drag session matches the predicate.

Source

fn cancel_drag_sessions( &mut self, predicate: impl FnMut(&DragSession) -> bool, ) -> Vec<PointerId>

Cancels all drag sessions matching the predicate and returns their pointer ids.

Source

fn begin_drag_with_kind<T: Any>( &mut self, pointer_id: PointerId, kind: DragKindId, source_window: AppWindowId, start: Point, payload: T, )

Begins a drag session with a typed payload.

Source

fn begin_cross_window_drag_with_kind<T: Any>( &mut self, pointer_id: PointerId, kind: DragKindId, source_window: AppWindowId, start: Point, payload: T, )

Begins a cross-window drag session with a typed payload.

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§