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.
- View
Buffer - Render to the temp buffer.
- View
State - View state.
- View
Style - All styles for a view.
- View
Widget - 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.