TranslatingWrapper subclass:#LayoutWrapper
instanceVariableNames:'layout'
classVariableNames:''
poolDictionaries:''
category:'Graphics-Display Objects'
!
!LayoutWrapper class methodsFor:'documentation'!
examples
"
[exBegin]
|t view wrapper|
t := StandardSystemView extent:200@200.
view := View new.
view viewBackground:Color red.
wrapper := LayoutWrapper new.
wrapper layout:(LayoutFrame new
leftFraction:0.2;
rightFraction:0.8;
topFraction:0.2;
bottomFraction:0.8).
wrapper component:view.
t addComponent:wrapper.
t open
[exEnd]
"
! !
!LayoutWrapper class methodsFor:'instance creation'!
on:aComponent in:aLayout
"create and return a layoutWrapper, which controls
aComponent bounds using aLayout.
The layout argument may be:
nil - no constraint
Point - origin shift
Rectangle - origin shift & extent
Layout - full control"
^ (self on:aComponent) layout:aLayout
"Created: 26.5.1996 / 16:18:44 / cg"
"Modified: 26.5.1996 / 16:34:04 / cg"
! !
!LayoutWrapper methodsFor:'accessing'!
layout
"return layout"
^ layout
"Created: 26.5.1996 / 16:18:11 / cg"
!
layout:something
"set the layout"
layout := something.
"Created: 26.5.1996 / 16:18:11 / cg"
"Modified: 5.6.1996 / 13:58:55 / cg"
! !
!LayoutWrapper methodsFor:'view protocol mimicri'!
containerChangedSize
"my container changed its size.
Resize my component according the layout spec"
layout notNil ifTrue:[
self bounds:(layout rectangleRelativeTo:(container viewRectangle)
preferred:(self preferredBounds)) rounded
]
"Modified: 5.6.1996 / 02:32:01 / cg"
! !
!LayoutWrapper class methodsFor:'documentation'!
version
^ '$Header: /cvs/stx/stx/libview2/LayoutWrapper.st,v 1.2 1996-06-05 15:28:29 cg Exp $'
! !