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>where
Label: AsRef<str>,
Data: DataTypeKind,
Format: AsRef<str>,
impl<'ui, Label, Data, Format> Slider<'ui, Label, Data, Format>where
Label: AsRef<str>,
Data: DataTypeKind,
Format: AsRef<str>,
sourcepub fn range(self, min: Data, max: Data) -> Self
pub fn range(self, min: Data, max: Data) -> Self
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: AsRef<str>>(
self,
display_format: Format2
) -> Slider<'ui, Label, Data, Format2>
pub fn display_format<Format2: AsRef<str>>(
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) -> Self
pub fn flags(self, flags: SliderFlags) -> Self
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.