pub struct Toggle { /* private fields */ }Expand description
Toggle switch widget (on/off).
Implementations§
Source§impl Toggle
impl Toggle
Sourcepub fn with_state(on: bool) -> Self
pub fn with_state(on: bool) -> Self
Create a toggle with initial state.
Sourcepub fn track_width(self, width: f32) -> Self
pub fn track_width(self, width: f32) -> Self
Set the track width.
Sourcepub fn track_height(self, height: f32) -> Self
pub fn track_height(self, height: f32) -> Self
Set the track height.
Sourcepub fn thumb_size(self, size: f32) -> Self
pub fn thumb_size(self, size: f32) -> Self
Set the thumb size.
Sourcepub const fn track_off_color(self, color: Color) -> Self
pub const fn track_off_color(self, color: Color) -> Self
Set the track off color.
Sourcepub const fn track_on_color(self, color: Color) -> Self
pub const fn track_on_color(self, color: Color) -> Self
Set the track on color.
Sourcepub const fn thumb_color(self, color: Color) -> Self
pub const fn thumb_color(self, color: Color) -> Self
Set the thumb color.
Sourcepub const fn disabled_color(self, color: Color) -> Self
pub const fn disabled_color(self, color: Color) -> Self
Set the disabled color.
Sourcepub const fn label_color(self, color: Color) -> Self
pub const fn label_color(self, color: Color) -> Self
Set the label color.
Sourcepub fn accessible_name(self, name: impl Into<String>) -> Self
pub fn accessible_name(self, name: impl Into<String>) -> Self
Set the accessible name.
Sourcepub const fn is_disabled(&self) -> bool
pub const fn is_disabled(&self) -> bool
Get disabled state.
Sourcepub const fn get_track_width(&self) -> f32
pub const fn get_track_width(&self) -> f32
Get the track width.
Sourcepub const fn get_track_height(&self) -> f32
pub const fn get_track_height(&self) -> f32
Get the track height.
Sourcepub const fn get_thumb_size(&self) -> f32
pub const fn get_thumb_size(&self) -> f32
Get the thumb size.
Sourcepub const fn get_spacing(&self) -> f32
pub const fn get_spacing(&self) -> f32
Get the spacing.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Toggle
impl<'de> Deserialize<'de> for Toggle
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Widget for Toggle
impl Widget for Toggle
Source§fn measure(&self, constraints: Constraints) -> Size
fn measure(&self, constraints: Constraints) -> Size
Compute intrinsic size constraints. Read more
Source§fn layout(&mut self, bounds: Rect) -> LayoutResult
fn layout(&mut self, bounds: Rect) -> LayoutResult
Position children within allocated bounds. Read more
Source§fn event(&mut self, event: &Event) -> Option<Box<dyn Any + Send>>
fn event(&mut self, event: &Event) -> Option<Box<dyn Any + Send>>
Handle input events. Read more
Source§fn children_mut(&mut self) -> &mut [Box<dyn Widget>]
fn children_mut(&mut self) -> &mut [Box<dyn Widget>]
Get mutable child widgets.
Source§fn is_interactive(&self) -> bool
fn is_interactive(&self) -> bool
Check if this widget is interactive (can receive focus/events).
Source§fn is_focusable(&self) -> bool
fn is_focusable(&self) -> bool
Check if this widget can receive keyboard focus.
Source§fn accessible_name(&self) -> Option<&str>
fn accessible_name(&self) -> Option<&str>
Get the accessible name for screen readers.
Source§fn accessible_role(&self) -> AccessibleRole
fn accessible_role(&self) -> AccessibleRole
Get the accessible role.
Auto Trait Implementations§
impl Freeze for Toggle
impl RefUnwindSafe for Toggle
impl Send for Toggle
impl Sync for Toggle
impl Unpin for Toggle
impl UnwindSafe for Toggle
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
Mutably borrows from an owned value. Read more