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>,
) -> bool
pub fn begin_drag( &self, window_id: TeksiloWindowId, data: &OutboundDragData, image: Option<&DragImageData>, ) -> bool
Start a native OS (outbound) drag for window_id, delegating to that
window’s guard. Returns true if a native session started, false if
the window isn’t attached or the backend declines (no outbound
support). Called from teksilo-app’s WindowOps::begin_os_drag.
Sourcepub fn run_pending_outbound_drag(&self, window_id: TeksiloWindowId)
pub fn run_pending_outbound_drag(&self, window_id: TeksiloWindowId)
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. No-op if the
window isn’t attached.
The guards borrow is deliberately held across the (blocking) drag loop:
the only re-entrant guards mutation is attach / detach (window create /
close), which cannot happen while the user is mid-drag on this window.
Trait Implementations§
Source§impl Clone for ExternalDndHandle
impl Clone for ExternalDndHandle
Source§fn clone(&self) -> ExternalDndHandle
fn clone(&self) -> ExternalDndHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto 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.