ListView.st
changeset 65 b33e4f3a264e
parent 63 f4eaf04d1eaf
child 70 14443a9ea4ec
equal deleted inserted replaced
64:c4e3323a5348 65:b33e4f3a264e
    34 
    34 
    35 ListView comment:'
    35 ListView comment:'
    36 COPYRIGHT (c) 1989 by Claus Gittinger
    36 COPYRIGHT (c) 1989 by Claus Gittinger
    37 	      All Rights Reserved
    37 	      All Rights Reserved
    38 
    38 
    39 $Header: /cvs/stx/stx/libwidg/ListView.st,v 1.12 1994-11-17 14:38:09 claus Exp $
    39 $Header: /cvs/stx/stx/libwidg/ListView.st,v 1.13 1994-11-21 16:45:30 claus Exp $
    40 '!
    40 '!
    41 
    41 
    42 !ListView class methodsFor:'documentation'!
    42 !ListView class methodsFor:'documentation'!
    43 
    43 
    44 copyright
    44 copyright
    55 "
    55 "
    56 !
    56 !
    57 
    57 
    58 version
    58 version
    59 "
    59 "
    60 $Header: /cvs/stx/stx/libwidg/ListView.st,v 1.12 1994-11-17 14:38:09 claus Exp $
    60 $Header: /cvs/stx/stx/libwidg/ListView.st,v 1.13 1994-11-21 16:45:30 claus Exp $
    61 "
    61 "
    62 !
    62 !
    63 
    63 
    64 documentation
    64 documentation
    65 "
    65 "
   192     topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
   192     topMargin := (self verticalPixelPerMillimeter:0.5) rounded.
   193     textStartLeft := leftMargin + margin.
   193     textStartLeft := leftMargin + margin.
   194     textStartTop := topMargin + margin.
   194     textStartTop := topMargin + margin.
   195     innerWidth := width - textStartLeft - margin.
   195     innerWidth := width - textStartLeft - margin.
   196     self getFontParameters
   196     self getFontParameters
       
   197 !
       
   198 
       
   199 realize
       
   200     extentChanged ifTrue:[
       
   201 	self computeNumberOfLinesShown.
       
   202     ].
       
   203     firstLineShown ~~ 1 ifTrue:[
       
   204 	firstLineShown + nLinesShown > list size ifTrue:[
       
   205 	    self scrollToLine:list size - nLinesShown.
       
   206 	]
       
   207     ].
       
   208     super realize
   197 ! !
   209 ! !
   198 
   210 
   199 !ListView methodsFor:'accessing'!
   211 !ListView methodsFor:'accessing'!
   200 
   212 
   201 backgroundColor
   213 backgroundColor
  2160     |listSize newOrigin|
  2172     |listSize newOrigin|
  2161 
  2173 
  2162     self computeNumberOfLinesShown.
  2174     self computeNumberOfLinesShown.
  2163 
  2175 
  2164     innerWidth := width - textStartLeft - margin.
  2176     innerWidth := width - textStartLeft - margin.
  2165     shown ifTrue:[
  2177     shown ifFalse:[^ self].
  2166 	list notNil ifTrue:[
  2178     list isNil ifTrue:[^ self].
  2167 	    listSize := self numberOfLines.
  2179 
  2168 	    ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
  2180     listSize := self numberOfLines.
  2169 		newOrigin := listSize - nFullLinesShown + 1.
  2181     "
  2170 		newOrigin < 1 ifTrue:[
  2182      if we are behond the end, scroll up a bit
  2171 		    newOrigin := 1
  2183     "
  2172 		].
  2184     ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
  2173 		self scrollToLine: newOrigin
  2185 	newOrigin := listSize - nFullLinesShown + 1.
  2174 	    ]
  2186 	newOrigin < 1 ifTrue:[
  2175 	]
  2187 	    newOrigin := 1
  2176     ]
  2188 	].
       
  2189 	self scrollToLine: newOrigin.
       
  2190 	^ self
       
  2191     ].
  2177 !
  2192 !
  2178 
  2193 
  2179 redrawX:x y:y width:w height:h
  2194 redrawX:x y:y width:w height:h
  2180     "a region must be redrawn"
  2195     "a region must be redrawn"
  2181 
  2196