Small ImGui table helper with fixed headers, optional column weights, and text clipping.
More...
#include <Table.h>
|
| | Table (std::string id, std::vector< std::string > headers) |
| | Creates a table with a stable ImGui ID and header labels.
|
| void | setColumnWidth (std::size_t columnIndex, float widthFraction) |
| | Sets the preferred normalized width for a column.
|
| void | addRow (std::vector< std::string > cells) |
| | Adds a row of cells matching the header count.
|
| void | addRow (std::initializer_list< std::string_view > cells) |
| | Adds a row from string-view cell literals matching the header count.
|
| void | clearRows () |
| | Removes all table rows while keeping headers and column widths.
|
| std::size_t | columnCount () const |
| | Returns the number of table columns.
|
| std::vector< float > | columnWidthFractions () const |
| | Returns normalized column width fractions after applying minimum widths.
|
| void | draw (const ImVec2 &outerSize) const |
| | Draws the table into the current ImGui context.
|
|
| std::string | id_ |
| std::vector< std::string > | headers_ |
| std::vector< std::optional< float > > | columnWidths_ |
| std::vector< std::vector< std::string > > | rows_ |
Small ImGui table helper with fixed headers, optional column weights, and text clipping.
Definition at line 17 of file Table.h.
◆ Table()
| Engine::UI::Table::Table |
( |
std::string | id, |
|
|
std::vector< std::string > | headers ) |
Creates a table with a stable ImGui ID and header labels.
◆ addRow() [1/2]
| void Engine::UI::Table::addRow |
( |
std::initializer_list< std::string_view > | cells | ) |
|
Adds a row from string-view cell literals matching the header count.
◆ addRow() [2/2]
| void Engine::UI::Table::addRow |
( |
std::vector< std::string > | cells | ) |
|
Adds a row of cells matching the header count.
◆ clearRows()
| void Engine::UI::Table::clearRows |
( |
| ) |
|
Removes all table rows while keeping headers and column widths.
◆ columnCount()
| std::size_t Engine::UI::Table::columnCount |
( |
| ) |
const |
|
nodiscard |
Returns the number of table columns.
◆ columnWidthFractions()
| std::vector< float > Engine::UI::Table::columnWidthFractions |
( |
| ) |
const |
|
nodiscard |
Returns normalized column width fractions after applying minimum widths.
◆ draw()
| void Engine::UI::Table::draw |
( |
const ImVec2 & | outerSize | ) |
const |
Draws the table into the current ImGui context.
◆ drawClippedCellText()
| void Engine::UI::Table::drawClippedCellText |
( |
const std::string & | text | ) |
const |
|
private |
◆ setColumnWidth()
| void Engine::UI::Table::setColumnWidth |
( |
std::size_t | columnIndex, |
|
|
float | widthFraction ) |
Sets the preferred normalized width for a column.
◆ columnWidths_
| std::vector<std::optional<float> > Engine::UI::Table::columnWidths_ |
|
private |
◆ headers_
| std::vector<std::string> Engine::UI::Table::headers_ |
|
private |
◆ id_
| std::string Engine::UI::Table::id_ |
|
private |
◆ MinimumColumnWidthFraction
| float Engine::UI::Table::MinimumColumnWidthFraction = 0.02f |
|
staticconstexpr |
Minimum normalized width assigned to any column.
Definition at line 20 of file Table.h.
◆ rows_
| std::vector<std::vector<std::string> > Engine::UI::Table::rows_ |
|
private |
The documentation for this class was generated from the following file:
- /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Widgets/Table.h