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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Style
impl !RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl !UnwindSafe for Style
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more