pub struct TextViewState { /* private fields */ }Expand description
The state of a TextView.
Implementations§
Source§impl TextViewState
impl TextViewState
Sourcepub fn markdown(text: &str, cx: &mut Context<'_, Self>) -> Self
pub fn markdown(text: &str, cx: &mut Context<'_, Self>) -> Self
Create a Markdown TextViewState.
Sourcepub fn selectable(self, selectable: bool) -> Self
pub fn selectable(self, selectable: bool) -> Self
Set whether the text is selectable, default false.
Sourcepub fn set_selectable(&mut self, selectable: bool, cx: &mut Context<'_, Self>)
pub fn set_selectable(&mut self, selectable: bool, cx: &mut Context<'_, Self>)
Set whether the text is selectable, default false.
Sourcepub fn selection_format(self, selection_format: SelectionFormat) -> Self
pub fn selection_format(self, selection_format: SelectionFormat) -> Self
Set the SelectionFormat, default is SelectionFormat::Plain.
Sourcepub fn set_selection_format(
&mut self,
selection_format: SelectionFormat,
cx: &mut Context<'_, Self>,
)
pub fn set_selection_format( &mut self, selection_format: SelectionFormat, cx: &mut Context<'_, Self>, )
Set the SelectionFormat, default is SelectionFormat::Plain.
Sourcepub fn scrollable(self, scrollable: bool) -> Self
pub fn scrollable(self, scrollable: bool) -> Self
Set whether the text view scrolls internally, default false.
Sourcepub fn set_scrollable(&mut self, scrollable: bool, cx: &mut Context<'_, Self>)
pub fn set_scrollable(&mut self, scrollable: bool, cx: &mut Context<'_, Self>)
Set whether the text view scrolls internally, default false.
Sourcepub fn is_clamped(&self) -> bool
pub fn is_clamped(&self) -> bool
Whether the last painted frame clipped content because of
TextView::max_lines.
Sourcepub fn set_text(&mut self, text: &str, cx: &mut Context<'_, Self>)
pub fn set_text(&mut self, text: &str, cx: &mut Context<'_, Self>)
Set the text content.
With a streamed fade-in enabled, text that extends the current text
fades in like Self::push_str would; any other replacement shows at
once.
Sourcepub fn push_str(&mut self, new_text: &str, cx: &mut Context<'_, Self>)
pub fn push_str(&mut self, new_text: &str, cx: &mut Context<'_, Self>)
Append partial text content to the existing text.
Sourcepub fn motion(self, motion: TextViewMotion) -> Self
pub fn motion(self, motion: TextViewMotion) -> Self
Set the motion policy; see TextViewMotion.
Sourcepub fn set_motion(&mut self, motion: TextViewMotion)
pub fn set_motion(&mut self, motion: TextViewMotion)
Set the motion policy; see TextViewMotion.
Sourcepub fn selected_text(&self) -> String
pub fn selected_text(&self) -> String
Return the selected text, in the view’s SelectionFormat.
Sourcepub fn invalidate_inline_layout(&mut self, cx: &mut Context<'_, Self>)
pub fn invalidate_inline_layout(&mut self, cx: &mut Context<'_, Self>)
Remeasure inline resources after their prepared content or metrics change.
Call from the resource owner’s completion handler, through a weak entity when the task can outlive this view. This does not reparse the document. Existing logical selection is retained until the next selection gesture.
Sourcepub fn clear_selection(&mut self, cx: &mut Context<'_, Self>)
pub fn clear_selection(&mut self, cx: &mut Context<'_, Self>)
Clear the current text selection.
Sourcepub fn select_all(&mut self, cx: &mut Context<'_, Self>)
pub fn select_all(&mut self, cx: &mut Context<'_, Self>)
Select all rendered text in this view.
Trait Implementations§
Source§impl Render for TextViewState
impl Render for TextViewState
Auto Trait Implementations§
impl !RefUnwindSafe for TextViewState
impl !Send for TextViewState
impl !Sync for TextViewState
impl !UnwindSafe for TextViewState
impl Freeze for TextViewState
impl Unpin for TextViewState
impl UnsafeUnpin for TextViewState
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> 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