pub struct Slider<T> {
pub value: f32,
pub range: RangeInclusive<f32>,
pub on_input: Option<Box<dyn FnMut(&mut EventCx<'_, '_>, &mut T, f32) + 'static>>,
pub axis: Axis,
pub width: Option<f32>,
pub length: Option<f32>,
pub color: Option<Color>,
pub background: Option<Color>,
pub border_radius: Option<BorderRadius>,
pub border_width: Option<BorderWidth>,
pub border_color: Option<Color>,
}
Expand description
A slider.
Can be styled with a SliderStyle
.
Fields§
§value: f32
The value of the slider.
range: RangeInclusive<f32>
The range of the slider.
on_input: Option<Box<dyn FnMut(&mut EventCx<'_, '_>, &mut T, f32) + 'static>>
The callback for when the value changes.
axis: Axis
The axis of the slider.
width: Option<f32>
The width of the slider.
length: Option<f32>
The length of the slider.
color: Option<Color>
The foreground color of the slider.
background: Option<Color>
The background color of the slider.
border_radius: Option<BorderRadius>
The border radius of the slider.
border_width: Option<BorderWidth>
The border width of the slider.
border_color: Option<Color>
The border color of the slider.
Implementations§
Source§impl<T> Slider<T>
impl<T> Slider<T>
Sourcepub fn range(self, range: impl Into<RangeInclusive<f32>>) -> Self
pub fn range(self, range: impl Into<RangeInclusive<f32>>) -> Self
Set self.range
.
The range of the slider.
Sourcepub fn color(self, color: impl Into<Color>) -> Self
pub fn color(self, color: impl Into<Color>) -> Self
Set self.color
.
The foreground color of the slider.
Sourcepub fn background(self, background: impl Into<Color>) -> Self
pub fn background(self, background: impl Into<Color>) -> Self
Set self.background
.
The background color of the slider.
Sourcepub fn border_radius(self, border_radius: impl Into<BorderRadius>) -> Self
pub fn border_radius(self, border_radius: impl Into<BorderRadius>) -> Self
Set self.border_radius
.
The border radius of the slider.
Sourcepub fn border_width(self, border_width: impl Into<BorderWidth>) -> Self
pub fn border_width(self, border_width: impl Into<BorderWidth>) -> Self
Set self.border_width
.
The border width of the slider.
Sourcepub fn border_color(self, border_color: impl Into<Color>) -> Self
pub fn border_color(self, border_color: impl Into<Color>) -> Self
Set self.border_color
.
The border color of the slider.
Trait Implementations§
Source§impl<T> View<T> for Slider<T>
impl<T> View<T> for Slider<T>
Source§type State = SliderStyle
type State = SliderStyle
The state of the view, see top-level documentation for more information.
Source§fn build(&mut self, cx: &mut BuildCx<'_, '_>, _data: &mut T) -> Self::State
fn build(&mut self, cx: &mut BuildCx<'_, '_>, _data: &mut T) -> Self::State
Build the view state, see top-level documentation for more information.
Source§fn rebuild(
&mut self,
style: &mut Self::State,
cx: &mut RebuildCx<'_, '_>,
_data: &mut T,
old: &Self,
)
fn rebuild( &mut self, style: &mut Self::State, cx: &mut RebuildCx<'_, '_>, _data: &mut T, old: &Self, )
Rebuild the view state, see top-level documentation for more information.
Source§fn event(
&mut self,
style: &mut Self::State,
cx: &mut EventCx<'_, '_>,
data: &mut T,
event: &Event,
) -> bool
fn event( &mut self, style: &mut Self::State, cx: &mut EventCx<'_, '_>, data: &mut T, event: &Event, ) -> bool
Handle an event, see top-level documentation for more information.
Auto Trait Implementations§
impl<T> Freeze for Slider<T>
impl<T> !RefUnwindSafe for Slider<T>
impl<T> !Send for Slider<T>
impl<T> !Sync for Slider<T>
impl<T> Unpin for Slider<T>
impl<T> !UnwindSafe for Slider<T>
Blanket Implementations§
Source§impl<T, V> AnyView<T> for V
impl<T, V> AnyView<T> for V
Source§fn dyn_build(&mut self, cx: &mut BuildCx<'_, '_>, data: &mut T) -> Box<dyn Any>
fn dyn_build(&mut self, cx: &mut BuildCx<'_, '_>, data: &mut T) -> Box<dyn Any>
Build the view.
Source§fn dyn_rebuild(
&mut self,
state: &mut Box<dyn Any>,
cx: &mut RebuildCx<'_, '_>,
data: &mut T,
old: &dyn AnyView<T>,
)
fn dyn_rebuild( &mut self, state: &mut Box<dyn Any>, cx: &mut RebuildCx<'_, '_>, data: &mut T, old: &dyn AnyView<T>, )
Rebuild the view.
Source§fn dyn_event(
&mut self,
state: &mut Box<dyn Any>,
cx: &mut EventCx<'_, '_>,
data: &mut T,
event: &Event,
) -> bool
fn dyn_event( &mut self, state: &mut Box<dyn Any>, cx: &mut EventCx<'_, '_>, data: &mut T, event: &Event, ) -> bool
Handle an event.
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