Module view

Module view 

Source
Expand description

A view allows scrolling of on or more widgets without builtin support for scrolling.

use rat_widget::paragraph::{Paragraph, ParagraphState};

///
/// Create the view and set the layout area
/// for the buffer.
///

let mut view_buf = View::new()
    .layout(Rect::new(0, 0, 400, 400))
    .vscroll(Scroll::new())
    .hscroll(Scroll::new())
    .into_buffer(l2[1], &mut state.view);

///
/// Render the widgets to the view buffer.
///
view_buf.render(
    Paragraph::new("Paragraph\nParagraph\n..."),
    Rect::new(0, 0, 40, 15),
    &mut state.first,
);

///
/// Render the finished buffer.
///
view_buf.finish(&mut buf, &mut state.view);

Structs§

View
Configure the view.
ViewBuffer
Render to the temp buffer.
ViewState
View state.
ViewStyle
All styles for a view.
ViewWidget
Clips and copies the temp buffer to the frame buffer.

Functions§

handle_events
Handle all events. Text events are only processed if focus is true. Mouse events are processed if they are in range.
handle_mouse_events
Handle only mouse-events.