#DOCUMENTATION by cg
authorClaus Gittinger <cg@exept.de>
Wed, 17 Jul 2019 10:16:15 +0200
changeset 4295 a3333891d7f3
parent 4294 95e9a81c2c12
child 4296 00f9234e8c1c
#DOCUMENTATION by cg class: LayoutFrame added: #leftFraction:rightFraction: #leftFraction:rightFraction:topFraction:bottomFraction: #topFraction:bottomFraction: comment/format in: #rectangleRelativeTo:preferred: category of: #rectangleRelativeTo:preferred: class: LayoutFrame class comment/format in: #documentation changed: #leftFraction:rightFraction:topFraction:bottomFraction:
LayoutFrame.st
--- a/LayoutFrame.st	Wed Jul 17 10:16:05 2019 +0200
+++ b/LayoutFrame.st	Wed Jul 17 10:16:15 2019 +0200
@@ -44,11 +44,8 @@
     easier. Instances can be used to control the geometry of a subview, within
     its superview. Like a layoutOrigin, it controls the origin of a component
     by given fraction and offset dimensions; in addition, the bottom-right
-    corner is also controlled by corresponding values. Therefore, the components
-    preferredExtent is ignored.
-
-    See also:
-        LayoutOrigin AlignmentOrigin Layout
+    corner is also controlled by corresponding values. 
+    Therefore, the component's preferredExtent is ignored.
 
     Notice: 
         this class was implemented using protocol information
@@ -195,11 +192,10 @@
 leftFraction:lF rightFraction:rF topFraction:tF bottomFraction:bF
     "create a new layoutFrame"
 
-    ^ self new
-        leftFraction:lF offset:0 
-        rightFraction:rF offset:0 
-        topFraction:tF offset:0 
-        bottomFraction:bF offset:0
+    ^ self new 
+        leftFraction:lF rightFraction:rF topFraction:tF bottomFraction:bF
+
+    "Modified (format): / 17-07-2019 / 10:09:10 / Claus Gittinger"
 !
 
 leftFrame:pixels
@@ -385,6 +381,22 @@
 
 !
 
+leftFraction:lF rightFraction:rF
+    leftFraction := lF.
+    rightFraction := rF.
+
+    "Created: / 17-07-2019 / 10:05:53 / Claus Gittinger"
+!
+
+leftFraction:lF rightFraction:rF topFraction:tF bottomFraction:bF
+    leftFraction := lF.
+    rightFraction := rF.
+    topFraction := tF.
+    bottomFraction := bF.
+
+    "Created: / 17-07-2019 / 10:07:46 / Claus Gittinger"
+!
+
 leftOffset:lO rightOffset:rO
     "set the horizontal offset fields"
 
@@ -442,6 +454,13 @@
     rightOffset := something.
 !
 
+topFraction:tF bottomFraction:bF
+    topFraction := tF.
+    bottomFraction := bF.
+
+    "Created: / 17-07-2019 / 10:07:15 / Claus Gittinger"
+!
+
 topOffset:newTopOffset bottomOffset:newBottomOffset
     topOffset := newTopOffset.
     bottomOffset := newBottomOffset.
@@ -472,6 +491,65 @@
       + rightFraction hash + bottomFraction hash + rightOffset hash + bottomOffset hash
 ! !
 
+!LayoutFrame methodsFor:'computing'!
+
+rectangleRelativeTo:superRectangle preferred:prefRectHolder
+    "compute the rectangle represented by the receiver,
+     given the superView's rectangle and the view's preferredExtent."
+
+    |x1 y1 x2 y2 superWidth superHeight|
+
+    x1 := x2 := superRectangle left.
+    y1 := y2 := superRectangle top.
+
+    leftOffset notNil ifTrue:[
+        x1 := x1 + leftOffset value
+    ].
+    topOffset notNil ifTrue:[
+        y1 := y1 + topOffset value
+    ].
+    rightOffset notNil ifTrue:[
+        x2 := x2 + rightOffset value
+    ].
+    bottomOffset notNil ifTrue:[
+        y2 := y2 + bottomOffset value
+    ].
+
+    leftFraction notNil ifTrue:[
+        superWidth := superRectangle width.
+        x1 := x1 + (superWidth * leftFraction value) 
+    ].
+    topFraction notNil ifTrue:[
+        superHeight := superRectangle height.
+        y1 := y1 + (superHeight * topFraction value) 
+    ].
+    rightFraction notNil ifTrue:[
+        superWidth isNil ifTrue:[superWidth := superRectangle width].
+        x2 := x2 + (superWidth * rightFraction value) 
+    ].
+    bottomFraction notNil ifTrue:[
+        superHeight isNil ifTrue:[superHeight := superRectangle height].
+        y2 := y2 + (superHeight * bottomFraction value) 
+    ].
+    ^ Rectangle left:x1 top:y1 right:x2 bottom:y2
+
+    "
+     |superRect lF|
+
+     superRect := 0@0 corner:99@99.
+     lF := (LayoutFrame new).
+     lF leftFraction:0.25;
+        topFraction:0.25;
+        rightFraction:0.75;
+        bottomFraction:0.75.
+     lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) 
+    "
+
+    "Created: / 06-03-1997 / 21:07:51 / cg"
+    "Modified: / 13-08-1998 / 18:33:59 / cg"
+    "Modified (comment): / 17-07-2019 / 10:03:07 / Claus Gittinger"
+! !
+
 !LayoutFrame methodsFor:'converting'!
 
 fromLiteralArrayEncoding:encoding
@@ -572,62 +650,6 @@
     ^ true
 
 
-!
-
-rectangleRelativeTo:superRectangle preferred:prefRectHolder
-    "compute the rectangle represented by the receiver,
-     given the superViews rectangle and the view's preferredExtent."
-
-    |x1 y1 x2 y2 superWidth superHeight|
-
-    x1 := x2 := superRectangle left.
-    y1 := y2 := superRectangle top.
-
-    leftOffset notNil ifTrue:[
-        x1 := x1 + leftOffset value
-    ].
-    topOffset notNil ifTrue:[
-        y1 := y1 + topOffset value
-    ].
-    rightOffset notNil ifTrue:[
-        x2 := x2 + rightOffset value
-    ].
-    bottomOffset notNil ifTrue:[
-        y2 := y2 + bottomOffset value
-    ].
-
-    leftFraction notNil ifTrue:[
-        superWidth := superRectangle width.
-        x1 := x1 + (superWidth * leftFraction value) 
-    ].
-    topFraction notNil ifTrue:[
-        superHeight := superRectangle height.
-        y1 := y1 + (superHeight * topFraction value) 
-    ].
-    rightFraction notNil ifTrue:[
-        superWidth isNil ifTrue:[superWidth := superRectangle width].
-        x2 := x2 + (superWidth * rightFraction value) 
-    ].
-    bottomFraction notNil ifTrue:[
-        superHeight isNil ifTrue:[superHeight := superRectangle height].
-        y2 := y2 + (superHeight * bottomFraction value) 
-    ].
-    ^ Rectangle left:x1 top:y1 right:x2 bottom:y2
-
-    "
-     |superRect lF|
-
-     superRect := 0@0 corner:99@99.
-     lF := (LayoutFrame new).
-     lF leftFraction:0.25;
-        topFraction:0.25;
-        rightFraction:0.75;
-        bottomFraction:0.75.
-     lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30) 
-    "
-
-    "Created: / 6.3.1997 / 21:07:51 / cg"
-    "Modified: / 13.8.1998 / 18:33:59 / cg"
 ! !
 
 !LayoutFrame class methodsFor:'documentation'!