HorizontalPanelView.st
changeset 340 f820bcd29a51
parent 205 6814c0bf8df8
child 379 a0ada7891fe9
equal deleted inserted replaced
339:ed1fcd2056f2 340:f820bcd29a51
     9  other person.  No title to or ownership of the software is
     9  other person.  No title to or ownership of the software is
    10  hereby transferred.
    10  hereby transferred.
    11 "
    11 "
    12 
    12 
    13 PanelView subclass:#HorizontalPanelView
    13 PanelView subclass:#HorizontalPanelView
    14 	 instanceVariableNames:''
    14 	instanceVariableNames:''
    15 	 classVariableNames:''
    15 	classVariableNames:''
    16 	 poolDictionaries:''
    16 	poolDictionaries:''
    17 	 category:'Views-Layout'
    17 	category:'Views-Layout'
    18 !
    18 !
    19 
    19 
    20 !HorizontalPanelView class methodsFor:'documentation'!
    20 !HorizontalPanelView class methodsFor:'documentation'!
    21 
    21 
    22 copyright
    22 copyright
  1228     sumOfWidths := 0.
  1228     sumOfWidths := 0.
  1229     maxHeight := 0.
  1229     maxHeight := 0.
  1230     maxWidth := 0.
  1230     maxWidth := 0.
  1231 
  1231 
  1232     subViews do:[:child |
  1232     subViews do:[:child |
  1233 	|childsPreference|
  1233         |childsPreference|
  1234 
  1234 
  1235 	"/ better to use component's preferredExtent ...
  1235         "/ better to use component's preferredExtent ...
  1236 
  1236 
  1237 	childsPreference := child preferredExtent.
  1237         childsPreference := child preferredExtent.
  1238 	sumOfWidths := sumOfWidths + childsPreference x.
  1238         sumOfWidths := sumOfWidths + childsPreference x.
  1239 	maxHeight := maxHeight max:childsPreference y.
  1239         maxHeight := maxHeight max:childsPreference y.
  1240 	maxWidth := maxWidth max:childsPreference x.
  1240         maxWidth := maxWidth max:childsPreference x.
  1241 
  1241 
  1242 	"/ ... instead of actual extent
  1242         "/ ... instead of actual extent
  1243 "/        sumOfWidths := sumOfWidths + child widthIncludingBorder.
  1243 "/        sumOfWidths := sumOfWidths + child widthIncludingBorder.
  1244 "/        maxHeight := maxHeight max:(child heightIncludingBorder).
  1244 "/        maxHeight := maxHeight max:(child heightIncludingBorder).
  1245 "/        maxWidth := maxWidth max:(child widthIncludingBorder).
  1245 "/        maxWidth := maxWidth max:(child widthIncludingBorder).
  1246     ].
  1246     ].
  1247     borderWidth ~~ 0 ifTrue:[
  1247     borderWidth ~~ 0 ifTrue:[
  1248 	sumOfWidths := sumOfWidths + (horizontalSpace * 2).
  1248         sumOfWidths := sumOfWidths + (horizontalSpace * 2).
  1249 	maxHeight := maxHeight + (verticalSpace * 2).
  1249         maxHeight := maxHeight + (verticalSpace * 2).
  1250     ].
  1250     ].
  1251     (hLayout == #fit 
  1251     (hLayout == #fit 
  1252     or:[hLayout == #fitSpace
  1252     or:[hLayout == #fitSpace
  1253     or:[hLayout endsWith:'Max']]) ifTrue:[
  1253     or:[hLayout endsWith:'Max']]) ifTrue:[
  1254 	sumOfWidths := maxWidth * subViews size.
  1254         sumOfWidths := maxWidth * subViews size.
  1255 	borderWidth ~~ 0 ifTrue:[
  1255         borderWidth ~~ 0 ifTrue:[
  1256 	    sumOfWidths := sumOfWidths + (horizontalSpace * 2).
  1256             sumOfWidths := sumOfWidths + (horizontalSpace * 2).
  1257 	]
  1257         ]
  1258     ] ifFalse:[
  1258     ] ifFalse:[
  1259 	sumOfWidths := sumOfWidths + ((subViews size - 1) * horizontalSpace).
  1259         sumOfWidths := sumOfWidths + ((subViews size - 1) * horizontalSpace).
  1260 	hLayout == #leftSpace ifTrue:[
  1260         ((hLayout == #leftSpace) or:[hLayout == #rightSpace]) ifTrue:[
  1261 	    sumOfWidths := sumOfWidths + horizontalSpace
  1261             sumOfWidths := sumOfWidths + horizontalSpace
  1262 	] ifFalse:[
  1262         ] ifFalse:[
  1263 	    ((hLayout == #center) or:[hLayout == #spread]) ifTrue:[
  1263             ((hLayout == #center) or:[hLayout == #spread]) ifTrue:[
  1264 		sumOfWidths := sumOfWidths + (horizontalSpace * 2)
  1264                 sumOfWidths := sumOfWidths + (horizontalSpace * 2)
  1265 	    ]
  1265             ]
  1266 	].
  1266         ].
  1267     ].
  1267     ].
  1268 
  1268 
  1269     ((vLayout == #topSpace) or:[vLayout == #bottomSpace]) ifTrue:[
  1269     ((vLayout == #topSpace) or:[vLayout == #bottomSpace]) ifTrue:[
  1270 	maxHeight := maxHeight + verticalSpace
  1270         maxHeight := maxHeight + verticalSpace
  1271     ] ifFalse:[
  1271     ] ifFalse:[
  1272 	((vLayout == #fitSpace)  or:[vLayout == #center]) ifTrue:[
  1272         ((vLayout == #fitSpace)  or:[vLayout == #center]) ifTrue:[
  1273 	    maxHeight := maxHeight + (verticalSpace * 2)
  1273             maxHeight := maxHeight + (verticalSpace * 2)
  1274 	]        
  1274         ]        
  1275     ].
  1275     ].
  1276 
  1276 
  1277     ^ sumOfWidths @ maxHeight
  1277     ^ sumOfWidths @ maxHeight
       
  1278 
       
  1279     "Modified: 9.2.1996 / 18:55:32 / cg"
  1278 ! !
  1280 ! !
  1279 
  1281 
  1280 !HorizontalPanelView class methodsFor:'documentation'!
  1282 !HorizontalPanelView class methodsFor:'documentation'!
  1281 
  1283 
  1282 version
  1284 version
  1283     ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.19 1995-11-23 18:17:29 cg Exp $'
  1285     ^ '$Header: /cvs/stx/stx/libwidg/HorizontalPanelView.st,v 1.20 1996-02-09 17:56:54 cg Exp $'
  1284 ! !
  1286 ! !