TableProps struct
#include <GGUI/Public/DataSource.h>
TableProps: a source's items as rows, with columns under a header.
GGSort sort; // caller-owned, so it can be persisted ui.Table(source, { .RowHeight = 22, .Columns = { { .Column = 0 }, { .Column = 2, .Width = 90, .bResizable = false } }, .Selected = &selection, .SortBy = &sort }); ui.Table(source, props, [=](UI& ui, ItemID item, uint32_t column) { ... }); // custom cells
The rows are a list's, or a tree's with bTree: virtualised, selectable, and keyboard-navigable the same way. A cell function is stored by the table.
Clicking a heading cycles its sort: ascending, descending, source order. Dragging a heading's right edge resizes the column; columns before it keep their current widths from then on.
Editable cells are edited in place. A cell the source gives a field for (CellField) hosts that field's editor. Otherwise double-click, or Enter on the selected row, opens a text field: Enter or losing focus commits (SetCell), Escape cancels.
Public variables
- float RowHeight
- as ListProps::
RowHeight - std::vector<GGTableColumn> Columns
- empty: every source column, sharing the width equally
- float HeaderHeight
- 0: the row height, or the text height if there is none
- bool bHeader
- shows its headings
- GGSize Width
- its width
- GGSize Height
- Fit with a RowHeight means fill the available space.
- std::string_view Class
- its style classes
- ItemSet* Selected
- as ListProps::
Selected - GGSelect Select
- GGSort* SortBy
- Caller-owned sort state, written when a heading is clicked. Null: the table keeps its own. (ListProps::
Sort is the order itself; this is where a table stores its order.). - std::vector<float>* Widths
- User-resized column widths, by column position; 0 = never resized. Null: the table keeps its own for as long as it exists.
- bool bTree
- Show items under their parents. The first column gets the indents and toggles.
- float Indent
- as TreeProps
- bool bExpanded
- as TreeProps
- ItemSet* Toggled
- as TreeProps
- ItemMoveFn OnMove
- as ListProps::
OnMove