--- a/HorizontalPanelView.st Sat Nov 10 00:05:37 2018 +0100
+++ b/HorizontalPanelView.st Sat Nov 10 00:17:13 2018 +0100
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 1989 by Claus Gittinger
All Rights Reserved
@@ -1190,8 +1188,8 @@
!HorizontalPanelView methodsFor:'layout'!
setChildPositions
- "(re)compute position of every child whenever children are added or
- my size has changed"
+ "(re)compute the position of every child;
+ called whenever children are added or my size has changed"
|xpos space sumOfWidths numChilds l wEach wInside hL vL resizeToMaxV
resizeToMaxH maxHeight maxWidth m2 subViews restWidth y2 bw|
@@ -1467,7 +1465,7 @@
"/ child origin:(xpos truncated + d @ ypos)
"/ ] ifFalse:[
child origin:(xpos truncated @ ypos)
- corner:(xpos + wEach - bwChild - 1) truncated @ y2.
+ corner:(xpos + wEach - bwChild "- 1") truncated @ y2.
"/ ].
advance := wEach.
] ifFalse:[
@@ -1508,29 +1506,19 @@
"Modified: / 04-09-1995 / 18:43:10 / claus"
"Modified: / 23-11-2016 / 00:36:03 / cg"
"Modified (format): / 13-02-2017 / 20:22:45 / cg"
+ "Modified: / 09-11-2018 / 21:12:26 / Claus Gittinger"
! !
!HorizontalPanelView methodsFor:'queries'!
-preferredExtent
+computePreferredExtent
"return a good extent, one that makes subviews fit"
|sumOfWidths maxHeight maxWidth m2 subViews|
- "/ If I have an explicit preferredExtent..
- explicitExtent notNil ifTrue:[
- ^ explicitExtent
- ].
-
- "/ If I have a cached preferredExtent value..
- preferredExtent notNil ifTrue:[
- ^ preferredExtent
- ].
-
subViews := self subViewsToConsider.
subViews isEmptyOrNil ifTrue:[
- ^ super preferredExtent.
- "/ ^ horizontalSpace @ verticalSpace].
+ ^ super computePreferredExtent.
].
"compute net height needed"
@@ -1543,7 +1531,6 @@
|childsPreference|
"/ better to use component's preferredExtent ...
-
childsPreference := child preferredExtent.
child realized ifTrue:[
childsPreference := childsPreference max:child extent.
@@ -1554,10 +1541,11 @@
maxWidth := maxWidth max:childsPreference x.
"/ ... instead of actual extent
-"/ sumOfWidths := sumOfWidths + child widthIncludingBorder.
-"/ maxHeight := maxHeight max:(child heightIncludingBorder).
-"/ maxWidth := maxWidth max:(child widthIncludingBorder).
+ "/ sumOfWidths := sumOfWidths + child widthIncludingBorder.
+ "/ maxHeight := maxHeight max:(child heightIncludingBorder).
+ "/ maxWidth := maxWidth max:(child widthIncludingBorder).
].
+
"/ self borderWidth ~~ 0 ifTrue:[
"/ sumOfWidths := sumOfWidths + (horizontalSpace * 2).
"/ maxHeight := maxHeight + (verticalSpace * 2).
@@ -1599,8 +1587,8 @@
m2 := margin * 2.
^ (sumOfWidths + m2) @ (maxHeight + m2)
- "Modified: / 17-01-1998 / 00:18:38 / cg"
- "Modified (format): / 30-03-2017 / 18:38:09 / stefan"
+ "Created: / 09-11-2018 / 19:55:09 / Claus Gittinger"
+ "Modified (format): / 09-11-2018 / 21:07:01 / Claus Gittinger"
! !
!HorizontalPanelView class methodsFor:'documentation'!