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<'_, TextViewState>,
) -> TextViewState
pub fn markdown( text: &str, cx: &mut Context<'_, TextViewState>, ) -> TextViewState
Create a Markdown TextViewState.
Sourcepub fn html(text: &str, cx: &mut Context<'_, TextViewState>) -> TextViewState
pub fn html(text: &str, cx: &mut Context<'_, TextViewState>) -> TextViewState
Create a HTML TextViewState.
Sourcepub fn selectable(self, selectable: bool) -> TextViewState
pub fn selectable(self, selectable: bool) -> TextViewState
Set whether the text is selectable, default false.
Sourcepub fn set_selectable(
&mut self,
selectable: bool,
cx: &mut Context<'_, TextViewState>,
)
pub fn set_selectable( &mut self, selectable: bool, cx: &mut Context<'_, TextViewState>, )
Set whether the text is selectable, default false.
Sourcepub fn selection_format(
self,
selection_format: SelectionFormat,
) -> TextViewState
pub fn selection_format( self, selection_format: SelectionFormat, ) -> TextViewState
Set the SelectionFormat, default is SelectionFormat::Plain.
Sourcepub fn set_selection_format(
&mut self,
selection_format: SelectionFormat,
cx: &mut Context<'_, TextViewState>,
)
pub fn set_selection_format( &mut self, selection_format: SelectionFormat, cx: &mut Context<'_, TextViewState>, )
Set the SelectionFormat, default is SelectionFormat::Plain.
Sourcepub fn scrollable(self, scrollable: bool) -> TextViewState
pub fn scrollable(self, scrollable: bool) -> TextViewState
Set whether the text view scrolls internally, default false.
Sourcepub fn set_scrollable(
&mut self,
scrollable: bool,
cx: &mut Context<'_, TextViewState>,
)
pub fn set_scrollable( &mut self, scrollable: bool, cx: &mut Context<'_, TextViewState>, )
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<'_, TextViewState>)
pub fn set_text(&mut self, text: &str, cx: &mut Context<'_, TextViewState>)
Set the text content.
Sourcepub fn push_str(&mut self, new_text: &str, cx: &mut Context<'_, TextViewState>)
pub fn push_str(&mut self, new_text: &str, cx: &mut Context<'_, TextViewState>)
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<'_, TextViewState>)
pub fn clear_selection(&mut self, cx: &mut Context<'_, TextViewState>)
Clear the current text selection.
Sourcepub fn select_all(&mut self, cx: &mut Context<'_, TextViewState>)
pub fn select_all(&mut self, cx: &mut Context<'_, TextViewState>)
Select all rendered text in this view.
Trait Implementations§
Source§impl Render for TextViewState
impl Render for TextViewState
Source§fn render(
&mut self,
window: &mut Window,
cx: &mut Context<'_, TextViewState>,
) -> impl IntoElement
fn render( &mut self, window: &mut Window, cx: &mut Context<'_, TextViewState>, ) -> impl IntoElement
Render this view into an element tree.
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