2003/10/16 09:35:55
authormegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:39:26 +0000 (07:39 +0000)
committermegacz <megacz@xwt.org>
Fri, 30 Jan 2004 07:39:26 +0000 (07:39 +0000)
darcs-hash:20040130073926-2ba56-b6343ba3955709ea15dba9fb1f40655c8821f677.gz

src/org/xwt/Box.java.pp
src/org/xwt/Surface.java

index 429c7a4..e6c7201 100644 (file)
@@ -209,10 +209,16 @@ public final class Box extends JS.Scope {
 
     // Reflow ////////////////////////////////////////////////////////////////////////////////////////
 
+    /** only for use on the root box */
     void reflow() { reflow(width, height); }
     void reflow(int new_width, int new_height) {
         repack();
         if (Surface.abort) return;
+        //#repeat width/height new_width/new_height HSHRINK_FLAG/VSHRINK_FLAG contentwidth/contentheight minwidth/minheight maxwidth/maxheight
+        new_width = bound(max(contentwidth, minwidth),
+                          new_width,
+                          ((flags & HSHRINK_FLAG) != 0) ? max(contentwidth, minwidth) : maxwidth);
+        //#end
         resize(x, y, new_width, new_height);
     }
 
@@ -263,8 +269,8 @@ public final class Box extends JS.Scope {
 
         // --- Phase 2 ----------------------------------------------------------------------
         // compute the min/max sizes of the columns and rows and set our contentwidth
+        //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows
         if (numChildren() != 0) {
-            //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows
             int numCols = cols;
             if (numCols == 0)
                 for(Box child = getChild(0); child != null; child = child.nextSibling())
@@ -274,10 +280,10 @@ public final class Box extends JS.Scope {
                 if (!(((child.flags & NOTPACKED_FLAG) != 0) || ((child.flags & INVISIBLE_FLAG) != 0)))
                     colWidth[child.col] = max(colWidth[child.col], child.contentwidth / child.colspan);
             for(int col=0; col<numCols; col++) contentwidth += colWidth[col];
-            contentwidth = max(textwidth, contentwidth);
-            contentwidth = bound(minwidth, contentwidth, maxwidth);
-            //#end               
         }
+        contentwidth = max(textwidth, contentwidth);
+        contentwidth = bound(minwidth, contentwidth, maxwidth);
+        //#end               
 
         offset_x = 0;
         if ((flags & NOTPACKED_FLAG) == 0) {
index 8e44116..3317d9e 100644 (file)
@@ -293,6 +293,7 @@ public abstract class Surface extends PixelBuffer {
         do {
             abort = false;
             root.reflow();
+            setSize();
             // update mouseinside and trigger Enter/Leave as a result of box size/position changes
             String oldcursor = cursor;
             cursor = "default";