Author: pbartok
Date: 2006-08-26 18:42:37 -0400 (Sat, 26 Aug 2006)
New Revision: 64418

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
   
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
Log:
2006-08-23  Peter Dennis Bartok  <[EMAIL PROTECTED]> 

        * Control.cs:
          - The size and location setters shouldn't go directly to 
            SetBoundsCore, but to SetBounds, which triggers layout on the
            parent, then calls SetBoundsCore. (Related to fix for #78835)
          - SetBounds: Moved actual location update code into this function
            from SetBoundsCore, to match MS. Added call to PerformLayout if
            we have a parent (to trigger resizing of anchored parents if the 
            child size has changed (see testcase for #78835) 
        * ListBox.cs, Form.cs: Call SetBounds instead of SetBoundsCore to match 
          new control code
        * ScrollableControl.cs (CalculateCanvasSize): Use shortcut variable



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-08-26 20:54:27 UTC (rev 64417)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-08-26 22:42:37 UTC (rev 64418)
@@ -1,3 +1,17 @@
+2006-08-23  Peter Dennis Bartok  <[EMAIL PROTECTED]> 
+
+       * Control.cs:
+         - The size and location setters shouldn't go directly to 
+           SetBoundsCore, but to SetBounds, which triggers layout on the
+           parent, then calls SetBoundsCore. (Related to fix for #78835)
+         - SetBounds: Moved actual location update code into this function
+           from SetBoundsCore, to match MS. Added call to PerformLayout if
+           we have a parent (to trigger resizing of anchored parents if the 
+           child size has changed (see testcase for #78835) 
+       * ListBox.cs, Form.cs: Call SetBounds instead of SetBoundsCore to match 
+         new control code
+       * ScrollableControl.cs (CalculateCanvasSize): Use shortcut variable
+
 2006-08-23  Peter Dennis Bartok  <[EMAIL PROTECTED]>
 
        * XplatUIX11.cs: Don't reset the DisplayHandle that's stored in

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-08-26 20:54:27 UTC (rev 64417)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs       
2006-08-26 22:42:37 UTC (rev 64418)
@@ -733,7 +733,7 @@
                        bounds.Y=top;
                        bounds.Width=width;
                        bounds.Height=height;
-                       SetBoundsCore(left, top, width, height, 
BoundsSpecified.All);
+                       SetBounds(left, top, width, height, 
BoundsSpecified.All);
                        Text=text;
                }
 
@@ -746,7 +746,7 @@
                        bounds.Y=top;
                        bounds.Width=width;
                        bounds.Height=height;
-                       SetBoundsCore(left, top, width, height, 
BoundsSpecified.All);
+                       SetBounds(left, top, width, height, 
BoundsSpecified.All);
                        Text=text;
                }
 
@@ -1645,7 +1645,7 @@
                        }
 
                        set {
-                               SetBoundsCore(value.Left, value.Top, 
value.Width, value.Height, BoundsSpecified.All);
+                               SetBounds(value.Left, value.Top, value.Width, 
value.Height, BoundsSpecified.All);
                        }
                }
 
@@ -2054,7 +2054,7 @@
                        }
 
                        set {
-                               SetBoundsCore(bounds.X, bounds.Y, bounds.Width, 
value, BoundsSpecified.Height);
+                               SetBounds(bounds.X, bounds.Y, bounds.Width, 
value, BoundsSpecified.Height);
                        }
                }
 
@@ -2137,7 +2137,7 @@
                        }
 
                        set {
-                               SetBoundsCore(value, bounds.Y, bounds.Width, 
bounds.Height, BoundsSpecified.X);
+                               SetBounds(value, bounds.Y, bounds.Width, 
bounds.Height, BoundsSpecified.X);
                        }
                }
 
@@ -2149,7 +2149,7 @@
                        }
 
                        set {
-                               SetBoundsCore(value.X, value.Y, bounds.Width, 
bounds.Height, BoundsSpecified.Location);
+                               SetBounds(value.X, value.Y, bounds.Width, 
bounds.Height, BoundsSpecified.Location);
                        }
                }
 
@@ -2314,7 +2314,7 @@
                        }
 
                        set {
-                               SetBoundsCore(bounds.X, bounds.Y, value.Width, 
value.Height, BoundsSpecified.Size);
+                               SetBounds(bounds.X, bounds.Y, value.Width, 
value.Height, BoundsSpecified.Size);
                        }
                }
 
@@ -2402,7 +2402,7 @@
                        }
 
                        set {
-                               SetBoundsCore(bounds.X, value, bounds.Width, 
bounds.Height, BoundsSpecified.Y);
+                               SetBounds(bounds.X, value, bounds.Width, 
bounds.Height, BoundsSpecified.Y);
                        }
                }
 
@@ -2448,7 +2448,7 @@
                        }
 
                        set {
-                               SetBoundsCore(bounds.X, bounds.Y, value, 
bounds.Height, BoundsSpecified.Width);
+                               SetBounds(bounds.X, bounds.Y, value, 
bounds.Height, BoundsSpecified.Width);
                        }
                }
 
@@ -2921,7 +2921,7 @@
                                AnchorStyles    anchor;
                                Rectangle       space;
 
-                               space= DisplayRectangle;
+                               space = DisplayRectangle;
 
                                // Deal with docking; go through in reverse, MS 
docs say that lowest Z-order is closest to edge
                                Control [] controls = 
child_controls.GetAllControls ();
@@ -2974,7 +2974,7 @@
                                        }
                                }
 
-                               space=DisplayRectangle;
+                               space = DisplayRectangle;
 
                                for (int i=0; i < controls.Length; i++) {
                                        int left;
@@ -3223,11 +3223,30 @@
                }
 
                public void SetBounds(int x, int y, int width, int height) {
-                       SetBoundsCore(x, y, width, height, BoundsSpecified.All);
+                       SetBounds(x, y, width, height, BoundsSpecified.All);
                }
 
                public void SetBounds(int x, int y, int width, int height, 
BoundsSpecified specified) {
+                       if ((specified & BoundsSpecified.X) != 
BoundsSpecified.X) {
+                               x = Left;
+                       }
+
+                       if ((specified & BoundsSpecified.Y) != 
BoundsSpecified.Y) {
+                               y = Top;
+                       }
+
+                       if ((specified & BoundsSpecified.Width) != 
BoundsSpecified.Width) {
+                               width = Width;
+                       }
+
+                       if ((specified & BoundsSpecified.Height) != 
BoundsSpecified.Height) {
+                               height = Height;
+                       }
+
                        SetBoundsCore(x, y, width, height, specified);
+                       if (parent != null) {
+                               parent.PerformLayout(this, "Bounds");
+                       }
                }
 
                public void Show() {
@@ -3616,7 +3635,7 @@
                                size.Height = (int)(size.Height * dy);
                        }
 
-                       SetBoundsCore(location.X, location.Y, size.Width, 
size.Height, BoundsSpecified.All);
+                       SetBounds(location.X, location.Y, size.Width, 
size.Height, BoundsSpecified.All);
 
                        /* Now scale our children */
                        Control [] controls = child_controls.GetAllControls ();
@@ -3638,22 +3657,6 @@
                [EditorBrowsable(EditorBrowsableState.Advanced)]
                protected virtual void SetBoundsCore(int x, int y, int width, 
int height, BoundsSpecified specified) {
                        // SetBoundsCore updates the Win32 control itself. 
UpdateBounds updates the controls variables and fires events, I'm guessing - pdb
-                       if ((specified & BoundsSpecified.X) != 
BoundsSpecified.X) {
-                               x = Left;
-                       }
-
-                       if ((specified & BoundsSpecified.Y) != 
BoundsSpecified.Y) {
-                               y = Top;
-                       }
-
-                       if ((specified & BoundsSpecified.Width) != 
BoundsSpecified.Width) {
-                               width = Width;
-                       }
-
-                       if ((specified & BoundsSpecified.Height) != 
BoundsSpecified.Height) {
-                               height = Height;
-                       }
-
                        if (IsHandleCreated) {
                                XplatUI.SetWindowPos(Handle, x, y, width, 
height);
                        }
@@ -3677,7 +3680,7 @@
                                return;
                        }
 
-                       SetBoundsCore(bounds.X, bounds.Y, WindowRect.Width, 
WindowRect.Height, BoundsSpecified.Size);
+                       SetBounds(bounds.X, bounds.Y, WindowRect.Width, 
WindowRect.Height, BoundsSpecified.Size);
                }
 
                [EditorBrowsable(EditorBrowsableState.Advanced)]

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2006-08-26 20:54:27 UTC (rev 64417)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2006-08-26 22:42:37 UTC (rev 64418)
@@ -1702,11 +1702,11 @@
 
                        if (!IsMdiChild) {
                                if (XplatUI.CalculateWindowRect(ref ClientRect, 
cp.Style, cp.ExStyle, cp.menu, out WindowRect)) {
-                                       SetBoundsCore(bounds.X, bounds.Y, 
WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
+                                       SetBounds(bounds.X, bounds.Y, 
WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
                                }
                        } else {
                                if (XplatUI.CalculateWindowRect(ref ClientRect, 
cp.Style, cp.ExStyle, cp.menu, out WindowRect)) {
-                                       SetBoundsCore(bounds.X, bounds.Y, 
WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
+                                       SetBounds(bounds.X, bounds.Y, 
WindowRect.Width, WindowRect.Height, BoundsSpecified.Size);
                                }
                        }
                }

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs       
2006-08-26 20:54:27 UTC (rev 64417)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs       
2006-08-26 22:42:37 UTC (rev 64418)
@@ -1786,7 +1786,7 @@
                        if (requested_height == -1)
                                return;
 
-                       SetBoundsCore (0, 0, 0, requested_height, 
BoundsSpecified.Height);
+                       SetBounds(0, 0, 0, requested_height, 
BoundsSpecified.Height);
                }
 
                private void UpdateScrollBars ()

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs
===================================================================
--- 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs 
    2006-08-26 20:54:27 UTC (rev 64417)
+++ 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ScrollableControl.cs 
    2006-08-26 22:42:37 UTC (rev 64418)
@@ -632,8 +632,8 @@
 
                                switch(child.Dock) {
                                        case DockStyle.Left: {
-                                               if ((child_controls[i].Right + 
extra_width) > width) {
-                                                       width = 
child_controls[i].Right + extra_width;
+                                               if ((child.Right + extra_width) 
> width) {
+                                                       width = child.Right + 
extra_width;
                                                }
                                                continue;
                                        }
@@ -657,8 +657,8 @@
                                                anchor = child.Anchor;
 
                                                if (((anchor & 
AnchorStyles.Left) != 0) && ((anchor & AnchorStyles.Right) == 0)) {
-                                                       if 
((child_controls[i].Right + extra_width) > width) {
-                                                               width = 
child_controls[i].Right + extra_width;
+                                                       if ((child.Right + 
extra_width) > width) {
+                                                               width = 
child.Right + extra_width;
                                                        }
                                                }
 

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

Reply via email to