#REFACTORING by exept
class: GIFReader
comment/format in: #readImage:
changed:
#fromStream:
#writeHeaderFor:
"{ Encoding: utf8 }"
"
COPYRIGHT (c) 2019 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.
"
"{ Package: 'stx:libview2' }"
"{ NameSpace: Smalltalk }"
LayoutFrame subclass:#ConstrainedLayoutFrame
instanceVariableNames:'minLeft maxLeft minRight maxRight minTop maxTop minBottom
maxBottom'
classVariableNames:''
poolDictionaries:''
category:'Graphics-Geometry'
!
!ConstrainedLayoutFrame class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 2019 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.
"
!
documentation
"
Instances of me are like layoutFrames,
with additional (optional) limits on the bounds.
Useful to arrange for labels in a dialog to never become too large.
[author:]
Claus Gittinger
[see also:]
View
LayoutFrame LayoutOrigin AlignmentOrigin Layout
Rectangle Point
"
! !
!ConstrainedLayoutFrame methodsFor:'accessing'!
maxBottom
^ maxBottom
!
maxBottom:something
maxBottom := something.
!
maxLeft
^ maxLeft
!
maxLeft:pixels
maxLeft := pixels.
!
maxRight
^ maxRight
!
maxRight:pixels
maxRight := pixels.
!
maxTop
^ maxTop
!
maxTop:pixels
maxTop := pixels.
!
minBottom
^ minBottom
!
minBottom:pixels
minBottom := pixels.
!
minLeft
^ minLeft
!
minLeft:pixels
minLeft := pixels.
!
minRight
^ minRight
!
minRight:pixels
minRight := pixels.
!
minTop
^ minTop
!
minTop:pixels
minTop := pixels.
! !
!ConstrainedLayoutFrame 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)
].
(minLeft notNil and:[x1 < minLeft]) ifTrue:[
x1 := minLeft.
].
(maxLeft notNil and:[x1 > maxLeft]) ifTrue:[
x1 := maxLeft.
].
(minTop notNil and:[y1 < minTop]) ifTrue:[
y1 := minTop.
].
(maxTop notNil and:[x1 > maxTop]) ifTrue:[
y1 := maxTop.
].
(minRight notNil and:[x1 < minRight]) ifTrue:[
x2 := minRight.
].
(maxRight notNil and:[x1 > maxRight]) ifTrue:[
x2 := maxRight.
].
(minBottom notNil and:[y1 < minBottom]) ifTrue:[
y2 := minBottom.
].
(maxBottom notNil and:[x1 > maxBottom]) ifTrue:[
y2 := maxBottom.
].
^ Rectangle left:x1 top:y1 right:x2 bottom:y2
"
|superRect1 superRect2 lF|
superRect1 := 0@0 corner:100@100.
superRect2 := 0@0 corner:400@100.
lF := (ConstrainedLayoutFrame new).
lF leftFraction:0.25 rightFraction:0.75
topFraction:0.25 bottomFraction:0.75.
lF rectangleRelativeTo:superRect1 preferred:(0@0 corner:30@30).
lF rectangleRelativeTo:superRect2 preferred:(0@0 corner:30@30).
lF maxLeft:70.
lF rectangleRelativeTo:superRect2 preferred:(0@0 corner:30@30).
"
"Created: / 17-07-2019 / 10:02:08 / Claus Gittinger"
! !
!ConstrainedLayoutFrame class methodsFor:'documentation'!
version_CVS
^ '$Header$'
! !