TinyMaterialDesign
Loading...
Searching...
No Matches
Public Member Functions | List of all members
LinearLayout Class Reference

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
 

Detailed Description

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

Constructor & Destructor Documentation

◆ LinearLayout()

LinearLayout ( Bounds  container,
LayoutAxis  axis,
int32_t  spacing = 8 
)
inline

Member Function Documentation

◆ itemRect() [1/2]

Bounds itemRect ( int  index,
const float *  weights,
int  count 
) const
inline

Bounds for the index-th of count items, sized proportionally to weights[index] relative to the sum of weights[0..count).

◆ itemRect() [2/2]

Bounds itemRect ( int  index,
int  count 
) const
inline

Bounds for the index-th of count equally-sized items (0-based).


The documentation for this class was generated from the following file: