Skip to main content

DropListener

Struct DropListener 

Source
pub struct DropListener {
    pub binding: Handle<WidgetsBinding>,
    pub on_change: Option<DragChangeCallback>,
    pub on_dropped: Option<DroppedCallback>,
    /* private fields */
}
Expand description

Hears what is dragged from outside the application over the application’s views, through the WidgetsBinding’s observers. Dispose it when done, as an AppLifecycleListener.

Fields§

§binding: Handle<WidgetsBinding>

The WidgetsBinding listened to.

§on_change: Option<DragChangeCallback>

Called for every report, whatever its phase.

§on_dropped: Option<DroppedCallback>

Called with the dropped items.

Implementations§

Source§

impl DropListener

Source

pub fn new(app: &mut App) -> Ref<DropListener>

A listener registered with the current WidgetsBinding.

Source

pub fn on_change( self: Ref<Self>, app: &mut App, on_change: DragChangeCallback, ) -> Ref<Self>

Source

pub fn on_dropped( self: Ref<Self>, app: &mut App, on_dropped: DroppedCallback, ) -> Ref<Self>

Source

pub fn dispose(self: Handle<Self>, app: &mut App)

Stops listening.

Trait Implementations§

Source§

impl Debug for DropListener

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl WidgetsBindingObserverObject for DropListener

Source§

fn did_change_drag(self: Handle<Self>, app: &mut App, report: &DragReport)

Source§

fn did_change_metrics(self: Handle<Self>, app: &mut App)

Source§

fn did_change_locales( self: Handle<Self>, app: &mut App, locales: Option<&[Locale]>, )

Source§

fn did_change_view_focus( self: Handle<Self>, app: &mut App, event: ViewFocusEvent, )

Source§

fn did_change_text_scale_factor(self: Handle<Self>, app: &mut App)

Source§

fn did_change_platform_brightness(self: Handle<Self>, app: &mut App)

Source§

fn did_change_caption_style(self: Handle<Self>, app: &mut App)

Source§

fn did_change_app_lifecycle_state( self: Handle<Self>, app: &mut App, state: AppLifecycleState, )

Source§

fn did_request_app_exit( self: Handle<Self>, app: &mut App, ) -> Task<AppExitResponse> ⓘ

Source§

fn did_change_accessibility_features(self: Handle<Self>, app: &mut App)

Source§

fn did_pop_route(self: Handle<Self>, app: &mut App, view: ViewId) -> bool

Source§

fn handle_start_back_gesture( self: Handle<Self>, app: &mut App, back_event: PredictiveBackEvent, ) -> bool

Source§

fn handle_update_back_gesture_progress( self: Handle<Self>, app: &mut App, back_event: PredictiveBackEvent, )

Source§

fn handle_commit_back_gesture(self: Handle<Self>, app: &mut App)

Source§

fn handle_cancel_back_gesture(self: Handle<Self>, app: &mut App)

Source§

fn did_add_view(self: Handle<Self>, app: &mut App, view: &ViewRef)

Source§

fn did_remove_view(self: Handle<Self>, app: &mut App, view: ViewId)

Source§

fn did_fail_view_request( self: Handle<Self>, app: &mut App, request: RequestId, error: &ViewError, )

Source§

fn did_request_view_close( self: Handle<Self>, app: &mut App, view: ViewId, ) -> bool

Auto Trait Implementations§

§

impl !RefUnwindSafe for DropListener

§

impl !Send for DropListener

§

impl !Sync for DropListener

§

impl !UnwindSafe for DropListener

§

impl Forget for DropListener

§

impl Freeze for DropListener
where NonZero<u32>: Freeze, PhantomData<fn() -> WidgetsBinding>: Freeze, *const RcInner<dyn Fn(&mut App, &DragReport)> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &DragReport)>>: Freeze, *const RcInner<dyn Fn(&mut App, &[Rc<dyn DataTransferItem>])> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, &[Rc<dyn DataTransferItem>])>>: Freeze, *const RcInner<dyn WidgetsBindingObserver> is !null: Freeze, PhantomData<RcInner<dyn WidgetsBindingObserver>>: Freeze,

§

impl Move for DropListener

§

impl Unpin for DropListener
where NonZero<u32>: Unpin, Rc<dyn Fn(&mut App, &DragReport)>: Unpin, Rc<dyn Fn(&mut App, &[Rc<dyn DataTransferItem>])>: Unpin, Rc<dyn WidgetsBindingObserver>: Unpin,

§

impl UnsafeUnpin for DropListener
where NonZeroU32Inner: UnsafeUnpin, PhantomData<fn() -> WidgetsBinding>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &DragReport)> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &DragReport)>>: UnsafeUnpin, *const RcInner<dyn Fn(&mut App, &[Rc<dyn DataTransferItem>])> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, &[Rc<dyn DataTransferItem>])>>: UnsafeUnpin, *const RcInner<dyn WidgetsBindingObserver> is !null: UnsafeUnpin, PhantomData<RcInner<dyn WidgetsBindingObserver>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>