Skip to main content

ListRows

Trait ListRows 

Source
pub trait ListRows<K: Key> {
    // Required methods
    fn len(&self) -> usize;
    fn key(&self, row: usize) -> K;
    fn label(&self, row: usize) -> String;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn item(&self, row: usize) -> SelectionItem { ... }
    fn icon(&self, row: usize) -> Option<Source> { ... }
    fn trailing(&self, row: usize) -> Option<String> { ... }
    fn ui(&mut self, ui: &mut Ui, row: usize, selected: bool) { ... }
}
Expand description

The rows a list shows; the application owns them.

Required Methods§

Source

fn len(&self) -> usize

Source

fn key(&self, row: usize) -> K

Row row’s key.

Source

fn label(&self, row: usize) -> String

Row row’s accessible name, searched by type-ahead.

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn item(&self, row: usize) -> SelectionItem

Row row’s item in the application-wide selection (ListView::shared): by default its key’s (SelectionItem::from_key). Give the id other widgets showing the same thing use.

Source

fn icon(&self, row: usize) -> Option<Source>

Row row’s icon, drawn before what ListRows::ui draws, in the row’s text colour (default: none).

Source

fn trailing(&self, row: usize) -> Option<String>

Row row’s weak text on its right (a count, a type; default: none), in the row’s muted tone; what ListRows::ui draws stops before it.

Source

fn ui(&mut self, ui: &mut Ui, row: usize, selected: bool)

Draws row row (its background is drawn, with its icon and its trailing text, a list item’s; the row is named by its label). By default, its label on one line, elided with “…” when it does not fit, the row then showing the full label on hover.

Implementors§