44 columns_.push_back(std::move(
column));
45 for (
auto&
row : rows_)
row.resize(columns_.size());
56 void add_row(std::vector<TableCell> cells) {
57 cells.resize(columns_.size());
59 && original_order_.size() == rows_.size()) {
60 restore_original_order_();
62 rows_.push_back(std::move(cells));
63 if (!original_order_.empty()) {
64 original_order_.push_back(rows_.size() - 1);
71 std::size_t
row_count()
const {
return rows_.size(); }
74 return rows_[
row][col];
90 restore_original_order_();
98 void restore_original_order_();
100 std::vector<TableColumn> columns_;
101 std::vector<std::vector<TableCell>> rows_;
105 std::vector<std::size_t> original_order_;
106 int sort_column_ = -1;
std::size_t column_count() const
Definition table_model.hpp:70
const TableCell & cell(std::size_t row, std::size_t col) const
Definition table_model.hpp:73
void sort_by(std::size_t col, TableSortOrder order)
Explicit sort (used by tests and by code that wants a specific order).
void add_column(TableColumn column)
Definition table_model.hpp:43
void toggle_sort(std::size_t col)
Sort rows by column col.
std::size_t row_count() const
Definition table_model.hpp:71
void clear_sort()
Clear any sort; original insertion order is restored.
Definition table_model.hpp:86
const TableColumn & column(std::size_t i) const
Definition table_model.hpp:72
int sort_column() const
Definition table_model.hpp:93
TableSortOrder sort_order() const
Definition table_model.hpp:94
void add_row(std::vector< TableCell > cells)
Add a row.
Definition table_model.hpp:56
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
TableSortOrder
Definition table_model.hpp:35
@ None
Definition table_model.hpp:36
@ Ascending
Definition table_model.hpp:37
@ Descending
Definition table_model.hpp:38
@ i
Definition input_events.hpp:40
@ row
Definition design_ir.hpp:53
Definition table_model.hpp:22
std::string text
Definition table_model.hpp:23
double sort_key_num
Optional numeric sort key.
Definition table_model.hpp:26
Column definition for TableListBox.
Definition table.hpp:16
std::string title
Definition table_model.hpp:30
float default_width
Definition table_model.hpp:32
bool sortable
Definition table.hpp:19