--- a/AlignOrg.st Sat Apr 27 16:19:26 1996 +0200
+++ b/AlignOrg.st Sat Apr 27 19:51:19 1996 +0200
@@ -43,10 +43,12 @@
reference point within the component is positioned.
The reference point itself is specified as fraction of the components size.
- Notice: this class was implemented using protocol information
- from alpha testers - it may not be complete or compatible to
- the corresponding ST-80 class. If you encounter any incompatibilities,
- please forward a note to the ST/X team.
+ Notice:
+ this class was implemented using protocol information
+ from alpha testers - it may not be complete or compatible to
+ the corresponding ST-80 class.
+ If you encounter any incompatibilities, please forward a note
+ describing the incompatibility verbal (i.e. no code) to the ST/X team.
[author:]
Claus Gittinger
@@ -59,56 +61,62 @@
examples
"
+ Although the examples below use a button as component,
+ they work of course with any type of subview ....
+
using a LayoutOrigin, to control the top-left origins position of
a component (i.e. origin at:0.5@0.5):
-
- |top button|
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5).
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5).
- top open
+ top open
+ [exEnd]
using an AlignmentOrigin, to control the centers position of
a component (i.e. center of component at:0.5@0.5):
-
- |top button|
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(AlignmentOrigin new
- leftFraction:0.5;
- topFraction:0.5;
- leftAlignmentFraction:0.5;
- topAlignmentFraction:0.5).
+ button := Button label:'component'.
+ top add:button in:(AlignmentOrigin new
+ leftFraction:0.5;
+ topFraction:0.5;
+ leftAlignmentFraction:0.5;
+ topAlignmentFraction:0.5).
- top open
+ top open
+ [exEnd]
using an AlignmentOrigin, to control the bottom-right position of
a component (i.e. bottom-right of component at:0.5@0.5):
-
- |top button|
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(AlignmentOrigin new
- leftFraction:0.5;
- topFraction:0.5;
- leftAlignmentFraction:1.0;
- topAlignmentFraction:1.0).
+ button := Button label:'component'.
+ top add:button in:(AlignmentOrigin new
+ leftFraction:0.5;
+ topFraction:0.5;
+ leftAlignmentFraction:1.0;
+ topAlignmentFraction:1.0).
- top open
+ top open
+ [exEnd]
"
! !
@@ -198,29 +206,32 @@
!AlignmentOrigin methodsFor:'queries'!
rectangleRelativeTo:superRectangle preferred:prefRect
+ "compute the rectangle represented by the receiver,
+ given the superViews rectangle and the views preferredExtent."
+
|x y|
leftOffset isNil ifTrue:[
- x := 0
+ x := 0
] ifFalse:[
- x := leftOffset
+ x := leftOffset
].
topOffset isNil ifTrue:[
- y := 0
+ y := 0
] ifFalse:[
- y := topOffset
+ y := topOffset
].
leftFraction notNil ifTrue:[
- x := x + (superRectangle width * leftFraction)
+ x := x + (superRectangle width * leftFraction)
].
topFraction notNil ifTrue:[
- y := y + (superRectangle height * topFraction)
+ y := y + (superRectangle height * topFraction)
].
leftAlignmentFraction ~~ 0 ifTrue:[
- x := x - (prefRect width * leftAlignmentFraction)
+ x := x - (prefRect width * leftAlignmentFraction)
].
topAlignmentFraction ~~ 0 ifTrue:[
- y := y - (prefRect height * topAlignmentFraction)
+ y := y - (prefRect height * topAlignmentFraction)
].
^ Rectangle origin:x@y extent:prefRect extent
@@ -230,15 +241,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: 27.4.1996 / 14:53:56 / cg"
! !
!AlignmentOrigin class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/AlignOrg.st,v 1.11 1996-04-25 16:21:00 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/AlignOrg.st,v 1.12 1996-04-27 17:51:19 cg Exp $'
! !
--- a/AlignmentOrigin.st Sat Apr 27 16:19:26 1996 +0200
+++ b/AlignmentOrigin.st Sat Apr 27 19:51:19 1996 +0200
@@ -43,10 +43,12 @@
reference point within the component is positioned.
The reference point itself is specified as fraction of the components size.
- Notice: this class was implemented using protocol information
- from alpha testers - it may not be complete or compatible to
- the corresponding ST-80 class. If you encounter any incompatibilities,
- please forward a note to the ST/X team.
+ Notice:
+ this class was implemented using protocol information
+ from alpha testers - it may not be complete or compatible to
+ the corresponding ST-80 class.
+ If you encounter any incompatibilities, please forward a note
+ describing the incompatibility verbal (i.e. no code) to the ST/X team.
[author:]
Claus Gittinger
@@ -59,56 +61,62 @@
examples
"
+ Although the examples below use a button as component,
+ they work of course with any type of subview ....
+
using a LayoutOrigin, to control the top-left origins position of
a component (i.e. origin at:0.5@0.5):
-
- |top button|
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5).
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5).
- top open
+ top open
+ [exEnd]
using an AlignmentOrigin, to control the centers position of
a component (i.e. center of component at:0.5@0.5):
-
- |top button|
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(AlignmentOrigin new
- leftFraction:0.5;
- topFraction:0.5;
- leftAlignmentFraction:0.5;
- topAlignmentFraction:0.5).
+ button := Button label:'component'.
+ top add:button in:(AlignmentOrigin new
+ leftFraction:0.5;
+ topFraction:0.5;
+ leftAlignmentFraction:0.5;
+ topAlignmentFraction:0.5).
- top open
+ top open
+ [exEnd]
using an AlignmentOrigin, to control the bottom-right position of
a component (i.e. bottom-right of component at:0.5@0.5):
-
- |top button|
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(AlignmentOrigin new
- leftFraction:0.5;
- topFraction:0.5;
- leftAlignmentFraction:1.0;
- topAlignmentFraction:1.0).
+ button := Button label:'component'.
+ top add:button in:(AlignmentOrigin new
+ leftFraction:0.5;
+ topFraction:0.5;
+ leftAlignmentFraction:1.0;
+ topAlignmentFraction:1.0).
- top open
+ top open
+ [exEnd]
"
! !
@@ -198,29 +206,32 @@
!AlignmentOrigin methodsFor:'queries'!
rectangleRelativeTo:superRectangle preferred:prefRect
+ "compute the rectangle represented by the receiver,
+ given the superViews rectangle and the views preferredExtent."
+
|x y|
leftOffset isNil ifTrue:[
- x := 0
+ x := 0
] ifFalse:[
- x := leftOffset
+ x := leftOffset
].
topOffset isNil ifTrue:[
- y := 0
+ y := 0
] ifFalse:[
- y := topOffset
+ y := topOffset
].
leftFraction notNil ifTrue:[
- x := x + (superRectangle width * leftFraction)
+ x := x + (superRectangle width * leftFraction)
].
topFraction notNil ifTrue:[
- y := y + (superRectangle height * topFraction)
+ y := y + (superRectangle height * topFraction)
].
leftAlignmentFraction ~~ 0 ifTrue:[
- x := x - (prefRect width * leftAlignmentFraction)
+ x := x - (prefRect width * leftAlignmentFraction)
].
topAlignmentFraction ~~ 0 ifTrue:[
- y := y - (prefRect height * topAlignmentFraction)
+ y := y - (prefRect height * topAlignmentFraction)
].
^ Rectangle origin:x@y extent:prefRect extent
@@ -230,15 +241,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: 27.4.1996 / 14:53:56 / cg"
! !
!AlignmentOrigin class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/AlignmentOrigin.st,v 1.11 1996-04-25 16:21:00 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/AlignmentOrigin.st,v 1.12 1996-04-27 17:51:19 cg Exp $'
! !
--- a/Layout.st Sat Apr 27 16:19:26 1996 +0200
+++ b/Layout.st Sat Apr 27 19:51:19 1996 +0200
@@ -44,43 +44,64 @@
be implemented (if the existing ones are not sufficient, add you own subclass
and install it as layout-object in your view).
- See more info & examples in concrete subclasses:
- LayoutOrigin LayoutFrame AlignmentOrigin
-
- Notice: this class was implemented using protocol information
- from alpha testers - it may not be complete or compatible to
- the corresponding ST-80 class. If you encounter any incompatibilities,
- please forward a note to the ST/X team.
+ Notice:
+ this class was implemented using protocol information
+ from alpha testers - it may not be complete or compatible to
+ the corresponding ST-80 class.
+ If you encounter any incompatibilities, please forward a note
+ describing the incompatibility verbal (i.e. no code) to the ST/X team.
[author:]
Claus Gittinger
+
+ [see also:]
+ View
+ LayoutOrigin LayoutFrame AlignmentOrigin
"
! !
!Layout class methodsFor:'instance creation'!
new
+ "return a new initialized instance"
+
^ self basicNew initialize
+
+ "Modified: 27.4.1996 / 14:47:08 / cg"
! !
!Layout methodsFor:'initialization'!
initialize
+ "setup the instance - to be redefined by concrete subclasses"
+
^ self subclassResponsibility
+
+ "Modified: 27.4.1996 / 14:46:56 / cg"
! !
!Layout methodsFor:'queries'!
isLayout
+ "return true, if the recevier is a layout object.
+ Always return true here."
^ true
+
+ "Modified: 27.4.1996 / 14:45:27 / cg"
!
rectangleRelativeTo:superRectangle preferred:prefRect
+ "compute the rectangle represented by the receiver,
+ given the superViews rectangle and the views preferredExtent.
+ Must be implemented by concrete subclasses."
+
^ self subclassResponsibility
+
+ "Modified: 27.4.1996 / 14:46:37 / cg"
! !
!Layout class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Layout.st,v 1.10 1996-04-25 16:20:30 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Layout.st,v 1.11 1996-04-27 17:50:49 cg Exp $'
! !
--- a/LayoutFrame.st Sat Apr 27 16:19:26 1996 +0200
+++ b/LayoutFrame.st Sat Apr 27 19:51:19 1996 +0200
@@ -45,66 +45,85 @@
See also:
LayoutOrigin AlignmentOrigin Layout
- Notice: this class was implemented using protocol information
- from alpha testers - it may not be complete or compatible to
- the corresponding ST-80 class. If you encounter any incompatibilities,
- please forward a note to the ST/X team.
+ Notice:
+ this class was implemented using protocol information
+ from alpha testers - it may not be complete or compatible to
+ the corresponding ST-80 class.
+ If you encounter any incompatibilities, please forward a note
+ describing the incompatibility verbal (i.e. no code) to the ST/X team.
[author:]
Claus Gittinger
+
+ [see also:]
+ View
+ LayoutOrigin AlignmentOrigin Layout
+ Rectangle Point
"
!
examples
"
- |top button|
+ Although the examples below use a button as component,
+ they work of course with any type of subview ....
+
- top := StandardSystemView new.
- top extent:300@300.
+ arrange for the button to be in 0.25 @ 0.25 -> 0.75 @ 0.75.
+ This is the same as with relative origin/corner.
+ [exBegin]
+ |top button|
- button := Button label:'component'.
- top add:button in:(LayoutFrame new
- leftFraction:0.25;
- topFraction:0.25;
- rightFraction:0.75;
- bottomFraction:0.75).
+ top := StandardSystemView new.
+ top extent:300@300.
- top open
+ button := Button label:'component'.
+ top add:button in:(LayoutFrame new
+ leftFraction:0.25;
+ topFraction:0.25;
+ rightFraction:0.75;
+ bottomFraction:0.75).
+
+ top open
+ [exEnd]
like above, but adds additional offset to the origin:
-
- |top button|
+ This is the same as with relative origin/corner
+ and setting left & right insets.
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutFrame new
- leftFraction:0.25; leftOffset:10;
- topFraction:0.25; topOffset:-20;
- rightFraction:0.75;
- bottomFraction:0.75).
+ button := Button label:'component'.
+ top add:button in:(LayoutFrame new
+ leftFraction:0.25; leftOffset:10;
+ topFraction:0.25; topOffset:-20;
+ rightFraction:0.75;
+ bottomFraction:0.75).
- top open
+ top open
+ [exEnd]
- like above, with offsets on all edges, actually simulating
- a constant inset on all four edges:
+ like above, with offsets on all edges,
+ actually simulating a constant inset on all four edges:
+ [exBegin]
+ |top button|
- |top button|
-
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutFrame new
- leftFraction:0.0; leftOffset:10;
- topFraction:0.0; topOffset:10;
- rightFraction:1.0; rightOffset:-10;
- bottomFraction:1.0; bottomOffset:-10).
+ button := Button label:'component'.
+ top add:button in:(LayoutFrame new
+ leftFraction:0.0; leftOffset:10;
+ topFraction:0.0; topOffset:10;
+ rightFraction:1.0; rightOffset:-10;
+ bottomFraction:1.0; bottomOffset:-10).
- top open
+ top open
+ [exEnd]
"
! !
@@ -242,39 +261,42 @@
!
rectangleRelativeTo:superRectangle preferred:prefRect
+ "compute the rectangle represented by the receiver,
+ given the superViews rectangle and the views preferredExtent."
+
|x1 y1 x2 y2|
leftOffset isNil ifTrue:[
- x1 := 0
+ x1 := 0
] ifFalse:[
- x1 := leftOffset
+ x1 := leftOffset
].
topOffset isNil ifTrue:[
- y1 := 0
+ y1 := 0
] ifFalse:[
- y1 := topOffset
+ y1 := topOffset
].
rightOffset isNil ifTrue:[
- x2 := 0
+ x2 := 0
] ifFalse:[
- x2 := rightOffset
+ x2 := rightOffset
].
bottomOffset isNil ifTrue:[
- y2 := 0
+ y2 := 0
] ifFalse:[
- y2 := bottomOffset
+ y2 := bottomOffset
].
leftFraction notNil ifTrue:[
- x1 := x1 + (superRectangle width * leftFraction)
+ x1 := x1 + (superRectangle width * leftFraction)
].
topFraction notNil ifTrue:[
- y1 := y1 + (superRectangle height * topFraction)
+ y1 := y1 + (superRectangle height * topFraction)
].
rightFraction notNil ifTrue:[
- x2 := x2 + (superRectangle width * rightFraction)
+ x2 := x2 + (superRectangle width * rightFraction)
].
bottomFraction notNil ifTrue:[
- y2 := y2 + (superRectangle height * bottomFraction)
+ y2 := y2 + (superRectangle height * bottomFraction)
].
^ Rectangle origin:x1@y1 corner:x2@y2
@@ -284,15 +306,17 @@
superRect := 0@0 corner:100@100.
lF := (LayoutFrame new).
lF leftFraction:0.25;
- topFraction:0.25;
- rightFraction:0.75;
- bottomFraction:0.75.
+ topFraction:0.25;
+ rightFraction:0.75;
+ bottomFraction:0.75.
lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30)
"
+
+ "Modified: 27.4.1996 / 14:54:03 / cg"
! !
!LayoutFrame class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/LayoutFrame.st,v 1.12 1996-04-25 16:20:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/LayoutFrame.st,v 1.13 1996-04-27 17:50:45 cg Exp $'
! !
--- a/LayoutFrm.st Sat Apr 27 16:19:26 1996 +0200
+++ b/LayoutFrm.st Sat Apr 27 19:51:19 1996 +0200
@@ -45,66 +45,85 @@
See also:
LayoutOrigin AlignmentOrigin Layout
- Notice: this class was implemented using protocol information
- from alpha testers - it may not be complete or compatible to
- the corresponding ST-80 class. If you encounter any incompatibilities,
- please forward a note to the ST/X team.
+ Notice:
+ this class was implemented using protocol information
+ from alpha testers - it may not be complete or compatible to
+ the corresponding ST-80 class.
+ If you encounter any incompatibilities, please forward a note
+ describing the incompatibility verbal (i.e. no code) to the ST/X team.
[author:]
Claus Gittinger
+
+ [see also:]
+ View
+ LayoutOrigin AlignmentOrigin Layout
+ Rectangle Point
"
!
examples
"
- |top button|
+ Although the examples below use a button as component,
+ they work of course with any type of subview ....
+
- top := StandardSystemView new.
- top extent:300@300.
+ arrange for the button to be in 0.25 @ 0.25 -> 0.75 @ 0.75.
+ This is the same as with relative origin/corner.
+ [exBegin]
+ |top button|
- button := Button label:'component'.
- top add:button in:(LayoutFrame new
- leftFraction:0.25;
- topFraction:0.25;
- rightFraction:0.75;
- bottomFraction:0.75).
+ top := StandardSystemView new.
+ top extent:300@300.
- top open
+ button := Button label:'component'.
+ top add:button in:(LayoutFrame new
+ leftFraction:0.25;
+ topFraction:0.25;
+ rightFraction:0.75;
+ bottomFraction:0.75).
+
+ top open
+ [exEnd]
like above, but adds additional offset to the origin:
-
- |top button|
+ This is the same as with relative origin/corner
+ and setting left & right insets.
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutFrame new
- leftFraction:0.25; leftOffset:10;
- topFraction:0.25; topOffset:-20;
- rightFraction:0.75;
- bottomFraction:0.75).
+ button := Button label:'component'.
+ top add:button in:(LayoutFrame new
+ leftFraction:0.25; leftOffset:10;
+ topFraction:0.25; topOffset:-20;
+ rightFraction:0.75;
+ bottomFraction:0.75).
- top open
+ top open
+ [exEnd]
- like above, with offsets on all edges, actually simulating
- a constant inset on all four edges:
+ like above, with offsets on all edges,
+ actually simulating a constant inset on all four edges:
+ [exBegin]
+ |top button|
- |top button|
-
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutFrame new
- leftFraction:0.0; leftOffset:10;
- topFraction:0.0; topOffset:10;
- rightFraction:1.0; rightOffset:-10;
- bottomFraction:1.0; bottomOffset:-10).
+ button := Button label:'component'.
+ top add:button in:(LayoutFrame new
+ leftFraction:0.0; leftOffset:10;
+ topFraction:0.0; topOffset:10;
+ rightFraction:1.0; rightOffset:-10;
+ bottomFraction:1.0; bottomOffset:-10).
- top open
+ top open
+ [exEnd]
"
! !
@@ -242,39 +261,42 @@
!
rectangleRelativeTo:superRectangle preferred:prefRect
+ "compute the rectangle represented by the receiver,
+ given the superViews rectangle and the views preferredExtent."
+
|x1 y1 x2 y2|
leftOffset isNil ifTrue:[
- x1 := 0
+ x1 := 0
] ifFalse:[
- x1 := leftOffset
+ x1 := leftOffset
].
topOffset isNil ifTrue:[
- y1 := 0
+ y1 := 0
] ifFalse:[
- y1 := topOffset
+ y1 := topOffset
].
rightOffset isNil ifTrue:[
- x2 := 0
+ x2 := 0
] ifFalse:[
- x2 := rightOffset
+ x2 := rightOffset
].
bottomOffset isNil ifTrue:[
- y2 := 0
+ y2 := 0
] ifFalse:[
- y2 := bottomOffset
+ y2 := bottomOffset
].
leftFraction notNil ifTrue:[
- x1 := x1 + (superRectangle width * leftFraction)
+ x1 := x1 + (superRectangle width * leftFraction)
].
topFraction notNil ifTrue:[
- y1 := y1 + (superRectangle height * topFraction)
+ y1 := y1 + (superRectangle height * topFraction)
].
rightFraction notNil ifTrue:[
- x2 := x2 + (superRectangle width * rightFraction)
+ x2 := x2 + (superRectangle width * rightFraction)
].
bottomFraction notNil ifTrue:[
- y2 := y2 + (superRectangle height * bottomFraction)
+ y2 := y2 + (superRectangle height * bottomFraction)
].
^ Rectangle origin:x1@y1 corner:x2@y2
@@ -284,15 +306,17 @@
superRect := 0@0 corner:100@100.
lF := (LayoutFrame new).
lF leftFraction:0.25;
- topFraction:0.25;
- rightFraction:0.75;
- bottomFraction:0.75.
+ topFraction:0.25;
+ rightFraction:0.75;
+ bottomFraction:0.75.
lF rectangleRelativeTo:superRect preferred:(0@0 corner:30@30)
"
+
+ "Modified: 27.4.1996 / 14:54:03 / cg"
! !
!LayoutFrame class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.12 1996-04-25 16:20:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.13 1996-04-27 17:50:45 cg Exp $'
! !
--- a/LayoutOrg.st Sat Apr 27 16:19:26 1996 +0200
+++ b/LayoutOrg.st Sat Apr 27 19:51:19 1996 +0200
@@ -42,53 +42,63 @@
A layoutOrigin controls the origin of a subcomponent, given a fractional
component and an offset component.
- See also:
- LayoutFrame AlignmentOrigin Layout
-
- Notice: this class was implemented using protocol information
- from alpha testers - it may not be complete or compatible to
- the corresponding ST-80 class. If you encounter any incompatibilities,
- please forward a note to the ST/X team.
+ Notice:
+ this class was implemented using protocol information
+ from alpha testers - it may not be complete or compatible to
+ the corresponding ST-80 class.
+ If you encounter any incompatibilities, please forward a note
+ describing the incompatibility verbal (i.e. no code) to the ST/X team.
[author:]
Claus Gittinger
+
+ [see also:]
+ View
+ LayoutFrame AlignmentOrigin Layout
+ Rectangle Point
"
!
examples
"
- using a LayoutOrigin, to control the top-left origins position of
- a component (i.e. origin at:0.5@0.5):
+ Although the examples below use a button as component,
+ they work of course with any type of subview ....
- |top button|
+ using a LayoutOrigin, to arrange for
+ the TOPLEFT of a component be positions
+ at the center (i.e. buttons origin at:0.5 @ 0.5):
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5).
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5).
- top open
+ top open
+ [exEnd]
like above, but adds an additional offset:
- (i.e. center of component at:0.5@0.5 OFFSET by 10@20):
+ (i.e. center of button at:0.5 @ 0.5 OFFSET by 10 @ 20):
+ [exBegin]
+ |top button|
- |top button|
-
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5;
- leftOffset:10;
- topOffset:20).
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5;
+ leftOffset:10;
+ topOffset:20).
- top open
+ top open
+ [exEnd]
"
! !
@@ -288,23 +298,26 @@
!
rectangleRelativeTo:superRectangle preferred:prefRect
+ "compute the rectangle represented by the receiver,
+ given the superViews rectangle and the views preferredExtent."
+
|x y|
leftOffset isNil ifTrue:[
- x := 0
+ x := 0
] ifFalse:[
- x := leftOffset
+ x := leftOffset
].
topOffset isNil ifTrue:[
- y := 0
+ y := 0
] ifFalse:[
- y := topOffset
+ y := topOffset
].
leftFraction notNil ifTrue:[
- x := x + (superRectangle width * leftFraction)
+ x := x + (superRectangle width * leftFraction)
].
topFraction notNil ifTrue:[
- y := y + (superRectangle height * topFraction)
+ y := y + (superRectangle height * topFraction)
].
^ Rectangle origin:x@y extent:prefRect extent
@@ -314,13 +327,15 @@
superRect := 0@0 corner:100@100.
lO := (LayoutOrigin new).
lO leftFraction:0.5;
- topFraction:0.5.
+ topFraction:0.5.
lO rectangleRelativeTo:superRect preferred:(0@0 corner:30@30)
"
+
+ "Modified: 27.4.1996 / 14:54:06 / cg"
! !
!LayoutOrigin class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Attic/LayoutOrg.st,v 1.11 1996-04-25 16:20:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Attic/LayoutOrg.st,v 1.12 1996-04-27 17:51:14 cg Exp $'
! !
--- a/LayoutOrigin.st Sat Apr 27 16:19:26 1996 +0200
+++ b/LayoutOrigin.st Sat Apr 27 19:51:19 1996 +0200
@@ -42,53 +42,63 @@
A layoutOrigin controls the origin of a subcomponent, given a fractional
component and an offset component.
- See also:
- LayoutFrame AlignmentOrigin Layout
-
- Notice: this class was implemented using protocol information
- from alpha testers - it may not be complete or compatible to
- the corresponding ST-80 class. If you encounter any incompatibilities,
- please forward a note to the ST/X team.
+ Notice:
+ this class was implemented using protocol information
+ from alpha testers - it may not be complete or compatible to
+ the corresponding ST-80 class.
+ If you encounter any incompatibilities, please forward a note
+ describing the incompatibility verbal (i.e. no code) to the ST/X team.
[author:]
Claus Gittinger
+
+ [see also:]
+ View
+ LayoutFrame AlignmentOrigin Layout
+ Rectangle Point
"
!
examples
"
- using a LayoutOrigin, to control the top-left origins position of
- a component (i.e. origin at:0.5@0.5):
+ Although the examples below use a button as component,
+ they work of course with any type of subview ....
- |top button|
+ using a LayoutOrigin, to arrange for
+ the TOPLEFT of a component be positions
+ at the center (i.e. buttons origin at:0.5 @ 0.5):
+ [exBegin]
+ |top button|
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5).
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5).
- top open
+ top open
+ [exEnd]
like above, but adds an additional offset:
- (i.e. center of component at:0.5@0.5 OFFSET by 10@20):
+ (i.e. center of button at:0.5 @ 0.5 OFFSET by 10 @ 20):
+ [exBegin]
+ |top button|
- |top button|
-
- top := StandardSystemView new.
- top extent:300@300.
+ top := StandardSystemView new.
+ top extent:300@300.
- button := Button label:'component'.
- top add:button in:(LayoutOrigin new
- leftFraction:0.5;
- topFraction:0.5;
- leftOffset:10;
- topOffset:20).
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5;
+ leftOffset:10;
+ topOffset:20).
- top open
+ top open
+ [exEnd]
"
! !
@@ -288,23 +298,26 @@
!
rectangleRelativeTo:superRectangle preferred:prefRect
+ "compute the rectangle represented by the receiver,
+ given the superViews rectangle and the views preferredExtent."
+
|x y|
leftOffset isNil ifTrue:[
- x := 0
+ x := 0
] ifFalse:[
- x := leftOffset
+ x := leftOffset
].
topOffset isNil ifTrue:[
- y := 0
+ y := 0
] ifFalse:[
- y := topOffset
+ y := topOffset
].
leftFraction notNil ifTrue:[
- x := x + (superRectangle width * leftFraction)
+ x := x + (superRectangle width * leftFraction)
].
topFraction notNil ifTrue:[
- y := y + (superRectangle height * topFraction)
+ y := y + (superRectangle height * topFraction)
].
^ Rectangle origin:x@y extent:prefRect extent
@@ -314,13 +327,15 @@
superRect := 0@0 corner:100@100.
lO := (LayoutOrigin new).
lO leftFraction:0.5;
- topFraction:0.5.
+ topFraction:0.5.
lO rectangleRelativeTo:superRect preferred:(0@0 corner:30@30)
"
+
+ "Modified: 27.4.1996 / 14:54:06 / cg"
! !
!LayoutOrigin class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/LayoutOrigin.st,v 1.11 1996-04-25 16:20:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/LayoutOrigin.st,v 1.12 1996-04-27 17:51:14 cg Exp $'
! !