[][src]Struct cursive_markup::MarkupView

pub struct MarkupView<R: Renderer + 'static> { /* fields omitted */ }

A view for hypertext that has been rendered by a Renderer.

This view displays hypertext (a combination of formatted text and links) that typically has been parsed from a markup language. You can use the arrow keys to navigate between the links, and the Enter key to select a link. If the focused link is changed, the on_link_focus callback is triggered. If the focused link is selected using the Enter key, the on_link_select callback is triggered.

The displayed hypertext is created by a Renderer implementation. The MarkupView calls the render method with the size constraint provided by cursive and receives a RenderedDocument that contains the text and the links. This document is cached until the available width changes.

You can also limit the available width by setting a maximum line width with the set_maximum_width method.

Implementations

impl MarkupView<RichRenderer>[src]

pub fn html(html: &str) -> MarkupView<RichRenderer>[src]

Creates a new MarkupView that uses a rich text HTML renderer.

Requires the html feature (enabled per default).

impl<R: Renderer + 'static> MarkupView<R>[src]

pub fn with_renderer(renderer: R) -> MarkupView<R>[src]

Creates a new MarkupView with the given renderer.

Sets the callback that is triggered if the link focus is changed.

Note that this callback is only triggered if the link focus is changed with the arrow keys. It is not triggered if the view takes focus. The callback will receive the target of the link as an argument.

Sets the callback that is triggered if a link is selected.

This callback is triggered if a link is focused and the users presses the Enter key. The callback will receive the target of the link as an argument.

pub fn set_maximum_width(&mut self, width: usize)[src]

Sets the maximum width of the view.

This means that the width that is available for the renderer is limited to the given value.

Trait Implementations

impl<R: Renderer + 'static> View for MarkupView<R>[src]

Auto Trait Implementations

impl<R> !RefUnwindSafe for MarkupView<R>

impl<R> !Send for MarkupView<R>

impl<R> !Sync for MarkupView<R>

impl<R> Unpin for MarkupView<R> where
    R: Unpin

impl<R> !UnwindSafe for MarkupView<R>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> AnyView for T where
    T: View, 

fn as_any(&self) -> &(dyn Any + 'static)

Downcast self to a Any.

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Downcast self to a mutable Any.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Erased for T

impl<T> Finder for T where
    T: View, 

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> IntoBoxedView for T where
    T: View, 

impl<T> Nameable for T where
    T: View, 

impl<T> Resizable for T where
    T: View, 

impl<T> Scrollable for T where
    T: View, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> View for T where
    T: ViewWrapper, 

impl<T> With for T