Trait requestty_ui::widgets::List
source · [−]pub trait List {
fn render_item<B: Backend>(
&mut self,
index: usize,
hovered: bool,
layout: Layout,
backend: &mut B
) -> Result<()>;
fn is_selectable(&self, index: usize) -> bool;
fn page_size(&self) -> usize;
fn should_loop(&self) -> bool;
fn height_at(&mut self, index: usize, layout: Layout) -> u16;
fn len(&self) -> usize;
fn is_empty(&self) -> bool { ... }
}
Expand description
A trait to represent a renderable list.
See Select
Required Methods
Render a single element at some index.
When rendering the element, only at most layout.max_height
lines can be used. If more
lines are used, the list may not be rendered properly. The place the terminal cursor ends at
does not matter.
layout.max_height
may be less than the height given by height_at
.
layout.render_region
can be used to determine which part of the element you want to
render.
sourcefn is_selectable(&self, index: usize) -> bool
fn is_selectable(&self, index: usize) -> bool
Whether the element at a particular index is selectable. Those that are not selectable are skipped during navigation.
The maximum height that can be taken by the list.
If the total height exceeds the page size, the list will be scrollable.
sourcefn should_loop(&self) -> bool
fn should_loop(&self) -> bool
Whether to wrap around when user gets to the last element.
This only applies when the list is scrollable, i.e. page size > total height.
The height of the element at an index will take to render