pub struct List<I: Item, D: ItemDelegate<I>> {Show 16 fields
pub title: String,
pub show_title: bool,
pub show_filter: bool,
pub show_status_bar: bool,
pub show_pagination: bool,
pub show_help: bool,
pub filtering_enabled: bool,
pub infinite_scrolling: bool,
pub item_name_singular: String,
pub item_name_plural: String,
pub key_map: KeyMap,
pub styles: Styles,
pub status_message_lifetime: Duration,
pub mouse_wheel_enabled: bool,
pub mouse_wheel_delta: usize,
pub mouse_click_enabled: bool,
/* private fields */
}Expand description
List model with filtering, pagination, and more.
Fields§
§title: StringTitle of the list.
show_title: boolWhether to show the title.
show_filter: boolWhether to show the filter input.
show_status_bar: boolWhether to show the status bar.
show_pagination: boolWhether to show pagination.
show_help: boolWhether to show help.
filtering_enabled: boolWhether filtering is enabled.
infinite_scrolling: boolWhether infinite scrolling is enabled.
item_name_singular: StringSingular name for items.
item_name_plural: StringPlural name for items.
key_map: KeyMapKey bindings.
styles: StylesStyles.
status_message_lifetime: DurationStatus message lifetime.
mouse_wheel_enabled: boolWhether mouse wheel scrolling is enabled.
mouse_wheel_delta: usizeNumber of items to scroll per mouse wheel tick.
mouse_click_enabled: boolWhether mouse click selection is enabled.
Implementations§
Source§impl<I: Item, D: ItemDelegate<I>> List<I, D>
impl<I: Item, D: ItemDelegate<I>> List<I, D>
Sourcepub fn new(items: Vec<I>, delegate: D, width: usize, height: usize) -> Self
pub fn new(items: Vec<I>, delegate: D, width: usize, height: usize) -> Self
Creates a new list with the given items and delegate.
Sourcepub fn mouse_wheel(self, enabled: bool) -> Self
pub fn mouse_wheel(self, enabled: bool) -> Self
Enables or disables mouse wheel scrolling (builder pattern).
Sourcepub fn mouse_wheel_delta(self, delta: usize) -> Self
pub fn mouse_wheel_delta(self, delta: usize) -> Self
Sets the number of items to scroll per mouse wheel tick (builder pattern).
Sourcepub fn mouse_click(self, enabled: bool) -> Self
pub fn mouse_click(self, enabled: bool) -> Self
Enables or disables mouse click item selection (builder pattern).
Sourcepub fn visible_items(&self) -> Vec<&I>
pub fn visible_items(&self) -> Vec<&I>
Returns visible items based on current filter.
Sourcepub fn selected_item(&self) -> Option<&I>
pub fn selected_item(&self) -> Option<&I>
Returns the currently selected item.
Sourcepub fn cursor_down(&mut self)
pub fn cursor_down(&mut self)
Moves the cursor down.
Sourcepub fn filter_state(&self) -> FilterState
pub fn filter_state(&self) -> FilterState
Returns the filter state.
Sourcepub fn filter_value(&self) -> String
pub fn filter_value(&self) -> String
Returns the current filter value.
Sourcepub fn set_filter_value(&mut self, value: &str)
pub fn set_filter_value(&mut self, value: &str)
Sets the filter value.
Sourcepub fn reset_filter(&mut self)
pub fn reset_filter(&mut self)
Resets the filter.
Sourcepub fn start_spinner(&mut self) -> Option<Message>
pub fn start_spinner(&mut self) -> Option<Message>
Starts the spinner. Returns a message that should be passed to update to start the animation.
Sourcepub fn stop_spinner(&mut self)
pub fn stop_spinner(&mut self)
Stops the spinner.
Sourcepub fn spinner_visible(&self) -> bool
pub fn spinner_visible(&self) -> bool
Returns whether the spinner is visible.
Sourcepub fn new_status_message(&mut self, msg: impl Into<String>) -> Option<Cmd>
pub fn new_status_message(&mut self, msg: impl Into<String>) -> Option<Cmd>
Sets a new status message.
Sourcepub fn status_message(&self) -> Option<&str>
pub fn status_message(&self) -> Option<&str>
Returns the current status message.
Sourcepub fn set_height(&mut self, h: usize)
pub fn set_height(&mut self, h: usize)
Sets the height.