Author: jpobst
Date: 2006-09-13 10:29:24 -0400 (Wed, 13 Sep 2006)
New Revision: 65353

Added:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterPanel.cs
   
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/SplitContainerTests.cs
Modified:
   trunk/mcs/class/Managed.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources
   trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
Log:
2006-09-14  Jonathan Pobst <[EMAIL PROTECTED]>

        * SplitContainer.cs, SplitterPanel.cs: Initial implementation [2.0].
        * SplitContainerTests.cs: Tests added [2.0].

Modified: trunk/mcs/class/Managed.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/ChangeLog     2006-09-13 13:44:19 UTC 
(rev 65352)
+++ trunk/mcs/class/Managed.Windows.Forms/ChangeLog     2006-09-13 14:29:24 UTC 
(rev 65353)
@@ -1,3 +1,8 @@
+2006-09-13  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * System.Windows.Forms.dll.sources: Added SplitContainer/SplitterPanel.
+       * System.Windows.Forms_test.dll.sources: Added SplitContainerTests.cs
+
 2006-09-07  Alexander Olk  <[EMAIL PROTECTED]>
 
        * resources/, System.Windows.Forms.dll.resources, Makefile:

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-13 13:44:19 UTC (rev 65352)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-09-13 14:29:24 UTC (rev 65353)
@@ -1,3 +1,7 @@
+2006-09-13  Jonathan Pobst <[EMAIL PROTECTED]>
+
+       * SplitContainer.cs, SplitterPanel.cs: Initial implementation [2.0].
+
 2006-09-12  Chris Toshok  <[EMAIL PROTECTED]>
 
        * DataGrid.cs (get_ListManager): if the list_manager is null, try

Added: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs    
    2006-09-13 13:44:19 UTC (rev 65352)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitContainer.cs    
    2006-09-13 14:29:24 UTC (rev 65353)
@@ -0,0 +1,435 @@
+//
+// SplitContainer.cs
+//
+// 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.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//     Jonathan Pobst ([EMAIL PROTECTED])
+//
+
+#if NET_2_0
+using System;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace System.Windows.Forms
+{
+       [ComVisibleAttribute (true)]
+       [ClassInterfaceAttribute (ClassInterfaceType.AutoDispatch)]
+       public class SplitContainer : ContainerControl
+       {
+               #region Local Variables
+               private FixedPanel fixed_panel;
+               private int splitter_distance;
+               private int splitter_width;
+               private int splitter_increment;
+               private Orientation orientation;
+               private bool binding_context_set;
+
+               private SplitterPanel panel1;
+               private bool panel1_collapsed;
+               private int panel1_min_size;
+
+               private SplitterPanel panel2;
+               private bool panel2_collapsed;
+               private int panel2_min_size;
+
+               private Splitter splitter;
+               #endregion
+
+               #region Public Events
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public event EventHandler AutoSizeChanged;
+               public event SplitterEventHandler SplitterMoved;
+               public event SplitterCancelEventHandler SplitterMoving;
+               #endregion
+
+               #region Public Constructors
+               public SplitContainer ()
+               {
+                       fixed_panel = FixedPanel.None;
+                       orientation = Orientation.Vertical;
+                       splitter_distance = 50;
+                       splitter_width = 4;
+                       splitter_increment = 1;
+                       panel1_collapsed = false;
+                       panel2_collapsed = false;
+                       panel1_min_size = 25;
+                       panel2_min_size = 25;
+                       binding_context_set = false;
+
+                       panel1 = new SplitterPanel (this);
+                       panel2 = new SplitterPanel (this);
+                       splitter = new Splitter ();
+
+                       splitter.TabStop = true;
+                       splitter.Size = new System.Drawing.Size (4, 4);
+                       splitter.SplitterMoved += new SplitterEventHandler 
(splitter_SplitterMoved);
+                       splitter.SplitterMoving += new SplitterEventHandler 
(splitter_SplitterMoving);
+
+                       panel1.Size = new Size (50, 50);
+
+                       this.Controls.Add (panel2);
+                       this.Controls.Add (splitter);
+                       this.Controls.Add (panel1);
+
+                       panel1.Dock = DockStyle.Left;
+                       panel2.Dock = DockStyle.Fill;
+                       splitter.Dock = DockStyle.Left;
+               }
+               #endregion
+
+               #region Public Properties
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               [Localizable (true)]
+               public override bool AutoScroll {
+                       get { return base.AutoScroll; }
+                       set { }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Size AutoScrollMargin {
+                       get { return base.AutoScrollMargin; }
+                       set { base.AutoScrollMargin = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Size AutoScrollMinSize {
+                       get { return base.AutoScrollMinSize; }
+                       set { base.AutoScrollMinSize = value; }
+               }
+
+               //Uncomment once this has been implemented in Control.cs
+               //[Browsable (false)]
+               //[EditorBrowsable (EditorBrowsableState.Never)]
+               //public override Point AutoScrollOffset {
+               //        get { return base.AutoScrollOffset; }
+               //        set { base.AutoScrollOffset = value; }
+               //}
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Point AutoScrollPosition {
+                       get { return base.AutoScrollPosition; }
+                       set { base.AutoScrollPosition = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public override bool AutoSize {
+                       get { return base.AutoSize; }
+                       set {
+                               base.AutoSize = value;
+                               if (AutoSizeChanged != null) AutoSizeChanged 
(this, new EventArgs ());
+                       }
+               }
+
+               public override Image BackgroundImage {
+                       get { return base.BackgroundImage; }
+                       set {
+                               base.BackgroundImage = value;
+                               UpdateSplitterBackground ();
+                       }
+               }
+
+               //Uncomment once this has been implemented in Control.cs
+               //[Browsable (false)]
+               //[EditorBrowsable (EditorBrowsableState.Never)]
+               //public override ImageLayout BackgroundImageLayout {
+               //        get { return base.BackgroundImageLayout; }
+               //        set { base.BackgroundImageLayout = value; }
+               //}
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               public override BindingContext BindingContext {
+                       get { return binding_context_set ? base.BindingContext 
: null; }
+                       set {
+                               binding_context_set = true;
+                               base.BindingContext = value;
+                       }
+               }
+
+               // MSDN says default is Fixed3D, creating a new SplitContainer 
says otherwise.
+               [DefaultValue (BorderStyle.None)]
+               public BorderStyle BorderStyle
+               {
+                       get { return panel1.BorderStyle; }
+                       set {
+                               if (!Enum.IsDefined (typeof (BorderStyle), 
value))
+                                       throw new InvalidEnumArgumentException 
(string.Format ("Enum argument value '{0}' is not valid for BorderStyle", 
value));
+                                       
+                               panel1.BorderStyle = value;
+                               panel2.BorderStyle = value;
+                       }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public ControlCollection Controls { get { return 
base.Controls; } }
+
+               new public DockStyle Dock {
+                       get { return base.Dock; }
+                       set { base.Dock = value; }
+               }
+
+               [DefaultValue (FixedPanel.None)]
+               public FixedPanel FixedPanel {
+                       get { return this.fixed_panel; }
+                       set {
+                               if (!Enum.IsDefined (typeof (FixedPanel), 
value))
+                                       throw new InvalidEnumArgumentException 
(string.Format ("Enum argument value '{0}' is not valid for FixedPanel", 
value));
+
+                               this.fixed_panel = value;
+                       }
+               }
+
+               [Localizable (true)]
+               [DefaultValue (false)]
+               public bool IsSplitterFixed {
+                       get { return !splitter.Enabled; }
+                       set { splitter.Enabled = !value; }
+               }
+
+               [Localizable (true)]
+               [DefaultValue (Orientation.Vertical)]
+               public Orientation Orientation {
+                       get { return this.orientation; }
+                       set {
+                               if (!Enum.IsDefined (typeof (Orientation), 
value))
+                                       throw new InvalidEnumArgumentException 
(string.Format ("Enum argument value '{0}' is not valid for Orientation", 
value));
+
+                               if (this.orientation != value) {
+                                       this.orientation = value;
+
+                                       switch (value) {
+                                               case Orientation.Vertical:
+                                                       panel1.Dock = 
DockStyle.Left;
+                                                       panel2.Dock = 
DockStyle.Fill;
+                                                       splitter.Dock = 
DockStyle.Left;
+                                                       splitter.Width = 
this.splitter_width;
+                                                       panel1.InternalWidth = 
this.splitter_distance;
+                                                       if (panel2.Width < 
panel2_min_size)
+                                                               
panel1.InternalWidth = this.Width - this.splitter_width - panel2_min_size;
+                                                       break;
+                                               case Orientation.Horizontal:
+                                               default:
+                                                       panel1.Dock = 
DockStyle.Top;
+                                                       panel2.Dock = 
DockStyle.Fill;
+                                                       splitter.Dock = 
DockStyle.Top;
+                                                       splitter.Height = 
this.splitter_width;
+                                                       panel1.InternalHeight = 
this.splitter_distance;
+                                                       if (panel2.Height < 
panel2_min_size)
+                                                               
panel1.InternalHeight = this.Height - this.splitter_width - panel2_min_size;
+                                                       break;
+                                       }
+
+                                       this.PerformLayout ();
+                               }
+                       }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Padding Padding {
+                       get { return base.Padding; }
+                       set { base.Padding = value; }
+               }
+
+               [Localizable (false)]
+               public SplitterPanel Panel1 { get { return this.panel1; } }
+
+               [DefaultValue (false)]
+               public bool Panel1Collapsed {
+                       get { return this.panel1_collapsed; }
+                       set {
+                               this.panel1_collapsed = value;
+                               this.panel1.Visible = !value;
+                               this.splitter.Visible = !value;
+                       }
+               }
+
+               [Localizable (true)]
+               [DefaultValue (25)]
+               public int Panel1MinSize {
+                       get { return this.panel1_min_size; }
+                       set { 
+                               this.panel1_min_size = value; 
+                               this.splitter.MinSize = value; 
+                       }
+               }
+
+               [Localizable (false)]
+               public SplitterPanel Panel2 { get { return this.panel2; } }
+
+               [DefaultValue (false)]
+               public bool Panel2Collapsed {
+                       get { return this.panel2_collapsed; }
+                       set {
+                               this.panel2_collapsed = value; 
+                               this.panel2.Visible = !value;
+                               this.splitter.Visible = !value;
+                       }
+               }
+
+               [Localizable (true)]
+               [DefaultValue (25)]
+               public int Panel2MinSize {
+                       get { return this.panel2_min_size; }
+                       set { this.panel2_min_size = value; 
this.splitter.MinExtra = value; }
+               }
+
+               // MSDN says the default is 40, MS's implementation defaults to 
50.
+               [Localizable (true)]
+               [DefaultValue (50)]
+               public int SplitterDistance {
+                       get { return this.splitter_distance; }
+                       set {
+                               if (value < 0)
+                                       throw new ArgumentOutOfRangeException 
();
+
+                               if (value < this.panel1_min_size)
+                                       value = this.panel1_min_size;
+
+                               switch (this.orientation) {
+                                       case Orientation.Vertical:
+                                               if (value > this.Width - 
this.panel2_min_size - this.splitter_width)
+                                                       value = this.Width - 
this.panel2_min_size - this.splitter_width;
+                                               panel1.InternalWidth = value;
+                                               break;
+                                       case Orientation.Horizontal:
+                                       default:
+                                               if (value > this.Height - 
this.panel2_min_size - this.splitter_width)
+                                                       value = this.Height - 
this.panel2_min_size - this.splitter_width;
+                                               panel1.InternalHeight = value;
+                                               break;
+                               }
+
+                               this.splitter_distance = value;
+
+                               UpdateSplitterBackground ();
+                       }
+               }
+
+               [Localizable (true)]
+               [DefaultValue (1)]
+               [MonoTODO ("Not implemented.")]
+               public int SplitterIncrement {
+                       get { return this.splitter_increment; }
+                       set { this.splitter_increment = value; }
+               }
+
+               [Browsable (false)]
+               public Rectangle SplitterRectangle { get { return 
splitter.Bounds; } }
+
+               [Localizable (true)]
+               [DefaultValue (4)]
+               public int SplitterWidth {
+                       get { return this.splitter_width; }
+                       set {
+                               if (value < 1)
+                                       throw new ArgumentOutOfRangeException 
();
+
+                               this.splitter_width = value;
+
+                               switch (this.orientation) {
+                                       case Orientation.Horizontal:
+                                               splitter.Height = value;
+                                               break;
+                                       case Orientation.Vertical:
+                                       default:
+                                               splitter.Width = value;
+                                               break;
+                               }
+                       }
+               }
+
+               [DefaultValue (true)]
+               new public bool TabStop {
+                       get { return splitter.TabStop; }
+                       set { splitter.TabStop = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               [Bindable (false)]
+               public override string Text {
+                       get { return base.Text; }
+                       set { base.Text = value; }
+               }
+               #endregion
+
+               #region Protected Properties
+               protected override Size DefaultSize { get { return new Size 
(150, 100); } }
+               #endregion
+
+               #region Public Methods
+               public void OnSplitterMoved (SplitterEventArgs e)
+               {
+                       if (SplitterMoved != null) SplitterMoved (this, e);
+               }
+
+               public void OnSplitterMoving (SplitterCancelEventArgs e)
+               {
+                       if (SplitterMoving != null) SplitterMoving (this, e);
+
+                       if (e.Cancel == true) {
+                               e.SplitX = splitter.Location.X;
+                               e.SplitY = splitter.Location.Y;
+                       }
+               }
+               #endregion
+
+               #region Private Methods
+               private void splitter_SplitterMoving (object sender, 
SplitterEventArgs e)
+               {
+                       SplitterCancelEventArgs ea = new 
SplitterCancelEventArgs (e.X, e.Y, e.SplitX, e.SplitY);
+                       this.OnSplitterMoving (ea);
+                       e.SplitX = ea.SplitX;
+                       e.SplitY = ea.SplitY;
+               }
+
+               private void splitter_SplitterMoved (object sender, 
SplitterEventArgs e)
+               {
+                       this.OnSplitterMoved (e);
+               }
+
+               private void UpdateSplitterBackground ()
+               {
+                       if (this.BackgroundImage != null) {
+                               Bitmap b = new Bitmap (splitter.Width, 
splitter.Height);
+                               Graphics.FromImage (b).DrawImage 
(base.BackgroundImage, new Rectangle (0, 0, b.Width, b.Height), 
this.SplitterRectangle, GraphicsUnit.Pixel);
+                               splitter.BackgroundImage = b;
+                       }
+                       else
+                               splitter.BackgroundImage = this.BackgroundImage;
+               }
+               #endregion
+       }
+}
+#endif
\ No newline at end of file

Added: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterPanel.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterPanel.cs 
2006-09-13 13:44:19 UTC (rev 65352)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/SplitterPanel.cs 
2006-09-13 14:29:24 UTC (rev 65353)
@@ -0,0 +1,179 @@
+//
+// SplitterPanel.cs
+//
+// 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.
+//
+// Copyright (c) 2006 Jonathan Pobst
+//
+// Authors:
+//     Jonathan Pobst ([EMAIL PROTECTED])
+//
+
+#if NET_2_0
+using System;
+using System.Runtime.InteropServices;
+using System.ComponentModel;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace System.Windows.Forms
+{
+       [ComVisibleAttribute (true)]
+       [ClassInterfaceAttribute (ClassInterfaceType.AutoDispatch)]
+       public sealed class SplitterPanel : Panel
+       {
+               private SplitContainer owner;
+
+               public SplitterPanel (SplitContainer owner)
+               {
+                       this.owner = owner;
+               }
+
+               #region Public Properties
+               // All of these are overriden just to hide them from the IDE  :/
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public AnchorStyles Anchor {
+                       get { return base.Anchor; }
+                       set { base.Anchor = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public bool AutoSize {
+                       get { return base.AutoSize; }
+                       set { base.AutoSize = value; }
+               }
+
+               //Uncomment once this has been implemented in 
ContainerControl.cs
+               //[Browsable (false)]
+               //[EditorBrowsable (EditorBrowsableState.Never)]
+               //[Localizable(false)]
+               //public override AutoSizeMode AutoSizeMode {
+               //        get { return base.AutoSizeMode; }
+               //        set { base.AutoSizeMode = value; }
+               //}
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public BorderStyle BorderStyle {
+                       get { return base.BorderStyle; }
+                       set { base.BorderStyle = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public DockStyle Dock {
+                       get { return base.Dock; }
+                       set { base.Dock = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public DockPaddingEdges DockPadding {
+                       get { return base.DockPadding; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public int Height {
+                       get { return this.Visible ? base.Height : 0; }
+                       set { throw new NotSupportedException ("The height 
cannot be set"); }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Point Location {
+                       get { return base.Location; }
+                       set { base.Location = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Size MaximumSize {
+                       get { return base.MaximumSize; }
+                       set { base.MaximumSize = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Size MinimumSize {
+                       get { return base.MinimumSize; }
+                       set { base.MinimumSize = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public string Name {
+                       get { return base.name; }
+                       set { base.name = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Control Parent {
+                       get { return base.Parent; }
+                       set { throw new NotSupportedException ("The parent 
cannot be set"); }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public Size Size {
+                       get { return base.Size; }
+                       set { base.Size = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public int TabIndex {
+                       get { return base.TabIndex; }
+                       set { base.TabIndex = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public bool TabStop {
+                       get { return base.TabStop; }
+                       set { base.TabStop = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public bool Visible {
+                       get { return base.Visible; }
+                       set { base.Visible = value; }
+               }
+
+               [Browsable (false)]
+               [EditorBrowsable (EditorBrowsableState.Never)]
+               new public int Width {
+                       get { return this.Visible ? base.Width : 0; }
+                       set { throw new NotSupportedException ("The width 
cannot be set"); }
+               }
+               #endregion
+
+               #region Internal Properties
+               internal int InternalHeight { set { base.Height = value; } }
+
+               internal int InternalWidth { set { base.Width = value; } }
+               #endregion
+       }
+}
+#endif
\ No newline at end of file

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources      
2006-09-13 13:44:19 UTC (rev 65352)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.dll.sources      
2006-09-13 14:29:24 UTC (rev 65353)
@@ -541,11 +541,13 @@
 System.Windows.Forms/SizeGripStyle.cs
 System.Windows.Forms/SizeType.cs
 System.Windows.Forms/SortOrder.cs
+System.Windows.Forms/SplitContainer.cs
 System.Windows.Forms/Splitter.cs
 System.Windows.Forms/SplitterCancelEventArgs.cs
 System.Windows.Forms/SplitterCancelEventHandler.cs
 System.Windows.Forms/SplitterEventArgs.cs
 System.Windows.Forms/SplitterEventHandler.cs
+System.Windows.Forms/SplitterPanel.cs
 System.Windows.Forms/StatusBar.cs
 System.Windows.Forms/StatusBarDrawItemEventArgs.cs
 System.Windows.Forms/StatusBarDrawItemEventHandler.cs

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 
2006-09-13 13:44:19 UTC (rev 65352)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms_test.dll.sources 
2006-09-13 14:29:24 UTC (rev 65353)
@@ -51,6 +51,7 @@
 System.Windows.Forms/RadioButtonTest.cs
 System.Windows.Forms/RichTextBoxTest.cs
 System.Windows.Forms/ScrollBarTest.cs
+System.Windows.Forms/SplitContainerTests.cs
 System.Windows.Forms/StatusBarTest.cs
 System.Windows.Forms/SystemInformationTest.cs
 System.Windows.Forms/TabControlTest.cs

Modified: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-09-13 13:44:19 UTC (rev 65352)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog   
2006-09-13 14:29:24 UTC (rev 65353)
@@ -1,3 +1,7 @@
+2006-09-13  Jonathan Pobst  <[EMAIL PROTECTED]>
+
+       * SplitContainerTests.cs: Added.
+
 2006-09-11  Gert Driesen  <[EMAIL PROTECTED]>
 
        * ListViewTest.cs: Added test for bug #79076. Added tests for 

Added: 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/SplitContainerTests.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/SplitContainerTests.cs
      2006-09-13 13:44:19 UTC (rev 65352)
+++ 
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/SplitContainerTests.cs
      2006-09-13 14:29:24 UTC (rev 65353)
@@ -0,0 +1,295 @@
+#if NET_2_0
+using System;
+using NUnit.Framework;
+using System.Windows.Forms;
+using System.Drawing;
+
+namespace ProfessionalColorTest
+{
+       [TestFixture]
+       public class SplitContainerTests
+       {
+               [Test]
+               public void TestSplitContainerConstruction ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+
+                       Assert.AreEqual (new Size (150, 100), sc.Size, "A1");
+                       Assert.AreEqual (FixedPanel.None, sc.FixedPanel, "A2");
+                       Assert.AreEqual (false, sc.IsSplitterFixed, "A3");
+                       Assert.AreEqual (Orientation.Vertical, sc.Orientation, 
"A4");
+                       Assert.AreEqual (false, sc.Panel1Collapsed, "A6");
+                       Assert.AreEqual (25, sc.Panel1MinSize, "A7");
+                       Assert.AreEqual (false, sc.Panel2Collapsed, "A9");
+                       Assert.AreEqual (25, sc.Panel2MinSize, "A10");
+                       Assert.AreEqual (50, sc.SplitterDistance, "A11");
+                       Assert.AreEqual (1, sc.SplitterIncrement, "A12");
+                       Assert.AreEqual (new Rectangle(50, 0, 4, 100), 
sc.SplitterRectangle, "A13");
+                       Assert.AreEqual (4, sc.SplitterWidth, "A14");
+                       Assert.AreEqual (BorderStyle.None, sc.BorderStyle, 
"A14");
+                       Assert.AreEqual (DockStyle.None, sc.Dock, "A15");
+               }
+               
+               [Test]
+               public void TestNotReleventProperties()
+               {
+                       // (MSDN lists are the following as "This property is 
not relevant to this class.")
+                       SplitContainer sc = new SplitContainer ();
+                       
+                       Assert.AreEqual (false, sc.AutoScroll, "B1");
+                       sc.AutoScroll = true;
+                       Assert.AreEqual (false, sc.AutoScroll, "B1-2");
+
+                       Assert.AreEqual (new Size(0,0), sc.AutoScrollMargin, 
"B2");
+                       sc.AutoScrollMargin = new Size (100, 100);
+                       Assert.AreEqual (new Size (100,100), 
sc.AutoScrollMargin, "B2-2");
+
+                       Assert.AreEqual (new Size (0, 0), sc.AutoScrollMinSize, 
"B3");
+                       sc.AutoScrollMinSize = new Size (100, 100);
+                       Assert.AreEqual (new Size (100, 100), 
sc.AutoScrollMinSize, "B3-2");
+
+                       //Assert.AreEqual (new Point (0, 0), 
sc.AutoScrollOffset, "B4");
+                       //sc.AutoScrollOffset = new Point (100, 100);
+                       //Assert.AreEqual (new Point (100, 100), 
sc.AutoScrollOffset, "B4-2");
+
+                       Assert.AreEqual (new Point (0, 0), 
sc.AutoScrollPosition, "B5");
+                       sc.AutoScrollPosition = new Point (100, 100);
+                       Assert.AreEqual (new Point (0, 0), 
sc.AutoScrollPosition, "B5-2");
+
+                       Assert.AreEqual (false, sc.AutoSize, "B6");
+                       sc.AutoSize = true;
+                       Assert.AreEqual (true, sc.AutoSize, "B6-2");
+
+                       //Assert.AreEqual (ImageLayout.Tile, 
sc.BackgroundImageLayout, "B7");
+                       //sc.BackgroundImageLayout =  ImageLayout.Stretch;
+                       //Assert.AreEqual (ImageLayout.Stretch, 
sc.BackgroundImageLayout, "B7-2");
+
+                       Assert.AreEqual (null, sc.BindingContext, "B8");
+                       sc.BindingContext = new BindingContext();
+                       Assert.AreEqual ("System.Windows.Forms.BindingContext", 
sc.BindingContext.ToString (), "B8-2");
+
+                       Assert.AreEqual (new Padding(0), sc.Padding, "B10");
+                       sc.Padding = new Padding (7);
+                       Assert.AreEqual (new Padding (7), sc.Padding, "B10-2");
+
+                       Assert.AreEqual (String.Empty, sc.Text, "B11");
+                       sc.Text = "Hello";
+                       Assert.AreEqual ("Hello", sc.Text, "B11-2");
+
+               }
+
+               [Test]
+               public void TestRelevantProperties ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+                       
+                       sc.BorderStyle = BorderStyle.FixedSingle;
+                       Assert.AreEqual (BorderStyle.FixedSingle, 
sc.BorderStyle, "C1");
+
+                       sc.Dock =  DockStyle.Fill;
+                       Assert.AreEqual (DockStyle.Fill, sc.Dock, "C2");
+
+                       sc.FixedPanel = FixedPanel.Panel1;
+                       Assert.AreEqual (FixedPanel.Panel1, sc.FixedPanel, 
"C3");
+
+                       sc.IsSplitterFixed = true;
+                       Assert.AreEqual (true, sc.IsSplitterFixed, "C4");
+
+                       sc.Orientation = Orientation.Horizontal;
+                       Assert.AreEqual (Orientation.Horizontal, 
sc.Orientation, "C5");
+
+                       sc.Panel1Collapsed = true;
+                       Assert.AreEqual (true, sc.Panel1Collapsed, "C6");
+                       
+                       sc.Panel1MinSize = 10;
+                       Assert.AreEqual (10, sc.Panel1MinSize, "C7");
+
+                       sc.Panel2Collapsed = true;
+                       Assert.AreEqual (true, sc.Panel2Collapsed, "C8");
+
+                       sc.Panel2MinSize = 10;
+                       Assert.AreEqual (10, sc.Panel2MinSize, "C9");
+
+                       sc.SplitterDistance = 77;
+                       Assert.AreEqual (77, sc.SplitterDistance, "C10");
+                       
+                       sc.SplitterIncrement = 5;
+                       Assert.AreEqual (5, sc.SplitterIncrement, "C11");
+                       
+                       sc.SplitterWidth = 10;
+                       Assert.AreEqual (10, sc.SplitterWidth, "C12");
+               }
+               
+               [Test]
+               public void TestPanelProperties ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+                       SplitterPanel p = sc.Panel1;
+
+                       Assert.AreEqual (AnchorStyles.Top | AnchorStyles.Left, 
p.Anchor, "D1");
+                       p.Anchor = AnchorStyles.None;
+                       Assert.AreEqual (AnchorStyles.None, p.Anchor, "D1-2");
+
+                       Assert.AreEqual (false, p.AutoSize, "D2");
+                       p.AutoSize = true;
+                       Assert.AreEqual (true, p.AutoSize, "D2-2");
+
+                       //Assert.AreEqual (AutoSizeMode.GrowOnly, 
p.AutoSizeMode, "D3");
+                       //p.AutoSizeMode = AutoSizeMode.GrowAndShrink;
+                       //Assert.AreEqual (AutoSizeMode.GrowOnly, 
p.AutoSizeMode, "D3-2");
+
+                       Assert.AreEqual (BorderStyle.None, p.BorderStyle, "D4");
+                       p.BorderStyle = BorderStyle.FixedSingle;
+                       Assert.AreEqual (BorderStyle.FixedSingle, 
p.BorderStyle, "D4-2");
+
+                       //Assert.AreEqual (DockStyle.None, p.Dock, "D5");
+                       //p.Dock = DockStyle.Left;
+                       //Assert.AreEqual (DockStyle.Left, p.Dock, "D5-2");
+
+                       //Assert.AreEqual (new Point(0,0), p.Location, "D7");
+                       //p.Location = new Point (10, 10);
+                       //Assert.AreEqual (new Point (0, 0), p.Location, 
"D7-2");
+
+                       Assert.AreEqual (new Size (0, 0), p.MaximumSize, "D8");
+                       p.MaximumSize = new Size (10, 10);
+                       Assert.AreEqual (new Size (10, 10), p.MaximumSize, 
"D8-2");
+
+                       Assert.AreEqual (new Size (0, 0), p.MinimumSize, "D9");
+                       p.MinimumSize = new Size (10, 10);
+                       Assert.AreEqual (new Size (10, 10), p.MinimumSize, 
"D9-2");
+
+                       Assert.AreEqual (String.Empty, p.Name, "D10");
+                       p.Name = "MyPanel";
+                       Assert.AreEqual ("MyPanel", p.Name, "D10-2");
+
+                       // We set a new max/min size above, so let's start over 
with new controls
+                       sc = new SplitContainer();
+                       p = sc.Panel1;
+                       
+                       //Assert.AreEqual (new Size (50, 100), p.Size, "D12");
+                       //p.Size = new Size (10, 10);
+                       //Assert.AreEqual (new Size (50, 100), p.Size, "D12-2");
+
+                       //Assert.AreEqual (0, p.TabIndex, "D13");
+                       p.TabIndex = 4;
+                       Assert.AreEqual (4, p.TabIndex, "D13-2");
+
+                       Assert.AreEqual (false, p.TabStop, "D14");
+                       p.TabStop = true;
+                       Assert.AreEqual (true, p.TabStop, "D14-2");
+
+                       Assert.AreEqual (true, p.Visible, "D15");
+                       p.Visible = false;
+                       Assert.AreEqual (false, p.Visible, "D15-2");
+               }
+               
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void TestPanelHeightProperty ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+                       SplitterPanel p = sc.Panel1;
+
+                       Assert.AreEqual (100, p.Height, "E1");
+                       
+                       p.Height = 200;
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void TestPanelWidthProperty ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+                       SplitterPanel p = sc.Panel1;
+
+                       Assert.AreEqual (50, p.Width, "F1");
+
+                       p.Width = 200;
+               }
+
+               [Test]
+               [ExpectedException (typeof (NotSupportedException))]
+               public void TestPanelParentProperty ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+                       SplitContainer sc2 = new SplitContainer ();
+                       SplitterPanel p = sc.Panel1;
+
+                       Assert.AreEqual (sc, p.Parent, "G1");
+
+                       p.Parent = sc2;
+               }
+
+               [Test]
+               public void TestSplitterPosition ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+
+                       Assert.AreEqual (new Rectangle (50, 0, 4, 100), 
sc.SplitterRectangle, "H1");
+                       
+                       sc.Orientation = Orientation.Horizontal;
+                       Assert.AreEqual (new Rectangle (0, 50, 150, 4), 
sc.SplitterRectangle, "H2");
+               }
+
+               [Test]
+               [Ignore ("SplitContainer.FixedPanel not yet implemented")]
+               public void TestFixedPanelNone ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+
+                       Assert.AreEqual (50, sc.SplitterDistance, "I1");
+
+                       sc.Width = 300;
+                       Assert.AreEqual (100, sc.SplitterDistance, "I2");
+               }
+               
+               [Test]
+               [Ignore ("SplitContainer.FixedPanel not yet implemented")]
+               public void TestFixedPanel1 ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+                       sc.FixedPanel = FixedPanel.Panel1;
+                       
+                       Assert.AreEqual (50, sc.SplitterDistance, "J1");
+
+                       sc.Width = 300;
+                       Assert.AreEqual (50, sc.SplitterDistance, "J2");
+               }
+               
+               [Test]
+               [Ignore ("SplitContainer.FixedPanel not yet implemented")]
+               public void TestFixedPanel2 ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+                       sc.FixedPanel = FixedPanel.Panel2;
+
+                       Assert.AreEqual (50, sc.SplitterDistance, "K1");
+
+                       sc.Width = 300;
+                       Assert.AreEqual (200, sc.SplitterDistance, "K2");
+               }
+
+               [Test]
+               public void TestSplitterDistance ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+
+                       Assert.AreEqual (new Rectangle (50, 0, 4, 100), 
sc.SplitterRectangle, "L1");
+
+                       sc.SplitterDistance = 100;
+                       Assert.AreEqual (new Rectangle (100, 0, 4, 100), 
sc.SplitterRectangle, "L2");
+               }
+
+               [Test]
+               public void TestSplitterWidth ()
+               {
+                       SplitContainer sc = new SplitContainer ();
+
+                       Assert.AreEqual (new Rectangle (50, 0, 4, 100), 
sc.SplitterRectangle, "M1");
+
+                       sc.SplitterWidth = 10;
+                       Assert.AreEqual (new Rectangle (50, 0, 10, 100), 
sc.SplitterRectangle, "M2");
+               }
+       }
+}
+#endif
\ No newline at end of file

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to