Skip to main content

Module metrics

Module metrics 

Source
Expand description

Metrics: the sizes the stock widgets are built from, one struct beside the palette.

Every field is logical px (or a text size in logical px), applied before env.scale, which the renderer multiplies everything by. Density is the app’s choice, as the palette is: Metrics::compact is a tighter set, Metrics::scaled multiplies every length for a density slider, and Core::set_metrics makes one the frame’s. An app that never sets one gets Metrics::default, the stock geometry.

Fields are roles, like the palette’s: control_pad_x is a button’s horizontal padding, not “spacing unit 3”, and a view that wants a number between two has arithmetic.

Structs§

Metrics
The sizes the stock widgets are built from. Plain data and Copy: a view reads it off ui.metrics() and may keep or change its own copy, and Core::set_metrics makes one the frame’s.

Constants§

TITLEBAR_H_ELSEWHERE
TITLEBAR_H_WINDOWS
The titlebar’s height on Windows and everywhere else: the caption height the OS draws, so the one metric that is the platform’s rather than a density’s. Named here so Metrics::comfortable picks the running one and the schema row (MetricRole::platform) carries both, which is what keeps a generated table from saying which machine wrote it.