Permalink
Browse files

Standardize default constructors (needed for xaml), pass null as gene…

…rator instead of Generator.Current for better flexibility in the future (e.g. design mode)
  • Loading branch information...
1 parent 56a913a commit 5d7701da837f13ec56e967f62d49a4510a87b8cc @cwensley cwensley committed Nov 14, 2013
Showing with 275 additions and 228 deletions.
  1. +1 −1 Source/Eto/Drawing/Bitmap.cs
  2. +6 −1 Source/Eto/Drawing/GraphicsPath.cs
  3. +7 −7 Source/Eto/Drawing/Icon.cs
  4. +2 −2 Source/Eto/Drawing/IndexedBitmap.cs
  5. +2 −2 Source/Eto/Drawing/Region.cs
  6. +3 −3 Source/Eto/Forms/Actions/ActionCollection.cs
  7. +1 −1 Source/Eto/Forms/Actions/RadioAction.desktop.cs
  8. +5 −5 Source/Eto/Forms/Cells/CheckBoxCell.cs
  9. +3 −3 Source/Eto/Forms/Cells/ComboBoxCell.cs
  10. +4 −4 Source/Eto/Forms/Cells/DrawableCell.cs
  11. +5 −5 Source/Eto/Forms/Cells/ImageTextCell.cs
  12. +5 −5 Source/Eto/Forms/Cells/ImageViewCell.cs
  13. +5 −5 Source/Eto/Forms/Cells/TextBoxCell.cs
  14. +3 −3 Source/Eto/Forms/Clipboard.cs
  15. +5 −5 Source/Eto/Forms/ColorDialog.cs
  16. +5 −4 Source/Eto/Forms/Controls/CheckBox.cs
  17. +8 −6 Source/Eto/Forms/Controls/ComboBox.cs
  18. +3 −3 Source/Eto/Forms/Controls/DateTimePicker.cs
  19. +1 −1 Source/Eto/Forms/Controls/Drawable.cs
  20. +2 −2 Source/Eto/Forms/Controls/Drawable.mobile.cs
  21. +3 −3 Source/Eto/Forms/Controls/EnumComboBox.cs
  22. +6 −6 Source/Eto/Forms/Controls/GridColumn.cs
  23. +3 −3 Source/Eto/Forms/Controls/GridView.cs
  24. +4 −3 Source/Eto/Forms/Controls/GroupBox.cs
  25. +5 −5 Source/Eto/Forms/Controls/ImageView.cs
  26. +6 −3 Source/Eto/Forms/Controls/Label.cs
  27. +4 −3 Source/Eto/Forms/Controls/ListBox.cs
  28. +5 −5 Source/Eto/Forms/Controls/Navigation.cs
  29. +3 −2 Source/Eto/Forms/Controls/NumericUpDown.cs
  30. +10 −9 Source/Eto/Forms/Controls/Panel.cs
  31. +4 −3 Source/Eto/Forms/Controls/PasswordBox.cs
  32. +2 −2 Source/Eto/Forms/Controls/ProgressBar.cs
  33. +6 −5 Source/Eto/Forms/Controls/RadioButton.cs
  34. +3 −2 Source/Eto/Forms/Controls/Scrollable.cs
  35. +7 −6 Source/Eto/Forms/Controls/SearchBox.cs
  36. +3 −3 Source/Eto/Forms/Controls/Slider.cs
  37. +3 −2 Source/Eto/Forms/Controls/Splitter.cs
  38. +3 −2 Source/Eto/Forms/Controls/TabControl.cs
  39. +2 −2 Source/Eto/Forms/Controls/TextArea.cs
  40. +7 −6 Source/Eto/Forms/Controls/TextBox.cs
  41. +2 −2 Source/Eto/Forms/Controls/TreeGridView.cs
  42. +3 −2 Source/Eto/Forms/Controls/TreeView.cs
  43. +1 −1 Source/Eto/Forms/Controls/WebView.cs
  44. +1 −6 Source/Eto/Forms/Cursor.cs
  45. +1 −1 Source/Eto/Forms/Cursors.cs
  46. +5 −4 Source/Eto/Forms/Dialog.cs
  47. +6 −1 Source/Eto/Forms/FontDialog.cs
  48. +5 −4 Source/Eto/Forms/Form.cs
  49. +4 −4 Source/Eto/Forms/GenerateActionArgs.cs
  50. +6 −1 Source/Eto/Forms/Layout/PixelLayout.cs
  51. +1 −1 Source/Eto/Forms/Layout/TableLayout.cs
  52. +4 −3 Source/Eto/Forms/Menu/CheckMenuItem.cs
  53. +3 −2 Source/Eto/Forms/Menu/ContextMenu.cs
  54. +4 −3 Source/Eto/Forms/Menu/ImageMenuItem.cs
  55. +3 −2 Source/Eto/Forms/Menu/MenuBar.cs
  56. +5 −4 Source/Eto/Forms/Menu/RadioMenuItem.cs
  57. +3 −3 Source/Eto/Forms/Menu/SeparatorMenuItem.cs
  58. +5 −5 Source/Eto/Forms/MessageBox.cs
  59. +5 −5 Source/Eto/Forms/OpenFileDialog.cs
  60. +2 −2 Source/Eto/Forms/Printing/PageSettings.cs
  61. +1 −1 Source/Eto/Forms/Printing/PrintDialog.cs
  62. +6 −1 Source/Eto/Forms/Printing/PrintDocument.cs
  63. +2 −2 Source/Eto/Forms/Printing/PrintSettings.cs
  64. +5 −5 Source/Eto/Forms/SaveFileDialog.cs
  65. +6 −1 Source/Eto/Forms/Screen.cs
  66. +6 −5 Source/Eto/Forms/SelectFolderDialog.cs
  67. +3 −2 Source/Eto/Forms/ToolBar/SeparatorToolBarItem.cs
  68. +4 −4 Source/Eto/Forms/ToolBar/ToolBar.cs
  69. +3 −4 Source/Eto/Forms/ToolBar/ToolBarButton.cs
  70. +5 −4 Source/Eto/Forms/UITimer.cs
@@ -175,7 +175,7 @@ public static Bitmap FromResource (Assembly asm, string resourceName)
/// </summary>
[Obsolete ("use Bitmap.FromResource instead")]
public Bitmap (Assembly asm, string resourceName)
- : this (Generator.Current)
+ : this (null)
{
if (asm == null) asm = Assembly.GetCallingAssembly ();
using (var stream = asm.GetManifestResourceStream (resourceName)) {
@@ -365,11 +365,16 @@ public static IGraphicsPath Create (Generator generator = null)
return generator.Create<IGraphicsPathHandler> ();
}
+ public GraphicsPath()
+ : this((Generator)null)
+ {
+ }
+
/// <summary>
/// Initializes a new instance of the GraphicsPath class
/// </summary>
/// <param name="generator">Platform generator for the object, or null to use the current generator</param>
- public GraphicsPath (Generator generator = null)
+ public GraphicsPath (Generator generator)
{
Handler = Create (generator);
}
@@ -50,7 +50,7 @@ public Icon (Generator generator, IIcon handler) : base(generator, handler)
/// Initializes a new instance of the Icon class with the contents of the specified <paramref name="stream"/>
/// </summary>
/// <param name="stream">Stream to load the content from</param>
- public Icon (Stream stream) : base(Generator.Current, typeof(IIcon))
+ public Icon (Stream stream, Generator generator = null) : base(generator, typeof(IIcon))
{
Handler.Create (stream);
}
@@ -59,7 +59,7 @@ public Icon (Stream stream) : base(Generator.Current, typeof(IIcon))
/// Intitializes a new instanc of the Icon class with the contents of the specified <paramref name="fileName"/>
/// </summary>
/// <param name="fileName">Name of the file to loat the content from</param>
- public Icon (string fileName) : base(Generator.Current, typeof(IIcon))
+ public Icon (string fileName, Generator generator = null) : base(generator, typeof(IIcon))
{
Handler.Create (fileName);
}
@@ -70,14 +70,14 @@ public Icon (string fileName) : base(Generator.Current, typeof(IIcon))
/// <param name="assembly">Assembly to load the resource from</param>
/// <param name="resourceName">Fully qualified name of the resource to load</param>
/// <returns>A new instance of an Icon loaded with the contents of the specified resource</returns>
- public static Icon FromResource (Assembly assembly, string resourceName)
+ public static Icon FromResource (Assembly assembly, string resourceName, Generator generator = null)
{
if (assembly == null)
assembly = Assembly.GetCallingAssembly ();
using (var stream = assembly.GetManifestResourceStream(resourceName)) {
if (stream == null)
throw new ResourceNotFoundException (assembly, resourceName);
- return new Icon (stream);
+ return new Icon (stream, generator);
}
}
@@ -90,17 +90,17 @@ public static Icon FromResource (Assembly assembly, string resourceName)
/// </remarks>
/// <param name="resourceName">Fully qualified name of the resource to load</param>
/// <returns>A new instance of an Icon loaded with the contents of the specified resource</returns>
- public static Icon FromResource (string resourceName)
+ public static Icon FromResource (string resourceName, Generator generator = null)
{
var asm = Assembly.GetCallingAssembly ();
- return FromResource (asm, resourceName);
+ return FromResource (asm, resourceName, generator);
}
/// <summary>
/// Obsolete. Do not use.
/// </summary>
[Obsolete("Use Icon.FromResource instead")]
- public Icon (Assembly asm, string resourceName) : base(Generator.Current, typeof(IIcon))
+ public Icon (Assembly asm, string resourceName) : base(null, typeof(IIcon))
{
if (asm == null)
asm = Assembly.GetCallingAssembly ();
@@ -50,8 +50,8 @@ public class IndexedBitmap : Image
/// <param name="width">Width of the bitmap in pixels</param>
/// <param name="height">Height of the bitmap in pixels</param>
/// <param name="bitsPerPixel">Number of bits per pixel, usually 4 (16 colours), 8 (64 colours), or 8 (256 colours)</param>
- public IndexedBitmap (int width, int height, int bitsPerPixel)
- : this(Generator.Current, width, height, bitsPerPixel)
+ public IndexedBitmap (int width, int height, int bitsPerPixel, Generator generator = null)
+ : this(generator, width, height, bitsPerPixel)
{
}
@@ -34,8 +34,8 @@ public class Region : InstanceWidget
/// <summary>
/// Initializes a new instance of the Region class
/// </summary>
- public Region ()
- : this (Generator.Current)
+ public Region()
+ : this((Generator)null)
{
}
@@ -7,11 +7,11 @@ public class ActionCollection : KeyedCollection<string, BaseAction>
{
readonly Generator generator;
- public ActionCollection ()
- : this(Generator.Current)
+ public ActionCollection()
+ : this((Generator)null)
{
}
-
+
public ActionCollection (Generator generator)
: this(generator, null)
{
@@ -9,7 +9,7 @@ public partial class RadioAction
public override MenuItem GenerateMenuItem(Generator generator)
{
- var mi = new RadioMenuItem(generator, (Controller != null) ? Controller.menuItem : null);
+ var mi = new RadioMenuItem((Controller != null) ? Controller.menuItem : null, generator);
mi.Text = MenuText;
mi.Shortcut = Accelerator;
mi.Enabled = Enabled;
@@ -19,13 +19,13 @@ public CheckBoxCell (string property)
Binding = new PropertyBinding (property);
}
- public CheckBoxCell ()
- : this(Generator.Current)
+ public CheckBoxCell()
+ : this((Generator)null)
{
}
-
- public CheckBoxCell (Generator g)
- : base(g, typeof(ICheckBoxCell), true)
+
+ public CheckBoxCell (Generator generator)
+ : base(generator, typeof(ICheckBoxCell), true)
{
}
}
@@ -21,9 +21,9 @@ public ComboBoxCell (string property)
{
Binding = new PropertyBinding (property);
}
-
- public ComboBoxCell ()
- : this (Generator.Current)
+
+ public ComboBoxCell()
+ : this((Generator)null)
{
}
@@ -45,13 +45,13 @@ public class DrawableCell : Cell
{
public Action<DrawableCellPaintArgs> PaintHandler { get; set; }
- public DrawableCell ()
- : this(Generator.Current)
+ public DrawableCell()
+ : this((Generator)null)
{
}
- public DrawableCell(Generator g)
- : base(g, typeof(IDrawableCell), true)
+ public DrawableCell(Generator generator)
+ : base(generator, typeof(IDrawableCell), true)
{
}
}
@@ -25,13 +25,13 @@ public ImageTextCell (string imageProperty, string textProperty)
TextBinding = new PropertyBinding(textProperty);
}
- public ImageTextCell ()
- : this(Generator.Current)
+ public ImageTextCell()
+ : this((Generator)null)
{
}
-
- public ImageTextCell (Generator g)
- : base(g, typeof(IImageTextCell), true)
+
+ public ImageTextCell (Generator generator)
+ : base(generator, typeof(IImageTextCell), true)
{
}
}
@@ -19,13 +19,13 @@ public ImageViewCell (string property)
Binding = new PropertyBinding (property);
}
- public ImageViewCell ()
- : this(Generator.Current)
+ public ImageViewCell()
+ : this((Generator)null)
{
}
-
- public ImageViewCell (Generator g)
- : base(g, typeof(IImageViewCell), true)
+
+ public ImageViewCell (Generator generator)
+ : base(generator, typeof(IImageViewCell), true)
{
}
}
@@ -19,13 +19,13 @@ public TextBoxCell (string property)
Binding = new PropertyBinding (property);
}
- public TextBoxCell ()
- : this(Generator.Current)
+ public TextBoxCell()
+ : this((Generator)null)
{
}
-
- public TextBoxCell (Generator g)
- : base(g, typeof(ITextBoxCell), true)
+
+ public TextBoxCell (Generator generator)
+ : base(generator, typeof(ITextBoxCell), true)
{
}
}
@@ -30,11 +30,11 @@ public class Clipboard : InstanceWidget
{
new IClipboard Handler { get { return (IClipboard)base.Handler; } }
- public Clipboard ()
- : this(Generator.Current)
+ public Clipboard()
+ : this((Generator)null)
{
}
-
+
public Clipboard (Generator generator)
: base(generator, typeof(IClipboard))
{
@@ -20,13 +20,13 @@ public virtual void OnColorChanged (EventArgs e)
ColorChanged (this, e);
}
- public ColorDialog ()
- : this (Generator.Current)
+ public ColorDialog()
+ : this((Generator)null)
{
}
-
- public ColorDialog (Generator g)
- : this (g, typeof(IColorDialog))
+
+ public ColorDialog (Generator generator)
+ : this (generator, typeof(IColorDialog))
{
}
@@ -26,16 +26,17 @@ public virtual void OnCheckedChanged(EventArgs e)
Properties.TriggerEvent(CheckedChangedKey, this, e);
}
- public CheckBox() : this(Generator.Current)
+ public CheckBox()
+ : this((Generator)null)
{
}
- public CheckBox(Generator g) : this(g, typeof(ICheckBox))
+ public CheckBox(Generator generator) : this(generator, typeof(ICheckBox))
{
}
- protected CheckBox(Generator g, Type type, bool initialize = true)
- : base(g, type, initialize)
+ protected CheckBox(Generator generator, Type type, bool initialize = true)
+ : base(generator, type, initialize)
{
}
@@ -5,19 +5,21 @@ namespace Eto.Forms
public interface IComboBox : IListControl
{
}
-
+
public class ComboBox : ListControl
{
- public ComboBox () : this (Generator.Current)
+ public ComboBox()
+ : this((Generator)null)
{
}
- public ComboBox (Generator g) : this (g, typeof(IComboBox))
+ public ComboBox(Generator generator)
+ : this(generator, typeof(IComboBox))
{
}
-
- protected ComboBox (Generator g, Type type, bool initialize = true)
- : base (g, type, initialize)
+
+ protected ComboBox(Generator generator, Type type, bool initialize = true)
+ : base(generator, type, initialize)
{
}
}
@@ -35,11 +35,11 @@ public virtual void OnValueChanged (EventArgs e)
ValueChanged (this, e);
}
- public DateTimePicker ()
- : this (Generator.Current)
+ public DateTimePicker()
+ : this((Generator)null)
{
}
-
+
public DateTimePicker (Generator generator)
: this (generator, typeof(IDateTimePicker))
{
@@ -46,7 +46,7 @@ public partial class Drawable : DockContainer
public event EventHandler<PaintEventArgs> Paint;
public Drawable()
- : this(Generator.Current)
+ : this((Generator)null)
{
}
@@ -11,11 +11,11 @@ public partial interface IDrawable
public partial class Drawable
{
public Drawable (bool largeCanvas)
- : this(Generator.Current, largeCanvas)
+ : this(null, largeCanvas)
{
}
- public Drawable (Generator g, bool largeCanvas) : base(g, typeof(IDrawable))
+ public Drawable (Generator generator, bool largeCanvas) : base(generator, typeof(IDrawable))
{
Handler.Create (largeCanvas);
}
@@ -73,16 +73,16 @@ public new T SelectedValue
/// <summary>
/// Initializes a new instance of the EnumComboBox
/// </summary>
- public EnumComboBox ()
- : this (Generator.Current)
+ public EnumComboBox()
+ : this((Generator)null)
{
}
/// <summary>
/// Initializes a new instance of the EnumComboBox with the specified generator
/// </summary>
/// <param name="generator">platform generator</param>
- protected EnumComboBox (Generator generator)
+ public EnumComboBox (Generator generator)
: base (generator)
{
}
Oops, something went wrong.

0 comments on commit 5d7701d

Please sign in to comment.