Expand description
A data grid over your own data, drawn onto a densa_draw::Canvas.
Domain-agnostic: an application describes its Columns and implements GridSource
(one call per visible cell, formatting into a stack buffer); GridPainter lays the
columns out from font metrics, aligns text, fills overflowing numbers with # like a
spreadsheet, and draws cell styles and glyphs. No GPU dependency: hand the canvas’s
instances to densa-render (or any other backend) to show them.
A widget showing a grid asks its data through GridModel instead: the same cells, plus
the rows to scroll through and sorting by column.
Painting allocates nothing once the frame’s characters are cached.
Structs§
- Cell
Style - How one cell is drawn:
CellStyle::new(color), withwith_backgroundfor a fill. - Color
- A color in linear RGB with straight (not premultiplied) alpha: the space densa blends in.
- Column
- A grid column: header title, width in characters, alignment. Made with
Column::new. - Grid
Layout - Pixel geometry of a grid, derived from its columns and the font’s metrics.
- Grid
Painter - Draws a
GridSourceonto aCanvas. - Palette
- Grid colors:
Palette::newis the dark default; change its fields for others. - Point
- A position in pixels, y down.
- Rect
- An axis-aligned rectangle in pixels, y down, stored as its four edges.
Enums§
Constants§
- CELL_
BYTES - Bytes a cell’s text may take.
FmtBufappends are all-or-nothing, so a write that does not fit leaves the cell as it was (blank if nothing was written yet), not truncated.
Traits§
- Grid
Model - The data of a grid widget: its columns, its rows, and each cell’s text and style, plus what the widget asks of it as the user works with it.
- Grid
Source - The data a
GridPainterdraws: one call per visible cell, every frame.
Type Aliases§
- Cell
Text - The stack buffer a
GridSourcewrites one cell’s text into.