pub struct Slider { /* private fields */ }Expand description
A draggable value between min and max. Arrow keys adjust it by step.
use ravenrs_reactive::State;
use ravenrs_widgets::{Slider, Ui};
let volume = State::new(40.0_f32);
let slider = Slider::new(volume.binding()).range(0.0, 100.0).step(5.0).width(240.0).show_value();
let mut ui = Ui::new(slider, ravenrs_style::Theme::raven_dark());
ui.update();Implementations§
Source§impl Slider
impl Slider
Sourcepub fn new(value: Binding<f32>) -> Slider
pub fn new(value: Binding<f32>) -> Slider
A slider over 0.0–1.0 bound to value, stepping by 0.01.
Sourcepub fn range(self, min: f32, max: f32) -> Slider
pub fn range(self, min: f32, max: f32) -> Slider
The value range; also resets the step to 1/100 of the range.
Sourcepub fn step(self, step: f32) -> Slider
pub fn step(self, step: f32) -> Slider
The keyboard increment (call after Slider::range).
Sourcepub fn width(self, width: f32) -> Slider
pub fn width(self, width: f32) -> Slider
Fixed width in logical pixels; by default the slider stretches.
Sourcepub fn label(self, label: impl Into<String>) -> Slider
pub fn label(self, label: impl Into<String>) -> Slider
The name screen readers announce, such as “Volume”.
Sourcepub fn marks(self, marks: impl IntoIterator<Item = f32>) -> Slider
pub fn marks(self, marks: impl IntoIterator<Item = f32>) -> Slider
Notches on the track at these values, such as where chapters begin.
Sourcepub fn track_colors(self, colors: impl IntoIterator<Item = Color>) -> Slider
pub fn track_colors(self, colors: impl IntoIterator<Item = Color>) -> Slider
Paints the track with these colors, evenly spaced from one end to the other, when the colors are what the value means, as from cold to warm. There is then no fill. The colors are data, so they come from whoever knows what they mean.
Sourcepub fn neutral(self, neutral: f32) -> Slider
pub fn neutral(self, neutral: f32) -> Slider
The value at rest, such as zero in the middle of the range. The fill starts there instead of at the minimum, and a double click, Backspace or Delete return to it.
Sourcepub fn show_value(self) -> Slider
pub fn show_value(self) -> Slider
Shows the value at the right of the track, with as many decimals as the step has.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Slider
impl !Send for Slider
impl !Sync for Slider
impl !UnwindSafe for Slider
impl Freeze for Slider
impl Unpin for Slider
impl UnsafeUnpin for Slider
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
Source§impl<V> ViewExt for Vwhere
V: View,
impl<V> ViewExt for Vwhere
V: View,
Source§fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
fn padding(self, padding: impl Into<Insets>) -> Styled<Self>
Source§fn background(self, fill: impl Into<Fill>) -> Styled<Self>
fn background(self, fill: impl Into<Fill>) -> Styled<Self>
Source§fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
fn frame(self, width: Option<f32>, height: Option<f32>) -> Styled<Self>
None keeps the content size.