diff --git a/src/Eto.Gtk/Forms/Controls/ProgressBarHandler.cs b/src/Eto.Gtk/Forms/Controls/ProgressBarHandler.cs index 9ca8764c69..e54ee93d25 100644 --- a/src/Eto.Gtk/Forms/Controls/ProgressBarHandler.cs +++ b/src/Eto.Gtk/Forms/Controls/ProgressBarHandler.cs @@ -5,8 +5,8 @@ namespace Eto.GtkSharp.Forms.Controls { public class ProgressBarHandler : GtkControl, ProgressBar.IHandler { - int minValue; - int maxValue = 100; + double minValue; + double maxValue = 100; bool indeterminate; UITimer timer; public static double UpdateInterval = 0.2; @@ -64,7 +64,7 @@ public bool Indeterminate } } - public int MaxValue + public double MaxValue { get { return maxValue; } set @@ -75,7 +75,7 @@ public int MaxValue } } - public int MinValue + public double MinValue { get { return minValue; } set @@ -86,12 +86,12 @@ public int MinValue } } - public int Value + public double Value { - get { return (int)((Control.Fraction * MaxValue) + MinValue); } + get { return Control.Fraction * MaxValue + MinValue; } set { - Control.Fraction = Math.Max(0, Math.Min(1, ((double)value - MinValue) / (double)MaxValue)); + Control.Fraction = Math.Max(0, Math.Min(1, (value - MinValue) / MaxValue)); } } diff --git a/src/Eto.Gtk/Forms/Controls/SliderHandler.cs b/src/Eto.Gtk/Forms/Controls/SliderHandler.cs index edd022bb00..e277a704ea 100644 --- a/src/Eto.Gtk/Forms/Controls/SliderHandler.cs +++ b/src/Eto.Gtk/Forms/Controls/SliderHandler.cs @@ -5,9 +5,9 @@ namespace Eto.GtkSharp.Forms.Controls { public class SliderHandler : GtkControl, Slider.IHandler { - int min; - int max = 100; - int tick = 1; + double min; + double max = 100; + double tick = 1; Gtk.Scale scale; public SliderHandler() @@ -33,7 +33,7 @@ protected override WeakConnector CreateConnector() protected class SliderConnector : GtkControlConnector { - int? lastValue; + double? lastValue; public new SliderHandler Handler { get { return (SliderHandler)base.Handler; } } @@ -41,7 +41,7 @@ public void HandleScaleValueChanged(object sender, EventArgs e) { var scale = Handler.scale; var tick = Handler.tick; - var value = (int)scale.Value; + var value = scale.Value; if (tick > 0) { var offset = value % tick; @@ -64,7 +64,7 @@ public void HandleScaleValueChanged(object sender, EventArgs e) } } - public int MaxValue + public double MaxValue { get { return max; } set @@ -74,7 +74,7 @@ public int MaxValue } } - public int MinValue + public double MinValue { get { return min; } set @@ -84,15 +84,15 @@ public int MinValue } } - public int Value + public double Value { - get { return (int)scale.Value; } + get { return scale.Value; } set { scale.Value = value; } } public bool SnapToTick { get; set; } - public int TickFrequency + public double TickFrequency { get { diff --git a/src/Eto.Mac/Forms/Controls/ProgressBarHandler.cs b/src/Eto.Mac/Forms/Controls/ProgressBarHandler.cs index e0dbe4ee57..7a2d5fe5d4 100644 --- a/src/Eto.Mac/Forms/Controls/ProgressBarHandler.cs +++ b/src/Eto.Mac/Forms/Controls/ProgressBarHandler.cs @@ -76,7 +76,8 @@ protected override SizeF GetNaturalSize (SizeF availableSize) return new Size (80, 30); } - public bool Indeterminate { + public bool Indeterminate + { get { return Control.Indeterminate; } set { Control.Indeterminate = value; @@ -87,22 +88,21 @@ public bool Indeterminate { } } - public int MaxValue { - get { return (int)Control.MaxValue; } - set { - Control.MaxValue = value; - } + public double MaxValue + { + get { return Control.MaxValue; } + set { Control.MaxValue = value; } } - public int MinValue { - get { return (int)Control.MinValue; } - set { - Control.MinValue = value; - } + public double MinValue + { + get { return Control.MinValue; } + set { Control.MinValue = value; } } - public int Value { - get { return (int)Control.DoubleValue; } + public double Value + { + get { return Control.DoubleValue; } set { Control.DoubleValue = value; } } } diff --git a/src/Eto.Mac/Forms/Controls/SliderHandler.cs b/src/Eto.Mac/Forms/Controls/SliderHandler.cs index 37083739c5..863accbc2c 100644 --- a/src/Eto.Mac/Forms/Controls/SliderHandler.cs +++ b/src/Eto.Mac/Forms/Controls/SliderHandler.cs @@ -76,10 +76,6 @@ static void HandleActivated(object sender, EventArgs e) { handler.TriggerMouseCallback(); - var newval = (int)Math.Round(handler.Control.DoubleValue); - if (newval != handler.Control.IntValue) - handler.Control.IntValue = newval; - handler.Callback.OnValueChanged(handler.Widget, EventArgs.Empty); } } @@ -89,9 +85,9 @@ protected override SizeF GetNaturalSize(SizeF availableSize) return Orientation == Orientation.Horizontal ? new Size(80, 30) : new Size(30, 80); } - public int MaxValue + public double MaxValue { - get { return (int)Control.MaxValue; } + get { return Control.MaxValue; } set { var old = TickFrequency; @@ -100,9 +96,9 @@ public int MaxValue } } - public int MinValue + public double MinValue { - get { return (int)Control.MinValue; } + get { return Control.MinValue; } set { var old = TickFrequency; @@ -111,10 +107,10 @@ public int MinValue } } - public int Value + public double Value { - get { return Control.IntValue; } - set { Control.IntValue = value; } + get { return Control.DoubleValue; } + set { Control.DoubleValue = value; } } public bool SnapToTick @@ -123,17 +119,17 @@ public bool SnapToTick set { Control.AllowsTickMarkValuesOnly = value; } } - public int TickFrequency + public double TickFrequency { get { if (Control.TickMarksCount > 1) - return (int)((MaxValue - MinValue) / (Control.TickMarksCount - 1)); + return (MaxValue - MinValue) / (Control.TickMarksCount - 1); return 0; } set { - Control.TickMarksCount = value > 0 ? ((MaxValue - MinValue) / value) + 1 : 0; + Control.TickMarksCount = value > 0 ? (MaxValue - MinValue) / value + 1 : 0; } } diff --git a/src/Eto.WinForms/Forms/Controls/ProgressBarHandler.cs b/src/Eto.WinForms/Forms/Controls/ProgressBarHandler.cs index be6c713f79..ad67cd3d29 100644 --- a/src/Eto.WinForms/Forms/Controls/ProgressBarHandler.cs +++ b/src/Eto.WinForms/Forms/Controls/ProgressBarHandler.cs @@ -25,19 +25,19 @@ public bool Indeterminate { } } - public int MaxValue { + public double MaxValue { get { return Control.Maximum; } - set { Control.Maximum = value; } + set { Control.Maximum = (int)value; } } - public int MinValue { + public double MinValue { get { return Control.Minimum; } - set { Control.Minimum = value; } + set { Control.Minimum = (int)value; } } - public int Value { + public double Value { get { return Control.Value; } - set { Control.Value = value; } + set { Control.Value = (int)value; } } } } diff --git a/src/Eto.WinForms/Forms/Controls/SliderHandler.cs b/src/Eto.WinForms/Forms/Controls/SliderHandler.cs index d5bf070050..89255e6b73 100644 --- a/src/Eto.WinForms/Forms/Controls/SliderHandler.cs +++ b/src/Eto.WinForms/Forms/Controls/SliderHandler.cs @@ -8,7 +8,7 @@ namespace Eto.WinForms.Forms.Controls { public class SliderHandler : WindowsControl, Slider.IHandler { - int? lastValue; + double? lastValue; class EtoTrackBar : swf.TrackBar { @@ -57,32 +57,32 @@ void HandleScaleValueChanged(object sender, EventArgs e) } } - public int MaxValue + public double MaxValue { get { return Control.Maximum; } - set { Control.Maximum = value; } + set { Control.Maximum = (int)value; } } - public int MinValue + public double MinValue { get { return Control.Minimum; } - set { Control.Minimum = value; } + set { Control.Minimum = (int)value; } } - public int Value + public double Value { get { return Control.Value; } - set { Control.Value = value; } + set { Control.Value = (int)value; } } public bool SnapToTick { get; set; } - public int TickFrequency + public double TickFrequency { get { return Control.TickFrequency; } set { - Control.TickFrequency = value; + Control.TickFrequency = (int)value; } } diff --git a/src/Eto.Wpf/Forms/Controls/ProgressBarHandler.cs b/src/Eto.Wpf/Forms/Controls/ProgressBarHandler.cs index 939c485fa9..5290b95da6 100644 --- a/src/Eto.Wpf/Forms/Controls/ProgressBarHandler.cs +++ b/src/Eto.Wpf/Forms/Controls/ProgressBarHandler.cs @@ -52,19 +52,19 @@ public ProgressBarHandler() }; } - public int MaxValue + public double MaxValue { get { return (int)Control.Maximum; } set { Control.Maximum = value; } } - public int MinValue + public double MinValue { get { return (int)Control.Minimum; } set { Control.Minimum = value; } } - public int Value + public double Value { get { return (int)Control.Value; } set { Control.Value = value; } diff --git a/src/Eto.Wpf/Forms/Controls/SliderHandler.cs b/src/Eto.Wpf/Forms/Controls/SliderHandler.cs index 2842ba4263..8932528d8d 100644 --- a/src/Eto.Wpf/Forms/Controls/SliderHandler.cs +++ b/src/Eto.Wpf/Forms/Controls/SliderHandler.cs @@ -43,21 +43,21 @@ protected override sw.Size DefaultSize public override bool UseKeyPreview { get { return true; } } - public int MaxValue + public double MaxValue { - get { return (int)Control.Maximum; } + get { return Control.Maximum; } set { Control.Maximum = value; } } - public int MinValue + public double MinValue { - get { return (int)Control.Minimum; } + get { return Control.Minimum; } set { Control.Minimum = value; } } - public int Value + public double Value { - get { return (int)Control.Value; } + get { return Control.Value; } set { Control.Value = value; } } @@ -67,9 +67,9 @@ public bool SnapToTick set { Control.IsSnapToTickEnabled = value; } } - public int TickFrequency + public double TickFrequency { - get { return (int)Control.TickFrequency; } + get { return Control.TickFrequency; } set { Control.TickFrequency = value; } } diff --git a/src/Eto/Forms/Controls/ProgressBar.cs b/src/Eto/Forms/Controls/ProgressBar.cs index 9451755788..be9d6eeb80 100644 --- a/src/Eto/Forms/Controls/ProgressBar.cs +++ b/src/Eto/Forms/Controls/ProgressBar.cs @@ -17,7 +17,7 @@ public class ProgressBar : Control /// /// The maximum value. [DefaultValue(100)] - public int MaxValue + public double MaxValue { get { return Handler.MaxValue; } set { Handler.MaxValue = value; } @@ -27,7 +27,7 @@ public int MaxValue /// Gets or sets the minimum value of the progress that represents 0% complete. The default is 0. /// /// The minimum value. - public int MinValue + public double MinValue { get { return Handler.MinValue; } set { Handler.MinValue = value; } @@ -37,7 +37,7 @@ public int MinValue /// Gets or sets the current progress that falls between and /// /// The value. - public int Value + public double Value { get { return Handler.Value; } set { Handler.Value = value; } @@ -66,19 +66,19 @@ public bool Indeterminate /// Gets or sets the value of the progress bar that represents 100% complete. The default is 100. /// /// The maximum value. - int MaxValue { get; set; } + double MaxValue { get; set; } /// /// Gets or sets the minimum value of the progress that represents 0% complete. The default is 0. /// /// The minimum value. - int MinValue { get; set; } + double MinValue { get; set; } /// /// Gets or sets the current progress that falls between and /// /// The value. - int Value { get; set; } + double Value { get; set; } /// /// Gets or sets a value indicating whether the progress is indeterminate diff --git a/src/Eto/Forms/Controls/Slider.cs b/src/Eto/Forms/Controls/Slider.cs index 3b23d92fa1..545a4823ca 100644 --- a/src/Eto/Forms/Controls/Slider.cs +++ b/src/Eto/Forms/Controls/Slider.cs @@ -32,7 +32,7 @@ protected virtual void OnValueChanged(EventArgs e) /// This is for visual representation only, unless the is set to true. /// /// The tick frequency. - public int TickFrequency + public double TickFrequency { get { return Handler.TickFrequency; } set { Handler.TickFrequency = value; } @@ -57,7 +57,7 @@ public bool SnapToTick /// Gets or sets the maximum value that can be set by the user. /// /// The maximum value. - public int MaxValue + public double MaxValue { get { return Handler.MaxValue; } set { Handler.MaxValue = value; } @@ -67,7 +67,7 @@ public int MaxValue /// Gets or sets the minimum value that can be set by the user. /// /// The minimum value. - public int MinValue + public double MinValue { get { return Handler.MinValue; } set { Handler.MinValue = value; } @@ -77,7 +77,7 @@ public int MinValue /// Gets or sets the current slider value. /// /// The value. - public int Value + public double Value { get { return Handler.Value; } set { Handler.Value = value; } @@ -87,11 +87,11 @@ public int Value /// Gets the binding for the property. /// /// The value binding. - public BindableBinding ValueBinding + public BindableBinding ValueBinding { get { - return new BindableBinding( + return new BindableBinding( this, c => c.Value, (c, v) => c.Value = v, @@ -160,19 +160,19 @@ public void OnValueChanged(Slider widget, EventArgs e) /// Gets or sets the maximum value that can be set by the user. /// /// The maximum value. - int MaxValue { get; set; } + double MaxValue { get; set; } /// /// Gets or sets the minimum value that can be set by the user. /// /// The minimum value. - int MinValue { get; set; } + double MinValue { get; set; } /// /// Gets or sets the current slider value. /// /// The value. - int Value { get; set; } + double Value { get; set; } /// /// Gets or sets the hint for numeric value between each visual tick. @@ -181,7 +181,7 @@ public void OnValueChanged(Slider widget, EventArgs e) /// This is for visual representation only, unless the is set to true. /// /// The tick frequency. - int TickFrequency { get; set; } + double TickFrequency { get; set; } /// /// Gets or sets a value indicating whether the slider will snap to each tick.