ASW Lib
A.D.S. Games SDL Wrapper Library. A library targeted at Allegro4 users who want to switch to SDL3 and use modern c++.
Loading...
Searching...
No Matches
asw::ui::detail::ForcedSizes Class Reference

Sizes a layout forced on its children, so a child gets its own size back when the layout stops forcing it, e.g. a grid row after its tallest child is hidden. More...

#include <layout.h>

Classes

struct  Entry
 

Public Member Functions

float natural (const Widget &w, float current) const
 The child's own size: its current size, unless that is still the size this layout forced on it last time.
 
void record (const Widget &w, float natural, float forced)
 Record the size forced on a child this layout.
 
void keep (const Widget &w)
 Keep last layout's record for a child skipped this layout, e.g. a hidden one.
 
void finish ()
 End the layout. Records not made or kept this layout are dropped.
 

Private Member Functions

const Entry * find (WidgetId id) const
 

Private Attributes

std::vector< Entry > _last
 
std::vector< Entry > _next
 
std::size_t _cursor = 0
 

Detailed Description

Sizes a layout forced on its children, so a child gets its own size back when the layout stops forcing it, e.g. a grid row after its tallest child is hidden.

Definition at line 44 of file layout.h.

Member Function Documentation

◆ find()

const asw::ui::detail::ForcedSizes::Entry * asw::ui::detail::ForcedSizes::find ( WidgetId id) const
private

Definition at line 6 of file layout.cpp.

◆ finish()

void asw::ui::detail::ForcedSizes::finish ( )

End the layout. Records not made or kept this layout are dropped.

Definition at line 40 of file layout.cpp.

◆ keep()

void asw::ui::detail::ForcedSizes::keep ( const Widget & w)

Keep last layout's record for a child skipped this layout, e.g. a hidden one.

Parameters
wThe child.

Definition at line 33 of file layout.cpp.

◆ natural()

float asw::ui::detail::ForcedSizes::natural ( const Widget & w,
float current ) const

The child's own size: its current size, unless that is still the size this layout forced on it last time.

Parameters
wThe child.
currentThe child's current size.
Returns
The child's own size.

Definition at line 19 of file layout.cpp.

◆ record()

void asw::ui::detail::ForcedSizes::record ( const Widget & w,
float natural,
float forced )

Record the size forced on a child this layout.

Parameters
wThe child.
naturalThe child's own size.
forcedThe size the layout gave it.

Definition at line 28 of file layout.cpp.

Member Data Documentation

◆ _cursor

std::size_t asw::ui::detail::ForcedSizes::_cursor = 0
mutableprivate

Definition at line 89 of file layout.h.

◆ _last

std::vector<Entry> asw::ui::detail::ForcedSizes::_last
private

Definition at line 87 of file layout.h.

◆ _next

std::vector<Entry> asw::ui::detail::ForcedSizes::_next
private

Definition at line 88 of file layout.h.


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