--- a/AlignOrg.st Sun Aug 27 16:41:00 1995 +0200
+++ b/AlignOrg.st Tue Aug 29 18:13:19 1995 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -22,7 +22,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -33,9 +33,83 @@
"
!
+documentation
+"
+ This class is provided to make porting of existing ST-80 applications
+ easier. Instances can be used to control the geometry of a subview, within
+ its superview. Like a LayoutOrigin, it controls the components origin
+ via a relative part plus offset. However, in contrast to LayoutOrigin
+ (in which the top-left corner is specified by fraction+offset, here any
+ reference point within the component is positioned.
+ The reference point itself is specified as fraction of the components size.
+
+ See also:
+ LayoutOrigin LayoutFrame 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.
+!
+
+examples
+"
+ using a LayoutOrigin, to control the top-left origins position of
+ a component (i.e. origin at:0.5@0.5):
+
+ |top button|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5).
+
+ top open
+
+
+ using an AlignmentOrigin, to control the centers position of
+ a component (i.e. center of component at:0.5@0.5):
+
+ |top button|
+
+ 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).
+
+ top open
+
+
+ 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|
+
+ 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).
+
+ top open
+"
+!
+
version
"
-$Header: /cvs/stx/stx/libview2/Attic/AlignOrg.st,v 1.2 1995-08-10 18:43:06 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/AlignOrg.st,v 1.3 1995-08-29 16:13:05 claus Exp $
"
! !
--- a/AlignmentOrigin.st Sun Aug 27 16:41:00 1995 +0200
+++ b/AlignmentOrigin.st Tue Aug 29 18:13:19 1995 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -22,7 +22,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -33,9 +33,83 @@
"
!
+documentation
+"
+ This class is provided to make porting of existing ST-80 applications
+ easier. Instances can be used to control the geometry of a subview, within
+ its superview. Like a LayoutOrigin, it controls the components origin
+ via a relative part plus offset. However, in contrast to LayoutOrigin
+ (in which the top-left corner is specified by fraction+offset, here any
+ reference point within the component is positioned.
+ The reference point itself is specified as fraction of the components size.
+
+ See also:
+ LayoutOrigin LayoutFrame 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.
+!
+
+examples
+"
+ using a LayoutOrigin, to control the top-left origins position of
+ a component (i.e. origin at:0.5@0.5):
+
+ |top button|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5).
+
+ top open
+
+
+ using an AlignmentOrigin, to control the centers position of
+ a component (i.e. center of component at:0.5@0.5):
+
+ |top button|
+
+ 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).
+
+ top open
+
+
+ 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|
+
+ 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).
+
+ top open
+"
+!
+
version
"
-$Header: /cvs/stx/stx/libview2/AlignmentOrigin.st,v 1.2 1995-08-10 18:43:06 claus Exp $
+$Header: /cvs/stx/stx/libview2/AlignmentOrigin.st,v 1.3 1995-08-29 16:13:05 claus Exp $
"
! !
--- a/Layout.st Sun Aug 27 16:41:00 1995 +0200
+++ b/Layout.st Tue Aug 29 18:13:19 1995 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -22,7 +22,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -33,9 +33,29 @@
"
!
+documentation
+"
+ This is an abstract superclass for geometry controlling objects.
+ While old smalltalks used relative origin/extent/corner and absolute
+ origin/corner/extents, these mechanisms are now being removed from the
+ view itself into geometry controlling objects, which are given a superviews
+ size and are to return a components size upon request.
+ This allows more flexible geometry management, since any algorithm can
+ be implemented (if the existing ones are not sufficient, add you own subclass
+ and instal 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.
+!
+
version
"
-$Header: /cvs/stx/stx/libview2/Layout.st,v 1.3 1995-08-10 18:43:53 claus Exp $
+$Header: /cvs/stx/stx/libview2/Layout.st,v 1.4 1995-08-29 16:12:37 claus Exp $
"
! !
--- a/LayoutFrame.st Sun Aug 27 16:41:00 1995 +0200
+++ b/LayoutFrame.st Tue Aug 29 18:13:19 1995 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -25,7 +25,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -36,9 +36,85 @@
"
!
+documentation
+"
+ This class is provided to make porting of existing ST-80 applications
+ 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
+
+ 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.
+!
+
+examples
+"
+ |top button|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ button := Button label:'component'.
+ top add:button in:(LayoutFrame new
+ leftFraction:0.25;
+ topFraction:0.25;
+ rightFraction:0.75;
+ bottomFraction:0.75).
+
+ top open
+
+
+ like above, but adds additional offset to the origin:
+
+ |top button|
+
+ 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).
+
+ top open
+
+
+ like above, with offsets on all edges, actually simulating
+ a constant inset on all four edges:
+
+ |top button|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ button := Button label:'component'.
+"/ MessageTracer trace:button selector:#sizeChanged:.
+"/ MessageTracer trace:button selector:#fixSize.
+"/ MessageTracer trace:button selector:#'pixelOrigin:extent:'.
+"/ MessageTracer trace:button selector:#layout:.
+"/ MessageTracer trace:button selector:#geometryLayout:.
+
+ 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
+"
+
version
"
-$Header: /cvs/stx/stx/libview2/LayoutFrame.st,v 1.3 1995-08-10 18:43:57 claus Exp $
+$Header: /cvs/stx/stx/libview2/LayoutFrame.st,v 1.4 1995-08-29 16:13:19 claus Exp $
"
! !
--- a/LayoutFrm.st Sun Aug 27 16:41:00 1995 +0200
+++ b/LayoutFrm.st Tue Aug 29 18:13:19 1995 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -25,7 +25,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -36,9 +36,85 @@
"
!
+documentation
+"
+ This class is provided to make porting of existing ST-80 applications
+ 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
+
+ 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.
+!
+
+examples
+"
+ |top button|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ button := Button label:'component'.
+ top add:button in:(LayoutFrame new
+ leftFraction:0.25;
+ topFraction:0.25;
+ rightFraction:0.75;
+ bottomFraction:0.75).
+
+ top open
+
+
+ like above, but adds additional offset to the origin:
+
+ |top button|
+
+ 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).
+
+ top open
+
+
+ like above, with offsets on all edges, actually simulating
+ a constant inset on all four edges:
+
+ |top button|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ button := Button label:'component'.
+"/ MessageTracer trace:button selector:#sizeChanged:.
+"/ MessageTracer trace:button selector:#fixSize.
+"/ MessageTracer trace:button selector:#'pixelOrigin:extent:'.
+"/ MessageTracer trace:button selector:#layout:.
+"/ MessageTracer trace:button selector:#geometryLayout:.
+
+ 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
+"
+
version
"
-$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.3 1995-08-10 18:43:57 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.4 1995-08-29 16:13:19 claus Exp $
"
! !
--- a/LayoutOrg.st Sun Aug 27 16:41:00 1995 +0200
+++ b/LayoutOrg.st Tue Aug 29 18:13:19 1995 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -25,7 +25,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -36,20 +36,88 @@
"
!
+documentation
+"
+ This class is provided to make porting of existing ST-80 applications
+ easier. Instances can be used to control the geometry of a subview, within
+ its superview. It provides the same functionality as a relative origin
+ combined with insets.
+ 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.
+!
+
+examples
+"
+ using a LayoutOrigin, to control the top-left origins position of
+ a component (i.e. origin at:0.5@0.5):
+
+ |top button|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5).
+
+ top open
+
+
+ like above, but adds an additional offset:
+ (i.e. center of component at:0.5@0.5 OFFSET by 10@20):
+
+ |top button|
+
+ 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).
+
+ top open
+"
+
version
"
-$Header: /cvs/stx/stx/libview2/Attic/LayoutOrg.st,v 1.3 1995-08-10 18:44:01 claus Exp $
+$Header: /cvs/stx/stx/libview2/Attic/LayoutOrg.st,v 1.4 1995-08-29 16:12:57 claus Exp $
"
! !
!LayoutOrigin class methodsFor:'instance creation'!
fractionalFromPoint:aPoint
+ "given a point, create a layoutOrigin representing the same
+ relative origin."
+
^ (self new) leftFraction:aPoint x topFraction:aPoint y
+
+ "
+ LayoutOrigin fractionalFromPoint:0.5@0.5
+ "
!
offsetFromPoint:aPoint
+ "given a point, create a layoutOrigin representing the same
+ absolute (pixel) origin."
+
^ self new leftOffset:aPoint x topOffset:aPoint y
+
+ "
+ LayoutOrigin offsetFromPoint:100@100
+ "
!
fromPoint:aPoint
@@ -70,6 +138,12 @@
layout leftOffset:x topOffset:y
].
^ layout
+
+ "
+ LayoutOrigin fromPoint:100@100
+ LayoutOrigin fromPoint:0.5@0.5
+ LayoutOrigin fromPoint:0.5@100
+ "
! !
!LayoutOrigin methodsFor:'printing & storing'!
--- a/LayoutOrigin.st Sun Aug 27 16:41:00 1995 +0200
+++ b/LayoutOrigin.st Tue Aug 29 18:13:19 1995 +0200
@@ -1,6 +1,6 @@
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -25,7 +25,7 @@
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
- All Rights Reserved
+ All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
@@ -36,20 +36,88 @@
"
!
+documentation
+"
+ This class is provided to make porting of existing ST-80 applications
+ easier. Instances can be used to control the geometry of a subview, within
+ its superview. It provides the same functionality as a relative origin
+ combined with insets.
+ 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.
+!
+
+examples
+"
+ using a LayoutOrigin, to control the top-left origins position of
+ a component (i.e. origin at:0.5@0.5):
+
+ |top button|
+
+ top := StandardSystemView new.
+ top extent:300@300.
+
+ button := Button label:'component'.
+ top add:button in:(LayoutOrigin new
+ leftFraction:0.5;
+ topFraction:0.5).
+
+ top open
+
+
+ like above, but adds an additional offset:
+ (i.e. center of component at:0.5@0.5 OFFSET by 10@20):
+
+ |top button|
+
+ 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).
+
+ top open
+"
+
version
"
-$Header: /cvs/stx/stx/libview2/LayoutOrigin.st,v 1.3 1995-08-10 18:44:01 claus Exp $
+$Header: /cvs/stx/stx/libview2/LayoutOrigin.st,v 1.4 1995-08-29 16:12:57 claus Exp $
"
! !
!LayoutOrigin class methodsFor:'instance creation'!
fractionalFromPoint:aPoint
+ "given a point, create a layoutOrigin representing the same
+ relative origin."
+
^ (self new) leftFraction:aPoint x topFraction:aPoint y
+
+ "
+ LayoutOrigin fractionalFromPoint:0.5@0.5
+ "
!
offsetFromPoint:aPoint
+ "given a point, create a layoutOrigin representing the same
+ absolute (pixel) origin."
+
^ self new leftOffset:aPoint x topOffset:aPoint y
+
+ "
+ LayoutOrigin offsetFromPoint:100@100
+ "
!
fromPoint:aPoint
@@ -70,6 +138,12 @@
layout leftOffset:x topOffset:y
].
^ layout
+
+ "
+ LayoutOrigin fromPoint:100@100
+ LayoutOrigin fromPoint:0.5@0.5
+ LayoutOrigin fromPoint:0.5@100
+ "
! !
!LayoutOrigin methodsFor:'printing & storing'!