Skip to main content

TitlebarMetrics

Struct TitlebarMetrics 

Source
#[repr(C)]
pub struct TitlebarMetrics { pub button_side: TitlebarButtonSide, pub buttons: TitlebarButtons, pub height: OptionPixelValue, pub button_area_width: OptionPixelValue, pub padding_horizontal: OptionPixelValue, pub safe_area: SafeAreaInsets, pub title_font: OptionString, pub title_font_size: OptionF32, pub title_font_weight: OptionU16, }
Expand description

Metrics for titlebar layout and window chrome.

This provides information needed to correctly position custom titlebar content when using WindowDecorations::NoTitle (expanded title mode).

Fields§

§button_side: TitlebarButtonSide

Which side the window control buttons are on

§buttons: TitlebarButtons

Which buttons are available

§height: OptionPixelValue

Height of the titlebar in pixels

§button_area_width: OptionPixelValue

Width reserved for window control buttons (close/min/max) This is the space to avoid when drawing custom title text

§padding_horizontal: OptionPixelValue

Horizontal padding inside the titlebar

§safe_area: SafeAreaInsets

Safe area insets for notched/rounded displays

§title_font: OptionString

Title text font (from SystemFonts::title_font)

§title_font_size: OptionF32

Title text font size

§title_font_weight: OptionU16

Title text font weight (400 = normal, 600 = semibold, 700 = bold)

Implementations§

Source§

impl TitlebarMetrics

Source

pub fn windows() -> Self

Windows-style titlebar (buttons on right)

Source

pub fn macos() -> Self

macOS-style titlebar (buttons on left, “traffic lights”)

Source

pub fn linux_gnome() -> Self

Linux GNOME-style titlebar (buttons on right by default)

Source

pub fn ios() -> Self

iOS-style safe area (for notched devices)

Source

pub fn android() -> Self

Android-style titlebar (action bar)

Trait Implementations§

Source§

impl Clone for TitlebarMetrics

Source§

fn clone(&self) -> TitlebarMetrics

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TitlebarMetrics

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TitlebarMetrics

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for TitlebarMetrics

Source§

fn eq(&self, other: &TitlebarMetrics) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for TitlebarMetrics

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.