7 inclusion of the above copyright notice. This software may not |
7 inclusion of the above copyright notice. This software may not |
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 |
|
13 'From Smalltalk/X, Version:2.10.8 on 18-dec-1995 at 23:29:27' ! |
12 |
14 |
13 View subclass:#ListView |
15 View subclass:#ListView |
14 instanceVariableNames:'list firstLineShown leftOffset nFullLinesShown nLinesShown |
16 instanceVariableNames:'list firstLineShown leftOffset nFullLinesShown nLinesShown |
15 fgColor bgColor partialLines leftMargin topMargin textStartLeft |
17 fgColor bgColor partialLines leftMargin topMargin textStartLeft |
16 textStartTop innerWidth tabPositions lineSpacing fontHeight |
18 textStartTop innerWidth tabPositions lineSpacing fontHeight |
485 |l oldSize| |
487 |l oldSize| |
486 |
488 |
487 oldSize := self size. |
489 oldSize := self size. |
488 l := something. |
490 l := something. |
489 l notNil ifTrue:[ |
491 l notNil ifTrue:[ |
490 l isString ifTrue:[ |
492 l isString ifTrue:[ |
491 l := l asStringCollection |
493 l := l asStringCollection |
492 ] |
494 ] |
493 ]. |
495 ]. |
494 self setList:l. |
496 self setList:l. |
495 self size ~~ oldSize ifTrue:[ |
497 |
496 self contentsChanged |
498 "Modified: 18.12.1995 / 22:20:43 / stefan" |
497 ] |
|
498 ! |
499 ! |
499 |
500 |
500 setList:aCollection |
501 setList:aCollection |
501 "set the contents (a collection of strings); |
502 "set the contents (a collection of strings); |
502 do not change position (i.e. do not scroll). |
503 do not change position (i.e. do not scroll). |
513 (for example: a file list being shown, without disturbing the user too much)" |
514 (for example: a file list being shown, without disturbing the user too much)" |
514 |
515 |
515 |oldFirst| |
516 |oldFirst| |
516 |
517 |
517 (aCollection isNil and:[list isNil]) ifTrue:[ |
518 (aCollection isNil and:[list isNil]) ifTrue:[ |
518 "no change" |
519 "no change" |
519 ^ self |
520 ^ self |
520 ]. |
521 ]. |
521 list := aCollection. |
522 list := aCollection. |
522 |
523 |
523 list notNil ifTrue:[ |
524 list notNil ifTrue:[ |
524 expandTabs ifTrue:[ |
525 expandTabs ifTrue:[ |
525 self expandTabs |
526 self expandTabs |
526 ] ifFalse:[ |
527 ] ifFalse:[ |
527 includesNonStrings := true. "/ actually: do not know |
528 includesNonStrings := true. "/ actually: do not know |
528 ] |
529 ] |
|
530 ]. |
|
531 |
|
532 "/ new - reposition horizontally if too big |
|
533 widthOfWidestLine := nil. "/ i.e. unknown |
|
534 innerWidth >= self widthOfContents ifTrue:[ |
|
535 leftOffset := 0. |
529 ]. |
536 ]. |
530 self contentsChanged. |
537 self contentsChanged. |
531 |
538 |
532 "/ new - reposition if too big |
539 "/ new - reposition vertically if too big |
533 (firstLineShown + nFullLinesShown) > self size ifTrue:[ |
540 (firstLineShown + nFullLinesShown) > self size ifTrue:[ |
534 oldFirst := firstLineShown. |
541 oldFirst := firstLineShown. |
535 firstLineShown := self size - nFullLinesShown + 1. |
542 firstLineShown := self size - nFullLinesShown + 1. |
536 firstLineShown < 1 ifTrue:[firstLineShown := 1]. |
543 firstLineShown < 1 ifTrue:[firstLineShown := 1]. |
537 self originChanged:(oldFirst - 1) negated. |
544 self originChanged:(oldFirst - 1) negated. |
538 shown ifTrue:[ |
545 shown ifTrue:[ |
539 self clear. |
546 self clear. |
540 ] |
547 ] |
541 ]. |
548 ]. |
542 "/ end new |
549 "/ end new |
543 shown ifTrue:[ |
550 shown ifTrue:[ |
544 self redrawFromVisibleLine:1 to:nLinesShown |
551 self redrawFromVisibleLine:1 to:nLinesShown |
545 ] |
552 ] |
546 |
553 |
|
554 "Modified: 18.12.1995 / 23:27:54 / stefan" |
547 ! |
555 ! |
548 |
556 |
549 size |
557 size |
550 "return the size (i.e. number of lines) |
558 "return the size (i.e. number of lines) |
551 this allows textViews to be used like collections in some places." |
559 this allows textViews to be used like collections in some places." |