Skip to main content

Module table

Module table 

Source
Expand description

Table — a virtualised data-table widget with header, scrolling body, striping, overlines, row-selection, sort-toggle hooks and scroll_to_row.

Designed to mirror the shape of egui_extras::TableBuilder so the same mental model carries over: configure columns (auto / exact / remainder.at_least(...).clip(...)), describe the row set (Homogeneous { count, height } or Heterogeneous { heights }), and provide cell + header painters. Cells are produced lazily — only rows within the visible viewport are painted, so 100 000-row demos remain cheap.

The widget intentionally does not know about your data: it owns the chrome (backgrounds, separators, scroll, selection bookkeeping) and invokes user-supplied painters for cell content. Cell painters get a CellInfo (rect, row, column, selected, font, visuals) and may use any of the project’s draw primitives.

Y-up note: agg-gui’s coordinate system has its origin at the bottom- left. Rows are stored top-down in the public API (row 0 visually topmost) and the widget converts to Y-up internally.

Resizable columns are intentionally not implemented in this first revision; the configuration is preserved so the API doesn’t break when it lands later.

Structs§

CellInfo
HeaderInfo
Table
TableBuilder
TableColumn

Enums§

ColumnSize
How a column derives its width.
TableRows
Row-set description.

Constants§

MIN_COL_W
Minimum width any column can be resized to.
RESIZE_HIT_HALF
Pixel half-width of the resize hit zone around a column’s right edge.

Functions§

clip_text_to_width
Trim text from the end with an ellipsis until it fits max_w, using the current font/size on ctx.
distribute_widths
Distribute total_w across columns according to their sizing modes.

Type Aliases§

CellPainter
HeaderClick
Optional callback for header clicks. Receives column index and click position relative to the header cell rect (Y-up).
HeaderPainter
RowPredicate
Per-row predicate (e.g. for overlines).
RowsProvider
Callback returning the live row spec. Called on every layout pass when set, so external state changes (e.g. switching demo modes or resizing the dataset) flow into the table without an observer widget.