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

Two unrelated single-rect placement helpers bundled under one name - not "arrange these into a row/column" (that's LinearLayout), but "place one rect relative to another rect it sits on top of or overlaps": More...

#include <StackLayout.h>

Public Member Functions

 StackLayout (Bounds container, int32_t overlapStep=0)
 
Bounds centered (int32_t width, int32_t height) const
 A width x height rect centered within the container.
 
Bounds offset (int index, int32_t width, int32_t height) const
 

Detailed Description

Two unrelated single-rect placement helpers bundled under one name - not "arrange these into a row/column" (that's LinearLayout), but "place one rect relative to another rect it sits on top of or overlaps":

Not a widget - see GridLayout.h for the rationale. A single StackLayout is normally used for just one of the two, not both.

StackLayout stack(button.bounds); icon.bounds = stack.centered(20, 20);

StackLayout avatars(Bounds(16, 16, 0, 0), 20); // 20px overlap step for (int i = 0; i < 3; ++i) avatar[i].bounds = avatars.offset(i, 32, 32);

Constructor & Destructor Documentation

◆ StackLayout()

StackLayout ( Bounds  container,
int32_t  overlapStep = 0 
)
inlineexplicit

Member Function Documentation

◆ centered()

Bounds centered ( int32_t  width,
int32_t  height 
) const
inline

A width x height rect centered within the container.

◆ offset()

Bounds offset ( int  index,
int32_t  width,
int32_t  height 
) const
inline

The index-th rect, offset horizontally by index * overlapStep from the container's origin - e.g. a row of overlapping avatars.


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