# HG changeset patch # User Claus Gittinger # Date 833365302 -7200 # Node ID 34d17118452acbed574c8954e1990a8caf815c6f # Parent 56da73772526264481ae09490680f1a84976f1a3 care for preSet preferredExtent diff -r 56da73772526 -r 34d17118452a ModalBox.st --- a/ModalBox.st Wed May 29 11:29:33 1996 +0200 +++ b/ModalBox.st Wed May 29 12:21:42 1996 +0200 @@ -430,7 +430,13 @@ visible in myself. This should be redefined in subclasses." + preferredExtent notNil ifTrue:[ + ^ preferredExtent + ]. + ^ self class defaultExtent + + "Modified: 29.5.1996 / 12:11:26 / cg" ! ! !ModalBox methodsFor:'show / hide'! @@ -803,6 +809,6 @@ !ModalBox class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.43 1996-05-28 20:06:03 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/ModalBox.st,v 1.44 1996-05-29 10:21:09 cg Exp $' ! ! ModalBox initialize! diff -r 56da73772526 -r 34d17118452a SimpleView.st --- a/SimpleView.st Wed May 29 11:29:33 1996 +0200 +++ b/SimpleView.st Wed May 29 12:21:42 1996 +0200 @@ -4644,28 +4644,60 @@ preferredExtent "return my preferred extent - this is the minimum size I would like to have. - The default here is the actual extent, the receiver currently has." - - "mhmh - if I have components, collect their - preferred bounds ..." - - |maxX maxY| - - subViews isNil ifTrue:[^ self extent]. -"/ ^ self extent. - - maxX := maxY := 0. + If the preferredExtent has been set, that one is returned. + Otherwise, if there are any components, a rectangle enclosing them + is returned. Otherwise, the actual extent is returned." + + |maxX maxY ext x y| + + preferredExtent notNil ifTrue:[ + ^ preferredExtent + ]. + + "/ mhmh - if I have subViews, collect their + "/ preferred bounds ... + subViews notNil ifTrue:[ - subViews do:[:aSubView | - |org corn| - - org := aSubView computeOrigin. - corn := org + aSubView preferredExtent. - maxX := maxX max:corn x. - maxY := maxY max:corn y. - ] + maxX := maxY := 0. + subViews do:[:aSubView | + |org corn| + + org := aSubView computeOrigin. + corn := org + aSubView preferredExtent. + maxX := maxX max:corn x. + maxY := maxY max:corn y. + ] ]. + + "/ mhmh - if I have components, collect their + "/ preferred bounds ... + + components notNil ifTrue:[ + maxX isNil ifTrue:[ + maxX := maxY := 0. + ]. + components do:[:aComponent | + |bounds org corn| + + bounds := aComponent preferredBounds. + corn := bounds corner. + maxX := maxX max:corn x. + maxY := maxY max:corn y. + ] + ]. + + "/ nothing found - return the actual size + + maxX isNil ifTrue:[ + ext := self extent. + + maxX := ext x. + maxY := ext y. + ]. + ^ maxX @ maxY. + + "Modified: 29.5.1996 / 12:09:55 / cg" ! sizeFixed @@ -6139,6 +6171,6 @@ !SimpleView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.112 1996-05-29 09:29:33 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/SimpleView.st,v 1.113 1996-05-29 10:21:42 cg Exp $' ! ! SimpleView initialize! diff -r 56da73772526 -r 34d17118452a TopView.st --- a/TopView.st Wed May 29 11:29:33 1996 +0200 +++ b/TopView.st Wed May 29 12:21:42 1996 +0200 @@ -250,7 +250,12 @@ however many subclasses redefine this to compute the actual value depending on the sizes of the contents or subcomponents." + preferredExtent notNil ifTrue:[ + ^ preferredExtent + ]. ^ self class defaultExtent + + "Modified: 29.5.1996 / 12:10:32 / cg" ! type @@ -370,5 +375,5 @@ !TopView class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.24 1996-05-25 10:10:02 cg Exp $' + ^ '$Header: /cvs/stx/stx/libview/TopView.st,v 1.25 1996-05-29 10:20:36 cg Exp $' ! !