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 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 selected_text(&self) -> String
pub fn selected_text(&self) -> String
Return the selected text, in the view’s SelectionFormat.
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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