pub struct Metrics {Show 16 fields
pub control_text: f32,
pub chrome_text: f32,
pub hint_text: f32,
pub radius: f32,
pub radius_inner: f32,
pub control_pad_x: f32,
pub control_pad_y: f32,
pub field_pad_x: f32,
pub field_pad_y: f32,
pub hint_pad_x: f32,
pub hint_pad_y: f32,
pub menu_pad_x: f32,
pub menu_pad_y: f32,
pub menu_width: f32,
pub menu_bar_h: f32,
pub titlebar_h: f32,
}Expand description
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.
Fields§
§control_text: f32A stock control’s label: the button’s text size.
chrome_text: f32The chrome’s text: a menu row, a menu-bar title, the titlebar’s title.
hint_text: f32A tooltip’s text.
radius: f32The corner of every stock surface: a button, a field, a menu, a tooltip.
radius_inner: f32The corner of a row inside one: a menu row, a menu-bar title.
control_pad_x: f32A button’s.
control_pad_y: f32§field_pad_x: f32A text field’s.
field_pad_y: f32§hint_pad_x: f32A tooltip’s.
hint_pad_y: f32A menu row’s; a menu-bar title’s is two px shorter, so the bar’s height and not the title’s padding decides the strip.
A menu panel’s width.
The drawn menu bar’s height.
titlebar_h: f32The titlebar’s height where the strip is the app’s alone: the
platform’s caption height (32 on Windows, 34 elsewhere), which
Metrics::compact leaves alone. Where the OS keeps controls of
its own over the strip — the macOS traffic lights under custom
chrome — the strip is as tall as the OS’s titlebar, which the
driver measures into env.window.native_controls, and this row
is not read (widgets::titlebar_height).
Implementations§
Source§impl Metrics
impl Metrics
Sourcepub const fn comfortable() -> Self
pub const fn comfortable() -> Self
The stock set — Default, named.
Sourcepub const fn compact() -> Self
pub const fn compact() -> Self
A tighter set for a dense tool — a mux, an inspector, a table of controls: smaller text, shallower padding, sharper corners. The titlebar keeps the platform’s height, since that is the OS’s number and not a density.
Sourcepub fn scaled(self, factor: f32) -> Self
pub fn scaled(self, factor: f32) -> Self
Every density multiplied by factor — a density slider, or an OS
text-size setting the day one is plumbed. Logical px in, logical
px out: env.scale is applied after this by the renderer and is
never folded in here. A row the schema marks the platform’s
(titlebar_h: the OS’s caption height, which the traffic lights
are drawn against) is left alone, as Metrics::compact leaves
it — a 1.5 slider drew a 51 px strip beside 34 px buttons.