pub struct Table {
pub style: Style,
pub cell_bg_color: Color,
pub selected_color: Color,
pub text_color: Color,
pub grid_color: Color,
/* private fields */
}Expand description
LVGL-parity table widget.
Stores cells as a flat row-major Vec; column widths as a Vec<i32>.
Row heights are computed dynamically from the cell content using the
LPAR-08 shared wrap_greedy_ltr measurement.
Fields§
§style: StyleBackground and outer border style.
cell_bg_color: ColorColor for cell background and grid lines.
selected_color: ColorColor for the selected cell background.
text_color: ColorText color.
grid_color: ColorGrid line color.
Implementations§
Source§impl Table
impl Table
Sourcepub fn set_font(&mut self, font: &'static dyn FontMetrics)
pub fn set_font(&mut self, font: &'static dyn FontMetrics)
Assign the font used to render this widget (FONT-00 §5); resolves to
FONT_6X10 when unset.
Sourcepub fn column_count(&self) -> usize
pub fn column_count(&self) -> usize
Return the number of columns.
Sourcepub fn set_row_count(&mut self, rows: usize)
pub fn set_row_count(&mut self, rows: usize)
Set the number of rows, extending or truncating the cell vector.
Sourcepub fn set_column_count(&mut self, cols: usize)
pub fn set_column_count(&mut self, cols: usize)
Set the number of columns, extending or truncating; preserves existing cell content where indices overlap.
Sourcepub fn set_cell_value(&mut self, row: usize, col: usize, text: &str)
pub fn set_cell_value(&mut self, row: usize, col: usize, text: &str)
Set the text value of a cell.
Out-of-bounds indices are silently ignored (matching LVGL behavior).
Sourcepub fn cell_value(&self, row: usize, col: usize) -> Option<&str>
pub fn cell_value(&self, row: usize, col: usize) -> Option<&str>
Return the text value of a cell, or None if empty or out of bounds.
Sourcepub fn set_cell_ctrl(&mut self, row: usize, col: usize, ctrl: CellCtrl)
pub fn set_cell_ctrl(&mut self, row: usize, col: usize, ctrl: CellCtrl)
Set control flags for a cell.
Sourcepub fn set_cell_align(&mut self, row: usize, col: usize, align: CellAlign)
pub fn set_cell_align(&mut self, row: usize, col: usize, align: CellAlign)
Set horizontal alignment for a cell.
Sourcepub fn set_column_width(&mut self, col: usize, width: i32)
pub fn set_column_width(&mut self, col: usize, width: i32)
Set the pixel width of column col.
A width of 0 means “auto” — the column participates in the remaining
width distribution.
Sourcepub fn column_width(&self, col: usize) -> i32
pub fn column_width(&self, col: usize) -> i32
Return the stored column width (0 = auto).
Sourcepub fn set_selected_cell(&mut self, row: usize, col: usize)
pub fn set_selected_cell(&mut self, row: usize, col: usize)
Set the selected cell. Out-of-bounds is silently ignored.
Sourcepub fn selected_cell(&self) -> Option<(usize, usize)>
pub fn selected_cell(&self) -> Option<(usize, usize)>
Return the selected cell (row, col), or None if nothing is selected.
Move selection to the next cell (right then down; wraps at the last cell to the first).
Wire to ObjectEvent::Key(Key::ArrowRight) or Key::Tab in a node handler.
Move selection to the previous cell (left then up; wraps at the first cell to the last).
Wire to ObjectEvent::Key(Key::ArrowLeft) or Key::BackTab.
Move selection one row up.
Wire to ObjectEvent::Key(Key::ArrowUp) in a node handler.
Move selection one row down.
Wire to ObjectEvent::Key(Key::ArrowDown) in a node handler.
Sourcepub fn activate_selected(&mut self)
pub fn activate_selected(&mut self)
Activate the selected cell and record it in the poll slot.
Wire to ObjectEvent::Key(Key::Enter) in a node handler.
Sourcepub fn last_activated(&mut self) -> Option<(usize, usize)>
pub fn last_activated(&mut self) -> Option<(usize, usize)>
Drain the activation poll slot.