care for sizing with no subviews;
authorca
Tue, 25 Feb 1997 14:03:55 +0100
changeset 1042 5914ecc423e1
parent 1041 976147f19ad7
child 1043 f0eeb4035bb8
care for sizing with no subviews; care for extentChanged setting
HPanelV.st
HorizontalPanelView.st
PanelView.st
VPanelV.st
VerticalPanelView.st
--- a/HPanelV.st	Mon Feb 24 21:20:10 1997 +0100
+++ b/HPanelV.st	Tue Feb 25 14:03:55 1997 +0100
@@ -1038,9 +1038,16 @@
      my size has changed"
 
     |xpos space sumOfWidths numChilds l wEach wInside hL vL resizeToMaxV 
-     resizeToMaxH maxHeight maxWidth d m2 subViews|
+     resizeToMaxH maxHeight maxWidth d m2 subViews ext|
+
+    subViews := self subViews.
+    subViews size == 0 ifTrue:[^ self].
 
-    (subViews := self subViews) isNil ifTrue:[^ self].
+    extentChanged ifTrue:[
+        ext := self computeExtent.
+        width := ext x.
+        height := ext y.
+    ].
 
     space := horizontalSpace.
     numChilds := subViews size.
@@ -1357,5 +1364,5 @@
 !HorizontalPanelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/HPanelV.st,v 1.28 1997-02-21 19:30:36 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/HPanelV.st,v 1.29 1997-02-25 13:03:31 ca Exp $'
 ! !
--- a/HorizontalPanelView.st	Mon Feb 24 21:20:10 1997 +0100
+++ b/HorizontalPanelView.st	Tue Feb 25 14:03:55 1997 +0100
@@ -1038,9 +1038,16 @@
      my size has changed"
 
     |xpos space sumOfWidths numChilds l wEach wInside hL vL resizeToMaxV 
-     resizeToMaxH maxHeight maxWidth d m2 subViews|
+     resizeToMaxH maxHeight maxWidth d m2 subViews ext|
+
+    subViews := self subViews.
+    subViews size == 0 ifTrue:[^ self].
 
-    (subViews := self subViews) isNil ifTrue:[^ self].
+    extentChanged ifTrue:[
+        ext := self computeExtent.
+        width := ext x.
+        height := ext y.
+    ].
 
     space := horizontalSpace.
     numChilds := subViews size.
@@ -1357,5 +1364,5 @@
 !HorizontalPanelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.28 1997-02-21 19:30:36 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.29 1997-02-25 13:03:31 ca Exp $'
 ! !
--- a/PanelView.st	Mon Feb 24 21:20:10 1997 +0100
+++ b/PanelView.st	Tue Feb 25 14:03:55 1997 +0100
@@ -296,48 +296,55 @@
      This method is redefined for different layout characteristics - you may
      even create subclasses with completely different geometry management."
 
-    |first xpos ypos maxHeightInRow thisRow subViews|
+    |first xpos ypos maxHeightInRow thisRow subViews ext|
+
+    subViews := self subViews.
+    subViews size == 0 ifTrue:[^ self].
 
-    (subViews := self subViews) notNil ifTrue:[
-        xpos := horizontalSpace.
-        ypos := verticalSpace.
+    extentChanged ifTrue:[
+        ext := self computeExtent.
+        width := ext x.
+        height := ext y.
+    ].
 
-        maxHeightInRow := 0.
-        first := true.
-        thisRow := OrderedCollection new.
-        subViews do:[:child |
-            "go to next row, if this subview won't fit"
-            first ifFalse: [
-                (xpos + child widthIncludingBorder + horizontalSpace) > width
-                ifTrue: [
-                    thisRow notEmpty ifTrue:[
-                        thisRow do:[:rowElement |
-                            rowElement heightIncludingBorder < maxHeightInRow ifTrue:[
-                                rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder))
-                            ]
+    xpos := horizontalSpace.
+    ypos := verticalSpace.
+
+    maxHeightInRow := 0.
+    first := true.
+    thisRow := OrderedCollection new.
+    subViews do:[:child |
+        "go to next row, if this subview won't fit"
+        first ifFalse: [
+            (xpos + child widthIncludingBorder + horizontalSpace) > width
+            ifTrue: [
+                thisRow notEmpty ifTrue:[
+                    thisRow do:[:rowElement |
+                        rowElement heightIncludingBorder < maxHeightInRow ifTrue:[
+                            rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder))
                         ]
-                    ].
-                    ypos := ypos + verticalSpace + maxHeightInRow.
-                    xpos := horizontalSpace.
-                    maxHeightInRow := 0.
-                    thisRow := OrderedCollection new.
-                ]
-            ].
-            thisRow add:child.
-            child origin:(xpos@ypos).
-            xpos := xpos + (child widthIncludingBorder) + horizontalSpace.
-            (maxHeightInRow < (child heightIncludingBorder)) ifTrue:[
-                maxHeightInRow := child heightIncludingBorder
-            ].
-            first := false
-        ].
-        thisRow notEmpty ifTrue:[
-            thisRow do:[:rowElement |
-                rowElement heightIncludingBorder < maxHeightInRow ifTrue:[
-                    rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder))
-                ]
+                    ]
+                ].
+                ypos := ypos + verticalSpace + maxHeightInRow.
+                xpos := horizontalSpace.
+                maxHeightInRow := 0.
+                thisRow := OrderedCollection new.
             ]
         ].
+        thisRow add:child.
+        child origin:(xpos@ypos).
+        xpos := xpos + (child widthIncludingBorder) + horizontalSpace.
+        (maxHeightInRow < (child heightIncludingBorder)) ifTrue:[
+            maxHeightInRow := child heightIncludingBorder
+        ].
+        first := false
+    ].
+    thisRow notEmpty ifTrue:[
+        thisRow do:[:rowElement |
+            rowElement heightIncludingBorder < maxHeightInRow ifTrue:[
+                rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder))
+            ]
+        ]
     ].
     mustRearrange := false
 
@@ -347,5 +354,5 @@
 !PanelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/PanelView.st,v 1.20 1997-02-21 19:27:43 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/PanelView.st,v 1.21 1997-02-25 13:03:15 ca Exp $'
 ! !
--- a/VPanelV.st	Mon Feb 24 21:20:10 1997 +0100
+++ b/VPanelV.st	Tue Feb 25 14:03:55 1997 +0100
@@ -652,10 +652,16 @@
     "(re)compute position of every child"
 
     |ypos space sumOfHeights numChilds l hEach hInside 
-     maxWidth resizeToMax hL m2 subViews|
+     maxWidth resizeToMax hL m2 subViews ext|
 
     subViews := self subViews.
-    subViews isNil ifTrue:[^ self].
+    subViews size == 0 ifTrue:[^ self].
+
+    extentChanged ifTrue:[
+        ext := self computeExtent.
+        width := ext x.
+        height := ext y.
+    ].
 
     space := verticalSpace.
     numChilds := subViews size.
@@ -958,5 +964,5 @@
 !VerticalPanelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/VPanelV.st,v 1.28 1997-02-21 19:31:01 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/VPanelV.st,v 1.29 1997-02-25 13:03:55 ca Exp $'
 ! !
--- a/VerticalPanelView.st	Mon Feb 24 21:20:10 1997 +0100
+++ b/VerticalPanelView.st	Tue Feb 25 14:03:55 1997 +0100
@@ -652,10 +652,16 @@
     "(re)compute position of every child"
 
     |ypos space sumOfHeights numChilds l hEach hInside 
-     maxWidth resizeToMax hL m2 subViews|
+     maxWidth resizeToMax hL m2 subViews ext|
 
     subViews := self subViews.
-    subViews isNil ifTrue:[^ self].
+    subViews size == 0 ifTrue:[^ self].
+
+    extentChanged ifTrue:[
+        ext := self computeExtent.
+        width := ext x.
+        height := ext y.
+    ].
 
     space := verticalSpace.
     numChilds := subViews size.
@@ -958,5 +964,5 @@
 !VerticalPanelView class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/VerticalPanelView.st,v 1.28 1997-02-21 19:31:01 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/VerticalPanelView.st,v 1.29 1997-02-25 13:03:55 ca Exp $'
 ! !