[−][src]Struct termimad::ListView
A filterable list whose columns can be automatically resized.
Notes:
- another version will allow more than one style per cell (i.e. make the cells composites rather than compounds). Shout out if you need that now.
- this version doesn't allow cell wrapping
Fields
area: Area
skin: &'t MadSkin
Methods
impl<'t, T> ListView<'t, T>
[src]
pub fn new(
area: Area,
columns: Vec<ListViewColumn<'t, T>>,
skin: &'t MadSkin
) -> Self
[src]
area: Area,
columns: Vec<ListViewColumn<'t, T>>,
skin: &'t MadSkin
) -> Self
Create a new list view with the passed columns.
The columns can't be changed afterwards but the area can be modified. When two columns have the same title, those titles are merged (but the columns below stay separated).
pub fn sort(&mut self, sort: Box<dyn Fn(&T, &T) -> Ordering>)
[src]
set a comparator for row sorting
pub fn tbody_height(&self) -> i32
[src]
return the height which is available for rows
pub fn scrollbar(&self) -> Option<(u16, u16)>
[src]
return an option which when filled contains a tupple with the top and bottom of the vertical scrollbar. Return none when the content fits the available space.
pub fn add_row(&mut self, data: T)
[src]
pub fn clear_rows(&mut self)
[src]
remove all rows (and selection).
Keep the columns and the sort function, if any.
pub fn row_counts(&self) -> (usize, usize)
[src]
return both the number of displayed rows and the total number
pub fn update_dimensions(&mut self)
[src]
recompute the widths of all columns. This should be called when the area size is modified
pub fn set_filter(&mut self, filter: Box<dyn Fn(&T) -> bool>)
[src]
pub fn remove_filter(&mut self)
[src]
pub fn write_on<W>(&self, w: &mut W) -> Result<()> where
W: Write,
[src]
W: Write,
write the list view on the given writer
pub fn write(&self) -> Result<()>
[src]
display the whole list in its area
pub fn do_scroll_show_bottom(&self) -> bool
[src]
return true if the last line of the list is visible
pub fn scroll_to_bottom(&mut self)
[src]
ensure the last line is visible
pub fn try_scroll_lines(&mut self, lines_count: i32)
[src]
set the scroll amount. lines_count can be negative
pub fn try_scroll_pages(&mut self, pages_count: i32)
[src]
set the scroll amount. pages_count can be negative
pub fn try_select_next(&mut self, up: bool)
[src]
try to select the next visible line
pub fn select_first_line(&mut self)
[src]
select the first visible line (unless there's nothing).
pub fn select_last_line(&mut self)
[src]
select the last visible line (unless there's nothing).
pub fn make_selection_visible(&mut self)
[src]
scroll to ensure the selected line (if any) is visible.
This is automatically called by try_scroll and try select functions
pub fn get_selection(&self) -> Option<&T>
[src]
pub fn has_selection(&self) -> bool
[src]
pub fn unselect(&mut self)
[src]
Auto Trait Implementations
impl<'t, T> !RefUnwindSafe for ListView<'t, T>
impl<'t, T> !Send for ListView<'t, T>
impl<'t, T> !Sync for ListView<'t, T>
impl<'t, T> Unpin for ListView<'t, T> where
T: Unpin,
T: Unpin,
impl<'t, T> !UnwindSafe for ListView<'t, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,