Author: jpobst
Date: 2008-01-22 15:47:04 -0500 (Tue, 22 Jan 2008)
New Revision: 93571
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollableControlTest.cs
Log:
2008-01-22 Jonathan Pobst <[EMAIL PROTECTED]>
* ScrollableControl.cs: With the advent of 2.0's Padding, DockPadding
becomes a wrapper around Padding.
[Fixes a part of bug #354676]
2008-01-22 Jonathan Pobst <[EMAIL PROTECTED]>
* ScrollableControlTest.cs: Add test for bug #354676.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-01-22 20:35:40 UTC (rev 93570)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-01-22 20:47:04 UTC (rev 93571)
@@ -1,3 +1,9 @@
+2008-01-22 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * ScrollableControl.cs: With the advent of 2.0's Padding, DockPadding
+ becomes a wrapper around Padding.
+ [Fixes a part of bug #354676]
+
2008-01-22 Geoff Norton <[EMAIL PROTECTED]>
* Mime.cs: Avoid a needles exception on OSX if we dont have a buffer
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
2008-01-22 20:35:40 UTC (rev 93570)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
2008-01-22 20:47:04 UTC (rev 93571)
@@ -59,14 +59,93 @@
[TypeConverter(typeof(ScrollableControl.DockPaddingEdgesConverter))]
#region Subclass DockPaddingEdges
- public class DockPaddingEdges : ICloneable {
+ public class DockPaddingEdges : ICloneable
+ {
+ private Control owner;
+
+#if NET_2_0
+ internal DockPaddingEdges (Control owner)
+ {
+ this.owner = owner;
+ }
+
+ #region DockPaddingEdges Public Instance Properties
+ [RefreshProperties (RefreshProperties.All)]
+ public int All {
+ get { return owner.Padding.All; }
+ set { owner.Padding = new Padding (value); }
+ }
+
+ [RefreshProperties (RefreshProperties.All)]
+ public int Bottom {
+ get { return owner.Padding.Bottom; }
+ set { owner.Padding = new Padding (Left, Top,
Right, value); }
+ }
+
+ [RefreshProperties (RefreshProperties.All)]
+ public int Left {
+ get { return owner.Padding.Left; }
+ set { owner.Padding = new Padding (value, Top,
Right, Bottom); }
+ }
+
+ [RefreshProperties (RefreshProperties.All)]
+ public int Right {
+ get { return owner.Padding.Right; }
+ set { owner.Padding = new Padding (Left, Top,
value, Bottom); }
+ }
+
+ [RefreshProperties (RefreshProperties.All)]
+ public int Top {
+ get { return owner.Padding.Top; }
+ set { owner.Padding = new Padding (Left, value,
Right, Bottom); }
+ }
+ #endregion // DockPaddingEdges Public Instance
Properties
+
+ // Public Instance Methods
+ public override bool Equals (object other)
+ {
+ if (!(other is DockPaddingEdges)) {
+ return false;
+ }
+
+ if ((this.All == ((DockPaddingEdges)other).All)
&& (this.Left == ((DockPaddingEdges)other).Left) &&
+ (this.Right ==
((DockPaddingEdges)other).Right) && (this.Top == ((DockPaddingEdges)other).Top)
&&
+ (this.Bottom ==
((DockPaddingEdges)other).Bottom)) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int GetHashCode ()
+ {
+ return All * Top * Bottom * Right * Left;
+ }
+
+ public override string ToString ()
+ {
+ return "All = " + All.ToString () + " Top = " +
Top.ToString () + " Left = " + Left.ToString () + " Bottom = " +
Bottom.ToString () + " Right = " + Right.ToString ();
+ }
+
+ internal void Scale (float dx, float dy)
+ {
+ Left = (int)(Left * dx);
+ Right = (int)(Right * dx);
+ Top = (int)(Top * dy);
+ Bottom = (int)(Bottom * dy);
+ }
+
+ object ICloneable.Clone ()
+ {
+ return new DockPaddingEdges (owner);
+ }
+#else
#region DockPaddingEdges Local Variables
private int all;
private int left;
private int right;
private int top;
private int bottom;
- private Control owner;
#endregion // DockPaddingEdges Local Variables
#region DockPaddingEdges Constructor
@@ -198,6 +277,7 @@
return padding_edge;
}
+#endif
}
#endregion // Subclass DockPaddingEdges
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2008-01-22 20:35:40 UTC (rev 93570)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2008-01-22 20:47:04 UTC (rev 93571)
@@ -1,5 +1,9 @@
2008-01-22 Jonathan Pobst <[EMAIL PROTECTED]>
+ * ScrollabeControlTest.cs: Add test for bug #354676.
+
+2008-01-22 Jonathan Pobst <[EMAIL PROTECTED]>
+
* ControlTest.cs: Add test for bug #355074.
2008-01-18 Jonathan Pobst <[EMAIL PROTECTED]>
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollableControlTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollableControlTest.cs
2008-01-22 20:35:40 UTC (rev 93570)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ScrollableControlTest.cs
2008-01-22 20:47:04 UTC (rev 93571)
@@ -277,6 +277,41 @@
return base.ScrollToControl (activeControl);
}
}
+
+ [Test]
+ public void Padding ()
+ {
+ ScrollableControl c = new ScrollableControl ();
+ c.Dock = DockStyle.Fill;
+ c.Padding = new Padding (40);
+
+ Assert.AreEqual (40, c.Padding.All, "A1");
+ Assert.AreEqual (40, c.DockPadding.All, "A2");
+
+ c.DockPadding.Right = 20;
+
+ Assert.AreEqual (20, c.Padding.Right, "A3");
+ Assert.AreEqual (20, c.DockPadding.Right, "A4");
+
+ c.Padding = new Padding (40, 40, 40, 40);
+
+ Assert.AreEqual (40, c.Padding.Right, "A5");
+ Assert.AreEqual (40, c.DockPadding.Right, "A6");
+
+ Form f = new Form ();
+ f.Controls.Add (c);
+
+ Button b = new Button ();
+ c.Controls.Add (b);
+
+ f.Show ();
+
+ // Padding does not affect laying out the controls
+ Assert.AreEqual (new Point (0, 0), b.Location, "A7");
+
+ f.Close ();
+ f.Dispose ();
+ }
#endif
}
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches