pub struct Style { /* private fields */ }Expand description
Styling map for defining widget appearance.
Implementations§
Source§impl Style
impl Style
Sourcepub fn from_values(values: impl IntoIterator<Item = (String, StyleVal)>) -> Self
pub fn from_values(values: impl IntoIterator<Item = (String, StyleVal)>) -> Self
Create a style from an array of strings and style values.
Sourcepub fn remove(&mut self, name: impl ToString)
pub fn remove(&mut self, name: impl ToString)
Removes the style value from the map with the give name.
Sourcepub fn with_value(self, name: impl ToString, value: StyleVal) -> Self
pub fn with_value(self, name: impl ToString, value: StyleVal) -> Self
Insert a style value with the given name into the style map.
Sourcepub fn set_color(&mut self, name: impl ToString, color: Color)
pub fn set_color(&mut self, name: impl ToString, color: Color)
Set a color style value by name.
Sourcepub fn set_gradient(&mut self, name: impl ToString, gradient: Gradient)
pub fn set_gradient(&mut self, name: impl ToString, gradient: Gradient)
Set a gradient style value by name.
Sourcepub fn set_brush(&mut self, name: impl ToString, brush: Brush)
pub fn set_brush(&mut self, name: impl ToString, brush: Brush)
Set a brush style value by name.
Sourcepub fn set_uint(&mut self, name: impl ToString, value: u32)
pub fn set_uint(&mut self, name: impl ToString, value: u32)
Set an unsized int style value by name.
Sourcepub fn get(&self, name: impl ToString) -> Option<StyleVal>
pub fn get(&self, name: impl ToString) -> Option<StyleVal>
Get a style value by name. Returns None if the value name does not exist.
Sourcepub fn get_color(&self, name: impl ToString) -> Option<Color>
pub fn get_color(&self, name: impl ToString) -> Option<Color>
Get a color style value by name. Returns None if the value name does not exist.
Sourcepub fn get_gradient(&self, name: impl ToString) -> Option<Gradient>
pub fn get_gradient(&self, name: impl ToString) -> Option<Gradient>
Get a gradient style value by name. Returns None if the value name does not exist.
Sourcepub fn get_brush(&self, name: impl ToString) -> Option<Brush>
pub fn get_brush(&self, name: impl ToString) -> Option<Brush>
Get a brush style value by name. Returns None if the value name does not exist.
Sourcepub fn get_float(&self, name: impl ToString) -> Option<f32>
pub fn get_float(&self, name: impl ToString) -> Option<f32>
Get a float style value by name. Returns None if the value name does not exist.
Sourcepub fn get_int(&self, name: impl ToString) -> Option<i32>
pub fn get_int(&self, name: impl ToString) -> Option<i32>
Get an int style value by name. Returns None if the value name does not exist.