Back to Serenity

Description

Base/usr/share/man/man5/GML/UI-Dimensions.md

latest2.7 KB
Original Source

Name

UI Dimensions

Description

UI Dimension (or GUI::UIDimension in c++) is a special, union — of positive integer and enum — like, type that is used to represent dimensions in a user interface context.

It can either store positive integers ≥0 or special meaning values from a pre determined set.

Basic Syntax

In GML UI Dimensions that are "regular" values (integer ≥0) are represented by JSON's int type, while "special" values are represented by their name as a JSON string type.

Special Values

Special Values carry size information that would otherwise not be intuitively possible to be transported by an integer (positive or negative) alone.

Importantly, while any "regular" (i.e. int ≥0) UI Dimension values might (by convention) be assigned to any UI Dimension property, many properties only allow a subset of the "special" values to be assigned to them.

Namec++ nameGML/JSON representationGeneral meaning
RegularGUI::SpecialDimension::Regular (mock)int ≥0This is a regular integer value specifying a specific size
GrowGUI::SpecialDimension::Grow"grow"Grow to the maximum size the surrounding allows
OpportunisticGrowGUI::SpecialDimension::OpportunisticGrow"opportunistic_grow"Grow when the opportunity arises, meaning — only when all other widgets have already grown to their maximum size, and only opportunistically growing widgets are left
FitGUI::SpecialDimension::Fit"fit"Grow exactly to the size of the surrounding as determined by other factors, but do not call for e.g. expansion of the parent container itself
ShrinkGUI::SpecialDimension::Shrink"shrink"Shrink to the smallest size possible