[−][src]Struct iced_native::widget::slider::Slider
An horizontal bar and a handle that selects a single value from a range of values.
A Slider
will try to fill the horizontal space of its container.
The Slider
range of numeric values is generic and its step size defaults
to 1 unit.
Example
pub enum Message { SliderChanged(f32), } let state = &mut slider::State::new(); let value = 50.0; Slider::new(state, 0.0..=100.0, value, Message::SliderChanged);
Implementations
impl<'a, T, Message, Renderer> Slider<'a, T, Message, Renderer> where
T: Copy + From<u8> + PartialOrd,
Renderer: Renderer,
[src]
T: Copy + From<u8> + PartialOrd,
Renderer: Renderer,
pub fn new<F>(
state: &'a mut State,
range: RangeInclusive<T>,
value: T,
on_change: F
) -> Self where
F: 'static + Fn(T) -> Message,
[src]
state: &'a mut State,
range: RangeInclusive<T>,
value: T,
on_change: F
) -> Self where
F: 'static + Fn(T) -> Message,
Creates a new Slider
.
It expects:
pub fn on_release(self, on_release: Message) -> Self
[src]
Sets the release message of the Slider
.
This is called when the mouse is released from the slider.
Typically, the user's interaction with the slider is finished when this message is produced. This is useful if you need to spawn a long-running task from the slider's result, where the default on_change message could create too many events.
pub fn width(self, width: Length) -> Self
[src]
Sets the width of the Slider
.
pub fn height(self, height: u16) -> Self
[src]
Sets the height of the Slider
.
pub fn style(self, style: impl Into<Renderer::Style>) -> Self
[src]
Sets the style of the Slider
.
pub fn step(self, step: T) -> Self
[src]
Sets the step size of the Slider
.
Trait Implementations
impl<'a, T, Message, Renderer> From<Slider<'a, T, Message, Renderer>> for Element<'a, Message, Renderer> where
T: 'a + Copy + Into<f64> + FromPrimitive,
Renderer: 'a + Renderer,
Message: 'a + Clone,
[src]
T: 'a + Copy + Into<f64> + FromPrimitive,
Renderer: 'a + Renderer,
Message: 'a + Clone,
impl<'a, T, Message, Renderer> Widget<Message, Renderer> for Slider<'a, T, Message, Renderer> where
T: Copy + Into<f64> + FromPrimitive,
Renderer: Renderer,
Message: Clone,
[src]
T: Copy + Into<f64> + FromPrimitive,
Renderer: Renderer,
Message: Clone,
fn width(&self) -> Length
[src]
fn height(&self) -> Length
[src]
fn layout(&self, _renderer: &Renderer, limits: &Limits) -> Node
[src]
fn on_event(
&mut self,
event: Event,
layout: Layout<'_>,
cursor_position: Point,
messages: &mut Vec<Message>,
_renderer: &Renderer,
_clipboard: Option<&dyn Clipboard>
)
[src]
&mut self,
event: Event,
layout: Layout<'_>,
cursor_position: Point,
messages: &mut Vec<Message>,
_renderer: &Renderer,
_clipboard: Option<&dyn Clipboard>
)
fn draw(
&self,
renderer: &mut Renderer,
_defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point
) -> Renderer::Output
[src]
&self,
renderer: &mut Renderer,
_defaults: &Renderer::Defaults,
layout: Layout<'_>,
cursor_position: Point
) -> Renderer::Output
fn hash_layout(&self, state: &mut Hasher)
[src]
fn overlay(
&mut self,
_layout: Layout<'_>
) -> Option<Element<'_, Message, Renderer>>
[src]
&mut self,
_layout: Layout<'_>
) -> Option<Element<'_, Message, Renderer>>
Auto Trait Implementations
impl<'a, T, Message, Renderer> !RefUnwindSafe for Slider<'a, T, Message, Renderer>
impl<'a, T, Message, Renderer> !Send for Slider<'a, T, Message, Renderer>
impl<'a, T, Message, Renderer> !Sync for Slider<'a, T, Message, Renderer>
impl<'a, T, Message, Renderer> Unpin for Slider<'a, T, Message, Renderer> where
Message: Unpin,
T: Unpin,
<Renderer as Renderer>::Style: Unpin,
Message: Unpin,
T: Unpin,
<Renderer as Renderer>::Style: Unpin,
impl<'a, T, Message, Renderer> !UnwindSafe for Slider<'a, T, Message, Renderer>
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
[src]
D: AdaptFrom<S, Swp, Dwp, T>,
Dwp: WhitePoint,
Swp: WhitePoint,
T: Component + Float,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
[src]
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into(self) -> D
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> ConvertInto<U> for T where
U: ConvertFrom<T>,
[src]
U: ConvertFrom<T>,
fn convert_into(self) -> U
[src]
fn convert_unclamped_into(self) -> U
[src]
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,