Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Slight tweak to remove the private events in Window.
- Loading branch information
Showing
11 changed files
with
221 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
Source/Eto.Platform.Gtk/Forms/Controls/ProgressBarHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using Eto.Forms; | ||
|
||
namespace Eto.Platform.GtkSharp.Forms.Controls | ||
{ | ||
public class ProgressBarHandler : GtkControl<Gtk.ProgressBar, ProgressBar>, IProgressBar | ||
{ | ||
public ProgressBarHandler() | ||
{ | ||
this.Control = new Gtk.ProgressBar (); | ||
MinValue = 0; | ||
MaxValue = 100; | ||
this.Control.Fraction = 0; | ||
} | ||
|
||
|
||
public int MaxValue { get; set; } | ||
|
||
public int MinValue { get;set; } | ||
|
||
public int Value { | ||
get { | ||
return (int)((Control.Fraction * MaxValue) + MinValue); | ||
} | ||
set { | ||
Control.Fraction = ((double)value - MinValue) / (double)MaxValue; | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
Source/Eto.Platform.Mac/Forms/Controls/ProgressBarHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using MonoMac.AppKit; | ||
using Eto.Forms; | ||
using Eto.Drawing; | ||
|
||
namespace Eto.Platform.Mac.Forms.Controls | ||
{ | ||
public class ProgressBarHandler : MacView<NSProgressIndicator, ProgressBar>, IProgressBar | ||
{ | ||
public class EtoSlider : NSProgressIndicator, IMacControl | ||
{ | ||
public object Handler { get; set; } | ||
|
||
} | ||
|
||
public ProgressBarHandler () | ||
{ | ||
Control = new EtoSlider { Handler = this }; | ||
|
||
MinValue = 0; | ||
MaxValue = 100; | ||
} | ||
|
||
protected override Size GetNaturalSize() | ||
{ | ||
return new Size(80, 30); | ||
} | ||
|
||
|
||
public override bool Enabled | ||
{ | ||
get { return true; } | ||
set { } | ||
} | ||
|
||
|
||
public int MaxValue { | ||
get { return (int)Control.MaxValue; } | ||
set { | ||
Control.MaxValue = value; | ||
} | ||
} | ||
|
||
public int MinValue { | ||
get { return (int)Control.MinValue; } | ||
set { | ||
Control.MinValue = value; | ||
} | ||
} | ||
|
||
public int Value { | ||
get { return (int)Control.DoubleValue; } | ||
set { Control.DoubleValue = value; } | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
Source/Eto.Platform.Windows/Forms/Controls/ProgressBarHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using SWF = System.Windows.Forms; | ||
using Eto.Forms; | ||
|
||
namespace Eto.Platform.Windows.Forms.Controls | ||
{ | ||
public class ProgressBarHandler : WindowsControl<SWF.ProgressBar, ProgressBar>, IProgressBar | ||
{ | ||
|
||
public ProgressBarHandler() | ||
{ | ||
this.Control = new SWF.ProgressBar { | ||
Maximum = 100 | ||
}; | ||
} | ||
|
||
public override void OnLoad(EventArgs e) | ||
{ | ||
base.OnLoad(e); | ||
} | ||
|
||
public int MaxValue { | ||
get { return this.Control.Maximum; } | ||
set { this.Control.Maximum = value; } | ||
} | ||
|
||
public int MinValue { | ||
get { return this.Control.Minimum; } | ||
set { this.Control.Minimum = value; } | ||
} | ||
|
||
public int Value { | ||
get { return this.Control.Value; } | ||
set { this.Control.Value = value; } | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
Source/Eto.Platform.Wpf/Forms/Controls/ProgressBarHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using swc = System.Windows.Controls; | ||
using Eto.Forms; | ||
|
||
namespace Eto.Platform.Wpf.Forms.Controls | ||
{ | ||
public class ProgressBarHandler : WpfControl<swc.ProgressBar, ProgressBar>, IProgressBar | ||
{ | ||
public ProgressBarHandler() | ||
{ | ||
Control = new swc.ProgressBar { | ||
Minimum = 0, | ||
Maximum = 100 | ||
}; | ||
} | ||
|
||
public int MaxValue | ||
{ | ||
get { return (int)Control.Maximum; } | ||
set { Control.Maximum = value; } | ||
} | ||
|
||
public int MinValue | ||
{ | ||
get { return (int)Control.Minimum; } | ||
set { Control.Minimum = value; } | ||
} | ||
|
||
public int Value | ||
{ | ||
get { return (int)Control.Value; } | ||
set { Control.Value = value; } | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
|
||
namespace Eto.Forms | ||
{ | ||
|
||
public interface IProgressBar : IControl | ||
{ | ||
int MaxValue { get; set; } | ||
|
||
int MinValue { get; set; } | ||
|
||
int Value { get; set; } | ||
} | ||
|
||
public class ProgressBar : Control | ||
{ | ||
IProgressBar inner; | ||
|
||
public ProgressBar () | ||
: this(Generator.Current) | ||
{ | ||
} | ||
|
||
public ProgressBar(Generator generator) | ||
: base(generator, typeof(IProgressBar), true) | ||
{ | ||
inner = (IProgressBar)Handler; | ||
} | ||
|
||
|
||
public int MaxValue { | ||
get { return inner.MaxValue; } | ||
set { inner.MaxValue = value; } | ||
} | ||
|
||
public int MinValue { | ||
get { return inner.MinValue; } | ||
set { inner.MinValue = value; } | ||
} | ||
|
||
public int Value { | ||
get { return inner.Value; } | ||
set { inner.Value = value; } | ||
} | ||
|
||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters