Explorar el Código

Commit a bunch of stubs I did months ago, might be useful to someone picking it up

svn path=/trunk/mcs/; revision=57355
Miguel de Icaza hace 20 años
padre
commit
3e620e6a87

+ 57 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ColumnStyle.cs

@@ -0,0 +1,57 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+
+namespace System.Windows.Forms {
+
+	public class ColumnStyle : TableLayoutSettings.Style {
+		float width;
+		
+		public ColumnStyle ()
+		{
+		}
+
+		public ColumnStyle (SizeType st) 
+		{
+			size_type = st;
+		}
+
+		public ColumnStyle (SizeType st, float width)
+		{
+			size_type = st;
+			this.width = width;
+		}
+
+		public float Width {
+			get {
+				return width;
+			}
+
+			set {
+				width = value;
+			}
+		}
+	}
+}

+ 43 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutEngine.cs

@@ -0,0 +1,43 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+using System;
+using System.ComponentModel;
+
+namespace System.Windows.Forms.Layout {
+
+	public abstract class LayoutEngine {
+		
+		public virtual void InitLayout (object child, BoundsSpecified specified)
+		{
+		}
+
+		public virtual bool Layout (object container, LayoutEventArgs args)
+		{
+			return false;
+		}
+	}
+}
+

+ 39 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/LayoutSettings.cs

@@ -0,0 +1,39 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+using System;
+using System.ComponentModel;
+using System.Windows.Forms.Layout;
+
+namespace System.Windows.Forms {
+
+	public abstract class LayoutSettings {
+		public virtual LayoutEngine LayoutEngine {
+			get {
+				return null;
+			}
+		}
+	}
+}

+ 57 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/RowStyle.cs

@@ -0,0 +1,57 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+
+namespace System.Windows.Forms {
+
+	public class RowStyle : TableLayoutSettings.Style {
+		float height;
+		
+		public RowStyle ()
+		{
+		}
+
+		public RowStyle (SizeType st) 
+		{
+			size_type = st;
+		}
+
+		public RowStyle (SizeType st, float height)
+		{
+			size_type = st;
+			this.height = height;
+		}
+
+		public float Height {
+			get {
+				return height;
+			}
+
+			set {
+				height = value;
+			}
+		}
+	}
+}

+ 33 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/SizeType.cs

@@ -0,0 +1,33 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+
+namespace System.Windows.Forms {
+	public enum SizeType {
+		AutoSize = 0,
+		Absolute = 1,
+		Percent = 2
+	}
+}

+ 43 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TableLayout.cs

@@ -0,0 +1,43 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+using System;
+using System.ComponentModel;
+using System.Windows.Forms.Layout;
+
+namespace System.Windows.Forms {
+
+	public class TableLayout : LayoutEngine {
+
+		public override void InitLayout (object child, BoundsSpecified specified)
+		{
+		}
+
+		public override bool Layout (object container, LayoutEventArgs args)
+		{
+			return false;
+		}
+	}
+}

+ 85 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TableLayoutPanel.cs

@@ -0,0 +1,85 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+using System;
+using System.ComponentModel;
+
+namespace System.Windows.Forms {
+
+	public class TableLayoutPanel : Panel, IExtenderProvider {
+		TableLayoutSettings settings;
+		
+		public TableLayoutPanel ()
+		{
+			settings = new TableLayoutSettings (this);
+		}
+
+		internal void Relayout ()
+		{
+		}
+		
+#region Proxy Properties
+		new public BorderStyle BorderStyle {
+			get {
+				return base.BorderStyle;
+			}
+
+			set {
+				base.BorderStyle = value;
+			}
+		}
+
+		public int ColumnCount {
+			get {
+				return settings.ColumnCount;
+			}
+
+			set {
+				settings.ColumnCount = value;
+			}
+		}
+
+		public int RowCount {
+			get {
+				return settings.RowCount;
+			}
+
+			set {
+				settings.RowCount = value;
+			}
+		}
+#endregion
+		
+#region IExtenderProvider
+		bool IExtenderProvider.CanExtend (object extendee)
+		{
+			//
+			// Read: `Implementing an Extender Provider'
+			//
+			throw new NotImplementedException ();
+		}
+#endregion
+	}
+}

+ 33 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TableLayoutPanelGrowStyle.cs

@@ -0,0 +1,33 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+
+namespace System.Windows.Forms {
+	public enum TableLayoutPanelGrowStyle {
+		FixedSize,
+		AddRows,
+		AddColumns,
+	}
+}

+ 206 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TableLayoutSettings.cs

@@ -0,0 +1,206 @@
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+// 
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+// 
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+//
+// Author:
+//   Miguel de Icaza ([email protected])
+//
+// (C) 2004 Novell, Inc.
+//
+using System;
+using System.ComponentModel;
+using System.Collections;
+using System.Windows.Forms.Layout;
+
+namespace System.Windows.Forms {
+
+	public class TableLayoutSettings : LayoutSettings {
+		TableLayoutPanel panel;
+		ColumnStyleCollection column_style;
+		TableLayoutPanelGrowStyle grow_style;
+		int column_count;
+		int row_count;
+
+		// Statics
+		static LayoutEngine layout_engine = new TableLayout ();
+		
+		internal TableLayoutSettings (TableLayoutPanel panel)
+		{
+			this.panel = panel;
+			column_count = 0;
+			row_count = 0;
+			grow_style = TableLayoutPanelGrowStyle.AddRows;
+			column_style = new ColumnStyleCollection (panel);
+		}
+
+		public int ColumnCount {
+			get {
+				return column_count;
+			}
+
+			set {
+				column_count = value;
+			}
+		}
+
+		public int RowCount {
+			get {
+				return row_count;
+			}
+
+			set {
+				row_count = value;
+			}
+		}
+
+		public TableLayoutPanelGrowStyle GrowStyle {
+			get {
+				return grow_style;
+			}
+		}
+
+		public override LayoutEngine LayoutEngine {
+			get {
+				return layout_engine;
+			}
+		}
+				
+		public TableLayoutSettings.ColumnStyleCollection ColumnStyle {
+			get {
+				return column_style;
+			}
+		}
+
+		public abstract class StyleCollection {
+			ArrayList al = new ArrayList ();
+			TableLayoutPanel table;
+			
+			internal StyleCollection (TableLayoutPanel table)
+			{
+				this.table = table;
+			}
+			
+			public int Add (TableLayoutSettings.Style style)
+			{
+				return al.Add (style);
+			}
+
+			// FIXME; later this should be an override.
+			public void Clear ()
+			{
+				al.Clear ();
+
+				// FIXME: Need to investigate what happens when the style is gone.
+				table.Relayout ();
+			}
+
+#region IList methods
+			//
+			// The IList methods will later be implemeneted, this is to get us started
+			//
+			internal bool Contains (Style style)
+			{
+				return al.Contains (style);
+			}
+
+			internal int IndexOf (Style style)
+			{
+				return al.IndexOf (style);
+			}
+
+			internal void Insert (int index, Style style)
+			{
+				al.Insert (index, style);
+			}
+
+			internal void Remove (Style style)
+			{
+				al.Remove (style);
+			}
+
+#endregion
+			public Style this [int idx] {
+				get {
+					return (Style) al [idx];
+				}
+
+				set {
+					al [idx] = value;
+				}
+			}
+		}
+		
+		public class ColumnStyleCollection : StyleCollection {
+
+			internal ColumnStyleCollection (TableLayoutPanel panel) : base (panel)
+			{
+			}
+			
+			public void Add (ColumnStyle style)
+			{
+				base.Add (style);
+			}
+
+			public bool Contains (ColumnStyle style)
+			{
+				return base.Contains (style);
+			}
+
+			public int IndexOf (ColumnStyle style)
+			{
+				return base.IndexOf (style);
+			}
+
+			public void Insert (int index, ColumnStyle style)
+			{
+				base.Insert (index, style);
+			}
+
+			public void Remove (ColumnStyle style)
+			{
+				base.Remove (style);
+			}
+
+			public new ColumnStyle this [int index] {
+				get {
+					return (ColumnStyle) base [index];
+				}
+
+				set {
+					base [index] = value;
+				}
+			}
+		}
+
+		public class Style {
+			internal SizeType size_type;
+			
+			public SizeType SizeType {
+				get {
+					return size_type;
+				}
+
+				set {
+					size_type = value;
+				}
+			}
+		}
+	}
+
+}