pub struct Slider<'ui, Label, Data, Format = &'static str> { /* private fields */ }
Expand description
Builder for a slider widget.
Implementations§
Source§impl<'ui, Label, Data, Format> Slider<'ui, Label, Data, Format>
impl<'ui, Label, Data, Format> Slider<'ui, Label, Data, Format>
Sourcepub fn range(self, min: Data, max: Data) -> Slider<'ui, Label, Data, Format>
pub fn range(self, min: Data, max: Data) -> Slider<'ui, Label, Data, Format>
Sets the range inclusively, such that both values given are valid values which the slider can be dragged to.
ui.slider_config("Example", i8::MIN, i8::MAX)
.range(4, 8)
// Remember to call .build()
;
It is safe, though up to C++ Dear ImGui, on how to handle when
min > max
.
Note for f32 and f64 sliders, Dear ImGui limits the available
range to half their full range (e.g f32::MIN/2.0 .. f32::MAX/2.0
)
Specifying a value above this will cause an abort.
For large ranged values, consider using Ui::input_scalar
instead
Sourcepub fn display_format<Format2>(
self,
display_format: Format2,
) -> Slider<'ui, Label, Data, Format2>
pub fn display_format<Format2>( self, display_format: Format2, ) -> Slider<'ui, Label, Data, Format2>
Sets the display format using a C-style printf string
Sourcepub fn flags(self, flags: SliderFlags) -> Slider<'ui, Label, Data, Format>
pub fn flags(self, flags: SliderFlags) -> Slider<'ui, Label, Data, Format>
Replaces all current settings with the given flags
Sourcepub fn build(self, value: &mut Data) -> bool
pub fn build(self, value: &mut Data) -> bool
Builds a slider that is bound to the given value.
Returns true if the slider value was changed.
Sourcepub fn build_array(self, values: &mut [Data]) -> bool
pub fn build_array(self, values: &mut [Data]) -> bool
Builds a horizontal array of multiple sliders attached to the given slice.
Returns true if any slider value was changed.
Trait Implementations§
impl<'ui, Label, Data, Format> Copy for Slider<'ui, Label, Data, Format>
Auto Trait Implementations§
impl<'ui, Label, Data, Format> Freeze for Slider<'ui, Label, Data, Format>
impl<'ui, Label, Data, Format = &'static str> !RefUnwindSafe for Slider<'ui, Label, Data, Format>
impl<'ui, Label, Data, Format = &'static str> !Send for Slider<'ui, Label, Data, Format>
impl<'ui, Label, Data, Format = &'static str> !Sync for Slider<'ui, Label, Data, Format>
impl<'ui, Label, Data, Format> Unpin for Slider<'ui, Label, Data, Format>
impl<'ui, Label, Data, Format = &'static str> !UnwindSafe for Slider<'ui, Label, Data, Format>
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