|
TinyMaterialDesign
|
Computes equal- or weighted-split rects along one axis of a container. More...
#include <LinearLayout.h>
Public Member Functions | |
| LinearLayout (Bounds container, LayoutAxis axis, int32_t spacing=8) | |
| Bounds | itemRect (int index, int count) const |
Bounds for the index-th of count equally-sized items (0-based). | |
| Bounds | itemRect (int index, const float *weights, int count) const |
Computes equal- or weighted-split rects along one axis of a container.
Not a widget - see GridLayout.h for the rationale. Use it before constructing/positioning widgets:
LinearLayout row(Bounds(16, 56, 308, 48), LayoutAxis::Horizontal); button1.bounds = row.itemRect(0, 3); button2.bounds = row.itemRect(1, 3); button3.bounds = row.itemRect(2, 3);
By default all count items split the container equally (minus spacing gutters). Pass per-item weights via itemRect(index, weights, count) to give some items more of the remaining space than others (weights are relative, not required to sum to 1).
|
inline |
|
inline |
Bounds for the index-th of count items, sized proportionally to weights[index] relative to the sum of weights[0..count).
|
inline |
Bounds for the index-th of count equally-sized items (0-based).