.
"
COPYRIGHT (c) 1995 by Claus Gittinger
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
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
'From Smalltalk/X, Version:2.10.5 on 15-apr-1995 at 12:14:46 pm'!
LayoutOrigin subclass:#LayoutFrame
instanceVariableNames:'rightFraction bottomFraction
rightOffset bottomOffset'
classVariableNames:''
poolDictionaries:''
category:'Graphics-Geometry'
!
!LayoutFrame class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1995 by Claus Gittinger
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
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
version
"
$Header: /cvs/stx/stx/libview2/Attic/LayoutFrm.st,v 1.3 1995-08-10 18:43:57 claus Exp $
"
! !
!LayoutFrame methodsFor:'accessing'!
rightFraction:something
"set rightFraction"
rightFraction := something.
!
rightFraction
"return rightFraction"
^ rightFraction
!
rightOffset:something
"set rightOffset"
rightOffset := something.
!
rightOffset
"return rightOffset"
^ rightOffset
!
rightFraction:something offset:o
"set rightFraction and offset"
rightFraction := something.
rightOffset := o
!
bottomFraction:something
"set bottomFraction"
bottomFraction := something.
!
bottomFraction
"return bottomFraction"
^ bottomFraction
!
bottomOffset:something
"set bottomOffset"
bottomOffset := something.
!
bottomOffset
"return bottomOffset"
^ bottomOffset
!
bottomFraction:something offset:o
"set bottomFraction and offset"
bottomFraction := something.
bottomOffset := o
! !
!LayoutFrame methodsFor:'printing & storing'!
displayString
^ (self class name) , '('
, 'l: ' , leftFraction displayString
, '+' , leftOffset displayString
, ' t: ' , topFraction displayString
, '+' , topOffset displayString
, ' r: ' , rightFraction displayString
, '+' , rightOffset displayString
, ' b: ' , bottomFraction displayString
, '+' , bottomOffset displayString
, ')'
! !
!LayoutFrame methodsFor:'queries'!
rectangleRelativeTo:superRectangle preferred:prefRect
|x1 y1 x2 y2|
leftOffset isNil ifTrue:[
x1 := 0
] ifFalse:[
x1 := leftOffset
].
topOffset isNil ifTrue:[
y1 := 0
] ifFalse:[
y1 := topOffset
].
rightOffset isNil ifTrue:[
x2 := 0
] ifFalse:[
x2 := rightOffset
].
bottomOffset isNil ifTrue:[
y2 := 0
] ifFalse:[
y2 := bottomOffset
].
leftFraction notNil ifTrue:[
x1 := x1 + (superRectangle width * leftFraction)
].
topFraction notNil ifTrue:[
y1 := y1 + (superRectangle height * topFraction)
].
rightFraction notNil ifTrue:[
x2 := x2 + (superRectangle width * rightFraction)
].
bottomFraction notNil ifTrue:[
y2 := y2 + (superRectangle height * bottomFraction)
].
^ Rectangle origin:x1@y1 corner:x2@y2
"
|superRect lF|
superRect := 0@0 corner:100@100.
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)
"
!
corner
^ rightFraction asFloat @ bottomFraction asFloat
! !
!LayoutFrame methodsFor:'initialization'!
initialize
leftOffset := rightOffset := bottomOffset := topOffset := 0.
leftFraction := topFraction := 0.
bottomFraction := rightFraction := 1.
! !