Author: jpobst
Date: 2007-11-19 22:39:17 -0500 (Mon, 19 Nov 2007)
New Revision: 89962

Modified:
   
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
Log:
2007-11-19  Jonathan Pobst  <[EMAIL PROTECTED]>
        [Backport to 1.2.6]
        * ToolStrip.cs: Handle flow layout in GetPreferredSize to fix PDN3.
        [Fixes bug #342123]

Modified: 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
  2007-11-20 03:37:19 UTC (rev 89961)
+++ 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
  2007-11-20 03:39:17 UTC (rev 89962)
@@ -1,3 +1,8 @@
+2007-11-19  Jonathan Pobst  <[EMAIL PROTECTED]>
+       [Backport to 1.2.6]
+       * ToolStrip.cs: Handle flow layout in GetPreferredSize to fix PDN3.
+       [Fixes bug #342123]
+
 2007-11-19  Everaldo Canuto  <[EMAIL PROTECTED]>
        [Backport to 1.2.6]
        * Form.cs: Check for empty Text before assign to cp.Caption in 
CreateParams

Modified: 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
===================================================================
--- 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
       2007-11-20 03:37:19 UTC (rev 89961)
+++ 
branches/mono-1-2-6/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ToolStrip.cs
       2007-11-20 03:39:17 UTC (rev 89962)
@@ -1401,6 +1401,34 @@
                {
                        Size new_size = Size.Empty;
 
+                       // TODO: This is total duct tape.  We really have to 
call into the correct
+                       // layout engine, do a dry run of the layout, and find 
out our true
+                       // preferred dimensions.
+                       if (this.LayoutStyle == ToolStripLayoutStyle.Flow) {
+                               Point currentLocation = Point.Empty;
+                               int tallest = 0;
+                               
+                               foreach (ToolStripItem tsi in items) {
+                                       if ((DisplayRectangle.Width - 
currentLocation.X) < (tsi.Width + tsi.Margin.Horizontal)) {
+
+                                               currentLocation.Y += tallest;
+                                               tallest = 0;
+                                               
+                                               currentLocation.X = 
DisplayRectangle.Left;
+                                       }
+
+                                       // Offset the left margin and set the 
control to our point
+                                       currentLocation.Offset 
(tsi.Margin.Left, 0);
+                                       tallest = Math.Max (tallest, tsi.Height 
+ tsi.Margin.Vertical);
+                                       
+                                       // Update our location pointer
+                                       currentLocation.X += tsi.Width + 
tsi.Margin.Right;
+                               }
+
+                               currentLocation.Y += tallest;
+                               return new Size (currentLocation.X, 
currentLocation.Y);
+                       }
+                               
                        if (this.orientation == Orientation.Vertical) {
                                foreach (ToolStripItem tsi in this.items)
                                        if (tsi.Available)  {

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

Reply via email to