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

Positions a single rect relative to a corner/edge of a container. More...

#include <AnchorLayout.h>

Public Member Functions

 AnchorLayout (Bounds container, int32_t margin=0)
 
Bounds rect (Anchor anchor, int32_t width, int32_t height) const
 Bounds for a width x height rect anchored at anchor, inset by margin.
 

Detailed Description

Positions a single rect relative to a corner/edge of a container.

Not a widget - see GridLayout.h for the rationale. Solves the "place a FAB in the bottom-right" / "badge in the top-right corner of an avatar" cases that would otherwise be hand-computed arithmetic in every sketch:

fab.bounds = AnchorLayout(screenBounds, 16).rect(Anchor::BottomRight, 56, 56); badge.bounds = AnchorLayout(avatar.bounds, 0).rect(Anchor::TopRight, 16, 16);

Constructor & Destructor Documentation

◆ AnchorLayout()

AnchorLayout ( Bounds  container,
int32_t  margin = 0 
)
inlineexplicit

Member Function Documentation

◆ rect()

Bounds rect ( Anchor  anchor,
int32_t  width,
int32_t  height 
) const
inline

Bounds for a width x height rect anchored at anchor, inset by margin.


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