pub struct SliderState<T>where
T: RangeOp<Step: Copy + Debug> + MapRange<u16> + Debug + Default + Copy + PartialEq,
u16: MapRange<T>,{Show 15 fields
pub area: Rect,
pub inner: Rect,
pub lower_bound: Rect,
pub upper_bound: Rect,
pub track: Rect,
pub knob: Rect,
pub scale_len: u16,
pub direction: Direction,
pub range: (T, T),
pub step: <T as RangeOp>::Step,
pub long_step: Option<<T as RangeOp>::Step>,
pub value: T,
pub focus: FocusFlag,
pub mouse: MouseFlags,
pub non_exhaustive: NonExhaustive,
}Expand description
State.
Fields§
§area: RectComplete area read only. renewed for each render.
inner: RectArea inside the block without padding due to alignment. read only. renewed for each render.
lower_bound: RectLower bounds area. read only. renewed for each render.
upper_bound: RectUpper bounds area. read only. renewed for each render.
track: RectTrack char. read only. renewed for each render.
knob: RectKnob text read only. renewed for each render.
scale_len: u16Length of the track without the knob
direction: DirectionDirection read only. renewed for each render.
range: (T, T)Value range
step: <T as RangeOp>::StepMinor step.
long_step: Option<<T as RangeOp>::Step>Major step.
value: TValue
focus: FocusFlagCurrent focus state. read+write
mouse: MouseFlagsMouse helper read+write
non_exhaustive: NonExhaustiveImplementations§
Source§impl<T> SliderState<T>
impl<T> SliderState<T>
Sourcepub fn new_range(range: (T, T), step: T::Step) -> Self
pub fn new_range(range: (T, T), step: T::Step) -> Self
New state with a given range and step.
The range will still be overridden when set with the Widget.
Sourcepub fn set_value(&mut self, value: T) -> bool
pub fn set_value(&mut self, value: T) -> bool
Set the value.
Any value you set is good, there will be no bounds check. Without user interaction the same value will be returned by value().
Sourcepub fn set_long_step(&mut self, step: T::Step)
pub fn set_long_step(&mut self, step: T::Step)
Major step size.
Sourcepub fn next_major(&mut self) -> bool
pub fn next_major(&mut self) -> bool
Next value by one major step.
Sourcepub fn prev_major(&mut self) -> bool
pub fn prev_major(&mut self) -> bool
Previous value by one major step.
Sourcepub fn clicked_at(&mut self, x: u16, y: u16) -> bool
pub fn clicked_at(&mut self, x: u16, y: u16) -> bool
Clicked in the range or at the boundary. Transforms the relative screen position to a value.
Trait Implementations§
Source§impl<T> Clone for SliderState<T>
impl<T> Clone for SliderState<T>
Source§impl<T> Debug for SliderState<T>
impl<T> Debug for SliderState<T>
Source§impl Default for SliderState<f32>
impl Default for SliderState<f32>
Source§impl Default for SliderState<f64>
impl Default for SliderState<f64>
Source§impl Default for SliderState<i16>
impl Default for SliderState<i16>
Source§impl Default for SliderState<i32>
impl Default for SliderState<i32>
Source§impl Default for SliderState<i64>
impl Default for SliderState<i64>
Source§impl Default for SliderState<i8>
impl Default for SliderState<i8>
Source§impl Default for SliderState<isize>
impl Default for SliderState<isize>
Source§impl Default for SliderState<u16>
impl Default for SliderState<u16>
Source§impl Default for SliderState<u32>
impl Default for SliderState<u32>
Source§impl Default for SliderState<u64>
impl Default for SliderState<u64>
Source§impl Default for SliderState<u8>
impl Default for SliderState<u8>
Source§impl Default for SliderState<usize>
impl Default for SliderState<usize>
Source§impl<T> HandleEvent<Event, MouseOnly, SliderOutcome> for SliderState<T>
impl<T> HandleEvent<Event, MouseOnly, SliderOutcome> for SliderState<T>
Source§impl<T> HandleEvent<Event, Regular, SliderOutcome> for SliderState<T>
impl<T> HandleEvent<Event, Regular, SliderOutcome> for SliderState<T>
Source§impl<T> HasFocus for SliderState<T>
impl<T> HasFocus for SliderState<T>
Source§fn build(&self, builder: &mut FocusBuilder)
fn build(&self, builder: &mut FocusBuilder)
Source§fn is_focused(&self) -> bool
fn is_focused(&self) -> bool
Source§fn lost_focus(&self) -> bool
fn lost_focus(&self) -> bool
Source§fn gained_focus(&self) -> bool
fn gained_focus(&self) -> bool
Source§impl<T> RelocatableState for SliderState<T>
impl<T> RelocatableState for SliderState<T>
Auto Trait Implementations§
impl<T> !Freeze for SliderState<T>
impl<T> !RefUnwindSafe for SliderState<T>
impl<T> !Send for SliderState<T>
impl<T> !Sync for SliderState<T>
impl<T> Unpin for SliderState<T>
impl<T> !UnwindSafe for SliderState<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more