ScalarSpec
ScalarSpec
Section titled “ScalarSpec”#include <Layout.hpp>Represents a single dimension value that can be absolute or percentage-based.
Used for sizing, margins, and positioning. Values can be:
-
Absolute: measured in cells (characters)
-
Percentage: measured as % of parent size
Example Usage:
ScalarSpec width = pct(50); // 50% of parent widthScalarSpec height = cells(10); // 10 cells tallPublic Attributes
Section titled “Public Attributes”| Return | Name | Description |
|---|---|---|
float | value | The numeric value. |
bool | percent | If true, value is a percentage; if false, it’s in cells. |
float value = 0.fThe numeric value.
percent
Section titled “percent”bool percent = falseIf true, value is a percentage; if false, it’s in cells.
Public Methods
Section titled “Public Methods”| Return | Name | Description |
|---|---|---|
bool | isSet const inline | Returns true if this spec was explicitly set. |
int | resolve const inline | Resolves this spec to an absolute cell count. |
const inline
inline bool isSet() constReturns true if this spec was explicitly set.
Returns
Section titled “Returns”True if value > 0
resolve
Section titled “resolve”const inline
inline int resolve(int parentSize) constResolves this spec to an absolute cell count.
Parameters
Section titled “Parameters”parentSizeThe parent size (used if this is a percentage)
Returns
Section titled “Returns”The resolved size in cells