PanelView.st
changeset 1042 5914ecc423e1
parent 1036 5958cde90d09
child 1072 79c647d81083
equal deleted inserted replaced
1041:976147f19ad7 1042:5914ecc423e1
   294 setChildPositions
   294 setChildPositions
   295     "(re)compute position of every child.
   295     "(re)compute position of every child.
   296      This method is redefined for different layout characteristics - you may
   296      This method is redefined for different layout characteristics - you may
   297      even create subclasses with completely different geometry management."
   297      even create subclasses with completely different geometry management."
   298 
   298 
   299     |first xpos ypos maxHeightInRow thisRow subViews|
   299     |first xpos ypos maxHeightInRow thisRow subViews ext|
   300 
   300 
   301     (subViews := self subViews) notNil ifTrue:[
   301     subViews := self subViews.
   302         xpos := horizontalSpace.
   302     subViews size == 0 ifTrue:[^ self].
   303         ypos := verticalSpace.
   303 
   304 
   304     extentChanged ifTrue:[
   305         maxHeightInRow := 0.
   305         ext := self computeExtent.
   306         first := true.
   306         width := ext x.
   307         thisRow := OrderedCollection new.
   307         height := ext y.
   308         subViews do:[:child |
   308     ].
   309             "go to next row, if this subview won't fit"
   309 
   310             first ifFalse: [
   310     xpos := horizontalSpace.
   311                 (xpos + child widthIncludingBorder + horizontalSpace) > width
   311     ypos := verticalSpace.
   312                 ifTrue: [
   312 
   313                     thisRow notEmpty ifTrue:[
   313     maxHeightInRow := 0.
   314                         thisRow do:[:rowElement |
   314     first := true.
   315                             rowElement heightIncludingBorder < maxHeightInRow ifTrue:[
   315     thisRow := OrderedCollection new.
   316                                 rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder))
   316     subViews do:[:child |
   317                             ]
   317         "go to next row, if this subview won't fit"
       
   318         first ifFalse: [
       
   319             (xpos + child widthIncludingBorder + horizontalSpace) > width
       
   320             ifTrue: [
       
   321                 thisRow notEmpty ifTrue:[
       
   322                     thisRow do:[:rowElement |
       
   323                         rowElement heightIncludingBorder < maxHeightInRow ifTrue:[
       
   324                             rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder))
   318                         ]
   325                         ]
   319                     ].
   326                     ]
   320                     ypos := ypos + verticalSpace + maxHeightInRow.
   327                 ].
   321                     xpos := horizontalSpace.
   328                 ypos := ypos + verticalSpace + maxHeightInRow.
   322                     maxHeightInRow := 0.
   329                 xpos := horizontalSpace.
   323                     thisRow := OrderedCollection new.
   330                 maxHeightInRow := 0.
   324                 ]
   331                 thisRow := OrderedCollection new.
   325             ].
       
   326             thisRow add:child.
       
   327             child origin:(xpos@ypos).
       
   328             xpos := xpos + (child widthIncludingBorder) + horizontalSpace.
       
   329             (maxHeightInRow < (child heightIncludingBorder)) ifTrue:[
       
   330                 maxHeightInRow := child heightIncludingBorder
       
   331             ].
       
   332             first := false
       
   333         ].
       
   334         thisRow notEmpty ifTrue:[
       
   335             thisRow do:[:rowElement |
       
   336                 rowElement heightIncludingBorder < maxHeightInRow ifTrue:[
       
   337                     rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder))
       
   338                 ]
       
   339             ]
   332             ]
   340         ].
   333         ].
       
   334         thisRow add:child.
       
   335         child origin:(xpos@ypos).
       
   336         xpos := xpos + (child widthIncludingBorder) + horizontalSpace.
       
   337         (maxHeightInRow < (child heightIncludingBorder)) ifTrue:[
       
   338             maxHeightInRow := child heightIncludingBorder
       
   339         ].
       
   340         first := false
       
   341     ].
       
   342     thisRow notEmpty ifTrue:[
       
   343         thisRow do:[:rowElement |
       
   344             rowElement heightIncludingBorder < maxHeightInRow ifTrue:[
       
   345                 rowElement top:(rowElement top + (maxHeightInRow - rowElement heightIncludingBorder))
       
   346             ]
       
   347         ]
   341     ].
   348     ].
   342     mustRearrange := false
   349     mustRearrange := false
   343 
   350 
   344     "Modified: 28.1.1997 / 17:51:36 / cg"
   351     "Modified: 28.1.1997 / 17:51:36 / cg"
   345 ! !
   352 ! !
   346 
   353 
   347 !PanelView class methodsFor:'documentation'!
   354 !PanelView class methodsFor:'documentation'!
   348 
   355 
   349 version
   356 version
   350     ^ '$Header: /cvs/stx/stx/libwidg/PanelView.st,v 1.20 1997-02-21 19:27:43 ca Exp $'
   357     ^ '$Header: /cvs/stx/stx/libwidg/PanelView.st,v 1.21 1997-02-25 13:03:15 ca Exp $'
   351 ! !
   358 ! !