Struct cursive::views::TextView
[−]
[src]
pub struct TextView { /* fields omitted */ }
A simple view showing a fixed text
Methods
impl TextView
[src]
fn new<S: Into<String>>(content: S) -> Self
Creates a new TextView with the given content.
fn set_scrollable(&mut self, scrollable: bool)
Enable or disable the view's scrolling capabilities.
When disabled, the view will never attempt to scroll (and will always ask for the full height).
fn scrollable(self, scrollable: bool) -> Self
Enable or disable the view's scrolling capabilities.
When disabled, the view will never attempt to scroll (and will always ask for the full height).
Chainable variant.
fn h_align(self, h: HAlign) -> Self
Sets the horizontal alignment for this view.
fn v_align(self, v: VAlign) -> Self
Sets the vertical alignment for this view.
fn align(self, a: Align) -> Self
Sets the alignment for this view.
fn center(self) -> Self
Center the text horizontally and vertically inside the view.
fn set_content<S: Into<String>>(&mut self, content: S)
Replace the text in this view.
fn append_content(&mut self, content: &str)
Append content to the end of a TextView.
fn get_content(&self) -> &str
Returns the current text in this view.
fn set_scroll_strategy(&mut self, strategy: ScrollStrategy)
Defines the way scrolling is adjusted on content or size change.
The scroll strategy defines how the scrolling position is adjusted when the size of the view or the content change.
It is reset to ScrollStrategy::KeepRow
whenever the user scrolls
manually.
fn scroll_strategy(self, strategy: ScrollStrategy) -> Self
Defines the way scrolling is adjusted on content or size change.
Chainable variant.
Trait Implementations
impl View for TextView
[src]
fn draw(&self, printer: &Printer)
Draws the view with the given printer (includes bounds) and focus.
fn on_event(&mut self, event: Event) -> EventResult
Called when a key was pressed. Read more
fn needs_relayout(&self) -> bool
Returns true
if the view content changed since last layout phase. Read more
fn required_size(&mut self, size: Vec2) -> Vec2
Returns the minimum size the view requires with the given restrictions. Read more
fn take_focus(&mut self, _: Direction) -> bool
This view is offered focus. Will it take it? Read more
fn layout(&mut self, size: Vec2)
Called once the size for this view has been decided, Read more
fn find_any(&mut self, &Selector) -> Option<&mut Any>
Finds the view pointed to by the given path. Read more