Expand description
A MadView is like a textview but it owns everything, from the source markdown to the area and the skin, which often makes it more convenient for dynamic texts. It’s also resizeable.
Fields
skin: MadSkin
scroll: usize
Implementations
sourceimpl MadView
impl MadView
sourcepub const fn from(markdown: String, area: Area, skin: MadSkin) -> MadView
pub const fn from(markdown: String, area: Area, skin: MadSkin) -> MadView
make a displayed text, that is a text in an area
sourcepub fn write(&self) -> Result<(), Error>
pub fn write(&self) -> Result<(), Error>
render the markdown in the area, taking the scroll into account
pub fn write_on<W: Write>(&self, w: &mut W) -> Result<(), Error>
sourcepub fn resize(&mut self, area: &Area)
pub fn resize(&mut self, area: &Area)
sets the new area. If it’s the same as the precedent one, this operation does nothing. The scroll is kept if possible.
sourcepub fn try_scroll_lines(&mut self, lines_count: i32)
pub fn try_scroll_lines(&mut self, lines_count: i32)
set the scroll amount. lines_count can be negative
sourcepub fn try_scroll_pages(&mut self, pages_count: i32)
pub fn try_scroll_pages(&mut self, pages_count: i32)
set the scroll amount. lines_count can be negative
sourcepub fn apply_key_event(&mut self, key: KeyEvent) -> bool
pub fn apply_key_event(&mut self, key: KeyEvent) -> bool
Apply an event being a key: page_up, page_down, up and down.
Return true when the event led to a change, false when it was discarded.
It’s possible to handle the key yourself and call the try_scroll methods.
Auto Trait Implementations
impl RefUnwindSafe for MadView
impl Send for MadView
impl Sync for MadView
impl Unpin for MadView
impl UnwindSafe for MadView
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more