pub struct TextSelectionHandle(/* private fields */);Expand description
A stable, participant-neutral handle for text that participates in window selection.
Implementations§
Source§impl TextSelectionHandle
impl TextSelectionHandle
Sourcepub fn new(fallback_copy_text: impl Into<String>, cx: &mut App) -> Self
pub fn new(fallback_copy_text: impl Into<String>, cx: &mut App) -> Self
Creates a selection participant handle with fallback text for copying.
Sourcepub fn snapshot(&self, cx: &App) -> Option<TextSelectionSnapshot>
pub fn snapshot(&self, cx: &App) -> Option<TextSelectionSnapshot>
Returns the current geometry selection snapshot for this participant.
Sourcepub fn set_fallback_copy_text(&self, text: impl Into<String>, cx: &mut App)
pub fn set_fallback_copy_text(&self, text: impl Into<String>, cx: &mut App)
Sets the fallback text copied while this participant participates.
Sourcepub fn set_local_selection(&self, active: bool, cx: &mut App)
pub fn set_local_selection(&self, active: bool, cx: &mut App)
Marks participant-local selection, such as select-all, as active.
Sourcepub fn has_local_selection(&self, cx: &App) -> bool
pub fn has_local_selection(&self, cx: &App) -> bool
Returns whether participant-local selection is active.
Sourcepub fn register(
&self,
registration: TextSelectionRegistration,
window: &mut Window,
cx: &mut App,
)
pub fn register( &self, registration: TextSelectionRegistration, window: &mut Window, cx: &mut App, )
Registers this participant and its geometry for the current frame.
Sourcepub fn update_runs(
&self,
runs: &[TextSelectionRun],
cx: &mut App,
) -> TextSelectionProjection
pub fn update_runs( &self, runs: &[TextSelectionRun], cx: &mut App, ) -> TextSelectionProjection
Projects the current snapshot onto plain-text runs and caches their copy text.
Sourcepub fn subscribe(
&self,
callback: impl FnMut(&TextSelectionEvent, &mut App) + 'static,
cx: &mut App,
) -> Subscription
pub fn subscribe( &self, callback: impl FnMut(&TextSelectionEvent, &mut App) + 'static, cx: &mut App, ) -> Subscription
Subscribes to participant selection notifications.
Sourcepub fn refresh_window_on_change(
&self,
window: &Window,
cx: &mut App,
) -> Subscription
pub fn refresh_window_on_change( &self, window: &Window, cx: &mut App, ) -> Subscription
Subscribes window to refresh whenever this participant’s selection changes.
Sourcepub fn focus_with(
&self,
callback: impl Fn(&mut Window, &mut App) + 'static,
cx: &mut App,
)
pub fn focus_with( &self, callback: impl Fn(&mut Window, &mut App) + 'static, cx: &mut App, )
Sets the callback which focuses the participant when a drag begins in it.
Sourcepub fn clear_with(&self, callback: impl Fn(&mut App) + 'static, cx: &mut App)
pub fn clear_with(&self, callback: impl Fn(&mut App) + 'static, cx: &mut App)
Sets the synchronous participant cleanup command used by window clear.
Sourcepub fn copy_with(
&self,
callback: impl Fn(&mut App) -> String + 'static,
cx: &mut App,
)
pub fn copy_with( &self, callback: impl Fn(&mut App) -> String + 'static, cx: &mut App, )
Sets a participant-specific copy projection.
Sourcepub fn resolve_content_key_with(
&self,
callback: impl Fn(Point<Pixels>, &App) -> Option<TextSelectionContentKey> + 'static,
cx: &mut App,
)
pub fn resolve_content_key_with( &self, callback: impl Fn(Point<Pixels>, &App) -> Option<TextSelectionContentKey> + 'static, cx: &mut App, )
Sets a participant-specific lookup for stable virtualized content keys.
Trait Implementations§
Source§impl Clone for TextSelectionHandle
impl Clone for TextSelectionHandle
Source§fn clone(&self) -> TextSelectionHandle
fn clone(&self) -> TextSelectionHandle
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 TextSelectionHandle
impl !UnwindSafe for TextSelectionHandle
impl Freeze for TextSelectionHandle
impl Send for TextSelectionHandle
impl Sync for TextSelectionHandle
impl Unpin for TextSelectionHandle
impl UnsafeUnpin for TextSelectionHandle
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more