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() -> Metrics
pub const fn comfortable() -> Metrics
The stock set — Default, named.
Sourcepub const fn compact() -> Metrics
pub const fn compact() -> Metrics
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) -> Metrics
pub fn scaled(self, factor: f32) -> Metrics
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.
Trait Implementations§
impl Copy for Metrics
impl StructuralPartialEq for Metrics
Auto Trait Implementations§
impl Freeze for Metrics
impl RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnsafeUnpin for Metrics
impl UnwindSafe for Metrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.