SliderState

Struct SliderState 

Source
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: Rect

Complete area read only. renewed for each render.

§inner: Rect

Area inside the block without padding due to alignment. read only. renewed for each render.

§lower_bound: Rect

Lower bounds area. read only. renewed for each render.

§upper_bound: Rect

Upper bounds area. read only. renewed for each render.

§track: Rect

Track char. read only. renewed for each render.

§knob: Rect

Knob text read only. renewed for each render.

§scale_len: u16

Length of the track without the knob

§direction: Direction

Direction read only. renewed for each render.

§range: (T, T)

Value range

§step: <T as RangeOp>::Step

Minor step.

§long_step: Option<<T as RangeOp>::Step>

Major step.

§value: T

Value

§focus: FocusFlag

Current focus state. read+write

§mouse: MouseFlags

Mouse helper read+write

§non_exhaustive: NonExhaustive

Implementations§

Source§

impl SliderState<u8>

Source

pub fn new() -> Self

Source§

impl SliderState<u16>

Source

pub fn new() -> Self

Source§

impl SliderState<u32>

Source

pub fn new() -> Self

Source§

impl SliderState<u64>

Source

pub fn new() -> Self

Source§

impl SliderState<usize>

Source

pub fn new() -> Self

Source§

impl SliderState<i8>

Source

pub fn new() -> Self

Source§

impl SliderState<i16>

Source

pub fn new() -> Self

Source§

impl SliderState<i32>

Source

pub fn new() -> Self

Source§

impl SliderState<i64>

Source

pub fn new() -> Self

Source§

impl SliderState<isize>

Source

pub fn new() -> Self

Source§

impl SliderState<f32>

Source

pub fn new() -> Self

Source§

impl SliderState<f64>

Source

pub fn new() -> Self

Source§

impl<T> SliderState<T>
where T: RangeOp<Step: Copy + Debug> + MapRange<u16> + Debug + Default + Copy + PartialEq, u16: MapRange<T>,

Source

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.

Source

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().

Source

pub fn value(&self) -> T

Current value.

Source

pub fn set_range(&mut self, range: (T, T))

Set the range.

Source

pub fn range(&self) -> (T, T)

Range.

Source

pub fn set_step(&mut self, step: T::Step)

Minor step size.

Source

pub fn step(&self) -> T::Step

Minor step size.

Source

pub fn set_long_step(&mut self, step: T::Step)

Major step size.

Source

pub fn long_step(&self) -> Option<T::Step>

Major step size.

Source

pub fn next(&mut self) -> bool

Next value by one step.

Source

pub fn prev(&mut self) -> bool

Previous value by one step.

Source

pub fn next_major(&mut self) -> bool

Next value by one major step.

Source

pub fn prev_major(&mut self) -> bool

Previous value by one major step.

Source

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>
where T: RangeOp<Step: Copy + Debug> + MapRange<u16> + Debug + Default + Copy + PartialEq, u16: MapRange<T>,

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for SliderState<T>
where T: RangeOp<Step: Copy + Debug> + MapRange<u16> + Debug + Default + Copy + PartialEq, u16: MapRange<T>,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for SliderState<f32>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<f64>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<i16>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<i32>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<i64>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<i8>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<isize>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<u16>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<u32>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<u64>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<u8>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Default for SliderState<usize>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T> HandleEvent<Event, MouseOnly, SliderOutcome> for SliderState<T>
where T: RangeOp<Step: Copy + Debug> + MapRange<u16> + Debug + Default + Copy + PartialEq, u16: MapRange<T>,

Source§

fn handle(&mut self, event: &Event, _keymap: MouseOnly) -> SliderOutcome

Handle an event. Read more
Source§

impl<T> HandleEvent<Event, Regular, SliderOutcome> for SliderState<T>
where T: RangeOp<Step: Copy + Debug> + MapRange<u16> + Debug + Default + Copy + PartialEq, u16: MapRange<T>,

Source§

fn handle(&mut self, event: &Event, _qualifier: Regular) -> SliderOutcome

Handle an event. Read more
Source§

impl<T> HasFocus for SliderState<T>
where T: RangeOp<Step: Copy + Debug> + MapRange<u16> + Debug + Default + Copy + PartialEq, u16: MapRange<T>,

Source§

fn build(&self, builder: &mut FocusBuilder)

Build the focus-structure for the container.
Source§

fn focus(&self) -> FocusFlag

Access to the flag for the rest.
Source§

fn area(&self) -> Rect

Area for mouse focus. Read more
Source§

fn id(&self) -> usize

Provide a unique id for the widget.
Source§

fn area_z(&self) -> u16

Z value for the area. Read more
Source§

fn navigable(&self) -> Navigation

Declares how the widget interacts with focus. Read more
Source§

fn is_focused(&self) -> bool

Focused?
Source§

fn lost_focus(&self) -> bool

Just lost focus.
Source§

fn gained_focus(&self) -> bool

Just gained focus.
Source§

impl<T> RelocatableState for SliderState<T>
where T: RangeOp<Step: Copy + Debug> + MapRange<u16> + Debug + Default + Copy + PartialEq, u16: MapRange<T>,

Source§

fn relocate(&mut self, shift: (i16, i16), clip: Rect)

Relocate the areas in this widgets state. Read more
Source§

fn relocate_hidden(&mut self)

Relocate all areas to a clip-rect (0,0+0x0).

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>
where u16: Sized, <T as RangeOp>::Step: Sized + Unpin, T: Unpin,

§

impl<T> !UnwindSafe for SliderState<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.