HorizontalPanelView.st
changeset 6138 094c0d355f5f
parent 6100 43667474ed53
child 6276 c5bd5d4f7243
equal deleted inserted replaced
6137:ede94cb05df9 6138:094c0d355f5f
  1527     preferredExtent notNil ifTrue:[
  1527     preferredExtent notNil ifTrue:[
  1528         ^ preferredExtent
  1528         ^ preferredExtent
  1529     ].
  1529     ].
  1530 
  1530 
  1531     subViews := self subViewsToConsider.
  1531     subViews := self subViewsToConsider.
  1532     (subViews size == 0) ifTrue:[
  1532     subViews isEmptyOrNil ifTrue:[
  1533         ^ super preferredExtent.
  1533         ^ super preferredExtent.
  1534         "/ ^ horizontalSpace @ verticalSpace].
  1534         "/ ^ horizontalSpace @ verticalSpace].
  1535     ].
  1535     ].
  1536 
  1536 
  1537     "compute net height needed"
  1537     "compute net height needed"
  1543     subViews do:[:child |
  1543     subViews do:[:child |
  1544         |childsPreference|
  1544         |childsPreference|
  1545 
  1545 
  1546         "/ better to use component's preferredExtent ...
  1546         "/ better to use component's preferredExtent ...
  1547 
  1547 
       
  1548         childsPreference := child preferredExtent.
  1548         child realized ifTrue:[
  1549         child realized ifTrue:[
  1549             childsPreference := child extent max:child preferredExtent.
  1550             childsPreference := childsPreference max:child extent.
  1550         ] ifFalse:[
       
  1551             childsPreference := child preferredExtent.
       
  1552         ].
  1551         ].
       
  1552 
  1553         sumOfWidths := sumOfWidths + childsPreference x.
  1553         sumOfWidths := sumOfWidths + childsPreference x.
  1554         maxHeight := maxHeight max:childsPreference y.
  1554         maxHeight := maxHeight max:childsPreference y.
  1555         maxWidth := maxWidth max:childsPreference x.
  1555         maxWidth := maxWidth max:childsPreference x.
  1556 
  1556 
  1557         "/ ... instead of actual extent
  1557         "/ ... instead of actual extent
  1563 "/        sumOfWidths := sumOfWidths + (horizontalSpace * 2).
  1563 "/        sumOfWidths := sumOfWidths + (horizontalSpace * 2).
  1564 "/        maxHeight := maxHeight + (verticalSpace * 2).
  1564 "/        maxHeight := maxHeight + (verticalSpace * 2).
  1565 "/    ].
  1565 "/    ].
  1566 
  1566 
  1567     (hLayout == #fit 
  1567     (hLayout == #fit 
  1568     or:[hLayout == #fitSpace
  1568      or:[hLayout == #fitSpace
  1569     or:[hLayout endsWith:'Max']]) ifTrue:[
  1569      or:[hLayout endsWith:'Max']]) ifTrue:[
  1570         sumOfWidths := maxWidth * subViews size.
  1570         sumOfWidths := maxWidth * subViews size.
  1571         self borderWidth ~~ 0 ifTrue:[
  1571         self borderWidth ~~ 0 ifTrue:[
  1572             sumOfWidths := sumOfWidths + (horizontalSpace * 2).
  1572             sumOfWidths := sumOfWidths + (horizontalSpace * 2).
  1573         ].
  1573         ].
  1574         hLayout == #fitSpace ifTrue:[
  1574         hLayout == #fitSpace ifTrue:[
  1585             ]
  1585             ]
  1586         ].
  1586         ].
  1587     ].
  1587     ].
  1588 
  1588 
  1589     ((vLayout == #topSpace) 
  1589     ((vLayout == #topSpace) 
  1590     or:[vLayout == #bottomSpace]) ifTrue:[
  1590      or:[vLayout == #bottomSpace]) ifTrue:[
  1591         maxHeight := maxHeight + verticalSpace
  1591         maxHeight := maxHeight + verticalSpace
  1592     ] ifFalse:[
  1592     ] ifFalse:[
  1593         ((vLayout == #fitSpace) 
  1593         ((vLayout == #fitSpace) 
  1594         or:[vLayout == #center
  1594          or:[vLayout == #center
  1595         or:[vLayout == #centerSpace]]) ifTrue:[
  1595          or:[vLayout == #centerSpace]]) ifTrue:[
  1596             maxHeight := maxHeight + (verticalSpace * 2)
  1596             maxHeight := maxHeight + (verticalSpace * 2)
  1597         ]        
  1597         ]        
  1598     ].
  1598     ].
  1599 
  1599 
  1600     m2 := margin * 2.
  1600     m2 := margin * 2.
  1601     ^ (sumOfWidths + m2) @ (maxHeight + m2)
  1601     ^ (sumOfWidths + m2) @ (maxHeight + m2)
  1602 
  1602 
  1603     "Modified: / 17.1.1998 / 00:18:38 / cg"
  1603     "Modified: / 17-01-1998 / 00:18:38 / cg"
       
  1604     "Modified (format): / 30-03-2017 / 18:38:09 / stefan"
  1604 ! !
  1605 ! !
  1605 
  1606 
  1606 !HorizontalPanelView class methodsFor:'documentation'!
  1607 !HorizontalPanelView class methodsFor:'documentation'!
  1607 
  1608 
  1608 version
  1609 version