2#include "TinyMaterialDesign/Core/Bounds.h"
7
8
9
10
11
12
13
14
15
16
17
18
21 TableLayout(
Bounds container,
const int32_t* columnWidths,
int columnCount,
const int32_t* rowHeights,
22 int rowCount, int32_t spacing = 8)
23 : container_(container),
24 columnWidths_(columnWidths),
25 columnCount_(columnCount),
26 rowHeights_(rowHeights),
32 int32_t x = container_
.x;
33 for (
int c = 0; c < col && c < columnCount_; ++c) x += columnWidths_[c] + spacing_;
34 int32_t y = container_
.y;
35 for (
int r = 0; r < row && r < rowCount_; ++r) y += rowHeights_[r] + spacing_;
37 const int32_t w = col < columnCount_ ? columnWidths_[col] : 0;
38 const int32_t h = row < rowCount_ ? rowHeights_[row] : 0;
42 int columns()
const {
return columnCount_; }
43 int rows()
const {
return rowCount_; }
48 for (
int c = 0; c < columnCount_; ++c) total += columnWidths_[c] + (c > 0 ? spacing_ : 0);
55 for (
int r = 0; r < rowCount_; ++r) total += rowHeights_[r] + (r > 0 ? spacing_ : 0);
61 const int32_t* columnWidths_;
63 const int32_t* rowHeights_;
Grid with explicit, independently-sized column widths and row heights.
Definition: TableLayout.h:19
int32_t totalWidth() const
Total width needed for all columns.
Definition: TableLayout.h:46
int columns() const
Definition: TableLayout.h:42
TableLayout(Bounds container, const int32_t *columnWidths, int columnCount, const int32_t *rowHeights, int rowCount, int32_t spacing=8)
Definition: TableLayout.h:21
Bounds cellRect(int row, int col) const
Bounds for the cell at (row, col), 0-based.
Definition: TableLayout.h:31
int32_t totalHeight() const
Total height needed for all rows.
Definition: TableLayout.h:53
int rows() const
Definition: TableLayout.h:43
Definition: AnchorLayout.h:4
Axis-aligned pixel rectangle used for widget bounds and hit-testing.
Definition: Bounds.h:21
Bounds(int32_t x, int32_t y, int32_t w, int32_t h)
Definition: Bounds.h:28
int32_t y
Definition: Bounds.h:23
int32_t x
Definition: Bounds.h:22