MultiColumnPanelView.st
changeset 6487 debe1f7cce35
parent 4564 0a0d41148e11
child 6827 71d47cbb79ed
equal deleted inserted replaced
6486:f423667b4c8a 6487:debe1f7cce35
     8  be provided or otherwise made available to, or used by, any
     8  be provided or otherwise made available to, or used by, any
     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 "{ Package: 'stx:libwidg' }"
    12 "{ Package: 'stx:libwidg' }"
       
    13 
       
    14 "{ NameSpace: Smalltalk }"
    13 
    15 
    14 PanelView subclass:#MultiColumnPanelView
    16 PanelView subclass:#MultiColumnPanelView
    15 	instanceVariableNames:'columnWidths'
    17 	instanceVariableNames:'columnWidths'
    16 	classVariableNames:''
    18 	classVariableNames:''
    17 	poolDictionaries:''
    19 	poolDictionaries:''
   601     "Modified: / 10-10-2007 / 13:47:56 / cg"
   603     "Modified: / 10-10-2007 / 13:47:56 / cg"
   602 ! !
   604 ! !
   603 
   605 
   604 !MultiColumnPanelView methodsFor:'queries'!
   606 !MultiColumnPanelView methodsFor:'queries'!
   605 
   607 
   606 preferredExtent
   608 computePreferredExtent
   607     "return a good extent, one that makes subviews fit"
   609     "return a good extent, one that makes subviews fit"
   608 
   610 
   609     |maxHeight maxWidth maxWidthPerCol w m2 subViews col numCols rowsPerCol|
   611     |maxHeight maxWidth maxWidthPerCol w m2 subViews col numCols rowsPerCol|
   610 
       
   611     "/ If I have an explicit preferredExtent..
       
   612     explicitExtent notNil ifTrue:[
       
   613         ^ explicitExtent
       
   614     ].
       
   615 
       
   616     "/ If I have a cached preferredExtent value..
       
   617     preferredExtent notNil ifTrue:[
       
   618         ^ preferredExtent
       
   619     ].
       
   620 
   612 
   621     subViews := self subViewsToConsider.
   613     subViews := self subViewsToConsider.
   622     (subViews size == 0) ifTrue:[
   614     (subViews size == 0) ifTrue:[
   623         ^ super preferredExtent.
   615         ^ super preferredExtent.
   624     ].
   616     ].
   666 
   658 
   667     w := maxWidthPerCol inject:0 into:[:sumSoFar :thisWidth | sumSoFar + thisWidth].
   659     w := maxWidthPerCol inject:0 into:[:sumSoFar :thisWidth | sumSoFar + thisWidth].
   668 
   660 
   669     ^ (w+m2) @ (rowsPerCol max * maxHeight) + m2
   661     ^ (w+m2) @ (rowsPerCol max * maxHeight) + m2
   670 
   662 
   671     "Modified: / 17.1.1998 / 00:18:16 / cg"
   663     "Created: / 09-11-2018 / 19:57:46 / Claus Gittinger"
   672 ! !
   664 ! !
   673 
   665 
   674 !MultiColumnPanelView class methodsFor:'documentation'!
   666 !MultiColumnPanelView class methodsFor:'documentation'!
   675 
   667 
   676 version
   668 version
   677     ^ '$Header: /cvs/stx/stx/libwidg/MultiColumnPanelView.st,v 1.4 2013-04-25 13:10:34 stefan Exp $'
   669     ^ '$Header$'
   678 !
   670 !
   679 
   671 
   680 version_CVS
   672 version_CVS
   681     ^ '$Header: /cvs/stx/stx/libwidg/MultiColumnPanelView.st,v 1.4 2013-04-25 13:10:34 stefan Exp $'
   673     ^ '$Header$'
   682 ! !
   674 ! !
   683 
   675