pub struct Slider<T, D>where
T: SliderValue,
D: Directional,{ /* private fields */ }
Expand description
A slider
Sliders allow user input of a value from a fixed range.
Implementations§
source§impl<T, D> Slider<T, D>where
T: SliderValue,
D: Directional + Default,
impl<T, D> Slider<T, D>where T: SliderValue, D: Directional + Default,
sourcepub fn new(range: RangeInclusive<T>, step: T) -> Slider<T, D>
pub fn new(range: RangeInclusive<T>, step: T) -> Slider<T, D>
Construct a slider
Values vary within the given range
. When keyboard navigation
is used, arrow keys will increment the value by step
and page up/down
keys by step * 16
.
The initial value defaults to the range’s
lower bound but may be specified via Slider::with_value
.
source§impl<T, D> Slider<T, D>where
T: SliderValue,
D: Directional,
impl<T, D> Slider<T, D>where T: SliderValue, D: Directional,
sourcepub fn new_with_direction(
range: RangeInclusive<T>,
step: T,
direction: D
) -> Slider<T, D>
pub fn new_with_direction( range: RangeInclusive<T>, step: T, direction: D ) -> Slider<T, D>
Construct a slider with the given direction
Values vary within the given range
. When keyboard navigation
is used, arrow keys will increment the value by step
and page up/down
keys by step * 16
.
The initial value defaults to the range’s
lower bound but may be specified via Slider::with_value
.
sourcepub fn on_move<F>(self, f: F) -> Slider<T, D>where
F: Fn(&mut EventMgr<'_>, T) + 'static,
pub fn on_move<F>(self, f: F) -> Slider<T, D>where F: Fn(&mut EventMgr<'_>, T) + 'static,
Set event handler f
This closure is called when the slider is moved.
sourcepub fn with_value(self, value: T) -> Slider<T, D>
pub fn with_value(self, value: T) -> Slider<T, D>
Set the initial value
sourcepub fn set_value(&mut self, value: T) -> Action
pub fn set_value(&mut self, value: T) -> Action
Set the value
Returns Action::REDRAW
if a redraw is required.
Trait Implementations§
source§impl<T, D> Clone for Slider<T, D>where
T: Clone + SliderValue,
D: Clone + Directional,
impl<T, D> Clone for Slider<T, D>where T: Clone + SliderValue, D: Clone + Directional,
source§impl<T, D> Debug for Slider<T, D>where
T: SliderValue,
D: Directional,
impl<T, D> Debug for Slider<T, D>where T: SliderValue, D: Directional,
source§impl<T, D> Layout for Slider<T, D>where
T: SliderValue,
D: Directional,
impl<T, D> Layout for Slider<T, D>where T: SliderValue, D: Directional,
source§impl<T, D> Widget for Slider<T, D>where
T: SliderValue,
D: Directional,
impl<T, D> Widget for Slider<T, D>where T: SliderValue, D: Directional,
source§fn handle_message(&mut self, mgr: &mut EventMgr<'_>)
fn handle_message(&mut self, mgr: &mut EventMgr<'_>)
source§fn translation(&self) -> Offset
fn translation(&self) -> Offset
source§fn steal_event(
&mut self,
mgr: &mut EventMgr<'_>,
id: &WidgetId,
event: &Event
) -> Response
fn steal_event( &mut self, mgr: &mut EventMgr<'_>, id: &WidgetId, event: &Event ) -> Response
source§impl<T, D> WidgetChildren for Slider<T, D>where
T: SliderValue,
D: Directional,
impl<T, D> WidgetChildren for Slider<T, D>where T: SliderValue, D: Directional,
source§fn num_children(&self) -> usize
fn num_children(&self) -> usize
source§fn get_child(&self, _index: usize) -> Option<&dyn Widget>
fn get_child(&self, _index: usize) -> Option<&dyn Widget>
None
if the index is
out of bounds. Read moresource§fn get_child_mut(&mut self, _index: usize) -> Option<&mut dyn Widget>
fn get_child_mut(&mut self, _index: usize) -> Option<&mut dyn Widget>
source§impl<T, D> WidgetCore for Slider<T, D>where
T: SliderValue,
D: Directional,
impl<T, D> WidgetCore for Slider<T, D>where T: SliderValue, D: Directional,
source§fn widget_name(&self) -> &'static str
fn widget_name(&self) -> &'static str
source§fn as_widget_mut(&mut self) -> &mut dyn Widget
fn as_widget_mut(&mut self) -> &mut dyn Widget
Auto Trait Implementations§
impl<T, D> !RefUnwindSafe for Slider<T, D>
impl<T, D> !Send for Slider<T, D>
impl<T, D> !Sync for Slider<T, D>
impl<T, D> Unpin for Slider<T, D>where D: Unpin, T: Unpin,
impl<T, D> !UnwindSafe for Slider<T, D>
Blanket Implementations§
source§impl<W> AdaptWidget for Wwhere
W: Widget + ?Sized,
impl<W> AdaptWidget for Wwhere W: Widget + ?Sized,
source§fn map_msg<M, N, F>(self, f: F) -> MapMessage<Self, M, N, F>where
M: Debug,
N: Debug,
Self: Sized,
F: FnMut(M) -> N,
fn map_msg<M, N, F>(self, f: F) -> MapMessage<Self, M, N, F>where M: Debug, N: Debug, Self: Sized, F: FnMut(M) -> N,
source§fn with_reserve<R>(self, r: R) -> Reserve<Self, R>where
R: FnMut(SizeMgr<'_>, AxisInfo) -> SizeRules,
Self: Sized,
fn with_reserve<R>(self, r: R) -> Reserve<Self, R>where R: FnMut(SizeMgr<'_>, AxisInfo) -> SizeRules, Self: Sized,
source§fn with_min_size_px(self, w: i32, h: i32) -> Reserve<Self, WithMinSizePx>where
Self: Sized,
fn with_min_size_px(self, w: i32, h: i32) -> Reserve<Self, WithMinSizePx>where Self: Sized,
source§fn with_min_size_em(self, w: f32, h: f32) -> Reserve<Self, WithMinSizeEm>where
Self: Sized,
fn with_min_size_em(self, w: f32, h: f32) -> Reserve<Self, WithMinSizeEm>where Self: Sized,
source§fn with_label<D, T>(self, direction: D, label: T) -> WithLabel<Self, D>where
D: Directional,
T: Into<AccelString>,
Self: Sized,
fn with_label<D, T>(self, direction: D, label: T) -> WithLabel<Self, D>where D: Directional, T: Into<AccelString>, Self: Sized,
§impl<S, T> CastApprox<T> for Swhere
T: ConvApprox<S>,
impl<S, T> CastApprox<T> for Swhere T: ConvApprox<S>,
§fn try_cast_approx(self) -> Result<T, Error>
fn try_cast_approx(self) -> Result<T, Error>
§fn cast_approx(self) -> T
fn cast_approx(self) -> T
§impl<S, T> CastFloat<T> for Swhere
T: ConvFloat<S>,
impl<S, T> CastFloat<T> for Swhere T: ConvFloat<S>,
§fn cast_trunc(self) -> T
fn cast_trunc(self) -> T
§fn cast_nearest(self) -> T
fn cast_nearest(self) -> T
§fn cast_floor(self) -> T
fn cast_floor(self) -> T
§fn try_cast_trunc(self) -> Result<T, Error>
fn try_cast_trunc(self) -> Result<T, Error>
§fn try_cast_nearest(self) -> Result<T, Error>
fn try_cast_nearest(self) -> Result<T, Error>
§fn try_cast_floor(self) -> Result<T, Error>
fn try_cast_floor(self) -> Result<T, Error>
§fn try_cast_ceil(self) -> Result<T, Error>
fn try_cast_ceil(self) -> Result<T, Error>
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>
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<W> WidgetExt for Wwhere
W: Widget + ?Sized,
impl<W> WidgetExt for Wwhere W: Widget + ?Sized,
source§fn eq_id<T>(&self, rhs: T) -> boolwhere
WidgetId: PartialEq<T>,
fn eq_id<T>(&self, rhs: T) -> boolwhere WidgetId: PartialEq<T>,
source§fn identify(&self) -> IdentifyWidget
fn identify(&self) -> IdentifyWidget
source§fn is_ancestor_of(&self, id: &WidgetId) -> bool
fn is_ancestor_of(&self, id: &WidgetId) -> bool
id
is self or a descendant Read moresource§fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
fn is_strict_ancestor_of(&self, id: &WidgetId) -> bool
id
is not self and is a descendant Read more