#BUGFIX by ca
class: PanelView
added:
#beVisible
#beVisiblePostUpdate
#storePreferredWidthOrHeight:for:
optimize resize operation
--- a/PanelView.st Tue Dec 17 16:39:10 2019 +0100
+++ b/PanelView.st Tue Dec 17 16:40:54 2019 +0100
@@ -309,6 +309,59 @@
"Created: / 30.3.1999 / 13:48:42 / stefan"
! !
+!PanelView methodsFor:'accessing-visibility'!
+
+beVisible
+ "after making the views visible check the vertical layout"
+
+ super beVisible.
+
+ (realized and:[OperatingSystem isMSWINDOWSlike])
+ ifFalse:[ ^ self ].
+
+ (self class == HorizontalPanelView or:[self class == VerticalPanelView]) ifTrue:[
+ self sensor enqueueMessage:#beVisiblePostUpdate for:self.
+ ].
+!
+
+beVisiblePostUpdate
+ "after making the views visible check the vertical layout; called by #beVisible"
+ | sviews |
+
+ (subViews size > 0 and:[self isVisible]) ifFalse:[ ^ self ].
+
+ sviews := self subViewsToConsider.
+ sviews notEmptyOrNil ifTrue:[
+ sviews detect:[: each | (each isView and:[(each getAttribute:#VerticalPanelPreferredWidthOrHeight) isNil]) ]
+ ifNone:[
+ sviews do:[: eachChild |
+ eachChild isView ifTrue:[ |wh|
+ wh := eachChild getAttribute:#VerticalPanelPreferredWidthOrHeight.
+ wh notNil ifTrue:[
+ self class == VerticalPanelView
+ ifTrue: [ eachChild height: wh ]
+ ifFalse:[ eachChild width: wh ].
+ ].
+ ].
+ ].
+ self setChildPositions.
+ mustRearrange := false.
+ ].
+ ].
+ subViews do:[: eachChild |
+ eachChild isView ifTrue:[ eachChild setAttribute: #VerticalPanelPreferredWidthOrHeight to: nil ]
+ ].
+!
+
+storePreferredWidthOrHeight: aWidthOrHeight for: aView
+ "called by UISpecification #buildViewWithLayoutFor to setup up a specific view"
+
+ OperatingSystem isMSWINDOWSlike ifFalse:[ ^ self ]. "/ supported only for windows!!!!
+
+ (aView isView and:[aWidthOrHeight isInteger and:[aWidthOrHeight > 0]])
+ ifTrue:[ aView setAttribute:#VerticalPanelPreferredWidthOrHeight to: aWidthOrHeight ]. "/ see: #beVisiblePostUpdate
+! !
+
!PanelView methodsFor:'adding & removing subviews'!
addComponent:aComponent