pub struct Icon(/* private fields */);Expand description
An icon from the platform’s own set, by its name there: an SF Symbol
on macOS, a themed icon’s name on Linux (Adwaita’s symbolic ones on
GNOME, Breeze’s on KDE), a Segoe Fluent Icons glyph on Windows. Names
differ, so pick one per platform with platform!. Symbolic icons are
drawn in the colour the platform gives icons, which follows dark mode.
It’s as large as the platform makes icons unless
icon_size says otherwise. Its label is its accessible name; without
one it’s decorative.
Icon::new(platform! {
macos => "trash",
gtk => "user-trash-symbolic",
kde => "edit-delete",
windows => "\u{E74D}",
})Implementations§
Source§impl Icon
impl Icon
pub fn new(name: impl IntoValue<String>) -> Icon
Sourcepub fn label(self, label: impl IntoValue<String>) -> Icon
pub fn label(self, label: impl IntoValue<String>) -> Icon
Its accessible name: what the icon stands for.
Sourcepub fn color(self, color: impl IntoValue<Color>) -> Icon
pub fn color(self, color: impl IntoValue<Color>) -> Icon
Its colour, in place of the one the platform gives icons: a
semantic one (Accent, SecondaryLabel, Error, …) follows the
appearance; Rgba is fixed. Symbolic icons take it (SF Symbols,
Adwaita’s and Breeze’s -symbolic icons, Segoe Fluent glyphs);
icons in full colour keep theirs.
Trait Implementations§
Source§impl ElementBuilder for Icon
impl ElementBuilder for Icon
fn element(&mut self) -> &mut Element
Source§fn style(self, f: impl FnOnce(&mut Style)) -> Self
fn style(self, f: impl FnOnce(&mut Style)) -> Self
Source§fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
fn style_with(self, f: impl Fn(&mut Style) + 'static) -> Self
f re-runs whenever the
signals it reads change, and must set every field it cares about.fn width(self, value: impl IntoValue<Length>) -> Self
fn height(self, value: impl IntoValue<Length>) -> Self
fn min_width(self, value: impl IntoValue<Length>) -> Self
fn min_height(self, value: impl IntoValue<Length>) -> Self
fn max_width(self, value: impl IntoValue<Length>) -> Self
fn max_height(self, value: impl IntoValue<Length>) -> Self
fn aspect_ratio(self, value: impl IntoValue<f32>) -> Self
fn padding(self, value: impl IntoValue<Length>) -> Self
fn padding_x(self, value: impl IntoValue<Length>) -> Self
fn padding_y(self, value: impl IntoValue<Length>) -> Self
fn padding_start(self, value: impl IntoValue<Length>) -> Self
fn padding_end(self, value: impl IntoValue<Length>) -> Self
fn padding_top(self, value: impl IntoValue<Length>) -> Self
fn padding_bottom(self, value: impl IntoValue<Length>) -> Self
fn margin(self, value: impl IntoValue<Length>) -> Self
fn margin_x(self, value: impl IntoValue<Length>) -> Self
fn margin_y(self, value: impl IntoValue<Length>) -> Self
fn margin_start(self, value: impl IntoValue<Length>) -> Self
fn margin_end(self, value: impl IntoValue<Length>) -> Self
fn margin_top(self, value: impl IntoValue<Length>) -> Self
fn margin_bottom(self, value: impl IntoValue<Length>) -> Self
fn grow(self, value: impl IntoValue<f32>) -> Self
fn shrink(self, value: impl IntoValue<f32>) -> Self
fn basis(self, value: impl IntoValue<Length>) -> Self
fn align_self(self, value: impl IntoValue<Align>) -> Self
Source§fn justify_self(self, value: impl IntoValue<Align>) -> Self
fn justify_self(self, value: impl IntoValue<Align>) -> Self
Source§fn top(self, value: impl IntoValue<Length>) -> Self
fn top(self, value: impl IntoValue<Length>) -> Self
absolute()).fn bottom(self, value: impl IntoValue<Length>) -> Self
Source§fn start(self, value: impl IntoValue<Length>) -> Self
fn start(self, value: impl IntoValue<Length>) -> Self
fn end(self, value: impl IntoValue<Length>) -> Self
fn grid_column(self, value: impl IntoValue<GridPlacement>) -> Self
fn grid_row(self, value: impl IntoValue<GridPlacement>) -> Self
fn direction(self, value: impl IntoValue<TextDirection>) -> Self
display the node had.fn size( self, width: impl IntoValue<Length>, height: impl IntoValue<Length>, ) -> Self
Source§fn tooltip(self, text: impl IntoValue<String>) -> Self
fn tooltip(self, text: impl IntoValue<String>) -> Self
entries, and built again whenever what it
reads changes, as Menu::children_with builds its entries.