pub struct ExternalDndHandle { /* private fields */ }Expand description
Per-app external-drag service. Registered in app-state by
TeksiloAppBuilder::install_external_dnd; teksilo-app calls
Self::attach / Self::detach from its window lifecycle hooks.
Cloneable; clones share the same backend and guard map.
Implementations§
Source§impl ExternalDndHandle
impl ExternalDndHandle
Sourcepub fn new<B: ExternalDndBackend + 'static>(backend: B) -> Self
pub fn new<B: ExternalDndBackend + 'static>(backend: B) -> Self
Build a handle wrapping the given backend.
Sourcepub fn attach(
&self,
window_id: TeksiloWindowId,
parent: ParentHandle,
poster: Arc<dyn AppEventPoster>,
)
pub fn attach( &self, window_id: TeksiloWindowId, parent: ParentHandle, poster: Arc<dyn AppEventPoster>, )
Register the window as an OS drop target. Idempotent per window: a
second attach for the same window_id replaces (and so revokes) the
previous registration.
Sourcepub fn detach(&self, window_id: TeksiloWindowId)
pub fn detach(&self, window_id: TeksiloWindowId)
Revoke the window’s OS drop-target registration (dropping its guard).
Called from teksilo-app’s window-close path. No-op if the window was
never attached.
Sourcepub fn attached_count(&self) -> usize
pub fn attached_count(&self) -> usize
Number of currently-attached windows. Test/diagnostic helper.
Sourcepub fn set_scale_factor(&self, window_id: TeksiloWindowId, scale: f64)
pub fn set_scale_factor(&self, window_id: TeksiloWindowId, scale: f64)
Tell window_id’s backend the window’s current HiDPI scale factor.
See ExternalDndGuard::set_scale_factor. No-op if not attached.
Sourcepub fn cancel_drag(&self, window_id: TeksiloWindowId)
pub fn cancel_drag(&self, window_id: TeksiloWindowId)
Cancel an in-flight outbound OS drag for window_id (the user pressed
Escape). See ExternalDndGuard::cancel_drag. No-op if not attached.
Sourcepub fn begin_drag(
&self,
window_id: TeksiloWindowId,
data: &OutboundDragData,
image: Option<&DragImageData>,
pointer: PointerKind,
) -> OsDragStart
pub fn begin_drag( &self, window_id: TeksiloWindowId, data: &OutboundDragData, image: Option<&DragImageData>, pointer: PointerKind, ) -> OsDragStart
Start a native OS (outbound) drag for window_id, delegating to that
window’s guard. OsDragStart::Declined if the window isn’t attached
or the backend declines (no outbound support). Called from
teksilo-app’s WindowOps::begin_os_drag. See
ExternalDndGuard::begin_drag.
Sourcepub fn set_drop_accepted(&self, window_id: TeksiloWindowId, accepted: bool)
pub fn set_drop_accepted(&self, window_id: TeksiloWindowId, accepted: bool)
Push the widget tree’s accept verdict for an inbound OS drag over
window_id to its backend. See ExternalDndGuard::set_drop_accepted.
No-op if the window isn’t attached.
Sourcepub fn run_pending_outbound_drag(
&self,
window_id: TeksiloWindowId,
on_start: &mut dyn FnMut(OsDragId),
)
pub fn run_pending_outbound_drag( &self, window_id: TeksiloWindowId, on_start: &mut dyn FnMut(OsDragId), )
Run the deferred blocking outbound OS drag for window_id (Windows OLE
DoDragDrop), if its guard stashed one via begin_drag. Called from
teksilo-app when it receives an OutboundOsDragRequest; on_start
runs right before the blocking loop (see
ExternalDndGuard::run_pending_outbound_drag). No-op if the window
isn’t attached.
The (blocking) drag loop runs on a shared handle to the guard, used
without holding the guards map’s borrow, so on_start, which runs app
handlers, may open or close a window (attach or detach a guard) without
a borrow conflict.
Trait Implementations§
Source§impl Clone for ExternalDndHandle
impl Clone for ExternalDndHandle
Auto Trait Implementations§
impl !RefUnwindSafe for ExternalDndHandle
impl !Send for ExternalDndHandle
impl !Sync for ExternalDndHandle
impl !UnwindSafe for ExternalDndHandle
impl Freeze for ExternalDndHandle
impl Unpin for ExternalDndHandle
impl UnsafeUnpin for ExternalDndHandle
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.