Vulkan Schnee 0.0.1 (22840dc8)
High-performance rendering engine
Loading...
Searching...
No Matches
Engine::UI::Table Class Reference

Small ImGui table helper with fixed headers, optional column weights, and text clipping. More...

#include <Table.h>

Collaboration diagram for Engine::UI::Table:

Public Member Functions

 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.

Static Public Attributes

static constexpr float MinimumColumnWidthFraction = 0.02f
 Minimum normalized width assigned to any column.

Private Member Functions

void drawClippedCellText (const std::string &text) const

Private Attributes

std::string id_
std::vector< std::string > headers_
std::vector< std::optional< float > > columnWidths_
std::vector< std::vector< std::string > > rows_

Detailed Description

Small ImGui table helper with fixed headers, optional column weights, and text clipping.

Definition at line 17 of file Table.h.

Constructor & Destructor Documentation

◆ Table()

Engine::UI::Table::Table ( std::string id,
std::vector< std::string > headers )

Creates a table with a stable ImGui ID and header labels.

Member Function Documentation

◆ 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.

Member Data Documentation

◆ columnWidths_

std::vector<std::optional<float> > Engine::UI::Table::columnWidths_
private

Definition at line 67 of file Table.h.

◆ headers_

std::vector<std::string> Engine::UI::Table::headers_
private

Definition at line 66 of file Table.h.

◆ id_

std::string Engine::UI::Table::id_
private

Definition at line 65 of file Table.h.

◆ 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

Definition at line 68 of file Table.h.


The documentation for this class was generated from the following file:
  • /workspace/magerbeton/gl3-vulkan/code/Engine/include/Engine/Widgets/Table.h