Skip to main content

Style

Trait Style 

Source
pub trait Style:
    StyleBasic
    + StyleValue
    + StyleEdit
    + StyleList
    + StylePopup
    + StyleChrome
    + StyleMisc
    + Sync {
Show 18 methods // Required methods fn tokens(&self, dark: bool) -> [u32; 50]; fn accent(&self, theme: &mut [u32; 50], dark: bool, rgb: u32); fn ts_size(&self) -> [u8; 8]; fn ts_line(&self) -> [u8; 8]; fn ts_font(&self) -> [u8; 8]; fn fonts(&self) -> [&'static [u8]; 4]; fn font_names(&self) -> [[&'static str; 5]; 4]; // Provided methods fn name(&self) -> &'static str { ... } fn ribbon_height(&self) -> i32 { ... } fn ribbon_padding(&self) -> u32 { ... } fn ribbon_preview(&self, _typography: u32) -> Option<(u32, i32, u32)> { ... } fn ribbon_metrics(&self) -> RibbonMetrics { ... } fn preview_card_offset(&self) -> Option<[i32; 2]> { ... } fn ts_size_fx(&self) -> [u16; 8] { ... } fn font_raster(&self) -> [FontRaster; 4] { ... } fn paint_icon( &self, _g: &mut Gfx<'_>, _cp: u32, _x: i32, _y: i32, _size_fx: i32, _color: u32, _accent: u32, _dark: bool, _disabled: bool, _dpi: u32, ) -> bool { ... } fn data(&self) -> &'static dyn StyleData { ... } fn shell(&self) -> &'static dyn StyleShell { ... }
}
Expand description

a style: tokens, type ramp, fonts and every widget family’s paint functions

Required Methods§

Source

fn tokens(&self, dark: bool) -> [u32; 50]

the T_* tokens (light or dark; accent entries may be 0: accent() fills them)

Source

fn accent(&self, theme: &mut [u32; 50], dark: bool, rgb: u32)

fill T_ACCENT, _HOVER, _PRESSED and T_ACCENT_TEXT from 0xRRGGBB (0 = the default)

Source

fn ts_size(&self) -> [u8; 8]

font px / line px / FONT_* of TS_CAPTION .. TS_DISPLAY (+ one spare) at 100 %

Source

fn ts_line(&self) -> [u8; 8]

Source

fn ts_font(&self) -> [u8; 8]

Source

fn fonts(&self) -> [&'static [u8]; 4]

Embedded SGF1 or TrueType/OpenType assets of FONT_REG, FONT_SEMI, FONT_BOLD, FONT_ICON.

Source

fn font_names(&self) -> [[&'static str; 5]; 4]

per embedded font: family, style, full, typographic family, typographic style (sty_font_names)

Provided Methods§

Source

fn name(&self) -> &'static str

the style’s short name, as build_rs.py –style knows it (“winui”, “kde”): the name Ui::set_style switches to (several styles linked into one app)

Source

fn ribbon_height(&self) -> i32

Ribbon height in DIP. Existing styles retain the original 110-DIP layout.

Source

fn ribbon_padding(&self) -> u32

Outer ribbon padding in DIP, independently styled from control content heights.

Source

fn ribbon_preview(&self, _typography: u32) -> Option<(u32, i32, u32)>

Optional document-style gallery face, size in 24.8 DIP and ink color. None preserves the ordinary UI type ramp in existing style previews.

Source

fn ribbon_metrics(&self) -> RibbonMetrics

Group sizing and overflow policy. Existing styles preserve compact flyouts.

Source

fn preview_card_offset(&self) -> Option<[i32; 2]>

Optional optical offset of a preview card in 24.8 DIP. Opts into the fractional panel painter; None keeps the original integer painter.

Source

fn ts_size_fx(&self) -> [u16; 8]

Font sizes in 24.8 DIP. The default keeps every existing integer type ramp exact.

Source

fn font_raster(&self) -> [FontRaster; 4]

Raster policy for the four embedded UI faces. Runtime/document fonts keep their own defaults. Existing styles preserve their pixel output.

Source

fn paint_icon( &self, _g: &mut Gfx<'_>, _cp: u32, _x: i32, _y: i32, _size_fx: i32, _color: u32, _accent: u32, _dark: bool, _disabled: bool, _dpi: u32, ) -> bool

Paint a semantic icon with the shared rasterizer; false uses the icon font. Coordinates are target pixels, size is 24.8 pixels; dpi permits fixed DIP details. Application icon hooks run first. Existing styles retain their original monochrome font rendering.

Source

fn data(&self) -> &'static dyn StyleData

The painters of the data views (grids, trees, badges, meters, charts). The default paints them from the theme tokens (stock.rs), so every style shows them; a style returns its own StyleData to give them its look.

Source

fn shell(&self) -> &'static dyn StyleShell

The painters of the app shell parts (navigation pane, command bar, splitter, breadcrumb, segmented control, wizard steps, toasts, spinner, calendar). Default: token-based (stock.rs).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§