prefRect may now be a valueHolder or block.
authorClaus Gittinger <cg@exept.de>
Wed, 27 May 1998 11:20:52 +0200
changeset 948 50ce6c646929
parent 947 a5325410e4fd
child 949 0eb888b21192
prefRect may now be a valueHolder or block.
AlignOrg.st
AlignmentOrigin.st
--- a/AlignOrg.st	Tue May 26 16:10:55 1998 +0200
+++ b/AlignOrg.st	Wed May 27 11:20:52 1998 +0200
@@ -264,33 +264,35 @@
 
 !
 
-rectangleRelativeTo:superRectangle preferred:prefRect
+rectangleRelativeTo:superRectangle preferred:prefRectHolder
     "compute the rectangle represented by the receiver,
      given the superViews rectangle and the views preferredExtent."
 
-    |x y|
+    |x y prefRect|
+
+    prefRect := prefRectHolder value.
 
     leftOffset isNil ifTrue:[
-	x := 0
+        x := 0
     ] ifFalse:[
-	x := leftOffset value
+        x := leftOffset value
     ].
     topOffset isNil ifTrue:[
-	y := 0
+        y := 0
     ] ifFalse:[
-	y := topOffset value
+        y := topOffset value
     ].
     leftFraction notNil ifTrue:[
-	x := x + (superRectangle width * leftFraction value)
+        x := x + (superRectangle width * leftFraction value)
     ].
     topFraction notNil ifTrue:[
-	y := y + (superRectangle height * topFraction value)
+        y := y + (superRectangle height * topFraction value)
     ].
     leftAlignmentFraction ~~ 0 ifTrue:[
-	x := x - (prefRect width * leftAlignmentFraction value)
+        x := x - (prefRect width * leftAlignmentFraction value)
     ].
     topAlignmentFraction ~~ 0 ifTrue:[
-	y := y - (prefRect height * topAlignmentFraction value)
+        y := y - (prefRect height * topAlignmentFraction value)
     ].
     ^ Rectangle left:x top:y extent:prefRect extent
 
@@ -300,17 +302,17 @@
      superRect := 0@0 corner:100@100.
      aO := (AlignmentOrigin new).
      aO leftFraction:0.5;
-	topFraction:0.5;
-	leftAlignmentFraction:0.5;
-	topAlignmentFraction:0.5.
+        topFraction:0.5;
+        leftAlignmentFraction:0.5;
+        topAlignmentFraction:0.5.
      aO rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) 
     "
 
-    "Modified: 13.9.1997 / 10:39:50 / cg"
+    "Modified: / 27.5.1998 / 10:19:09 / cg"
 ! !
 
 !AlignmentOrigin class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Attic/AlignOrg.st,v 1.23 1997-11-28 19:07:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Attic/AlignOrg.st,v 1.24 1998-05-27 09:20:52 cg Exp $'
 ! !
--- a/AlignmentOrigin.st	Tue May 26 16:10:55 1998 +0200
+++ b/AlignmentOrigin.st	Wed May 27 11:20:52 1998 +0200
@@ -264,33 +264,35 @@
 
 !
 
-rectangleRelativeTo:superRectangle preferred:prefRect
+rectangleRelativeTo:superRectangle preferred:prefRectHolder
     "compute the rectangle represented by the receiver,
      given the superViews rectangle and the views preferredExtent."
 
-    |x y|
+    |x y prefRect|
+
+    prefRect := prefRectHolder value.
 
     leftOffset isNil ifTrue:[
-	x := 0
+        x := 0
     ] ifFalse:[
-	x := leftOffset value
+        x := leftOffset value
     ].
     topOffset isNil ifTrue:[
-	y := 0
+        y := 0
     ] ifFalse:[
-	y := topOffset value
+        y := topOffset value
     ].
     leftFraction notNil ifTrue:[
-	x := x + (superRectangle width * leftFraction value)
+        x := x + (superRectangle width * leftFraction value)
     ].
     topFraction notNil ifTrue:[
-	y := y + (superRectangle height * topFraction value)
+        y := y + (superRectangle height * topFraction value)
     ].
     leftAlignmentFraction ~~ 0 ifTrue:[
-	x := x - (prefRect width * leftAlignmentFraction value)
+        x := x - (prefRect width * leftAlignmentFraction value)
     ].
     topAlignmentFraction ~~ 0 ifTrue:[
-	y := y - (prefRect height * topAlignmentFraction value)
+        y := y - (prefRect height * topAlignmentFraction value)
     ].
     ^ Rectangle left:x top:y extent:prefRect extent
 
@@ -300,17 +302,17 @@
      superRect := 0@0 corner:100@100.
      aO := (AlignmentOrigin new).
      aO leftFraction:0.5;
-	topFraction:0.5;
-	leftAlignmentFraction:0.5;
-	topAlignmentFraction:0.5.
+        topFraction:0.5;
+        leftAlignmentFraction:0.5;
+        topAlignmentFraction:0.5.
      aO rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) 
     "
 
-    "Modified: 13.9.1997 / 10:39:50 / cg"
+    "Modified: / 27.5.1998 / 10:19:09 / cg"
 ! !
 
 !AlignmentOrigin class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/AlignmentOrigin.st,v 1.23 1997-11-28 19:07:46 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/AlignmentOrigin.st,v 1.24 1998-05-27 09:20:52 cg Exp $'
 ! !