HorizontalPanelView.st
changeset 3674 d9a22791dc50
parent 3515 25470e3161e1
child 3686 de886bde6f31
equal deleted inserted replaced
3673:e1c29dd73768 3674:d9a22791dc50
  1209                         sumOfWidths := sumOfWidths - subViews first widthIncludingBorder.
  1209                         sumOfWidths := sumOfWidths - subViews first widthIncludingBorder.
  1210                     ]
  1210                     ]
  1211                 ].
  1211                 ].
  1212             ].
  1212             ].
  1213 
  1213 
  1214             restWidth := width - sumOfWidths - (numChilds-1*space).
  1214             restWidth := width - sumOfWidths "- (numChilds-1*space)".
  1215 
  1215 
  1216             ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
  1216             ((l == #center) and:[numChilds == 1]) ifTrue:[l := #spread].
  1217             (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
  1217             (l == #spread and:[numChilds == 1]) ifTrue:[l := #spreadSpace].
  1218 
  1218 
  1219             "
  1219             "
  1220              compute position of leftmost subview and space between them;
  1220              compute position of leftmost subview and space between them;
  1221              if they do hardly fit, leave no space between them 
  1221              if they do hardly fit, leave no space between them 
  1222             "
  1222             "
  1223             ((sumOfWidths >= (width - m2)) 
  1223             ((sumOfWidths > (width - m2)) 
  1224             and:[l ~~ #fixLeftSpace and:[l ~~ #fixLeft]]) ifTrue:[
  1224             and:[l ~~ #fixLeftSpace and:[l ~~ #fixLeft]]) ifTrue:[
  1225                 xpos := margin.
  1225                 xpos := margin.
  1226                 space := 0
  1226                 space := 0
  1227             ] ifFalse: [
  1227             ] ifFalse: [
  1228                 l == #fixLeftSpace ifTrue:[
  1228                 l == #fixLeftSpace ifTrue:[
  1267                             xpos := restWidth // 2
  1267                             xpos := restWidth // 2
  1268                         ]
  1268                         ]
  1269                       ] ifFalse:[
  1269                       ] ifFalse:[
  1270                         ((l == #left) or:[l == #leftSpace
  1270                         ((l == #left) or:[l == #leftSpace
  1271                         or:[l == #leftFit or:[l == #leftSpaceFit]]]) ifTrue:[
  1271                         or:[l == #leftFit or:[l == #leftSpaceFit]]]) ifTrue:[
  1272                             space := space min:(restWidth - m2) // (numChilds + 1).
  1272                             (l == #left or:[l == #leftFit]) ifTrue:[
       
  1273                                 space := space min:(restWidth - m2) // (numChilds - 1).
       
  1274                             ] ifFalse:[
       
  1275                                 space := space min:(restWidth - m2) // (numChilds "+ 1").
       
  1276                             ].
  1273                             (hL == #fixLeft or:[hL == #fixLeftSpace]) ifTrue:[
  1277                             (hL == #fixLeft or:[hL == #fixLeftSpace]) ifTrue:[
  1274                                 space := space max:horizontalSpace.
  1278                                 space := space max:horizontalSpace.
  1275                             ] ifFalse:[
  1279                             ] ifFalse:[
  1276                                 space := space max:0.
  1280                                 space := space max:0.
  1277                             ].
  1281                             ].
  1458     subViews do:[:child |
  1462     subViews do:[:child |
  1459         |childsPreference|
  1463         |childsPreference|
  1460 
  1464 
  1461         "/ better to use component's preferredExtent ...
  1465         "/ better to use component's preferredExtent ...
  1462 
  1466 
  1463         childsPreference := child preferredExtent.
  1467         child realized ifTrue:[
       
  1468             childsPreference := child extent.
       
  1469         ] ifFalse:[
       
  1470             childsPreference := child preferredExtent.
       
  1471         ].
  1464         sumOfWidths := sumOfWidths + childsPreference x.
  1472         sumOfWidths := sumOfWidths + childsPreference x.
  1465         maxHeight := maxHeight max:childsPreference y.
  1473         maxHeight := maxHeight max:childsPreference y.
  1466         maxWidth := maxWidth max:childsPreference x.
  1474         maxWidth := maxWidth max:childsPreference x.
  1467 
  1475 
  1468         "/ ... instead of actual extent
  1476         "/ ... instead of actual extent
  1514 ! !
  1522 ! !
  1515 
  1523 
  1516 !HorizontalPanelView class methodsFor:'documentation'!
  1524 !HorizontalPanelView class methodsFor:'documentation'!
  1517 
  1525 
  1518 version
  1526 version
  1519     ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.55 2007-11-28 12:16:04 ca Exp $'
  1527     ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.56 2008-07-18 09:43:03 cg Exp $'
  1520 ! !
  1528 ! !