diff --git a/src/widget/spin_button/mod.rs b/src/widget/spin_button/mod.rs index fb98b2ed..e5ef2f12 100644 --- a/src/widget/spin_button/mod.rs +++ b/src/widget/spin_button/mod.rs @@ -59,7 +59,7 @@ impl<'a, T, M> SpinButton<'a, T, M> where T: Add + Sub + PartialEq + PartialOrd + Display + Copy { - /// Create a new default spin button + /// Create a new new button pub fn new( label: impl Into, step: T, @@ -82,7 +82,7 @@ where } } -/// Shorthand function to create a default spin button +/// Shorthand function to create a new spin button pub fn spin_button<'a, T, M>( label: impl Into, step: T, @@ -98,6 +98,21 @@ where SpinButton::new(label, step, value, min, max, orientation, on_press) } +/// Shorthand to create a standard (horizontal) spin button widget +pub fn spin_button_standard<'a, T, M>( + label: impl Into, + step: T, + value: T, + min: T, + max: T, + on_press: impl Fn(T) -> M + 'static, +) -> SpinButton<'a, T, M> +where + T: Add + Sub + PartialEq + PartialOrd + Display + Copy +{ + SpinButton::new(label, step, value, min, max, None, on_press) +} + fn increment(step: T, value: T, min: T, max: T) -> T where T: Add + Sub + PartialEq + PartialOrd + Display + Copy