pub struct Column<T> { /* private fields */ }Expand description
A column: an id (stable, used for sorting and saved state), a title, and how to get the cell value from a row.
Implementations§
Source§impl<T> Column<T>
impl<T> Column<T>
Sourcepub fn text(
id: &str,
title: &str,
value: impl Fn(&T) -> String + 'static,
) -> Self
pub fn text( id: &str, title: &str, value: impl Fn(&T) -> String + 'static, ) -> Self
A text column.
Sourcepub fn number(
id: &str,
title: &str,
value: impl Fn(&T) -> f64 + 'static,
) -> Self
pub fn number( id: &str, title: &str, value: impl Fn(&T) -> f64 + 'static, ) -> Self
A right-aligned number column, sorted numerically.
Sourcepub fn check(
id: &str,
title: &str,
value: impl Fn(&T) -> bool + 'static,
) -> Self
pub fn check( id: &str, title: &str, value: impl Fn(&T) -> bool + 'static, ) -> Self
A checkbox column. Clicking a checkbox emits TableEvent::Toggle;
the model doesn’t change the row itself.
Sourcepub fn progress(
id: &str,
title: &str,
value: impl Fn(&T) -> f64 + 'static,
) -> Self
pub fn progress( id: &str, title: &str, value: impl Fn(&T) -> f64 + 'static, ) -> Self
A progress bar from 0 to 1 (values outside are clamped). Sorted and copied as the number; VoiceOver reads it as a percentage.
Sourcepub fn icon(self, image: impl Fn(&T) -> Option<CellImage> + 'static) -> Self
pub fn icon(self, image: impl Fn(&T) -> Option<CellImage> + 'static) -> Self
Shows an image before each cell’s text (a text or number column),
e.g. a file’s icon before its name. None leaves the space empty.
Sourcepub fn fit(self) -> Self
pub fn fit(self) -> Self
Sizes the column to its widest content (and its title) whenever the rows change. With many rows, the longest values are measured.
Sourcepub fn decimals(self, decimals: usize) -> Self
pub fn decimals(self, decimals: usize) -> Self
Decimal places shown for a number column (default 0).
Sourcepub fn editable(self, editable: bool) -> Self
pub fn editable(self, editable: bool) -> Self
Lets the user edit this column’s text or number cells (double-click,
or Return on the selected row’s cell). Finishing an edit emits
TableEvent::Edit; the model doesn’t change the row: apply it with
TableModel::update_row. No effect on checkbox columns.