Table.hpp

Specs for the Table widget.

TableInfo is the core information for a table and has two helper classes: TableRowInfo and TableDataInfo. The Table class is a smart pointer to a TableInfo object.

A Table is composed of a series of rows, each with the same number of columns. TableDataInfo may be multiple cells wide/tall, masking other cells.

Todo:

Tables should more directly manage internal slates rather than just adding divs and then having them filled in.

TextTables should be created that simply use text in cells, radically speeding up printing of such tables (and covering 80% of use cases).

IDEALLY: Make a single table that will look at what each cell is pointing to (table or text) and write out what it needs to, in place.

Add a ClearColumn method, as well as other column functionality.

Add an operator[] to table that returns the appropriate row (and one to row for cell).

class TableWidget : public internal::WidgetFacet<TableWidget>
#include <Table.hpp>

Subclassed by Table

Public Types

using INFO_TYPE = internal::TableInfo

Public Functions

inline TableWidget(size_t r, size_t c, const std::string &in_id = "")
inline TableWidget(const TableWidget &in)
inline TableWidget(const Widget &in)
inline TableWidget()
inline virtual ~TableWidget()
inline size_t GetNumCols() const
inline size_t GetNumRows() const
inline size_t GetNumCells() const
inline virtual void PrepareAppend() override
inline void ClearTable()
inline void ClearRows()
inline void ClearRow(size_t r)
inline void ClearCol(size_t c)
inline void ClearRowGroup(size_t r)
inline void ClearColGroup(size_t c)
inline void ClearCells()
inline void ClearCell(size_t r, size_t c)
TableCell GetCell(size_t r, size_t c) const

Focus on a specific cell in the table.

TableRow GetRow(size_t r) const

Focus on a specific row in the table.

TableCol GetCol(size_t c) const

Focus on a specific column in the table.

TableRowGroup GetRowGroup(size_t r) const

Focus on a specific group of rows in the table.

TableColGroup GetColGroup(size_t c) const

Focus on a specific group of columns in the table.

Table GetTable() const

Focus on a the entire table.

inline Text GetTextWidget()

Get the Text widget associated with the currently active cell.

Widget AddText(size_t r, size_t c, const std::string &text)

Add text to a specified cell in the table.

Widget AddHeader(size_t r, size_t c, const std::string &text)

Set a specified cell to be a table header.

inline const std::string &GetCSS(const std::string &setting) const override

Get a CSS value for the currently active cell.

inline virtual bool OK(std::stringstream &ss, bool verbose = false, const std::string &prefix = "")

Debugging function.

Protected Types

using parent_t = internal::WidgetFacet<TableWidget>

Protected Functions

inline internal::TableInfo *Info()

Get a properly cast version of info.

inline internal::TableInfo *const Info() const
inline TableWidget(internal::TableInfo *in_info, size_t _row = 0, size_t _col = 0)
inline void DoCSS(const std::string &setting, const std::string &value) override

Apply CSS to appropriate component based on current state.

inline void DoAttr(const std::string &setting, const std::string &value) override

Apply CSS to appropriate component based on current state.

inline void DoListen(const std::string &event_name, size_t fun_id) override

Apply CSS to appropriate component based on current state.

Protected Attributes

size_t cur_row
size_t cur_col
class Table : public TableWidget
#include <Table.hpp>

Public Functions

inline Table(size_t r, size_t c, const std::string &in_id = "")
inline Table(const TableWidget &in)
inline Table(const Widget &in)
inline Table(internal::TableInfo *in_info, size_t _row, size_t _col)
inline Table()
inline Table &Clear()
inline Table &ClearStyle()
inline Table &ClearAttr()
inline Table &ClearListen()
inline Table &ClearExtras()
inline Table &ClearChildren()
inline Table &Rows(size_t r)

Resize the number of rows in the table.

inline Table &Cols(size_t c)

Resize the number of columns in the table.

inline Table &Resize(size_t r, size_t c)

Fully resize the table (both rows and columns)

inline Table &SetColSpan(size_t new_span)

Setup the number of columns the current column group.

template<typename SETTING_TYPE>
inline Table &RowCSS(size_t row_id, const std::string &setting, SETTING_TYPE &&value)

Apply CSS to target row.

template<typename SETTING_TYPE>
inline Table &CellCSS(size_t row_id, [[maybe_unused]] size_t col_id, const std::string &setting, SETTING_TYPE &&value)

Apply CSS to target cell.

template<typename SETTING_TYPE>
inline Table &RowsCSS(const std::string &setting, SETTING_TYPE &&value)

Apply CSS to all rows.

template<typename SETTING_TYPE>
inline Table &CellsCSS(const std::string &setting, SETTING_TYPE &&value)

Apply CSS to all cells.