pub struct NumericTypeSettings {Show 15 fields
pub widget: NumericWidgetKind,
pub range: NumericRange,
pub speed: Option<f64>,
pub step: Option<f64>,
pub step_fast: Option<f64>,
pub format: Option<String>,
pub log: bool,
pub clamp: bool,
pub always_clamp: bool,
pub wrap_around: bool,
pub no_round_to_format: bool,
pub no_input: bool,
pub clamp_on_input: bool,
pub clamp_zero_range: bool,
pub no_speed_tweaks: bool,
}Expand description
Type-level settings controlling how a particular numeric primitive type is rendered.
Fields§
§widget: NumericWidgetKindDefault widget kind for this numeric type.
range: NumericRangeDefault range behavior for this numeric type.
speed: Option<f64>Default drag speed (for drag widgets), stored as f64.
step: Option<f64>Default step size (for input widgets), stored as f64.
step_fast: Option<f64>Default fast step size (for input widgets), stored as f64.
format: Option<String>Default printf-style numeric format, if any.
log: boolLogarithmic scale flag for slider/drag widgets.
clamp: boolPost-edit manual clamp (our own helper, distinct from ImGui flags).
always_clamp: boolAlways-clamp flag for slider/drag widgets.
wrap_around: boolWrap-around flag for slider widgets.
no_round_to_format: boolDisable rounding to format for slider/drag widgets.
no_input: boolDisable direct text input on sliders.
clamp_on_input: boolClamp when editing via text input.
clamp_zero_range: boolClamp zero-range behavior.
no_speed_tweaks: boolDisable built-in speed tweaks for drag widgets.
Implementations§
Source§impl NumericTypeSettings
impl NumericTypeSettings
Sourcepub fn with_format<S: Into<String>>(self, fmt: S) -> Self
pub fn with_format<S: Into<String>>(self, fmt: S) -> Self
Set an explicit printf-style format string for this numeric type.
This is a convenience helper for configuring the underlying ImGui
scalar/slider/drag widgets, equivalent to assigning format directly.
Sourcepub fn without_format(self) -> Self
pub fn without_format(self) -> Self
Clear any explicit format and fall back to Dear ImGui’s defaults.
Sourcepub fn with_decimal(self) -> Self
pub fn with_decimal(self) -> Self
Decimal integer format (%d).
Intended for signed integer types such as i32.
Sourcepub fn with_unsigned(self) -> Self
pub fn with_unsigned(self) -> Self
Unsigned decimal integer format (%u).
Intended for unsigned integer types such as u32.
Sourcepub fn with_octal(self) -> Self
pub fn with_octal(self) -> Self
Octal integer format (%o).
Sourcepub fn with_int_padded(self, width: u32, pad_char: char) -> Self
pub fn with_int_padded(self, width: u32, pad_char: char) -> Self
Padded decimal integer format, e.g. width=4, pad_char=‘0’ -> %04d.
This is a small convenience for typical zero-padded integer displays; callers should ensure the format matches the underlying numeric type.
Sourcepub fn with_char(self) -> Self
pub fn with_char(self) -> Self
Character format (%c), useful for small integer types interpreted as chars.
Sourcepub fn with_float(self, precision: u32) -> Self
pub fn with_float(self, precision: u32) -> Self
Floating-point format %.Nf, e.g. precision=3 -> %.3f.
Sourcepub fn with_double(self, precision: u32) -> Self
pub fn with_double(self, precision: u32) -> Self
Double format %.Nlf, primarily for parity with ImReflect’s helpers.
Sourcepub fn with_scientific(self, precision: u32, uppercase: bool) -> Self
pub fn with_scientific(self, precision: u32, uppercase: bool) -> Self
Scientific notation %.Ne / %.NE.
Sourcepub fn with_percentage(self, precision: u32) -> Self
pub fn with_percentage(self, precision: u32) -> Self
Percentage format %.Nf%% (e.g. 12.3%).
Sourcepub fn slider_0_to_1(self, precision: u32) -> Self
pub fn slider_0_to_1(self, precision: u32) -> Self
Convenience preset: slider in the range [0, 1] with clamping and a
floating-point display format %.Nf.
This is primarily intended for floating-point types (f32 / f64).
Sourcepub fn slider_minus1_to_1(self, precision: u32) -> Self
pub fn slider_minus1_to_1(self, precision: u32) -> Self
Convenience preset: slider in the range [-1, 1] with clamping and a
floating-point display format %.Nf.
This is primarily intended for floating-point types (f32 / f64).
Sourcepub fn drag_with_speed(self, speed: f64, precision: u32) -> Self
pub fn drag_with_speed(self, speed: f64, precision: u32) -> Self
Convenience preset: drag widget with a given speed and floating-point
display format %.Nf.
This is primarily intended for floating-point types.
Sourcepub fn percentage_slider_0_to_1(self, precision: u32) -> Self
pub fn percentage_slider_0_to_1(self, precision: u32) -> Self
Convenience preset: slider in [0, 1] displayed as a percentage
%.Nf%% with clamping.
This expects the underlying numeric value to live in the 0..1 range.
Trait Implementations§
Source§impl Clone for NumericTypeSettings
impl Clone for NumericTypeSettings
Source§fn clone(&self) -> NumericTypeSettings
fn clone(&self) -> NumericTypeSettings
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more