Author: jpobst
Date: 2007-06-08 09:25:59 -0400 (Fri, 08 Jun 2007)
New Revision: 78952
Added:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PanelTest.cs
Modified:
trunk/mcs/class/Managed.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
Log:
2007-06-08 Jonathan Pobst <[EMAIL PROTECTED]>
* Panel.cs: Add autosize properties/event.
2007-06-08 Jonathan Pobst <[EMAIL PROTECTED]>
* PanelTest.cs: Add.
2007-06-08 Jonathan Pobst <[EMAIL PROTECTED]>
* System.Windows.Forms_test.dll.sources: Add PanelTest.cs.
Modified: trunk/mcs/class/Managed.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/ChangeLog 2007-06-08 13:13:36 UTC
(rev 78951)
+++ trunk/mcs/class/Managed.Windows.Forms/ChangeLog 2007-06-08 13:25:59 UTC
(rev 78952)
@@ -1,3 +1,7 @@
+2007-06-08 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * System.Windows.Forms_test.dll.sources: Add PanelTest.cs.
+
2007-06-06 Jonathan Pobst <[EMAIL PROTECTED]>
* System.Windows.Forms_test.dll.sources: Add ButtonBaseTest.cs.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-06-08 13:13:36 UTC (rev 78951)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-06-08 13:25:59 UTC (rev 78952)
@@ -1,3 +1,7 @@
+2007-06-08 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * Panel.cs: Add autosize properties/event.
+
2007-06-07 Jonathan Pobst <[EMAIL PROTECTED]>
* Control.cs:
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs
2007-06-08 13:13:36 UTC (rev 78951)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Panel.cs
2007-06-08 13:25:59 UTC (rev 78952)
@@ -50,6 +50,24 @@
#endregion // Constructors & Destructors
#region Public Instance Properties
+#if NET_2_0
+ [Browsable (true)]
+ [EditorBrowsable (EditorBrowsableState.Always)]
+ [DesignerSerializationVisibility
(DesignerSerializationVisibility.Visible)]
+ public override bool AutoSize {
+ get { return base.AutoSize; }
+ set { base.AutoSize = value; }
+ }
+
+ [Browsable (true)]
+ [DefaultValue (AutoSizeMode.GrowOnly)]
+ [Localizable (true)]
+ public virtual AutoSizeMode AutoSizeMode {
+ get { return base.GetAutoSizeMode (); }
+ set { base.SetAutoSizeMode (value); }
+ }
+#endif
+
[DefaultValue(BorderStyle.None)]
[DispId(-504)]
public BorderStyle BorderStyle {
@@ -109,6 +127,15 @@
#endregion // Protected Instance Methods
#region Events
+#if NET_2_0
+ [Browsable (true)]
+ [EditorBrowsable (EditorBrowsableState.Always)]
+ public new event EventHandler AutoSizeChanged {
+ add { base.AutoSizeChanged += value; }
+ remove { base.AutoSizeChanged -= value; }
+ }
+#endif
+
[Browsable(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
public new event KeyEventHandler KeyDown {
@@ -137,6 +164,31 @@
remove { base.TextChanged -= value; }
}
#endregion
+
+ #region Internal Methods
+#if NET_2_0
+ internal override Size GetPreferredSizeCore (Size proposedSize)
+ {
+ Size retsize = Size.Empty;
+
+ foreach (Control child in Controls) {
+ if (child.Dock == DockStyle.Fill) {
+ if (child.Bounds.Right > retsize.Width)
+ retsize.Width =
child.Bounds.Right;
+ } else if (child.Dock != DockStyle.Top &&
child.Dock != DockStyle.Bottom && (child.Anchor & AnchorStyles.Right) == 0 &&
(child.Bounds.Right + child.Margin.Right) > retsize.Width)
+ retsize.Width = child.Bounds.Right +
child.Margin.Right;
+
+ if (child.Dock == DockStyle.Fill) {
+ if (child.Bounds.Bottom >
retsize.Height)
+ retsize.Height =
child.Bounds.Bottom;
+ } else if (child.Dock != DockStyle.Left &&
child.Dock != DockStyle.Right && (child.Anchor & AnchorStyles.Bottom) == 0 &&
(child.Bounds.Bottom + child.Margin.Bottom) > retsize.Height)
+ retsize.Height = child.Bounds.Bottom +
child.Margin.Bottom;
+ }
+
+ return retsize;
+ }
+#endif
+ #endregion
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources
2007-06-08 13:13:36 UTC (rev 78951)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources
2007-06-08 13:25:59 UTC (rev 78952)
@@ -95,6 +95,7 @@
System.Windows.Forms/PaddingTest.cs
System.Windows.Forms/PaddingConverterTest.cs
System.Windows.Forms/PaintEventArgsTest.cs
+System.Windows.Forms/PanelTest.cs
System.Windows.Forms/PictureBoxTest.cs
System.Windows.Forms/PrintDialogTest.cs
System.Windows.Forms/ProgressBarTest.cs
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-06-08 13:13:36 UTC (rev 78951)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-06-08 13:25:59 UTC (rev 78952)
@@ -1,3 +1,7 @@
+2007-06-08 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * PanelTest.cs: Add.
+
2007-06-07 Jonathan Pobst <[EMAIL PROTECTED]>
* ScrollableControlTest.cs: ScrollToControl test is theme dependent due
to
Added:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PanelTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PanelTest.cs
2007-06-08 13:13:36 UTC (rev 78951)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/PanelTest.cs
2007-06-08 13:25:59 UTC (rev 78952)
@@ -0,0 +1,63 @@
+//
+// PanelTest.cs: Test cases for PanelTest.
+//
+// Author:
+// Jonathan Pobst ([EMAIL PROTECTED])
+//
+// (C) 2007 Novell, Inc.
+//
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Windows.Forms
+{
+ [TestFixture]
+ public class PanelTest
+ {
+ [Test]
+ public void Constructor ()
+ {
+ Panel p = new Panel ();
+
+#if NET_2_0
+ Assert.AreEqual (false, p.AutoSize, "A1");
+ Assert.AreEqual (AutoSizeMode.GrowOnly, p.AutoSizeMode,
"A2");
+#endif
+ Assert.AreEqual (BorderStyle.None, p.BorderStyle, "A3");
+ Assert.AreEqual (false, p.TabStop, "A4");
+ Assert.AreEqual (string.Empty, p.Text, "A5");
+ }
+
+#if NET_2_0
+ [Test]
+ public void AutoSize ()
+ {
+ Form f = new Form ();
+ f.ShowInTaskbar = false;
+
+ Panel p = new Panel ();
+ p.AutoSize = true;
+ f.Controls.Add (p);
+
+ Button b = new Button ();
+ b.Size = new Size (200, 200);
+ b.Location = new Point (200, 200);
+ p.Controls.Add (b);
+
+ f.Show ();
+
+ Assert.AreEqual (new Size (403, 403), p.ClientSize,
"A1");
+
+ p.Controls.Remove (b);
+ Assert.AreEqual (new Size (200, 100), p.ClientSize,
"A2");
+
+ p.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+ Assert.AreEqual (new Size (0, 0), p.ClientSize, "A3");
+ }
+#endif
+ }
+}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches