pub struct ToggleButtonCustomStyle(/* private fields */);Expand description
Represents a custom style for a ToggleButton.
Implementations§
Source§impl ToggleButtonCustomStyle
impl ToggleButtonCustomStyle
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new styles for ToggleButton.
Sourcepub fn handle_color(self, color: impl Into<Brush>) -> Self
pub fn handle_color(self, color: impl Into<Brush>) -> Self
Sourcepub fn accent_color(self, color: impl Into<Brush>) -> Self
pub fn accent_color(self, color: impl Into<Brush>) -> Self
Sets the accent color of the toggle button.
§Arguments
color - A Brush that sets the toggle button’s accent color.
This is the same as the background color.
Sourcepub fn handle_inset(self, inset: impl Into<PxPct>) -> Self
pub fn handle_inset(self, inset: impl Into<PxPct>) -> Self
Sets the inset of the toggle handle.
§Arguments
inset - A PxPct value that defines the inset of the handle from
the toggle button’s edge.
Sourcepub fn circle_rad(self, rad: impl Into<PxPct>) -> Self
pub fn circle_rad(self, rad: impl Into<PxPct>) -> Self
Sets the radius of the toggle circle.
§Arguments
rad - A PxPct value that defines the radius of the toggle
button’s inner circle.
Sourcepub fn behavior(self, switch: ToggleHandleBehavior) -> Self
pub fn behavior(self, switch: ToggleHandleBehavior) -> Self
Sets the switch behavior of the toggle button.
§Arguments
switch - A ToggleHandleBehavior that defines how the toggle
handle behaves on interaction.
On Follow, the handle will follow the mouse.
On Snap, the handle will snap to the nearest side.
Sourcepub fn apply_if(self, cond: bool, f: impl FnOnce(Self) -> Self) -> Self
pub fn apply_if(self, cond: bool, f: impl FnOnce(Self) -> Self) -> Self
Sets the styles of the toggle button if true.
§Arguments
cond - if resolves to true will apply styles from the closure.
let state = RwSignal::new(false);
let toggle = ToggleButton::new_rw(state)
.toggle_style(move |s| s
.apply_if(state.get(), |s| s
.accent_color(css::DARK_GRAY)
)
);Trait Implementations§
Source§impl Clone for ToggleButtonCustomStyle
impl Clone for ToggleButtonCustomStyle
Source§fn clone(&self) -> ToggleButtonCustomStyle
fn clone(&self) -> ToggleButtonCustomStyle
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ToggleButtonCustomStyle
impl Debug for ToggleButtonCustomStyle
Source§impl Default for ToggleButtonCustomStyle
impl Default for ToggleButtonCustomStyle
Source§fn default() -> ToggleButtonCustomStyle
fn default() -> ToggleButtonCustomStyle
Source§impl From<ToggleButtonCustomStyle> for Style
impl From<ToggleButtonCustomStyle> for Style
Source§fn from(value: ToggleButtonCustomStyle) -> Self
fn from(value: ToggleButtonCustomStyle) -> Self
Auto Trait Implementations§
impl Freeze for ToggleButtonCustomStyle
impl !RefUnwindSafe for ToggleButtonCustomStyle
impl !Send for ToggleButtonCustomStyle
impl !Sync for ToggleButtonCustomStyle
impl Unpin for ToggleButtonCustomStyle
impl !UnwindSafe for ToggleButtonCustomStyle
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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