ListView.st
changeset 24 966098a893f8
parent 21 9ef599238fea
child 38 4b9b70b2cc87
equal deleted inserted replaced
23:69f1ba57f67a 24:966098a893f8
    33 ListView comment:'
    33 ListView comment:'
    34 
    34 
    35 COPYRIGHT (c) 1989 by Claus Gittinger
    35 COPYRIGHT (c) 1989 by Claus Gittinger
    36               All Rights Reserved
    36               All Rights Reserved
    37 
    37 
    38 $Header: /cvs/stx/stx/libwidg/ListView.st,v 1.6 1994-01-08 17:27:30 claus Exp $
    38 $Header: /cvs/stx/stx/libwidg/ListView.st,v 1.7 1994-01-13 00:17:08 claus Exp $
    39 
    39 
    40 written spring 89 by claus
    40 written spring 89 by claus
    41 '!
    41 '!
    42 
    42 
    43 !ListView class methodsFor:'documentation'!
    43 !ListView class methodsFor:'documentation'!
   323                                 and:(firstLineShown + nLinesShown).
   323                                 and:(firstLineShown + nLinesShown).
   324     (self removeIndexWithoutRedraw:lineNr) ifFalse:[^ self].
   324     (self removeIndexWithoutRedraw:lineNr) ifFalse:[^ self].
   325     visLine := self listLineToVisibleLine:lineNr.
   325     visLine := self listLineToVisibleLine:lineNr.
   326     visLine notNil ifTrue:[
   326     visLine notNil ifTrue:[
   327         srcY := topMargin + (visLine * fontHeight).
   327         srcY := topMargin + (visLine * fontHeight).
       
   328         self catchExpose.
   328         self copyFrom:self x:textStartLeft y:srcY
   329         self copyFrom:self x:textStartLeft y:srcY
   329                          toX:textStartLeft y:(srcY - fontHeight)
   330                          toX:textStartLeft y:(srcY - fontHeight)
   330                        width:w height:((nLinesShown - visLine) * fontHeight).
   331                        width:w height:((nLinesShown - visLine) * fontHeight).
   331         self redrawVisibleLine:nFullLinesShown.
   332         self redrawVisibleLine:nFullLinesShown.
   332         (nFullLinesShown ~~ nLinesShown) ifTrue:[
   333         (nFullLinesShown ~~ nLinesShown) ifTrue:[
   333             self redrawVisibleLine:nLinesShown
   334             self redrawVisibleLine:nLinesShown
   334         ].
   335         ].
   335         exposePending := true.
       
   336         self waitForExpose
   336         self waitForExpose
   337     ]
   337     ]
   338 !
   338 !
   339 
   339 
   340 font:aFont
   340 font:aFont
  1189                                     and:(firstLineShown + nLinesShown).
  1189                                     and:(firstLineShown + nLinesShown).
  1190         w := w + leftMargin.
  1190         w := w + leftMargin.
  1191 
  1191 
  1192         firstLineShown := firstLineShown + count.
  1192         firstLineShown := firstLineShown + count.
  1193         h := (fontHeight * count) + textStartTop.
  1193         h := (fontHeight * count) + textStartTop.
       
  1194         self catchExpose.
  1194         self copyFrom:self x:margin y:h
  1195         self copyFrom:self x:margin y:h
  1195                          toX:margin y:textStartTop
  1196                          toX:margin y:textStartTop
  1196                        width:w height:(height - m2 - h).
  1197                        width:w height:(height - m2 - h).
  1197 
  1198 
  1198         self redrawFromVisibleLine:(nFullLinesShown - count + 1)
  1199         self redrawFromVisibleLine:(nFullLinesShown - count + 1)
  1199                                 to:nLinesShown.
  1200                                 to:nLinesShown.
       
  1201         self waitForExpose.
  1200         self originChanged:(count negated).
  1202         self originChanged:(count negated).
  1201         exposePending := true.
       
  1202         self waitForExpose
       
  1203     ]
  1203     ]
  1204 !
  1204 !
  1205 
  1205 
  1206 scrollDown
  1206 scrollDown
  1207     "change origin to scroll down one line"
  1207     "change origin to scroll down one line"
  1231         w := self widthForScrollBetween:firstLineShown
  1231         w := self widthForScrollBetween:firstLineShown
  1232                                     and:(firstLineShown + nLinesShown).
  1232                                     and:(firstLineShown + nLinesShown).
  1233         w := w + leftMargin.
  1233         w := w + leftMargin.
  1234         firstLineShown := firstLineShown - count.
  1234         firstLineShown := firstLineShown - count.
  1235         h := (fontHeight * count) + topMargin.
  1235         h := (fontHeight * count) + topMargin.
       
  1236         self catchExpose.
  1236         self copyFrom:self x:margin y:topMargin
  1237         self copyFrom:self x:margin y:topMargin
  1237                          toX:margin y:h
  1238                          toX:margin y:h
  1238                        width:w height:(height - h - margin).
  1239                        width:w height:(height - h - margin).
  1239         self redrawFromVisibleLine:1 to:count.
  1240         self redrawFromVisibleLine:1 to:count.
       
  1241         self waitForExpose.
  1240         self originChanged:(count negated).
  1242         self originChanged:(count negated).
  1241         exposePending := true.
       
  1242         self waitForExpose
       
  1243     ]
  1243     ]
  1244 !
  1244 !
  1245 
  1245 
  1246 scrollUp
  1246 scrollUp
  1247     "change origin to scroll up one line"
  1247     "change origin to scroll up one line"