Author: jpobst
Date: 2007-03-24 15:56:11 -0500 (Sat, 24 Mar 2007)
New Revision: 74947
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/DefaultLayout.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DefaultLayoutTest.cs
Log:
2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
* Control.cs: Make SetBoundsCore match MS better. The BoundsSpecified
parameter indicates which aspects were explicit/user-set.
* ComboBox.cs, ListBox.cs: Call SetBoundsCore correctly. (no 0
parameters).
2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
* DefaultLayout.cs: Call SetBounds with BoundsSpecified.None instead
of using SetImplicitBounds.
* TableLayout.cs: Call SetBounds with BoundsSpecified.None instead of
modifying Control.Bounds.
2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
* DefaultLayoutTest.cs: Enable some NotWorking tests that now
work correctly.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-24 19:18:43 UTC (rev 74946)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-24 20:56:11 UTC (rev 74947)
@@ -1,5 +1,11 @@
2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
+ * Control.cs: Make SetBoundsCore match MS better. The BoundsSpecified
+ parameter indicates which aspects were explicit/user-set.
+ * ComboBox.cs, ListBox.cs: Call SetBoundsCore correctly. (no 0
parameters).
+
+2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
+
* ProgressBar.cs: Throw AOORE instead of AE for property Value (2.0).
* ScrollBar.cs: Throw AOORE instead of AE for properties LargeChange,
SmallChange, and Value (2.0).
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
2007-03-24 19:18:43 UTC (rev 74946)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
2007-03-24 20:56:11 UTC (rev 74947)
@@ -1637,7 +1637,7 @@
// Save the requested height since set bounds can
destroy it
int save_height = requested_height;
- SetBounds (0, 0, 0, requested_height,
BoundsSpecified.Height);
+ SetBounds (bounds.X, bounds.Y, bounds.Width,
requested_height, BoundsSpecified.Height);
requested_height = save_height;
}
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2007-03-24 19:18:43 UTC (rev 74946)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2007-03-24 20:56:11 UTC (rev 74947)
@@ -2455,10 +2455,7 @@
anchor_style = AnchorStyles.Top |
AnchorStyles.Left;
if (dock_style == DockStyle.None) {
- if (explicit_bounds == Rectangle.Empty)
- Bounds = new Rectangle (new
Point (0, 0), DefaultSize);
- else
- Bounds = explicit_bounds;
+ Bounds = explicit_bounds;
}
if (parent != null) {
@@ -3538,12 +3535,6 @@
PerformLayout(null, null);
}
- internal void SetImplicitBounds (int x, int y, int width, int
height) {
- Rectangle saved_bounds = explicit_bounds;
- SetBounds (x, y, width, height);
- explicit_bounds = saved_bounds;
- }
-
[EditorBrowsable(EditorBrowsableState.Advanced)]
public void PerformLayout(Control affectedControl, string
affectedProperty) {
LayoutEventArgs levent = new
LayoutEventArgs(affectedControl, affectedProperty);
@@ -3770,23 +3761,8 @@
}
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");
}
@@ -4233,6 +4209,9 @@
[EditorBrowsable(EditorBrowsableState.Advanced)]
protected virtual void SetBoundsCore(int x, int y, int width,
int height, BoundsSpecified specified) {
+ Rectangle old_explicit = explicit_bounds;
+ Rectangle new_bounds = new Rectangle (x, y, width,
height);
+
// SetBoundsCore updates the Win32 control itself.
UpdateBounds updates the controls variables and fires events, I'm guessing - pdb
if (IsHandleCreated) {
XplatUI.SetWindowPos(Handle, x, y, width,
height);
@@ -4248,7 +4227,29 @@
}
UpdateBounds(x, y, width, height);
+
+ // BoundsSpecified tells us which variables were
programatic (user-set).
+ // We need to store those in the explicit bounds
+ if ((specified & BoundsSpecified.X) ==
BoundsSpecified.X)
+ explicit_bounds.X = new_bounds.X;
+ else
+ explicit_bounds.X = old_explicit.X;
+ if ((specified & BoundsSpecified.Y) ==
BoundsSpecified.Y)
+ explicit_bounds.Y = new_bounds.Y;
+ else
+ explicit_bounds.Y = old_explicit.Y;
+
+ if ((specified & BoundsSpecified.Width) ==
BoundsSpecified.Width)
+ explicit_bounds.Width = new_bounds.Width;
+ else
+ explicit_bounds.Width = old_explicit.Width;
+
+ if ((specified & BoundsSpecified.Height) ==
BoundsSpecified.Height)
+ explicit_bounds.Height = new_bounds.Height;
+ else
+ explicit_bounds.Height = old_explicit.Height;
+
UpdateDistances();
}
@@ -4367,7 +4368,8 @@
bounds.Width=width;
bounds.Height=height;
- // Assume explicit bounds set. SetImplicitBounds will
restore old bounds
+ // Assume explicit bounds set. SetBoundsCore will
restore old bounds
+ // if needed.
explicit_bounds = bounds;
client_size.Width=clientWidth;
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
2007-03-24 19:18:43 UTC (rev 74946)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
2007-03-24 20:56:11 UTC (rev 74947)
@@ -1840,7 +1840,7 @@
if (requested_height == -1)
return;
- SetBounds(0, 0, 0, requested_height,
BoundsSpecified.Height);
+ SetBounds(bounds.X, bounds.Y, bounds.Width,
requested_height, BoundsSpecified.Height);
}
private void UpdateScrollBars ()
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
2007-03-24 19:18:43 UTC (rev 74946)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/ChangeLog
2007-03-24 20:56:11 UTC (rev 74947)
@@ -1,3 +1,10 @@
+2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
+
+ * DefaultLayout.cs: Call SetBounds with BoundsSpecified.None instead
+ of using SetImplicitBounds.
+ * TableLayout.cs: Call SetBounds with BoundsSpecified.None instead of
+ modifying Control.Bounds.
+
2007-02-28 Jonathan Pobst <[EMAIL PROTECTED]>
* DefaultLayout.cs: Use ClientRectangle instead of DisplayRectangle
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/DefaultLayout.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/DefaultLayout.cs
2007-03-24 19:18:43 UTC (rev 74946)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/DefaultLayout.cs
2007-03-24 20:56:11 UTC (rev 74947)
@@ -58,36 +58,36 @@
break;
case DockStyle.Left:
- child.SetImplicitBounds (space.Left,
space.Y, child.Width, space.Height);
+ child.SetBounds (space.Left, space.Y,
child.Width, space.Height, BoundsSpecified.None);
space.X += child.Width;
space.Width -= child.Width;
break;
case DockStyle.Top:
- child.SetImplicitBounds (space.Left,
space.Y, space.Width, child.Height);
+ child.SetBounds (space.Left, space.Y,
space.Width, child.Height, BoundsSpecified.None);
space.Y += child.Height;
space.Height -= child.Height;
break;
case DockStyle.Right:
- child.SetImplicitBounds (space.Right -
child.Width, space.Y, child.Width, space.Height);
+ child.SetBounds (space.Right -
child.Width, space.Y, child.Width, space.Height, BoundsSpecified.None);
space.Width -= child.Width;
break;
case DockStyle.Bottom:
- child.SetImplicitBounds (space.Left,
space.Bottom - child.Height, space.Width, child.Height);
+ child.SetBounds (space.Left,
space.Bottom - child.Height, space.Width, child.Height, BoundsSpecified.None);
space.Height -= child.Height;
break;
case DockStyle.Fill:
- child.SetImplicitBounds (space.Left,
space.Top, space.Width, space.Height);
+ child.SetBounds (space.Left, space.Top,
space.Width, space.Height, BoundsSpecified.None);
break;
}
}
// MdiClient gets whatever space is left
if (mdi != null)
- mdi.SetImplicitBounds (space.Left, space.Top,
space.Width, space.Height);
+ mdi.SetBounds (space.Left, space.Top,
space.Width, space.Height, BoundsSpecified.None);
}
void LayoutAnchoredChildren (Control parent, Control[] controls)
@@ -151,7 +151,7 @@
if (height < 0)
height = 0;
- child.SetBounds (left, top, width, height);
+ child.SetBounds (left, top, width, height,
BoundsSpecified.None);
}
}
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
2007-03-24 19:18:43 UTC (rev 74946)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms.Layout/TableLayout.cs
2007-03-24 20:56:11 UTC (rev 74947)
@@ -441,7 +441,7 @@
else // (center control)
new_y = ((current_pos.Y
+ column_height - c.Margin.Top - c.Margin.Bottom) / 2) + c.Margin.Top -
(new_height / 2);
- c.Bounds = new Rectangle(new_x,
new_y, new_width, new_height);
+ c.SetBounds (new_x, new_y,
new_width, new_height, BoundsSpecified.None);
}
current_pos.Offset
(panel.column_widths[x], 0);
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-03-24 19:18:43 UTC (rev 74946)
+++ trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/ChangeLog
2007-03-24 20:56:11 UTC (rev 74947)
@@ -1,5 +1,10 @@
2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
+ * DefaultLayoutTest.cs: Enable some NotWorking tests that now
+ work correctly.
+
+2007-03-24 Jonathan Pobst <[EMAIL PROTECTED]>
+
* ProgressBarTest.cs, ScrollBarTest.cs, TimerTest.cs: Update
tests to pass on .Net 2.0.
Modified:
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DefaultLayoutTest.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DefaultLayoutTest.cs
2007-03-24 19:18:43 UTC (rev 74946)
+++
trunk/mcs/class/Managed.Windows.Forms/Test/System.Windows.Forms/DefaultLayoutTest.cs
2007-03-24 20:56:11 UTC (rev 74947)
@@ -616,7 +616,6 @@
}
[Test]
- [Category ("NotWorking")]
public void TestUndockDefaultSize ()
{
Size sz = panel.Size;
@@ -635,7 +634,6 @@
}
[Test]
- [Category ("NotWorking")]
public void TestUndockExplicitSize ()
{
panel.Size = new Size (50, 50);
@@ -665,7 +663,6 @@
}
[Test]
- [Category ("NotWorking")]
public void TestUndockExplicitSizeVisible ()
{
form.Show ();
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches