VerticalPanelView.st
changeset 321 00c17944cb00
parent 205 6814c0bf8df8
child 341 7f5c67028a04
equal deleted inserted replaced
320:b2ca0310ead0 321:00c17944cb00
     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:#VerticalPanelView
    13 PanelView subclass:#VerticalPanelView
    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 !VerticalPanelView class methodsFor:'documentation'!
    20 !VerticalPanelView class methodsFor:'documentation'!
    21 
    21 
    22 copyright
    22 copyright
   860     sumOfHeights := 0.
   860     sumOfHeights := 0.
   861     maxWidth := 0.
   861     maxWidth := 0.
   862     maxHeight := 0.
   862     maxHeight := 0.
   863 
   863 
   864     subViews do:[:child |
   864     subViews do:[:child |
   865 	|childsPreference|
   865         |childsPreference|
   866 
   866 
   867 	childsPreference := child preferredExtent.
   867         childsPreference := child preferredExtent.
   868 	sumOfHeights := sumOfHeights + childsPreference y.
   868         sumOfHeights := sumOfHeights + childsPreference y.
   869 	maxHeight := maxHeight max:childsPreference y.
   869         maxHeight := maxHeight max:childsPreference y.
   870 	maxWidth := maxWidth max:childsPreference x.
   870         maxWidth := maxWidth max:childsPreference x.
   871 
   871 
   872 "/        sumOfHeights := sumOfHeights + child heightIncludingBorder.
   872 "/        sumOfHeights := sumOfHeights + child heightIncludingBorder.
   873 "/        maxWidth := maxWidth max:(child widthIncludingBorder).
   873 "/        maxWidth := maxWidth max:(child widthIncludingBorder).
   874 "/        maxHeight := maxHeight max:(child heightIncludingBorder).
   874 "/        maxHeight := maxHeight max:(child heightIncludingBorder).
   875     ].
   875     ].
       
   876 
   876     borderWidth ~~ 0 ifTrue:[
   877     borderWidth ~~ 0 ifTrue:[
   877 	sumOfHeights := sumOfHeights + (horizontalSpace * 2).
   878         sumOfHeights := sumOfHeights + (verticalSpace * 2).
   878 	maxWidth := maxWidth + (horizontalSpace * 2).
   879         maxWidth := maxWidth + (horizontalSpace * 2).
   879     ].
   880     ].
       
   881 
   880     (vLayout == #fit or:[vLayout == #fitSpace]) ifTrue:[
   882     (vLayout == #fit or:[vLayout == #fitSpace]) ifTrue:[
   881 	sumOfHeights := maxHeight * subViews size.
   883         sumOfHeights := maxHeight * subViews size.
   882 	borderWidth ~~ 0 ifTrue:[
   884         borderWidth ~~ 0 ifTrue:[
   883 	    sumOfHeights := sumOfHeights + (verticalSpace * 2).
   885             sumOfHeights := sumOfHeights + (verticalSpace * 2).
   884 	]
   886         ]
   885     ] ifFalse:[
   887     ] ifFalse:[
   886 	sumOfHeights := sumOfHeights + ((subViews size - 1) * verticalSpace).
   888         sumOfHeights := sumOfHeights + ((subViews size - 1) * verticalSpace).
   887 	vLayout == #topSpace ifTrue:[
   889         vLayout == #topSpace ifTrue:[
   888 	    sumOfHeights := sumOfHeights + verticalSpace
   890             sumOfHeights := sumOfHeights + verticalSpace
   889 	] ifFalse:[
   891         ] ifFalse:[
   890 	    ((vLayout == #center) or:[vLayout == #spread]) ifTrue:[
   892             ((vLayout == #center) or:[vLayout == #spread]) ifTrue:[
   891 		sumOfHeights := sumOfHeights + (verticalSpace * 2)
   893                 sumOfHeights := sumOfHeights + (verticalSpace * 2)
   892 	    ]
   894             ]
   893 	].
   895         ].
   894     ].
   896     ].
   895 
   897 
   896     ((hLayout == #leftSpace) or:[hLayout == #rightSpace]) ifTrue:[
   898     ((hLayout == #leftSpace) or:[hLayout == #rightSpace]) ifTrue:[
   897 	maxWidth := maxWidth + horizontalSpace
   899         maxWidth := maxWidth + horizontalSpace
   898     ] ifFalse:[
   900     ] ifFalse:[
   899 	((hLayout == #fitSpace) or:[hLayout == #center]) ifTrue:[
   901         ((hLayout == #fitSpace) or:[hLayout == #center]) ifTrue:[
   900 	    maxWidth := maxWidth + (horizontalSpace * 2)
   902             maxWidth := maxWidth + (horizontalSpace * 2)
   901 	]        
   903         ]        
   902     ].
   904     ].
   903     ^ maxWidth @ sumOfHeights
   905     ^ maxWidth @ sumOfHeights
       
   906 
       
   907     "Modified: 6.2.1996 / 14:31:20 / cg"
   904 ! !
   908 ! !
   905 
   909 
   906 !VerticalPanelView class methodsFor:'documentation'!
   910 !VerticalPanelView class methodsFor:'documentation'!
   907 
   911 
   908 version
   912 version
   909     ^ '$Header: /cvs/stx/stx/libwidg/VerticalPanelView.st,v 1.17 1995-11-23 18:16:34 cg Exp $'
   913     ^ '$Header: /cvs/stx/stx/libwidg/VerticalPanelView.st,v 1.18 1996-02-06 20:46:13 cg Exp $'
   910 ! !
   914 ! !