Skip to main content

TableRows

Trait TableRows 

Source
pub trait TableRows<K: Key> {
    // Required methods
    fn len(&self) -> usize;
    fn key(&self, row: usize) -> K;
    fn label(&self, row: usize) -> String;
    fn cell(&mut self, ui: &mut Ui, row: usize, column: usize, selected: bool);

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn row_top(&self, row: usize, row_h: f32) -> f32 { ... }
}
Expand description

The rows a table shows; the application owns them, sorted as the table’s sort says.

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.

Source

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

Draws a cell (its row’s background is drawn). Its Ui truncates text: a label too long for the cell is elided with “…” and shows the full text on hover.

Provided Methods§

Source

fn is_empty(&self) -> bool

Source

fn row_top(&self, row: usize, row_h: f32) -> f32

Where row row starts, from the top of the first row, rows being row_h high unless the application says otherwise: rows of several heights (a row expanded to several lines) give their offsets here, 0.0 for row 0, and TableRows::len gives the height of them all. Called for the rows in view and a binary search over the rows, so keep it cheap.

Implementors§