ListView.st
changeset 887 9b25df4d193a
parent 883 84da1a010350
child 890 abd28e2f66ca
equal deleted inserted replaced
886:498e52f3d1dc 887:9b25df4d193a
  1245     "Modified: 28.2.1996 / 19:30:23 / cg"
  1245     "Modified: 28.2.1996 / 19:30:23 / cg"
  1246 ! !
  1246 ! !
  1247 
  1247 
  1248 !ListView methodsFor:'event processing'!
  1248 !ListView methodsFor:'event processing'!
  1249 
  1249 
       
  1250 contentsChanged
       
  1251     "contents changed - move origin up if possible"
       
  1252 
       
  1253     |listSize newOrigin|
       
  1254 
       
  1255     shown ifFalse:[^ self].
       
  1256     list isNil ifTrue:[^ self].
       
  1257 
       
  1258     listSize := self numberOfLines.
       
  1259     "
       
  1260      if we are beyond the end, scroll up a bit
       
  1261     "
       
  1262     ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
       
  1263         newOrigin := listSize - nFullLinesShown + 1.
       
  1264         newOrigin < 1 ifTrue:[
       
  1265             newOrigin := 1
       
  1266         ].
       
  1267         self scrollToLine: newOrigin.
       
  1268     ].
       
  1269 
       
  1270     ^ super contentsChanged
       
  1271 
       
  1272     "Modified: 18.11.1996 / 19:50:07 / stefan"
       
  1273 !
       
  1274 
  1250 keyPress:key x:x y:y
  1275 keyPress:key x:x y:y
  1251     "a key was pressed - handle page-keys here"
  1276     "a key was pressed - handle page-keys here"
  1252 
  1277 
  1253     <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
  1278     <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown
  1254 			  #BeginOfText #EndOfText
  1279 			  #BeginOfText #EndOfText
  1358 
  1383 
  1359     how ~~ #smaller ifTrue:[self invalidate ].
  1384     how ~~ #smaller ifTrue:[self invalidate ].
  1360 
  1385 
  1361     listSize := self numberOfLines.
  1386     listSize := self numberOfLines.
  1362     "
  1387     "
  1363      if we are behond the end, scroll up a bit
  1388      if we are beyond the end, scroll up a bit
  1364     "
  1389     "
  1365     ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
  1390     ((firstLineShown + nFullLinesShown) > listSize) ifTrue:[
  1366 	newOrigin := listSize - nFullLinesShown + 1.
  1391         newOrigin := listSize - nFullLinesShown + 1.
  1367 	newOrigin < 1 ifTrue:[
  1392         newOrigin < 1 ifTrue:[
  1368 	    newOrigin := 1
  1393             newOrigin := 1
  1369 	].
  1394         ].
  1370 	self scrollToLine: newOrigin.
  1395         self scrollToLine: newOrigin.
  1371 	^ self
  1396         ^ self
  1372     ].
  1397     ].
  1373 
  1398 
  1374     "Modified: 29.5.1996 / 16:19:23 / cg"
  1399     "Modified: 29.5.1996 / 16:19:23 / cg"
       
  1400     "Modified: 18.11.1996 / 19:37:02 / stefan"
  1375 ! !
  1401 ! !
  1376 
  1402 
  1377 !ListView methodsFor:'initialization'!
  1403 !ListView methodsFor:'initialization'!
  1378 
  1404 
  1379 create
  1405 create
  3474 ! !
  3500 ! !
  3475 
  3501 
  3476 !ListView class methodsFor:'documentation'!
  3502 !ListView class methodsFor:'documentation'!
  3477 
  3503 
  3478 version
  3504 version
  3479     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.106 1996-11-14 16:40:54 ca Exp $'
  3505     ^ '$Header: /cvs/stx/stx/libwidg/ListView.st,v 1.107 1996-11-18 19:58:25 stefan Exp $'
  3480 ! !
  3506 ! !