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
[src]
Creates a new TextView with the given content.
fn empty() -> Self
[src]
Creates a new empty TextView
.
fn set_scrollable(&mut self, scrollable: bool)
[src]
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
[src]
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
[src]
Sets the horizontal alignment for this view.
fn v_align(self, v: VAlign) -> Self
[src]
Sets the vertical alignment for this view.
fn align(self, a: Align) -> Self
[src]
Sets the alignment for this view.
fn center(self) -> Self
[src]
Center the text horizontally and vertically inside the view.
fn content<S: Into<String>>(self, content: S) -> Self
[src]
Replace the text in this view.
Chainable variant.
fn set_content<S: Into<String>>(&mut self, content: S)
[src]
Replace the text in this view.
fn append_content(&mut self, content: &str)
[src]
Append content to the end of a TextView.
fn get_content(&self) -> &str
[src]
Returns the current text in this view.
fn set_scroll_strategy(&mut self, strategy: ScrollStrategy)
[src]
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
[src]
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)
[src]
Draws the view with the given printer (includes bounds) and focus.
fn on_event(&mut self, event: Event) -> EventResult
[src]
Called when a key was pressed. Read more
fn needs_relayout(&self) -> bool
[src]
Returns true
if the view content changed since last layout phase. Read more
fn required_size(&mut self, size: Vec2) -> Vec2
[src]
Returns the minimum size the view requires with the given restrictions. Read more
fn take_focus(&mut self, _: Direction) -> bool
[src]
This view is offered focus. Will it take it? Read more
fn layout(&mut self, size: Vec2)
[src]
Called once the size for this view has been decided, Read more
fn call_on_any<'a>(&mut self, _: &Selector, _: Box<FnMut(&mut Any) + 'a>)
[src]
Runs a closure on the view identified by the given selector. Read more
fn focus_view(&mut self, &Selector) -> Result<(), ()>
[src]
Moves the focus to the view identified by the given selector. Read more