298 StopRedrawSignal nameClass:self message:#stopRedrawSignal. |
299 StopRedrawSignal nameClass:self message:#stopRedrawSignal. |
299 ]. |
300 ]. |
300 ^ StopRedrawSignal |
301 ^ StopRedrawSignal |
301 ! ! |
302 ! ! |
302 |
303 |
303 !DSVColumnView methodsFor:'AEG-Extensions'! |
|
304 |
|
305 doScrollCenterToColAt:aColNr |
|
306 "make column at a column number visible, positioning in the center |
|
307 " |
|
308 |x dX l x1 | |
|
309 |
|
310 (aColNr between:0 and:(self numberOfColumns)) ifFalse:[ |
|
311 ^ self |
|
312 ]. |
|
313 |
|
314 dX := 0. |
|
315 aColNr == 0 ifTrue:[^self]. |
|
316 x1 := self xVisibleOfColNr:aColNr. |
|
317 x := x1 - (width / 2) asInteger. |
|
318 x <= margin ifTrue:[ |
|
319 dX := margin - x |
|
320 ] ifFalse:[ |
|
321 x := x1 + (width / 2) asInteger - 1. |
|
322 l := width - margin. |
|
323 x > l ifTrue:[dX := l - x] |
|
324 ]. |
|
325 |
|
326 (dX == 0) ifFalse:[ |
|
327 self scrollTo: viewOrigin - (dX@0). |
|
328 ]. |
|
329 |
|
330 ! |
|
331 |
|
332 scrollCenterToColAt:aColNr |
|
333 "make column at a column number visible, positioning in the center |
|
334 " |
|
335 "/ |x dX l x1 | |
|
336 self pushEvent:#doScrollCenterToColAt: with:aColNr. |
|
337 "/ (aColNr between:0 and:(self numberOfColumns)) ifFalse:[ |
|
338 "/ ^ self |
|
339 "/ ]. |
|
340 "/ |
|
341 "/ dX := 0. |
|
342 "/ aColNr == 0 ifTrue:[^self]. |
|
343 "/ x1 := self xVisibleOfColNr:aColNr. |
|
344 "/ x := x1 - (width / 2) asInteger. |
|
345 "/ x <= margin ifTrue:[ |
|
346 "/ dX := margin - x |
|
347 "/ ] ifFalse:[ |
|
348 "/ x := x1 + (width / 2) asInteger - 1. |
|
349 "/ l := width - margin. |
|
350 "/ x > l ifTrue:[dX := l - x] |
|
351 "/ ]. |
|
352 "/ |
|
353 "/ (dX == 0) ifFalse:[ |
|
354 "/ self scrollTo: viewOrigin - (dX@0). |
|
355 "/ ] |
|
356 "/ |
|
357 |
|
358 ! ! |
|
359 |
|
360 !DSVColumnView methodsFor:'accessing'! |
304 !DSVColumnView methodsFor:'accessing'! |
361 |
305 |
362 builder |
306 builder |
363 "get the builder (UIBuilder or nil) |
307 "get the builder (UIBuilder or nil)" |
364 " |
308 |
365 ^ builder |
309 ^ builder |
366 ! |
310 ! |
367 |
311 |
368 builder:aBuilder |
312 builder:aBuilder |
369 "set the builder (UIBuilder or nil) |
313 "set the builder (UIBuilder or nil)" |
370 " |
314 |
371 builder := aBuilder |
315 builder := aBuilder |
372 ! |
316 ! |
373 |
317 |
374 columnView |
318 columnView |
375 "returns self |
319 "returns self" |
376 " |
320 |
377 ^ self |
321 ^ self |
|
322 ! |
|
323 |
|
324 heightOfContents |
|
325 "return the height of the contents in pixels" |
|
326 |
|
327 preferredExtent isNil ifTrue:[ |
|
328 self preferredExtent |
|
329 ]. |
|
330 ^ preferredExtent y |
378 ! |
331 ! |
379 |
332 |
380 labelView |
333 labelView |
381 |
334 |
382 ^labelView |
335 ^labelView |
416 preferredLabelViewHeight |
369 preferredLabelViewHeight |
417 ^ labelView preferredHeight + (labelView margin + self verticalSpacing * 2). |
370 ^ labelView preferredHeight + (labelView margin + self verticalSpacing * 2). |
418 ! |
371 ! |
419 |
372 |
420 rowFontAscent |
373 rowFontAscent |
421 "returns the inset of a printable text in a row |
374 "returns the inset of a printable text in a row" |
422 " |
375 |
423 ^ rowFontAscent |
376 ^ rowFontAscent |
424 ! ! |
377 ! ! |
425 |
378 |
426 !DSVColumnView methodsFor:'accessing-actions'! |
379 !DSVColumnView methodsFor:'accessing-actions'! |
427 |
380 |
428 action:aOneArgAction |
381 action:aOneArgAction |
429 "set the action block to be performed on select |
382 "set the action block to be performed on select" |
430 " |
383 |
431 actionBlock := aOneArgAction |
384 actionBlock := aOneArgAction |
432 |
385 ! |
433 |
386 |
434 ! |
387 doubleClickAction:aOneArgAction |
435 |
388 "set the action block to be performed on doubleclick" |
436 doubleClickAction:aOneArgAction |
389 |
437 "set the action block to be performed on doubleclick |
|
438 " |
|
439 doubleClickActionBlock := aOneArgAction |
390 doubleClickActionBlock := aOneArgAction |
440 |
391 ! |
441 |
392 |
442 ! |
393 rowIfAbsent:aOneArgAction |
443 |
|
444 rowIfAbsent:aOneArgAction |
|
445 "set the action block to be performed on each 'nil' entry into the |
394 "set the action block to be performed on each 'nil' entry into the |
446 list. The argument to the block is the index into the list. The |
395 list. The argument to the block is the index into the list. The |
447 block returns the row which is put to the list |
396 block returns the row which is put to the list" |
448 " |
397 |
449 rowIfAbsentBlock := aOneArgAction |
398 rowIfAbsentBlock := aOneArgAction |
450 |
|
451 |
|
452 ! |
399 ! |
453 |
400 |
454 selectConditionBlock |
401 selectConditionBlock |
455 "get the select-conditionBlock; this block is evaluated before |
402 "get the select-conditionBlock; this block is evaluated before |
456 any selection change is performed (passing the to-be-changed row number |
403 any selection change is performed (passing the to-be-changed row number |
457 index as arg). |
404 index as arg). |
458 The change will not be done, if the block returns false. |
405 The change will not be done, if the block returns false. " |
459 " |
406 |
460 ^ selectConditionBlock |
407 ^ selectConditionBlock |
461 ! |
408 ! |
462 |
409 |
463 selectConditionBlock:aOneArgBlockOrNil |
410 selectConditionBlock:aOneArgBlockOrNil |
464 "set the select-conditionBlock; this block is evaluated before |
411 "set the select-conditionBlock; this block is evaluated before |
465 any selection change is performed (passing the to-be-changed row number |
412 any selection change is performed (passing the to-be-changed row number |
466 index as arg). |
413 index as arg). |
467 The change will not be done, if the block returns false. |
414 The change will not be done, if the block returns false. " |
468 " |
415 |
469 selectConditionBlock := aOneArgBlockOrNil. |
416 selectConditionBlock := aOneArgBlockOrNil. |
470 ! |
417 ! |
471 |
418 |
472 tabAtEndAction:aNoneArgAction |
419 tabAtEndAction:aNoneArgAction |
473 "set the action, called without any argument at end of the list entering |
420 "set the action, called without any argument at end of the list entering |
474 tab next. |
421 tab next. |
475 The default is to give the focus to the view after self in the focusSequence |
422 The default is to give the focus to the view after self in the focusSequence" |
476 " |
423 |
477 tabAtEndAction := aNoneArgAction |
424 tabAtEndAction := aNoneArgAction |
478 |
425 ! |
479 |
426 |
480 ! |
427 tabAtStartAction:aNoneArgAction |
481 |
|
482 tabAtStartAction:aNoneArgAction |
|
483 "set the action, called without any argument at start of the list entering |
428 "set the action, called without any argument at start of the list entering |
484 tab previous. |
429 tab previous. |
485 The default is to give the focus to the view before self in the focusSequence |
430 The default is to give the focus to the view before self in the focusSequence" |
486 " |
431 |
487 tabAtStartAction := aNoneArgAction |
432 tabAtStartAction := aNoneArgAction |
488 |
|
489 |
|
490 ! ! |
433 ! ! |
491 |
434 |
492 !DSVColumnView methodsFor:'accessing-behavior'! |
435 !DSVColumnView methodsFor:'accessing-behavior'! |
493 |
436 |
494 beDependentOfRows |
437 beDependentOfRows |
495 "make myself dependent of any row; in this case any change notification |
438 "make myself dependent of any row; in this case any change notification |
496 raised by a row is catched and the cell identified by the 'readSelector' |
439 raised by a row is catched and the cell identified by the 'readSelector' |
497 is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
440 is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
498 -> row changed:'what' |
441 -> row changed:'what' |
499 On default the attribute is set to false (disabled). |
442 By default, the attribute is set to false (disabled)." |
500 " |
443 |
501 ^ beDependentOfRows |
444 ^ beDependentOfRows |
502 ! |
445 ! |
503 |
446 |
504 beDependentOfRows:aBool |
447 beDependentOfRows:aBool |
505 "make myself dependent of any row; in this case any change notification |
448 "make myself dependent of any row; in this case any change notification |
506 raised by a row is catched and the cell identified by the 'readSelector' |
449 raised by a row is catched and the cell identified by the 'readSelector' |
507 is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
450 is redrawn. In case of a nil readSelector, the whole raw is redrawn. |
508 -> row changed:'what' |
451 -> row changed:'what' |
509 On default the attribute is set to false (disabled). |
452 By default, the attribute is set to false (disabled)." |
510 " |
453 |
511 aBool ~~ beDependentOfRows ifTrue:[ |
454 aBool ~~ beDependentOfRows ifTrue:[ |
512 beDependentOfRows := aBool. |
455 beDependentOfRows := aBool. |
513 |
|
514 list size ~~ 0 ifTrue:[ |
456 list size ~~ 0 ifTrue:[ |
515 list do:[:aRow| aRow notNil ifTrue:[ |
457 list do:[:aRow | |
516 beDependentOfRows ifTrue:[aRow addDependent:self] |
458 aRow notNil ifTrue:[ |
517 ifFalse:[aRow removeDependent:self] |
459 beDependentOfRows ifTrue:[ |
|
460 aRow addDependent:self |
|
461 ] ifFalse:[ |
|
462 aRow removeDependent:self |
|
463 ] |
518 ] |
464 ] |
519 ] |
465 ] |
520 ] |
466 ] |
521 ] |
467 ] |
522 ! |
468 ! |
580 |
526 |
581 scrollWhenUpdating := aSymbolOrNil |
527 scrollWhenUpdating := aSymbolOrNil |
582 ! |
528 ! |
583 |
529 |
584 selectRowOnDefault |
530 selectRowOnDefault |
585 "in case of selecting a none selectable cell, the row is selected |
531 "in case of selecting a none selectable cell, the row is selected" |
586 " |
532 |
587 ^ selectRowOnDefault |
533 ^ selectRowOnDefault |
588 ! |
534 ! |
589 |
535 |
590 selectRowOnDefault:aBool |
536 selectRowOnDefault:aBool |
591 "in case of selecting a none selectable cell, the row is selected |
537 "in case of selecting a none selectable cell, the row is selected" |
592 " |
538 |
593 selectRowOnDefault := aBool |
539 selectRowOnDefault := aBool |
594 ! |
540 ! |
595 |
541 |
596 tabIntern |
542 tabIntern |
597 "returns true if tabing is supported in the widget |
543 "returns true if tabing is supported in the widget" |
598 " |
544 |
599 ^ tabIntern |
545 ^ tabIntern |
600 ! |
546 ! |
601 |
547 |
602 tabIntern:aBool |
548 tabIntern:aBool |
603 "returns true if tabing is supported in the widget |
549 "returns true if tabing is supported in the widget" |
604 " |
550 |
605 tabIntern := aBool ? true |
551 tabIntern := aBool ? true |
606 ! |
552 ! |
607 |
553 |
608 useIndex |
554 useIndex |
609 "specify, if the selected components value or its index in the |
555 "specify, if the selected components value or its index in the |
610 list should be sent to the model. The default is its index. |
556 list should be sent to the model. The default is its index." |
611 " |
557 |
612 ^ useIndex |
558 ^ useIndex |
613 |
559 ! |
614 |
560 |
615 ! |
561 useIndex:aBool |
616 |
|
617 useIndex:aBool |
|
618 "specify, if the selected components value or its index in the |
562 "specify, if the selected components value or its index in the |
619 list should be sent to the model. The default is its index. |
563 list should be sent to the model. The default is its index." |
620 " |
564 |
621 useIndex := aBool |
565 useIndex := aBool |
622 |
|
623 ! ! |
566 ! ! |
624 |
567 |
625 !DSVColumnView methodsFor:'accessing-colors'! |
568 !DSVColumnView methodsFor:'accessing-colors'! |
626 |
569 |
627 backgroundColor |
570 backgroundColor |
628 "get the background color of the rows |
571 "get the background color of the rows" |
629 " |
572 |
630 ^ bgColor |
573 ^ bgColor |
631 |
574 ! |
632 |
575 |
633 ! |
576 backgroundColor:aColor |
634 |
577 "set the background color of the rows" |
635 backgroundColor:aColor |
578 |
636 "set the background color of the rows |
|
637 " |
|
638 bgColor ~~ aColor ifTrue:[ |
579 bgColor ~~ aColor ifTrue:[ |
639 super viewBackground:bgColor. |
580 super viewBackground:bgColor. |
640 |
|
641 self realized ifTrue:[ |
581 self realized ifTrue:[ |
642 bgColor := aColor onDevice:device. |
582 bgColor := aColor onDevice:device. |
643 self invalidate |
583 self invalidate |
644 ] ifFalse:[ |
584 ] ifFalse:[ |
645 bgColor := aColor |
585 bgColor := aColor |
646 ] |
586 ] |
647 ] |
587 ] |
648 ! |
588 ! |
649 |
589 |
650 foregroundColor |
590 foregroundColor |
651 "return the foreground color of the rows |
591 "return the foreground color of the rows" |
652 " |
592 |
653 ^ fgColor |
593 ^ fgColor |
654 |
594 ! |
655 ! |
595 |
656 |
596 foregroundColor:aColor |
657 foregroundColor:aColor |
597 "set the foreground color of the rows" |
658 "set the foreground color of the rows |
598 |
659 " |
|
660 fgColor ~~ aColor ifTrue:[ |
599 fgColor ~~ aColor ifTrue:[ |
661 self realized ifTrue:[ |
600 self realized ifTrue:[ |
662 fgColor := aColor onDevice:device. |
601 fgColor := aColor onDevice:device. |
663 self invalidate |
602 self invalidate |
664 ] ifFalse:[ |
603 ] ifFalse:[ |
665 fgColor := aColor |
604 fgColor := aColor |
666 ] |
605 ] |
667 ] |
606 ] |
668 |
|
669 ! |
607 ! |
670 |
608 |
671 selectionBackgroundColor |
609 selectionBackgroundColor |
672 "returns the background color of a selected row |
610 "returns the background color of a selected row" |
673 " |
611 |
674 ^ selectionBackgroundColor |
612 ^ selectionBackgroundColor |
675 ! |
613 ! |
676 |
614 |
677 selectionForegroundColor |
615 selectionForegroundColor |
678 "returns the foreground color of a selected row |
616 "returns the foreground color of a selected row" |
679 " |
617 |
680 ^ selectionForegroundColor |
618 ^ selectionForegroundColor |
681 ! |
619 ! |
682 |
620 |
683 separatorDarkColor |
621 separatorDarkColor |
684 "returns the dark color used for drawing a shadowed separator (3D) |
622 "returns the dark color used for drawing a shadowed separator (3D)" |
685 " |
623 |
686 ^ shadowColor |
624 ^ shadowColor |
687 |
|
688 |
|
689 ! |
625 ! |
690 |
626 |
691 separatorLightColor |
627 separatorLightColor |
692 "returns the light color used for drawing a shadowed separator (3D) |
628 "returns the light color used for drawing a shadowed separator (3D)" |
693 " |
629 |
694 ^ lightColor |
630 ^ lightColor |
695 |
|
696 |
|
697 ! |
631 ! |
698 |
632 |
699 separatorOneDColor |
633 separatorOneDColor |
700 "returns the color used for drawing a oneD separator |
634 "returns the color used for drawing a oneD separator" |
701 " |
635 |
702 separatorOneDColor isNil ifTrue:[^ fgColor]. |
636 separatorOneDColor isNil ifTrue:[ |
|
637 ^ fgColor |
|
638 ]. |
703 ^ separatorOneDColor |
639 ^ separatorOneDColor |
704 ! |
640 ! |
705 |
641 |
706 separatorOneDColor:aColorOrNil |
642 separatorOneDColor:aColorOrNil |
707 "set the color used for drawing a oneD separator; if the color |
643 "set the color used for drawing a oneD separator; if the color |
708 is nil, the current forgroundColor is used |
644 is nil, the current forgroundColor is used" |
709 " |
645 |
710 separatorOneDColor = aColorOrNil ifTrue:[^ self]. |
646 separatorOneDColor = aColorOrNil ifTrue:[ |
|
647 ^ self |
|
648 ]. |
711 separatorOneDColor := aColorOrNil. |
649 separatorOneDColor := aColorOrNil. |
712 |
|
713 self realized ifTrue:[ |
650 self realized ifTrue:[ |
714 separatorOneDColor notNil ifTrue:[ |
651 separatorOneDColor notNil ifTrue:[ |
715 separatorOneDColor := separatorOneDColor onDevice:device. |
652 separatorOneDColor := separatorOneDColor onDevice:device. |
716 ]. |
653 ]. |
717 self invalidate. |
654 self invalidate. |
718 ]. |
655 ]. |
719 ! ! |
656 ! ! |
720 |
657 |
721 !DSVColumnView methodsFor:'accessing-columns'! |
658 !DSVColumnView methodsFor:'accessing-columns'! |
722 |
659 |
723 columnAt:anIndex |
660 columnAt:anIndex |
724 "returns the column at an index |
661 "returns the column at an index" |
725 " |
662 |
726 ^ columnDescriptors at:anIndex ifAbsent:nil |
663 ^ columnDescriptors at:anIndex ifAbsent:nil |
727 ! |
664 ! |
728 |
665 |
729 columnDescriptors |
666 columnDescriptors |
730 "returns list of column descriptors |
667 "returns list of column descriptors" |
731 " |
668 |
732 ^ columnDescriptors collect:[:aCol| aCol description ] |
669 ^ columnDescriptors collect:[:aCol | aCol description ] |
733 ! |
670 ! |
734 |
671 |
735 columnDescriptors:aColumnDescriptionList |
672 columnDescriptors:aColumnDescriptionList |
736 "set the columnDescriptors; scroll to top and deselect |
673 "set the columnDescriptors; scroll to top and deselect" |
737 " |
674 |
738 | delta| |
675 |delta| |
739 |
676 |
740 self deselect. |
677 self deselect. |
741 |
678 (viewOrigin x ~~ 0 or:[ viewOrigin y ~~ 0 ]) ifTrue:[ |
742 (viewOrigin x ~~ 0 or:[viewOrigin y ~~ 0]) ifTrue:[ |
|
743 delta := viewOrigin negated. |
679 delta := viewOrigin negated. |
744 viewOrigin := 0@0. |
680 viewOrigin := 0 @ 0. |
745 self originChanged:delta |
681 self originChanged:delta |
746 ]. |
682 ]. |
747 self setColumnDescriptors:aColumnDescriptionList |
683 self setColumnDescriptors:aColumnDescriptionList |
748 ! |
684 ! |
749 |
685 |
750 dataSetColumns |
686 dataSetColumns |
751 "returns the list of DataSetColumns; each column reprasents a DataSetColumnSpec |
687 "returns the list of DataSetColumns; each column represents a DataSetColumnSpec" |
752 " |
688 |
753 ^ columnDescriptors |
689 ^ columnDescriptors |
754 ! |
690 ! |
755 |
691 |
756 firstColumn |
692 firstColumn |
757 "returns the first column |
693 "returns the first column" |
758 " |
694 |
759 ^ columnDescriptors at:1 |
695 ^ columnDescriptors at:1 |
760 |
|
761 ! |
696 ! |
762 |
697 |
763 lastColumn |
698 lastColumn |
764 "returns the last column |
699 "returns the last column" |
765 " |
700 |
766 ^ columnDescriptors last |
701 ^ columnDescriptors last |
767 |
|
768 ! |
702 ! |
769 |
703 |
770 setColumnDescriptors:aColumnDescriptionList |
704 setColumnDescriptors:aColumnDescriptionList |
771 "set the columnDescriptors; dont deselect and do not scroll to top |
705 "set the columnDescriptors; dont deselect and do not scroll to top" |
772 " |
|
773 |cid| |
706 |cid| |
774 |
707 |
775 cid := 0. |
708 cid := 0. |
776 columnDescriptors := aColumnDescriptionList ? #(). |
709 columnDescriptors := aColumnDescriptionList ? #(). |
777 |
710 |
778 columnDescriptors := columnDescriptors collect:[:el||dsc lbl| |
711 columnDescriptors := columnDescriptors collect:[:el||dsc lbl| |
779 dsc := el isSequenceable ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:el] |
712 dsc := el isSequenceable |
780 ifFalse:[el]. |
713 ifTrue:[DataSetColumnSpec new fromLiteralArrayEncoding:el] |
|
714 ifFalse:[el]. |
781 cid := cid + 1. |
715 cid := cid + 1. |
782 lbl := DataSetLabel new description:dsc builder:builder on:labelView. |
716 lbl := DataSetLabel new description:dsc builder:builder on:labelView. |
783 DataSetColumn new on:self description:dsc columnNumber:cid label:lbl |
717 DataSetColumn new on:self description:dsc columnNumber:cid label:lbl |
784 ]. |
718 ]. |
785 |
719 |
796 checkToggleActiveImage |
730 checkToggleActiveImage |
797 ^ checkToggleActiveImage |
731 ^ checkToggleActiveImage |
798 ! |
732 ! |
799 |
733 |
800 checkToggleExtent |
734 checkToggleExtent |
801 "returns the extent of a checkToggle |
735 "returns the extent of a checkToggle" |
802 " |
736 |
803 ^ checkToggleExtent |
737 ^ checkToggleExtent |
804 ! |
738 ! |
805 |
739 |
806 checkToggleForm |
740 checkToggleForm |
807 "returns the form of a checkToggle |
741 "returns the form of a checkToggle" |
808 " |
742 |
809 ^ checkToggleForm |
743 ^ checkToggleForm |
810 ! |
744 ! |
811 |
745 |
812 checkToggleLevel |
746 checkToggleLevel |
813 "returns the level of a checkToggle button |
747 "returns the level of a checkToggle button" |
814 " |
748 |
815 ^ checkToggleLevel |
749 ^ checkToggleLevel |
816 ! |
750 ! |
817 |
751 |
818 checkTogglePassiveImage |
752 checkTogglePassiveImage |
819 ^ checkTogglePassiveImage |
753 ^ checkTogglePassiveImage |
820 ! |
754 ! |
821 |
755 |
822 comboButtonExtent |
756 comboButtonExtent |
823 "returns the extent of a comboList or -Box |
757 "returns the extent of a comboList or -Box" |
824 " |
758 |
825 ^ comboButtonExtent |
759 ^ comboButtonExtent |
826 ! |
760 ! |
827 |
761 |
828 comboButtonForm |
762 comboButtonForm |
829 "returns the form of a comboList or -Box |
763 "returns the form of a comboList or -Box" |
830 " |
764 |
831 ^ comboButtonForm |
765 ^ comboButtonForm |
832 ! |
766 ! |
833 |
767 |
834 comboButtonLevel |
768 comboButtonLevel |
835 "returns the level of a comboList or -Box button |
769 "returns the level of a comboList or -Box button" |
836 " |
770 |
837 ^ comboButtonLevel |
771 ^ comboButtonLevel |
838 ! |
772 ! |
839 |
773 |
840 rowSelectorExtent |
774 rowSelectorExtent |
841 "returns the bitmap of a selected row |
775 "returns the bitmap of a selected row" |
842 " |
776 |
843 ^ rowSelectorForm extent |
777 ^ rowSelectorForm extent |
844 ! |
778 ! |
845 |
779 |
846 rowSelectorForm |
780 rowSelectorForm |
847 "returns the (arrow-) image shown for a selected row. |
781 "returns the (arrow-) image shown for a selected row. |
848 (te arrow shown in the first column) |
782 (the arrow shown in the first column)" |
849 " |
783 |
850 ^ rowSelectorForm |
784 ^ rowSelectorForm |
851 ! ! |
785 ! ! |
852 |
786 |
853 !DSVColumnView methodsFor:'accessing-mvc'! |
787 !DSVColumnView methodsFor:'accessing-mvc'! |
854 |
788 |
855 columnAdaptor |
789 columnAdaptor |
856 "return the value of the instance variable 'columnAdaptor' (automatically generated)" |
790 "return the value of the instance variable 'columnAdaptor' (automatically generated)" |
857 |
791 |
858 columnAdaptor isValueModel ifTrue:[^ columnAdaptor value]. |
792 columnAdaptor isValueModel ifTrue:[ |
859 ^ columnAdaptor |
793 ^ columnAdaptor value |
|
794 ]. |
|
795 ^ columnAdaptor |
860 ! |
796 ! |
861 |
797 |
862 columnAdaptor:something |
798 columnAdaptor:something |
863 "set the value of the instance variable 'columnAdaptor' (automatically generated)" |
799 "set the value of the instance variable 'columnAdaptor' (automatically generated)" |
864 |
800 |
869 columnAdaptor addDependent:self |
805 columnAdaptor addDependent:self |
870 ]. |
806 ]. |
871 ! |
807 ! |
872 |
808 |
873 columnHolder |
809 columnHolder |
874 "get the valueHolder, which keeps the list of column descriptions |
810 "get the valueHolder, which keeps the list of column descriptions" |
875 " |
811 |
876 ^ columnHolder |
812 ^ columnHolder |
877 |
813 ! |
878 ! |
814 |
879 |
815 columnHolder:aValueHolder |
880 columnHolder:aValueHolder |
816 "set the valueHolder, which keeps the list of column descriptions" |
881 "set the valueHolder, which keeps the list of column descriptions |
817 |
882 " |
|
883 |columns| |
818 |columns| |
884 |
819 |
885 columnHolder notNil ifTrue:[ |
820 columnHolder notNil ifTrue:[ |
886 columnHolder removeDependent:self |
821 columnHolder removeDependent:self |
887 ]. |
822 ]. |
888 |
|
889 (columnHolder := aValueHolder) notNil ifTrue:[ |
823 (columnHolder := aValueHolder) notNil ifTrue:[ |
890 columnHolder addDependent:self. |
824 columnHolder addDependent:self. |
891 columns := columnHolder value. |
825 columns := columnHolder value. |
892 |
|
893 columns notNil ifTrue:[ |
826 columns notNil ifTrue:[ |
894 self columnDescriptors:columns |
827 self columnDescriptors:columns |
895 ] |
828 ] |
896 ]. |
829 ]. |
897 |
830 ! |
898 ! |
831 |
899 |
832 listAt:index put:newElement |
900 listAt:index put:newElement |
|
901 "kludge callback, when an element hs to be replaced |
833 "kludge callback, when an element hs to be replaced |
902 due to a col-adaptor returning a new row element |
834 due to a col-adaptor returning a new row element" |
903 " |
835 |
904 |list| |
836 |list| |
905 |
837 |
906 (list := listHolder value) notNil ifTrue:[ |
838 (list := listHolder value) notNil ifTrue:[ |
907 list at:index put:newElement |
839 list at:index put:newElement |
908 ] |
840 ] |
909 ! |
841 ! |
910 |
842 |
911 listHolder |
843 listHolder |
912 "get the valueHolder which holds the list of rows |
844 "get the valueHolder which holds the list of rows" |
913 " |
845 |
914 ^ listHolder |
846 ^ listHolder |
915 ! |
847 ! |
916 |
848 |
917 listHolder:aListHolder |
849 listHolder:aListHolder |
918 "set the valueHolder which holds the list of rows |
850 "set the valueHolder which holds the list of rows" |
919 " |
851 |
920 listHolder ~~ aListHolder ifTrue:[ |
852 listHolder ~~ aListHolder ifTrue:[ |
921 listHolder notNil ifTrue:[ |
853 listHolder notNil ifTrue:[ |
922 listHolder removeDependent:self |
854 listHolder removeDependent:self |
923 ]. |
855 ]. |
924 |
|
925 (listHolder := aListHolder) notNil ifTrue:[ |
856 (listHolder := aListHolder) notNil ifTrue:[ |
926 listHolder addDependent:self |
857 listHolder addDependent:self |
927 ] |
858 ] |
928 ]. |
859 ]. |
929 self pushEvent:#list: with:(listHolder value). |
860 self pushEvent:#list: with:(listHolder value). |
930 |
861 ! |
931 ! |
862 |
932 |
863 model:aModel |
933 model:aModel |
864 "set the valueHolder which holds the selection and maybe the list of rows" |
934 "set the valueHolder which holds the selection and maybe the list of rows |
865 |
935 " |
|
936 model notNil ifTrue:[ |
866 model notNil ifTrue:[ |
937 model removeDependent:self. |
867 model removeDependent:self. |
938 (model respondsTo:#list) ifTrue:[ |
868 (model respondsTo:#list) ifTrue:[ |
939 (model list == listHolder) ifTrue:[ |
869 (model list == listHolder) ifTrue:[ |
940 self listHolder:nil |
870 self listHolder:nil |
941 ] |
871 ] |
942 ] |
872 ] |
943 ]. |
873 ]. |
944 |
|
945 (model := aModel) notNil ifTrue:[ |
874 (model := aModel) notNil ifTrue:[ |
946 model addDependent:self. |
875 model addDependent:self. |
947 |
|
948 (aModel respondsTo:#list) ifTrue:[ |
876 (aModel respondsTo:#list) ifTrue:[ |
949 self listHolder:model list |
877 self listHolder:model list |
950 ] |
878 ] |
951 ] |
879 ] |
952 |
|
953 ! ! |
880 ! ! |
954 |
881 |
955 !DSVColumnView methodsFor:'accessing-rows'! |
882 !DSVColumnView methodsFor:'accessing-rows'! |
956 |
883 |
957 at:aRowNr |
884 at:aRowNr |
958 "return the row at an index, aRowNr |
885 "return the row at an index, aRowNr" |
959 " |
886 |
960 |row| |
887 |row| |
961 |
888 |
962 (row := list at:aRowNr) isNil ifTrue:[ |
889 (row := list at:aRowNr) isNil ifTrue:[ |
963 lockRowIndex := aRowNr. |
890 lockRowIndex := aRowNr. |
964 |
891 |
973 ^ row |
900 ^ row |
974 |
901 |
975 "Modified: / 31.7.1998 / 01:07:46 / cg" |
902 "Modified: / 31.7.1998 / 01:07:46 / cg" |
976 ! |
903 ! |
977 |
904 |
978 at:aRowNr ifAbsent:exceptionBlock |
905 at:aRowNr ifAbsent:exceptionBlock |
979 "return the row at a aRowNr. If the index is invalid, return the |
906 "return the row at a aRowNr. If the index is invalid, return the |
980 result of evaluating the exceptionblock |
907 result of evaluating the exceptionblock" |
981 " |
908 |
982 (aRowNr between:1 and:list size) ifTrue:[ |
909 (aRowNr between:1 and:list size) ifTrue:[ |
983 ^ self at:aRowNr |
910 ^ self at:aRowNr |
984 ]. |
911 ]. |
985 ^ exceptionBlock value |
912 ^ exceptionBlock value |
986 ! |
913 ! |
987 |
914 |
988 at:aRowNr put:aRow |
915 at:aRowNr put:aRow |
989 "change the row at an index. The added row is returned |
916 "change the row at an index. The added row is returned" |
990 " |
917 |
991 lockRowIndex ~~ aRowNr ifTrue:[ |
918 lockRowIndex ~~ aRowNr ifTrue:[ |
992 (aRowNr <= list size and:[(list at:aRowNr) == aRow]) ifTrue:[ |
919 (aRowNr <= list size and:[ (list at:aRowNr) == aRow ]) ifTrue:[ |
993 self invalidateRowAt:aRowNr |
920 self invalidateRowAt:aRowNr |
994 ] ifFalse:[ |
921 ] ifFalse:[ |
995 self replaceFrom:aRowNr to:aRowNr with:(Array with:aRow) startingAt:1. |
922 self |
996 ] |
923 replaceFrom:aRowNr |
997 ]. |
924 to:aRowNr |
998 ^ aRow |
925 with:(Array with:aRow) |
|
926 startingAt:1. |
|
927 ] |
|
928 ]. |
|
929 ^ aRow |
999 ! |
930 ! |
1000 |
931 |
1001 first |
932 first |
1002 "return the first row |
933 "return the first row" |
1003 " |
934 |
1004 ^ self at:1 |
935 ^ self at:1 |
1005 ! |
936 ! |
1006 |
937 |
1007 identityIndexOfRow:aRow |
938 identityIndexOfRow:aRow |
1008 "returns index of a row or 0 |
939 "returns index of a row or 0" |
1009 " |
940 |
1010 (list size ~~ 0 and:[aRow notNil]) ifTrue:[ |
941 (list size ~~ 0 and:[ aRow notNil ]) ifTrue:[ |
1011 ^ list identityIndexOf:aRow |
942 ^ list identityIndexOf:aRow |
1012 ]. |
943 ]. |
1013 ^ 0 |
944 ^ 0 |
1014 ! |
945 ! |
1015 |
946 |
1016 last |
947 last |
1017 "return the last row |
948 "return the last row" |
1018 " |
949 |
1019 ^ self at:(list size) |
950 ^ self at:(list size) |
1020 ! |
951 ! |
1021 |
952 |
1022 list |
953 list |
1023 "get the list of rows |
954 "get the list of rows" |
1024 " |
955 |
1025 ^ list |
956 ^ list |
1026 |
|
1027 |
|
1028 |
|
1029 ! |
957 ! |
1030 |
958 |
1031 list:aList |
959 list:aList |
1032 "set the list of rows |
960 "set the list of rows" |
1033 " |
961 |
1034 |makeDependent selectionHasChanged| |
962 |makeDependent selectionHasChanged| |
1035 |
963 |
1036 "/ remove selection without redraw |
964 "/ remove selection without redraw |
1037 |
965 |
1038 selectionHasChanged := self hasSelection. |
966 selectionHasChanged := self hasSelection. |
1095 ]. |
1025 ]. |
1096 ] |
1026 ] |
1097 ! |
1027 ! |
1098 |
1028 |
1099 has3Dseparators |
1029 has3Dseparators |
1100 "returns true if shown in 3D mode |
1030 "returns true if shown in 3D mode" |
1101 " |
1031 |
1102 ^ separatorSize ~~ 1 |
1032 ^ separatorSize ~~ 1 |
1103 ! |
1033 ! |
1104 |
1034 |
1105 has3Dseparators:aBool |
1035 has3Dseparators:aBool |
1106 "enable or disable 3D mode |
1036 "enable or disable 3D mode" |
1107 " |
1037 |
1108 |newSepSize| |
1038 |newSepSize| |
1109 |
1039 |
1110 newSepSize := aBool ifTrue:[2] ifFalse:[1]. |
1040 newSepSize := aBool ifTrue:2 ifFalse:1. |
1111 |
|
1112 newSepSize ~~ separatorSize ifTrue:[ |
1041 newSepSize ~~ separatorSize ifTrue:[ |
1113 separatorSize := newSepSize. |
1042 separatorSize := newSepSize. |
1114 |
|
1115 realized ifTrue:[ |
1043 realized ifTrue:[ |
1116 columnDescriptors do:[:aCol| aCol invalidate ]. |
1044 columnDescriptors do:[:aCol | |
|
1045 aCol invalidate |
|
1046 ]. |
1117 self preferredExtentChanged. |
1047 self preferredExtentChanged. |
1118 self invalidate. |
1048 self invalidate. |
1119 self contentsChanged |
1049 self contentsChanged |
1120 ] |
1050 ] |
1121 ] |
1051 ] |
1122 |
|
1123 |
|
1124 ! |
1052 ! |
1125 |
1053 |
1126 horizontalSpacing |
1054 horizontalSpacing |
1127 "horizontal spacing used by columns |
1055 "horizontal spacing used by columns" |
1128 " |
1056 |
1129 ^ horizontalSpacing |
1057 ^ horizontalSpacing |
1130 ! |
1058 ! |
1131 |
1059 |
1132 horizontalSpacing:aNumber |
1060 horizontalSpacing:aNumber |
1133 "horizontal spacing used by columns |
1061 "horizontal spacing used by columns" |
1134 " |
1062 |
1135 horizontalSpacing ~~ aNumber ifTrue:[ |
1063 horizontalSpacing ~~ aNumber ifTrue:[ |
1136 horizontalSpacing := aNumber. |
1064 horizontalSpacing := aNumber. |
1137 self preferredExtentChanged. |
1065 self preferredExtentChanged. |
1138 ]. |
1066 ]. |
1139 ! |
1067 ! |
1140 |
1068 |
1141 showLabels |
1069 showLabels |
1142 "control the labels view to be visible or unvisible |
1070 "control the labels view to be visible or unvisible" |
1143 " |
1071 |
1144 ^ labelView isVisible |
1072 ^ labelView isVisible |
1145 |
1073 ! |
1146 ! |
1074 |
1147 |
1075 showLabels:aState |
1148 showLabels:aState |
1076 "control the labels view to be visible or unvisible" |
1149 "control the labels view to be visible or unvisible |
1077 |
1150 " |
|
1151 labelView isVisible:aState |
1078 labelView isVisible:aState |
1152 ! |
1079 ! |
1153 |
1080 |
1154 verticalSpacing |
1081 verticalSpacing |
1155 "vertical spacing used by columns |
1082 "vertical spacing used by columns" |
1156 " |
1083 |
1157 ^ verticalSpacing |
1084 ^ verticalSpacing |
1158 ! |
1085 ! |
1159 |
1086 |
1160 verticalSpacing:aNumber |
1087 verticalSpacing:aNumber |
1161 "vertical spacing used by columns |
1088 "vertical spacing used by columns" |
1162 " |
1089 |
1163 verticalSpacing ~~ aNumber ifTrue:[ |
1090 verticalSpacing ~~ aNumber ifTrue:[ |
1164 verticalSpacing := aNumber. |
1091 verticalSpacing := aNumber. |
1165 self preferredExtentChanged. |
1092 self preferredExtentChanged. |
1166 ]. |
1093 ]. |
1167 ! ! |
1094 ! ! |
1168 |
1095 |
1169 !DSVColumnView methodsFor:'adding & removing rows'! |
1096 !DSVColumnView methodsFor:'adding & removing rows'! |
1170 |
1097 |
1171 add:aRow |
1098 add:aRow |
1172 "insert row at end |
1099 "insert row at end" |
1173 " |
1100 |
1174 ^ self add:aRow beforeIndex:(1 + list size) |
1101 ^ self add:aRow beforeIndex:(1 + list size) |
1175 ! |
1102 ! |
1176 |
1103 |
1177 add:aRow afterIndex:aRowNr |
1104 add:aRow afterIndex:aRowNr |
1178 "add a new row after slot aRowNr and redisplay; returns nil in case |
1105 "add a new row after slot aRowNr and redisplay; returns nil in case |
1179 of an invalid index or the row |
1106 of an invalid index or the row" |
1180 " |
1107 |
1181 ^ self add:aRow beforeIndex:(aRowNr + 1) |
1108 ^ self add:aRow beforeIndex:(aRowNr + 1) |
1182 ! |
1109 ! |
1183 |
1110 |
1184 add:aRow beforeIndex:aRowNr |
1111 add:aRow beforeIndex:aRowNr |
1185 "add a new row before slot aRowNr and redisplay; returns nil in case |
1112 "add a new row before slot aRowNr and redisplay; returns nil in case |
1186 of an invalid index or the row |
1113 of an invalid index or the row" |
1187 " |
1114 |
1188 self addAll:(Array with:aRow) beforeIndex:aRowNr. |
1115 self addAll:(Array with:aRow) beforeIndex:aRowNr. |
1189 ^ aRow. |
1116 ^ aRow. |
1190 ! |
1117 ! |
1191 |
1118 |
1192 addAll:aList beforeIndex:start |
1119 addAll:aList beforeIndex:start |
1193 "add a collection of rows before slot start and redisplay |
1120 "add a collection of rows before slot start and redisplay" |
1194 " |
1121 |
1195 |y0 y1 yD h dH size noSel| |
1122 |y0 y1 yD h dH size noSel| |
1196 |
1123 |
1197 (size := aList size) == 0 ifTrue:[ |
1124 (size := aList size) == 0 ifTrue:[ |
1198 ^ self |
1125 ^ self |
1199 ]. |
1126 ]. |
1405 self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
1331 self invalidateX:margin y:y0 width:width - margin - margin height:(height - y0). |
1406 ]. |
1332 ]. |
1407 self contentsChanged. |
1333 self contentsChanged. |
1408 ! |
1334 ! |
1409 |
1335 |
1410 removeIndex:aRowNr |
1336 removeIndex:aRowNr |
1411 "remove row at an index; returns the removed row |
1337 "remove row at an index; returns the removed row" |
1412 " |
1338 |
1413 |row| |
1339 |row| |
1414 |
1340 |
1415 row := list at:aRowNr ifAbsent:nil. |
1341 row := list at:aRowNr ifAbsent:nil. |
1416 self removeFrom:aRowNr to:aRowNr. |
1342 self removeFrom:aRowNr to:aRowNr. |
1417 ^ row |
1343 ^ row |
1418 ! |
1344 ! |
1419 |
1345 |
1420 removeLast |
1346 removeLast |
1421 "remove last row; the row is returned |
1347 "remove last row; the row is returned" |
1422 " |
1348 |
1423 ^ self removeIndex:(list size) |
1349 ^ self removeIndex:(list size) |
1424 ! |
1350 ! |
1425 |
1351 |
1426 replaceFrom:start to:stop with:aCollection startingAt:repStart |
1352 replaceFrom:start to:stop with:aCollection startingAt:repStart |
1427 "replace elements in the receiver between index start and stop, |
1353 "replace elements in the receiver between index start and stop, |
1428 with elements taken from replacementCollection starting at repStart. |
1354 with elements taken from replacementCollection starting at repStart. |
1429 Return the receiver. |
1355 Return the receiver." |
1430 " |
1356 |
1431 |inSelList listSize repStop run| |
1357 |inSelList listSize repStop run| |
1432 |
1358 |
1433 inSelList := OrderedCollection new. |
1359 inSelList := OrderedCollection new. |
1434 listSize := list size. |
1360 listSize := list size. |
1435 repStop := repStart + (stop - start). |
1361 repStop := repStart + (stop - start). |
1482 |
1408 |
1483 aColumn setDescWidth:(aColumn width + aDeltaX). |
1409 aColumn setDescWidth:(aColumn width + aDeltaX). |
1484 preferredExtent notNil ifTrue:[self fitColumns] |
1410 preferredExtent notNil ifTrue:[self fitColumns] |
1485 ! |
1411 ! |
1486 |
1412 |
1487 update:what with:aPara from:chgObj |
1413 update:what with:aPara from:chgObj |
1488 "one of my rows/cells changed its value |
1414 "one of my rows/cells changed its value" |
1489 " |
1415 |
1490 |row listHoldersList arg1 arg2 col| |
1416 |row listHoldersList arg1 arg2 col| |
1491 |
1417 |
1492 chgObj == columnHolder ifTrue:[ |
1418 chgObj == columnHolder ifTrue:[ |
1493 ^ self columnDescriptors:(columnHolder value) |
1419 ^ self columnDescriptors:(columnHolder value) |
1494 ]. |
1420 ]. |
1495 |
|
1496 chgObj == columnAdaptor ifTrue:[ |
1421 chgObj == columnAdaptor ifTrue:[ |
1497 col := columnAdaptor value. |
1422 col := columnAdaptor value. |
1498 columnDescriptors do:[:aCol| aCol columnAdaptor:col]. |
1423 columnDescriptors do:[:aCol | |
1499 ^ self invalidate |
1424 aCol columnAdaptor:col |
1500 ]. |
1425 ]. |
1501 |
1426 ^ self invalidate |
|
1427 ]. |
1502 chgObj == editValue ifTrue:[ |
1428 chgObj == editValue ifTrue:[ |
1503 self updateColumnFromEditValue. |
1429 self updateColumnFromEditValue. |
1504 ^ self |
1430 ^ self |
1505 ]. |
1431 ]. |
1506 |
|
1507 chgObj == model ifTrue:[ |
1432 chgObj == model ifTrue:[ |
1508 (what == #selectionIndex or:[what == #selection]) ifTrue:[ |
1433 (what == #selectionIndex or:[ what == #selection ]) ifTrue:[ |
1509 ^ self selectRowIndex:(model selectionIndex copy) |
1434 ^ self selectRowIndex:(model selectionIndex copy) |
1510 ]. |
1435 ]. |
1511 what == #list ifTrue:[ |
1436 what == #list ifTrue:[ |
1512 ^ self listHolder:model list |
1437 ^ self listHolder:model list |
1513 ]. |
1438 ]. |
1518 self selectRowIndex:model value |
1443 self selectRowIndex:model value |
1519 ] |
1444 ] |
1520 ]. |
1445 ]. |
1521 ^ self |
1446 ^ self |
1522 ]. |
1447 ]. |
1523 |
|
1524 chgObj == listHolder ifTrue:[ |
1448 chgObj == listHolder ifTrue:[ |
1525 listHoldersList := listHolder value. |
1449 listHoldersList := listHolder value. |
1526 |
|
1527 what == #value ifTrue:[ |
1450 what == #value ifTrue:[ |
1528 ^ self list:listHoldersList |
1451 ^ self list:listHoldersList |
1529 ]. |
1452 ]. |
1530 aPara isCollection ifTrue:[ |
1453 aPara isCollection ifTrue:[ |
1531 arg1 := aPara at:1. |
1454 arg1 := aPara at:1. |
1532 arg2 := aPara at:2. |
1455 arg2 := aPara at:2. |
1533 ] ifFalse:[ |
1456 ] ifFalse:[ |
1534 arg1 := arg2 := aPara |
1457 arg1 := arg2 := aPara |
1535 ]. |
1458 ]. |
1536 |
|
1537 what == #at: ifTrue:[ |
1459 what == #at: ifTrue:[ |
1538 ^ self at:arg1 put:(listHoldersList at:arg1) |
1460 ^ self at:arg1 put:(listHoldersList at:arg1) |
1539 ]. |
1461 ]. |
1540 |
|
1541 what == #insert: ifTrue:[ |
1462 what == #insert: ifTrue:[ |
1542 ^ self add:(listHoldersList at:arg1) beforeIndex:arg1 |
1463 ^ self add:(listHoldersList at:arg1) beforeIndex:arg1 |
1543 ]. |
1464 ]. |
1544 |
|
1545 what == #remove: ifTrue:[ |
1465 what == #remove: ifTrue:[ |
1546 ^ self removeFrom:arg1 to:arg1 |
1466 ^ self removeFrom:arg1 to:arg1 |
1547 ]. |
1467 ]. |
1548 what == #removeFrom: ifTrue:[ |
1468 what == #removeFrom: ifTrue:[ |
1549 listHoldersList size == 0 ifTrue:[self list:nil] |
1469 listHoldersList size == 0 ifTrue:[ |
1550 ifFalse:[self removeFrom:arg1 to:arg2]. |
1470 self list:nil |
|
1471 ] ifFalse:[ |
|
1472 self removeFrom:arg1 to:arg2 |
|
1473 ]. |
1551 ^ self |
1474 ^ self |
1552 ]. |
1475 ]. |
1553 |
|
1554 what == #insertCollection: ifTrue:[ |
1476 what == #insertCollection: ifTrue:[ |
1555 arg2 ~~ 0 ifTrue:[ |
1477 arg2 ~~ 0 ifTrue:[ |
1556 self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1)) beforeIndex:arg1 |
1478 self addAll:(listHoldersList copyFrom:arg1 to:(arg1 + arg2 - 1)) |
|
1479 beforeIndex:arg1 |
1557 ]. |
1480 ]. |
1558 ^ self. |
1481 ^ self. |
1559 ]. |
1482 ]. |
1560 what == #replace: ifTrue:[ |
1483 what == #replace: ifTrue:[ |
1561 self replaceFrom:arg1 to:arg2 with:listHoldersList startingAt:arg1. |
1484 self |
|
1485 replaceFrom:arg1 |
|
1486 to:arg2 |
|
1487 with:listHoldersList |
|
1488 startingAt:arg1. |
1562 ^ self |
1489 ^ self |
1563 ]. |
1490 ]. |
1564 self list:listHoldersList. |
1491 self list:listHoldersList. |
1565 ^ self |
1492 ^ self |
1566 ]. |
1493 ]. |
1567 arg1 := aPara ? what. |
1494 arg1 := aPara ? what. |
1568 row := (what isNumber) ifTrue:[what] ifFalse:[chgObj]. |
1495 row := (what isNumber) ifTrue:[ |
|
1496 what |
|
1497 ] ifFalse:[ chgObj ]. |
1569 self invalidateVisibleRow:row readSelector:arg1. |
1498 self invalidateVisibleRow:row readSelector:arg1. |
1570 |
|
1571 editView notNil ifTrue:[ |
1499 editView notNil ifTrue:[ |
1572 (self isInSelection:(self identityIndexOfRow:row)) ifTrue:[ |
1500 (self isInSelection:(self identityIndexOfRow:row)) ifTrue:[ |
1573 self updateEditorFromChangedRow |
1501 self updateEditorFromChangedRow |
1574 ] |
1502 ] |
1575 ]. |
1503 ]. |
1605 modifiedChannel value:true. |
1533 modifiedChannel value:true. |
1606 ]. |
1534 ]. |
1607 ! |
1535 ! |
1608 |
1536 |
1609 updateEditorFromChangedRow |
1537 updateEditorFromChangedRow |
1610 "/ self reopenEditor |
|
1611 |
|
1612 |rowsValue rowNr| |
1538 |rowsValue rowNr| |
1613 |
1539 |
1614 (rowNr := selectedRowIndex) isNumber ifFalse:[ |
1540 (rowNr := selectedRowIndex) isNumber ifFalse:[ |
1615 rowNr := rowNr first. |
1541 rowNr := rowNr first. |
1616 ]. |
1542 ]. |
1617 |
|
1618 rowsValue := (self columnAt:selectedColIndex) at:rowNr. |
1543 rowsValue := (self columnAt:selectedColIndex) at:rowNr. |
1619 |
1544 (editValue notNil and:[ editValue value ~= rowsValue ]) ifTrue:[ |
1620 (editValue notNil and:[editValue value ~= rowsValue]) ifTrue:[ |
1545 editValue value:rowsValue withoutNotifying:self. |
1621 editValue value:rowsValue withoutNotifying:self. |
1546 editView |
1622 editView withAllSubViewsDo:[:v | |
1547 withAllSubViewsDo:[:v | |
1623 v isInputField ifTrue:[ |
1548 v isInputField ifTrue:[ |
1624 v flash. |
1549 v flash. |
|
1550 ] |
1625 ] |
1551 ] |
1626 ] |
|
1627 ]. |
1552 ]. |
1628 ! ! |
1553 ! ! |
1629 |
1554 |
1630 !DSVColumnView methodsFor:'drag & drop'! |
1555 !DSVColumnView methodsFor:'drag & drop'! |
1631 |
1556 |
1632 canDrag |
1557 canDrag |
1633 "returns true if dragging is enabled |
1558 "returns true if dragging is enabled" |
1634 " |
1559 |
1635 ^ dropSource notNil |
1560 ^ dropSource notNil |
1636 |
|
1637 ! |
1561 ! |
1638 |
1562 |
1639 dragAutoScroll:aContext |
1563 dragAutoScroll:aContext |
1640 "called by the DragAndDropManager to scroll during a drag/drop operation |
1564 "called by the DragAndDropManager to scroll during a drag/drop operation |
1641 if necassery (decided by the widget itself); If a scroll is done return |
1565 if necassery (decided by the widget itself); If a scroll is done return |
1642 true otherwise false (used to restore the background) |
1566 true otherwise false (used to restore the background)" |
1643 " |
1567 |
1644 |yInset absLnNr y| |
1568 |yInset absLnNr y| |
1645 |
1569 |
1646 y := aContext targetPoint y. |
1570 y := aContext targetPoint y. |
1647 yInset := margin + rowHeight. |
1571 yInset := margin + rowHeight. |
1648 y > yInset ifTrue:[ |
1572 y > yInset ifTrue:[ |
1702 ] |
1620 ] |
1703 ! ! |
1621 ! ! |
1704 |
1622 |
1705 !DSVColumnView methodsFor:'drawing'! |
1623 !DSVColumnView methodsFor:'drawing'! |
1706 |
1624 |
1707 colorOnDevice:aColor |
1625 colorOnDevice:aColor |
1708 "returns color on device |
1626 "returns color on device" |
1709 " |
1627 |
1710 |col| |
1628 |col| |
1711 |
1629 |
1712 aColor = Color noColor ifFalse:[ |
1630 aColor = Color noColor ifFalse:[ |
1713 col := colorMap at:aColor ifAbsent:nil. |
1631 col := colorMap at:aColor ifAbsent:nil. |
1714 |
|
1715 col isNil ifTrue:[ |
1632 col isNil ifTrue:[ |
1716 colorMap at:aColor put:(col := aColor onDevice:device) |
1633 colorMap at:aColor put:(col := aColor onDevice:device) |
1717 ]. |
1634 ]. |
1718 ^ col |
1635 ^ col |
1719 ]. |
1636 ]. |
1720 ^ bgColor |
1637 ^ bgColor |
1721 ! |
1638 ! |
1722 |
1639 |
1723 forceRedraw |
1640 forceRedraw |
1724 "a redraw forced by any other component |
1641 "a redraw forced by any other component" |
1725 " |
1642 |
1726 shown ifTrue:[ |
1643 shown ifTrue:[ |
1727 self invalidate |
1644 self invalidate |
1728 ] |
1645 ] |
1729 ! |
1646 ! |
1730 |
1647 |
1731 invalidate |
1648 invalidate |
1732 "recompute extent before repair range |
1649 "recompute extent before repair range" |
1733 " |
1650 |
1734 self recomputeHeightOfContents. |
1651 self recomputeHeightOfContents. |
1735 super invalidate. |
1652 super invalidate. |
1736 |
1653 ! |
1737 |
1654 |
1738 ! |
1655 invalidateRowAt:aRowNr |
1739 |
1656 "redraw total row at an index" |
1740 invalidateRowAt:aRowNr |
1657 |
1741 "redraw total row at an index |
|
1742 " |
|
1743 self invalidateRowAt:aRowNr colAt:0 |
1658 self invalidateRowAt:aRowNr colAt:0 |
1744 ! |
1659 ! |
1745 |
1660 |
1746 invalidateRowAt:aRowNr colAt:aColNr |
1661 invalidateRowAt:aRowNr colAt:aColNr |
1747 "redraw either a single column in a row, |
1662 "redraw either a single column in a row, |
1748 or the complete visible row (in case of aColNr == 0). |
1663 or the complete visible row (in case of aColNr == 0). |
1749 If the row/column is hidden, no redraw is done |
1664 If the row/column is hidden, no redraw is done" |
1750 " |
1665 |
1751 |x "{ Class:SmallInteger }" |
1666 |x "{ Class:SmallInteger }" |
1752 y "{ Class:SmallInteger }" |
1667 y "{ Class:SmallInteger }" |
1753 h "{ Class:SmallInteger }" |
1668 h "{ Class:SmallInteger }" |
1754 w "{ Class:SmallInteger }" |
1669 w "{ Class:SmallInteger }" |
1755 col| |
1670 col| |
2054 self paint:bgColor. |
1969 self paint:bgColor. |
2055 self fillRectangleX:x y:y width:w height:h. |
1970 self fillRectangleX:x y:y width:w height:h. |
2056 self drawEdgesAtX:x y:y width:w height:h level:comboButtonLevel on:self. |
1971 self drawEdgesAtX:x y:y width:w height:h level:comboButtonLevel on:self. |
2057 self paint:fgColor on:bgColor. |
1972 self paint:fgColor on:bgColor. |
2058 self displayForm:comboButtonForm x:(x + e x) y:(y + e y) |
1973 self displayForm:comboButtonForm x:(x + e x) y:(y + e y) |
2059 |
1974 ! |
2060 ! |
1975 |
2061 |
1976 drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC |
2062 drawEdgesAtX:x y:y width:w height:h level:aLevel on:aGC |
1977 "draw edges for a cell or label" |
2063 "draw edges for a cell or label |
1978 |
2064 " |
1979 aGC |
2065 aGC drawEdgesForX:x |
1980 drawEdgesForX:x |
2066 y:y |
1981 y:y |
2067 width:w |
1982 width:w |
2068 height:h |
1983 height:h |
2069 level:aLevel |
1984 level:aLevel |
2070 shadow:buttonShadowColor |
1985 shadow:buttonShadowColor |
2071 light:buttonLightColor |
1986 light:buttonLightColor |
2072 halfShadow:buttonHalfShadowColor |
1987 halfShadow:buttonHalfShadowColor |
2073 halfLight:buttonHalfLightColor |
1988 halfLight:buttonHalfLightColor |
2074 style:ButtonEdgeStyle. |
1989 style:ButtonEdgeStyle. |
2075 |
|
2076 ! ! |
1990 ! ! |
2077 |
1991 |
2078 !DSVColumnView methodsFor:'enumerating columns'! |
1992 !DSVColumnView methodsFor:'enumerating columns'! |
2079 |
1993 |
2080 columnsDo:aOneArgBlock |
1994 columnsDo:aOneArgBlock |
2081 "evaluate the argument, aOneArgBlock for every column |
1995 "evaluate the argument, aOneArgBlock for every column" |
2082 " |
1996 |
2083 columnDescriptors do:aOneArgBlock |
1997 columnDescriptors do:aOneArgBlock |
2084 |
1998 ! |
2085 |
1999 |
2086 ! |
2000 columnsFrom:start to:stop do:aOneArgBlock |
2087 |
|
2088 columnsFrom:start to:stop do:aOneArgBlock |
|
2089 "evaluate the argument, aOneArgBlock for the columns with index start to |
2001 "evaluate the argument, aOneArgBlock for the columns with index start to |
2090 stop in the collection of column descriptors |
2002 stop in the collection of column descriptors" |
2091 " |
2003 |
2092 columnDescriptors from:start to:stop do:aOneArgBlock |
2004 columnDescriptors |
2093 |
2005 from:start |
2094 |
2006 to:stop |
|
2007 do:aOneArgBlock |
2095 ! ! |
2008 ! ! |
2096 |
2009 |
2097 !DSVColumnView methodsFor:'event handling'! |
2010 !DSVColumnView methodsFor:'event handling'! |
2098 |
2011 |
2099 buttonControlPressAtRowNr:aStartRow |
2012 buttonControlPressAtRowNr:aStartRow |
2365 ]. |
2277 ]. |
2366 ^ nil |
2278 ^ nil |
2367 ! |
2279 ! |
2368 |
2280 |
2369 findMenuForSelection |
2281 findMenuForSelection |
2370 "find the middle button menu for the current selection; returns the menu or nil |
2282 "find the middle button menu for the current selection; returns the menu or nil" |
2371 " |
2283 |
2372 |col row menu| |
2284 |col row menu| |
2373 |
2285 |
2374 self numberOfSelections == 1 ifTrue:[ |
2286 self numberOfSelections == 1 ifTrue:[ |
2375 row := self at:(self firstIndexSelected). |
2287 row := self at:(self firstIndexSelected). |
2376 col := self selectedColumn. |
2288 col := self selectedColumn. |
2377 |
2289 (col notNil |
2378 (col notNil and:[(menu := col menuForRow:row orAdaptor:columnAdaptor) notNil]) ifTrue:[ |
2290 and:[ (menu := col menuForRow:row orAdaptor:columnAdaptor) notNil ]) |
2379 ^ menu |
2291 ifTrue:[ ^ menu ]. |
2380 ]. |
2292 col := columnDescriptors |
2381 col := columnDescriptors detect:[:c| c rendererType == #rowSelector] |
2293 detect:[:c | c rendererType == #rowSelector ] |
2382 ifNone:[nil]. |
2294 ifNone:[ nil ]. |
2383 |
|
2384 col notNil ifTrue:[ |
2295 col notNil ifTrue:[ |
2385 ^ col menuForRow:row inApplication:(self application) |
2296 ^ col menuForRow:row inApplication:(self application) |
2386 ] |
2297 ] |
2387 ]. |
2298 ]. |
2388 ^ nil |
2299 ^ nil |
2389 ! |
2300 ! |
2390 |
2301 |
2391 keyPress:aKey x:x y:y |
2302 keyPress:aKey x:x y:y |
2392 "a key was pressed - handle page-keys here |
2303 "a key was pressed - handle page-keys here" |
2393 " |
2304 |
2394 <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
2305 <resource: #keyboard (#PreviousPage #NextPage #HalfPageUp #HalfPageDown |
2395 #BeginOfText #EndOfText #ScrollUp #ScrollDown |
2306 #BeginOfText #EndOfText #ScrollUp #ScrollDown |
2396 #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)> |
2307 #CursorUp #CursorDown #CursorRight #CursorLeft #SelectAll)> |
2397 |
2308 |
2398 |maxColNr firstSelRowNr minSelRowNr maxSelRowNr selRowNr selColNr |
2309 |maxColNr firstSelRowNr minSelRowNr maxSelRowNr selRowNr selColNr |
2656 ^ false |
2567 ^ false |
2657 ! ! |
2568 ! ! |
2658 |
2569 |
2659 !DSVColumnView methodsFor:'gc operations'! |
2570 !DSVColumnView methodsFor:'gc operations'! |
2660 |
2571 |
2661 imageOnMyDevice:anImage |
2572 imageOnMyDevice:anImage |
2662 "associate image to device and clear pixel mask; returns the new image. |
2573 "associate image to device and clear pixel mask; returns the new image." |
2663 " |
2574 |
2664 |deviceImage| |
2575 |deviceImage| |
2665 |
2576 |
2666 anImage isNil ifTrue:[^ anImage]. |
2577 anImage isNil ifTrue:[ |
2667 |
2578 ^ anImage |
|
2579 ]. |
2668 deviceImage := anImage onDevice:device. |
2580 deviceImage := anImage onDevice:device. |
2669 deviceImage isImage ifTrue:[ |
2581 deviceImage isImage ifTrue:[ |
2670 deviceImage clearMaskedPixels. |
2582 deviceImage clearMaskedPixels. |
2671 ]. |
2583 ]. |
2672 ^ deviceImage |
2584 ^ deviceImage |
2673 "/ |image| |
2585 ! |
2674 "/ |
2586 |
2675 "/ (image := anImage) notNil ifTrue:[ |
2587 registerImage:anImage key:aKey |
2676 "/ image device ~~ device ifTrue:[ |
2588 "any row can register an image with a unique identifier a key symbol" |
2677 "/ image := image copy onDevice:device. |
2589 |
2678 "/ ]. |
|
2679 "/ image isImage ifTrue:[ |
|
2680 "/ image := image clearMaskedPixels |
|
2681 "/ ] |
|
2682 "/ ]. |
|
2683 "/ ^ image |
|
2684 ! |
|
2685 |
|
2686 registerImage:anImage key:aKey |
|
2687 "any row can register an image with a unique identifier a key symbol |
|
2688 " |
|
2689 |img| |
2590 |img| |
2690 |
2591 |
2691 (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
2592 (img := registererImages at:aKey ifAbsent:nil) notNil ifTrue:[ |
2692 ^ img |
2593 ^ img |
2693 ]. |
2594 ]. |
2694 img := self imageOnMyDevice:anImage. |
2595 img := self imageOnMyDevice:anImage. |
2695 registererImages at:aKey put:img. |
2596 registererImages at:aKey put:img. |
2696 ^ img |
2597 ^ img |
2697 ! |
2598 ! |
2698 |
2599 |
2699 registeredImageAt:aKey |
2600 registeredImageAt:aKey |
2700 "any row can register an image with a unique identifier |
2601 "any row can register an image with a unique identifier" |
2701 " |
2602 |
2702 ^ registererImages at:aKey ifAbsent:nil |
2603 ^ registererImages at:aKey ifAbsent:nil |
2703 ! |
2604 ! |
2704 |
2605 |
2705 releaseAllRegisteredImages |
2606 releaseAllRegisteredImages |
2706 "release all registered images |
2607 "release all registered images" |
2707 " |
2608 |
2708 registererImages := IdentityDictionary new. |
2609 registererImages := IdentityDictionary new. |
2709 ! ! |
2610 ! ! |
2710 |
2611 |
2711 !DSVColumnView methodsFor:'initialization & release'! |
2612 !DSVColumnView methodsFor:'initialization & release'! |
2712 |
2613 |
2713 create |
2614 create |
2714 "set color on device |
|
2715 " |
|
2716 super create. |
2615 super create. |
2717 |
2616 |
2718 fgColor := fgColor onDevice:device. |
2617 fgColor := fgColor onDevice:device. |
2719 bgColor := bgColor onDevice:device. |
2618 bgColor := bgColor onDevice:device. |
2720 selectionForegroundColor := selectionForegroundColor onDevice:device. |
2619 selectionForegroundColor := selectionForegroundColor onDevice:device. |
2826 catchChangeEvents := false. |
2725 catchChangeEvents := false. |
2827 rowFontAscent := 1. "/ dummy initialization |
2726 rowFontAscent := 1. "/ dummy initialization |
2828 separatorSize := 1. "/ separators mode 2D |
2727 separatorSize := 1. "/ separators mode 2D |
2829 selectRowOnDefault := true. |
2728 selectRowOnDefault := true. |
2830 autoScroll := true. |
2729 autoScroll := true. |
2831 ! |
2730 scrollRowWise := false. |
2832 |
|
2833 mapped |
|
2834 "set selection if exists after mapping |
|
2835 " |
|
2836 "/ |idx| |
|
2837 "/ |
|
2838 super mapped. |
|
2839 "/ needFitColumns == true ifTrue:[ |
|
2840 "/ self fitColumns |
|
2841 "/ ]. |
|
2842 "/ |
|
2843 "/ (idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
|
2844 "/ self scrollToRowAt:idx colAt:0. |
|
2845 "/ ]. |
|
2846 ! |
2731 ! |
2847 |
2732 |
2848 realize |
2733 realize |
2849 "recompute contents and fit columns to view |
2734 "recompute contents and fit columns to view" |
2850 " |
2735 |
2851 |selection| |
2736 |selection| |
2852 |
2737 |
2853 self bitGravity:#NorthWest. |
2738 self bitGravity:#NorthWest. |
2854 self recomputeHeightOfContents. |
2739 self recomputeHeightOfContents. |
2855 |
|
2856 selection := 0. |
2740 selection := 0. |
2857 |
|
2858 model notNil ifTrue:[ |
2741 model notNil ifTrue:[ |
2859 (model respondsTo:#selectionIndex) ifTrue:[ |
2742 (model respondsTo:#selectionIndex) ifTrue:[ |
2860 selection := model selectionIndex |
2743 selection := model selectionIndex |
2861 ] ifFalse:[ |
2744 ] ifFalse:[ |
2862 model == listHolder ifFalse:[ |
2745 model == listHolder ifFalse:[ |
2863 selection := model value |
2746 selection := model value |
2864 ] |
2747 ] |
2865 ] |
2748 ] |
2866 ]. |
2749 ]. |
2867 self selectRowIndex:selection. |
2750 self selectRowIndex:selection. |
2868 |
|
2869 super realize. |
2751 super realize. |
2870 self fitColumns. |
2752 self fitColumns. |
2871 ! |
2753 ! |
2872 |
2754 |
2873 realized |
2755 realized |
2874 "set selection if exists after mapping |
2756 "set selection if exists after mapping" |
2875 " |
2757 |
2876 |idx| |
2758 |idx| |
2877 |
2759 |
2878 super realized. |
2760 super realized. |
2879 |
|
2880 needFitColumns == true ifTrue:[ |
2761 needFitColumns == true ifTrue:[ |
2881 self fitColumns |
2762 self fitColumns |
2882 ]. |
2763 ]. |
2883 |
|
2884 (idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
2764 (idx := self firstIndexSelected) ~~ 0 ifTrue:[ |
2885 self scrollToRowAt:idx colAt:0. |
2765 self scrollToRowAt:idx colAt:0. |
2886 ]. |
2766 ]. |
2887 ! |
2767 ! |
2888 |
2768 |
2889 release |
2769 release |
2890 "remove dependencies |
2770 "remove dependencies" |
2891 " |
2771 |
2892 self columnHolder:nil. |
2772 self columnHolder:nil. |
2893 |
2773 listHolder removeDependent:self. |
2894 listHolder removeDependent:self. |
|
2895 |
|
2896 columnAdaptor isValueModel ifTrue:[ |
2774 columnAdaptor isValueModel ifTrue:[ |
2897 columnAdaptor removeDependent:self |
2775 columnAdaptor removeDependent:self |
2898 ]. |
2776 ]. |
2899 |
|
2900 self beDependentOfRows:false. |
2777 self beDependentOfRows:false. |
2901 super release |
2778 super release |
2902 ! ! |
2779 ! ! |
2903 |
2780 |
2904 !DSVColumnView methodsFor:'obsolete'! |
2781 !DSVColumnView methodsFor:'obsolete'! |
2905 |
2782 |
2906 has3Dsepartors |
2783 has3Dsepartors |
2907 "shouldn't be used any more |
2784 "shouldn't be used any more" |
2908 " |
2785 |
2909 ^ self has3Dseparators |
2786 ^ self has3Dseparators |
2910 ! |
2787 ! |
2911 |
2788 |
2912 has3Dsepartors:aBool |
2789 has3Dsepartors:aBool |
2913 "shouldn't be used any more |
2790 "shouldn't be used any more" |
2914 " |
2791 |
2915 self has3Dseparators:aBool |
2792 self has3Dseparators:aBool |
2916 |
|
2917 ! ! |
2793 ! ! |
2918 |
2794 |
2919 !DSVColumnView methodsFor:'private'! |
2795 !DSVColumnView methodsFor:'private'! |
2920 |
2796 |
2921 anyColumnHasBackground |
2797 anyColumnHasBackground |
2935 columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]]. |
2811 columnDescriptors do:[:eachCol | eachCol hasPotentialNonConstantBackground ifTrue:[^ true]]. |
2936 ^ false. |
2812 ^ false. |
2937 ! |
2813 ! |
2938 |
2814 |
2939 destroyEditView |
2815 destroyEditView |
2940 "destroy the edit view; release KeyboardForwarder |
2816 "destroy the edit view; release KeyboardForwarder" |
2941 " |
2817 |
2942 editValue notNil ifTrue:[ |
2818 editValue notNil ifTrue:[ |
2943 editValue removeDependent:self. |
2819 editValue removeDependent:self. |
2944 editValue := nil |
2820 editValue := nil |
2945 ]. |
2821 ]. |
2946 editView notNil ifTrue:[ |
2822 editView notNil ifTrue:[ |
2947 editView withAllSubViewsDo:[:aView| |
2823 editView withAllSubViewsDo:[:aView | aView delegate:nil ]. |
2948 aView delegate:nil |
|
2949 ]. |
|
2950 editView destroy. |
2824 editView destroy. |
2951 editView := nil. |
2825 editView := nil. |
2952 self windowGroup focusView:nil. |
2826 self windowGroup focusView:nil. |
2953 ]. |
2827 ]. |
2954 |
2828 ! |
2955 |
2829 |
2956 ! |
2830 detectViewAt:aPoint in:aView |
2957 |
2831 "returns the view at a point" |
2958 detectViewAt:aPoint in:aView |
2832 |
2959 "returns the view at a point |
2833 aView isNil ifTrue:[ |
2960 " |
2834 ^ nil |
2961 aView isNil ifTrue:[^ nil]. |
2835 ]. |
2962 ^ aView detectViewAt:aPoint. |
2836 ^ aView detectViewAt:aPoint. |
2963 |
|
2964 "/ cg: old code was (refactored to use common code) |
|
2965 "/ |
|
2966 "/ |p| |
|
2967 "/ |
|
2968 "/ (aView notNil and:[aView subViews notNil]) ifTrue:[ |
|
2969 "/ aView subViews do:[:sv| |
|
2970 "/ p := device translatePoint:aPoint fromView:self toView:sv. |
|
2971 "/ |
|
2972 "/ (p x >= 0 and:[p y >= 0 and:[p x <= sv width and:[p y <= sv height]]]) ifTrue:[ |
|
2973 "/ ^ self detectViewAt:aPoint in:sv |
|
2974 "/ ] |
|
2975 "/ ] |
|
2976 "/ ]. |
|
2977 "/ ^ aView |
|
2978 |
|
2979 "Modified: / 10.10.2001 / 13:53:24 / cg" |
|
2980 ! |
2837 ! |
2981 |
2838 |
2982 fitColumns |
2839 fitColumns |
2983 "fit columns to view; |
2840 "fit columns to view; " |
2984 " |
2841 |
2985 |selectedColumn list width changed dX sz oldOrgX newOrgX| |
2842 |selectedColumn list width changed dX sz oldOrgX newOrgX| |
2986 |
2843 |
2987 preferredExtent isNil ifTrue:[ |
2844 preferredExtent isNil ifTrue:[ |
2988 self preferredExtent. |
2845 self preferredExtent. |
2989 ]. |
2846 ]. |
3053 self contentsChanged. |
2910 self contentsChanged. |
3054 ]. |
2911 ]. |
3055 ! |
2912 ! |
3056 |
2913 |
3057 maxViewOriginY |
2914 maxViewOriginY |
3058 "returns the maximum possible y of the view origin |
2915 "returns the maximum possible y of the view origin" |
3059 " |
2916 |
3060 |y| |
2917 |y| |
3061 |
2918 |
3062 y := self heightOfContents - self innerHeight. |
2919 y := self heightOfContents - self innerHeight. |
3063 ^ y max:0 |
2920 ^ y max:0 |
3064 |
|
3065 ! |
2921 ! |
3066 |
2922 |
3067 updateEditViewOrigin |
2923 updateEditViewOrigin |
3068 "update origin of the editView |
2924 "update origin of the editView" |
3069 " |
2925 |
3070 |x y| |
2926 |x y| |
3071 |
2927 |
3072 editView notNil ifTrue:[ |
2928 editView notNil ifTrue:[ |
3073 y := self yVisibleOfRowNr:(self firstIndexSelected). |
2929 y := self yVisibleOfRowNr:(self firstIndexSelected). |
3074 x := self xVisibleOfColNr:selectedColIndex. |
2930 x := self xVisibleOfColNr:selectedColIndex. |
3075 |
|
3076 editView origin:(x @ y + separatorSize). |
2931 editView origin:(x @ y + separatorSize). |
3077 ]. |
2932 ]. |
3078 |
2933 ! |
3079 ! |
2934 |
3080 |
2935 xVisibleOfColNr:aColNr |
3081 xVisibleOfColNr:aColNr |
2936 "returns visible x assigned to a column number" |
3082 "returns visible x assigned to a column number |
2937 |
3083 " |
2938 |x |
3084 |x |
2939 end "{ Class:SmallInteger }"| |
3085 end "{ Class:SmallInteger }" |
2940 |
3086 | |
|
3087 x := margin - viewOrigin x. |
2941 x := margin - viewOrigin x. |
3088 |
|
3089 aColNr > 1 ifTrue:[ |
2942 aColNr > 1 ifTrue:[ |
3090 end := aColNr - 1. |
2943 end := aColNr - 1. |
3091 |
2944 columnDescriptors |
3092 columnDescriptors from:1 to:end do:[:aCol| |
2945 from:1 |
3093 x := x + aCol width |
2946 to:end |
3094 ] |
2947 do:[:aCol | x := x + aCol width ] |
3095 ]. |
2948 ]. |
3096 ^ x |
2949 ^ x |
3097 |
2950 ! |
3098 ! |
2951 |
3099 |
2952 xVisibleToColNr:x |
3100 xVisibleToColNr:x |
2953 "returns the column number assigned to a physical x or nil" |
3101 "returns the column number assigned to a physical x or nil |
2954 |
3102 " |
2955 |x0 |
3103 |x0 |
2956 nr "{ Class:SmallInteger }"| |
3104 nr "{ Class:SmallInteger }" |
|
3105 | |
|
3106 |
2957 |
3107 x0 := x + viewOrigin x - margin. |
2958 x0 := x + viewOrigin x - margin. |
3108 nr := 1. |
2959 nr := 1. |
3109 |
2960 columnDescriptors do:[:aCol | |
3110 columnDescriptors do:[:aCol| |
|
3111 x0 := x0 - aCol width. |
2961 x0 := x0 - aCol width. |
3112 x0 <= 0 ifTrue:[^ nr]. |
2962 x0 <= 0 ifTrue:[ ^ nr ]. |
3113 nr := nr + 1. |
2963 nr := nr + 1. |
3114 ]. |
2964 ]. |
3115 ^ nil. |
2965 ^ nil. |
3116 |
2966 ! |
3117 ! |
2967 |
3118 |
2968 yVisibleOfRowNr:aRowNr |
3119 yVisibleOfRowNr:aRowNr |
2969 "returns visible y assigned to the row number" |
3120 "returns visible y assigned to the row number |
2970 |
3121 " |
|
3122 ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
2971 ^ (aRowNr - 1) * rowHeight + margin - viewOrigin y |
3123 |
2972 ! |
3124 ! |
2973 |
3125 |
2974 yVisibleToRowNr:y |
3126 yVisibleToRowNr:y |
2975 "returns the row number assigned to a physical y or nil" |
3127 "returns the row number assigned to a physical y or nil |
2976 |
3128 " |
|
3129 |rowNr| |
2977 |rowNr| |
3130 |
2978 |
3131 rowNr := (y + viewOrigin y - margin) // rowHeight + 1. |
2979 rowNr := (y + viewOrigin y - margin) // rowHeight + 1. |
3132 |
|
3133 (rowNr between:1 and:(list size)) ifTrue:[ |
2980 (rowNr between:1 and:(list size)) ifTrue:[ |
3134 ^ rowNr |
2981 ^ rowNr |
3135 ]. |
2982 ]. |
3136 ^ nil |
2983 ^ nil |
3137 ! ! |
2984 ! ! |
3141 hasOpenEditor |
2988 hasOpenEditor |
3142 ^ editView notNil |
2989 ^ editView notNil |
3143 ! |
2990 ! |
3144 |
2991 |
3145 indexOfFirstRowShown |
2992 indexOfFirstRowShown |
3146 "returns index of first row shown |
2993 "returns index of first row shown" |
3147 " |
2994 |
3148 |idx| |
2995 |idx| |
3149 |
2996 |
3150 idx := (viewOrigin y // rowHeight) + 1. |
2997 idx := (viewOrigin y // rowHeight) + 1. |
3151 ^ (idx <= list size) ifTrue:[idx] ifFalse:[0] |
2998 ^ (idx <= list size) ifTrue:[ idx ] ifFalse:[ 0 ] |
3152 |
|
3153 ! |
2999 ! |
3154 |
3000 |
3155 isEnabled |
3001 isEnabled |
3156 ^ enableChannel value ~~ false |
3002 ^ enableChannel value ~~ false |
3157 ! |
3003 ! |
3158 |
3004 |
3159 isRowSelectable:aRowNumber |
3005 isRowSelectable:aRowNumber |
3160 "returne true if a row number is selectable |
3006 "returne true if a row number is selectable" |
3161 " |
3007 |
3162 (aRowNumber notNil and:[aRowNumber ~~ 0]) ifTrue:[ |
3008 (aRowNumber notNil and:[ aRowNumber ~~ 0 ]) ifTrue:[ |
3163 selectConditionBlock isNil ifTrue:[^ true]. |
3009 selectConditionBlock isNil ifTrue:[ |
|
3010 ^ true |
|
3011 ]. |
3164 ^ (selectConditionBlock value:aRowNumber) |
3012 ^ (selectConditionBlock value:aRowNumber) |
3165 ]. |
3013 ]. |
3166 ^ false |
3014 ^ false |
3167 ! |
3015 ! |
3168 |
3016 |
3169 numberOfColumns |
3017 numberOfColumns |
3170 "returns number of columns |
3018 "returns number of columns" |
3171 " |
3019 |
3172 ^ columnDescriptors size |
3020 ^ columnDescriptors size |
3173 |
|
3174 ! |
3021 ! |
3175 |
3022 |
3176 numberOfRows |
3023 numberOfRows |
3177 "returns number of raws |
3024 "returns number of raws" |
3178 " |
3025 |
3179 ^ list size |
3026 ^ list size |
3180 |
|
3181 ! |
3027 ! |
3182 |
3028 |
3183 rowHeight |
3029 rowHeight |
3184 "get the height of the highest row in pixels |
3030 "get the height of the highest row in pixels" |
3185 " |
3031 |
3186 ^ rowHeight |
3032 ^ rowHeight |
3187 |
|
3188 ! |
3033 ! |
3189 |
3034 |
3190 separatorSize |
3035 separatorSize |
3191 "returns vertical/horizontal size of a separator dependent on the |
3036 "returns vertical/horizontal size of a separator dependent on the |
3192 3D effect. |
3037 3D effect." |
3193 " |
3038 |
3194 ^ separatorSize |
3039 ^ separatorSize |
3195 |
|
3196 ! |
3040 ! |
3197 |
3041 |
3198 size |
3042 size |
3199 "returns number of raws |
3043 "returns number of raws" |
3200 " |
3044 |
3201 ^ list size |
3045 ^ list size |
3202 |
|
3203 ! ! |
3046 ! ! |
3204 |
3047 |
3205 !DSVColumnView methodsFor:'recomputation'! |
3048 !DSVColumnView methodsFor:'recomputation'! |
3206 |
3049 |
3207 hasPreferredExtent |
3050 hasPreferredExtent |
3208 "returns true if preferred extent is accumulated |
3051 "returns true if preferred extent is accumulated" |
3209 " |
3052 |
3210 ^ preferredExtent notNil |
3053 ^ preferredExtent notNil |
3211 ! |
3054 ! |
3212 |
3055 |
3213 preferredExtent |
3056 preferredExtent |
3214 "recompute preferred extent; raise notification |
3057 "recompute preferred extent; raise notification" |
3215 " |
3058 |
3216 |x| |
3059 |x| |
3217 |
3060 |
3218 preferredExtent notNil ifTrue:[ |
3061 preferredExtent notNil ifTrue:[ |
3219 ^ preferredExtent |
3062 ^ preferredExtent |
3220 ]. |
3063 ]. |
3221 x := 3. |
3064 x := 3. |
3222 |
3065 columnDescriptors do:[:aCol | |
3223 columnDescriptors do:[:aCol| |
|
3224 minRowHeight := (aCol heightOfHighestRow) max:minRowHeight. |
3066 minRowHeight := (aCol heightOfHighestRow) max:minRowHeight. |
3225 x := x + (aCol minWidth). |
3067 x := x + (aCol minWidth). |
3226 ]. |
3068 ]. |
3227 rowHeight := (minRowHeight + separatorSize + verticalSpacing + verticalSpacing + 1) // 2 * 2. |
3069 rowHeight := (minRowHeight + separatorSize + verticalSpacing |
|
3070 + verticalSpacing + 1) |
|
3071 // 2 * 2. |
3228 preferredExtent := x @ (list size * rowHeight). |
3072 preferredExtent := x @ (list size * rowHeight). |
3229 rowFontAscent := font ascent. |
3073 rowFontAscent := font ascent. |
3230 |
3074 ^ preferredExtent |
3231 ^ preferredExtent |
|
3232 ! |
3075 ! |
3233 |
3076 |
3234 preferredExtentChanged |
3077 preferredExtentChanged |
3235 "called if the preffered extent changed |
3078 "called if the preffered extent changed" |
3236 " |
3079 |
3237 |x "{ Class:SmallInteger }" |
3080 |x "{ Class:SmallInteger }" |
3238 y "{ Class:SmallInteger }" |
3081 y "{ Class:SmallInteger }"| |
3239 | |
3082 |
3240 y := viewOrigin y. |
3083 y := viewOrigin y. |
3241 x := viewOrigin x. |
3084 x := viewOrigin x. |
3242 |
3085 (y ~~ 0 or:[ x ~~ 0 ]) ifTrue:[ |
3243 (y ~~ 0 or:[x ~~ 0]) ifTrue:[ |
|
3244 self originWillChange. |
3086 self originWillChange. |
3245 |
|
3246 viewOrigin := 0 @ 0. |
3087 viewOrigin := 0 @ 0. |
3247 preferredExtent := nil. |
3088 preferredExtent := nil. |
3248 self originChanged:(x negated @ y negated). |
3089 self originChanged:(x negated @ y negated). |
3249 ] |
3090 ] |
3250 ! |
3091 ! |
3251 |
3092 |
3252 recomputeHeightOfContents |
3093 recomputeHeightOfContents |
3253 "recompute height of contents( scrolling ) |
3094 "recompute height of contents( scrolling )" |
3254 " |
3095 |
3255 preferredExtent notNil ifTrue:[ |
3096 preferredExtent notNil ifTrue:[ |
3256 preferredExtent y:(rowHeight * list size) |
3097 preferredExtent y:(rowHeight * list size) |
3257 ] ifFalse:[ |
3098 ] ifFalse:[ |
3258 self preferredExtent |
3099 self preferredExtent |
3259 ]. |
3100 ]. |
3260 ! ! |
3101 ! ! |
3261 |
3102 |
3262 !DSVColumnView methodsFor:'scroller interface'! |
3103 !DSVColumnView methodsFor:'scroller interface'! |
3263 |
3104 |
3264 heightOfContents |
3105 innerHeight |
3265 "return the height of the contents in pixels |
3106 "returns the inner height of the contents shown" |
3266 " |
3107 |
|
3108 ^ height - margin - margin |
|
3109 ! |
|
3110 |
|
3111 verticalScrollStep |
|
3112 "return the amount to scroll when stepping up/down." |
|
3113 |
|
3114 ^ rowHeight |
|
3115 ! |
|
3116 |
|
3117 viewOrigin |
|
3118 "return the viewOrigin; thats the coordinate of the contents |
|
3119 which is shown topLeft in the view." |
|
3120 |
|
3121 ^ viewOrigin |
|
3122 ! |
|
3123 |
|
3124 widthOfContents |
|
3125 "return the width of the contents in pixels" |
|
3126 |
3267 preferredExtent isNil ifTrue:[ |
3127 preferredExtent isNil ifTrue:[ |
3268 self preferredExtent |
3128 self preferredExtent |
3269 ]. |
3129 ]. |
3270 ^ preferredExtent y |
|
3271 ! |
|
3272 |
|
3273 innerHeight |
|
3274 "returns the inner height of the contents shown |
|
3275 " |
|
3276 ^ height - margin - margin |
|
3277 |
|
3278 ! |
|
3279 |
|
3280 verticalScrollStep |
|
3281 "return the amount to scroll when stepping up/down. |
|
3282 " |
|
3283 ^ rowHeight |
|
3284 |
|
3285 |
|
3286 |
|
3287 ! |
|
3288 |
|
3289 viewOrigin |
|
3290 "return the viewOrigin; thats the coordinate of the contents |
|
3291 which is shown topLeft in the view. |
|
3292 " |
|
3293 ^ viewOrigin |
|
3294 |
|
3295 ! |
|
3296 |
|
3297 widthOfContents |
|
3298 "return the width of the contents in pixels |
|
3299 " |
|
3300 preferredExtent isNil ifTrue:[ |
|
3301 self preferredExtent |
|
3302 ]. |
|
3303 ^ preferredExtent x |
3130 ^ preferredExtent x |
3304 |
|
3305 ! |
3131 ! |
3306 |
3132 |
3307 xOriginOfContents |
3133 xOriginOfContents |
3308 "return the horizontal origin of the contents in pixels |
3134 "return the horizontal origin of the contents in pixels" |
3309 " |
3135 |
3310 ^ viewOrigin x |
3136 ^ viewOrigin x |
3311 |
|
3312 ! |
3137 ! |
3313 |
3138 |
3314 yOriginOfContents |
3139 yOriginOfContents |
3315 "return the vertical origin of the contents in pixels |
3140 "return the vertical origin of the contents in pixels" |
3316 " |
3141 |
3317 ^ viewOrigin y |
3142 ^ viewOrigin y |
3318 |
|
3319 ! ! |
3143 ! ! |
3320 |
3144 |
3321 !DSVColumnView methodsFor:'scrolling'! |
3145 !DSVColumnView methodsFor:'scrolling'! |
3322 |
3146 |
3323 scrollTo:anOrigin redraw:doRedraw |
3147 scrollTo:anOrigin redraw:doRedraw |
3324 "change origin to have newOrigin be visible at the top-left. |
3148 "change origin to have newOrigin be visible at the top-left." |
3325 " |
3149 |
3326 |newOrg dltOrg wg |
3150 |newOrg dltOrg wg |
3327 h "{ Class:SmallInteger }" |
3151 h "{ Class:SmallInteger }" |
3328 w "{ Class:SmallInteger }" |
3152 w "{ Class:SmallInteger }" |
3329 x "{ Class:SmallInteger }" |
3153 x "{ Class:SmallInteger }" |
3330 x0 "{ Class:SmallInteger }" |
3154 x0 "{ Class:SmallInteger }" |
3480 ]. |
3304 ]. |
3481 |
3305 |
3482 (dX == 0 and:[dY == 0]) ifFalse:[ |
3306 (dX == 0 and:[dY == 0]) ifFalse:[ |
3483 self scrollTo:(viewOrigin - (dX @ dY)). |
3307 self scrollTo:(viewOrigin - (dX @ dY)). |
3484 ] |
3308 ] |
3485 |
|
3486 |
|
3487 ! |
3309 ! |
3488 |
3310 |
3489 scrollToSelection |
3311 scrollToSelection |
3490 "make selection visible |
3312 "make selection visible" |
3491 " |
3313 |
3492 |rowNr| |
3314 |rowNr| |
3493 |
3315 |
3494 (rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
3316 (rowNr := self firstIndexSelected) ~~ 0 ifTrue:[ |
3495 self scrollToRowAt:rowNr colAt:selectedColIndex |
3317 self scrollToRowAt:rowNr colAt:selectedColIndex |
3496 ] |
3318 ] |
3497 |
|
3498 ! |
3319 ! |
3499 |
3320 |
3500 scrollVerticalTo:aPixelOffset |
3321 scrollVerticalTo:aPixelOffset |
3501 "change origin to make aPixelOffset be the top line" |
3322 "change origin to make aPixelOffset be the top line" |
3502 |
3323 |
3503 |orgX orgY| |
3324 |orgX orgY| |
3504 |
3325 |
3505 orgX := viewOrigin x. |
3326 orgX := viewOrigin x. |
3506 orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight. |
3327 scrollRowWise ifTrue:[ |
3507 ^ self scrollTo:(orgX @ orgY). |
3328 orgY := (aPixelOffset + rowHeight - 1) // rowHeight * rowHeight. |
3508 |
3329 ] ifFalse:[ |
|
3330 orgY := aPixelOffset. |
|
3331 ]. |
|
3332 ^ self scrollTo:(orgX @ orgY). |
3509 ! |
3333 ! |
3510 |
3334 |
3511 startAutoScroll:aSelectorOrBlock distance:aDistance |
3335 startAutoScroll:aSelectorOrBlock distance:aDistance |
3512 "setup for auto-scroll (when button-press-moving below/above view); |
3336 "setup for auto-scroll (when button-press-moving below/above view); |
3513 - timeDelta for scroll is computed from distance |
3337 - timeDelta for scroll is computed from distance" |
3514 " |
3338 |
3515 |timeDelta scrollBlock| |
3339 |timeDelta scrollBlock| |
3516 |
3340 |
3517 autoScroll ifFalse:[ |
3341 autoScroll ifFalse:[ |
3518 self stopAutoScroll. |
3342 self stopAutoScroll. |
3519 ^ self |
3343 ^ self |
3740 ]. |
3557 ]. |
3741 self scrollToRowAt:rowNr colAt:colNr |
3558 self scrollToRowAt:rowNr colAt:colNr |
3742 ! |
3559 ! |
3743 |
3560 |
3744 maxIndexSelected |
3561 maxIndexSelected |
3745 "return the largest index selected or 0 |
3562 "return the largest index selected or 0" |
3746 " |
3563 |
3747 multipleSelectOk ifFalse:[ |
3564 multipleSelectOk ifFalse:[ |
3748 ^ selectedRowIndex |
3565 ^ selectedRowIndex |
3749 ]. |
3566 ]. |
3750 selectedRowIndex size ~~ 0 ifTrue:[ |
3567 selectedRowIndex size ~~ 0 ifTrue:[ |
3751 ^ selectedRowIndex max |
3568 ^ selectedRowIndex max |
3752 ]. |
3569 ]. |
3753 ^ 0 |
3570 ^ 0 |
3754 ! |
3571 ! |
3755 |
3572 |
3756 minIndexSelected |
3573 minIndexSelected |
3757 "return the smallest index selected or 0 |
3574 "return the smallest index selected or 0" |
3758 " |
3575 |
3759 multipleSelectOk ifFalse:[ |
3576 multipleSelectOk ifFalse:[ |
3760 ^ selectedRowIndex |
3577 ^ selectedRowIndex |
3761 ]. |
3578 ]. |
3762 selectedRowIndex size ~~ 0 ifTrue:[ |
3579 selectedRowIndex size ~~ 0 ifTrue:[ |
3763 ^ selectedRowIndex min |
3580 ^ selectedRowIndex min |
3764 ]. |
3581 ]. |
3765 ^ 0 |
3582 ^ 0 |
3766 ! |
3583 ! |
3767 |
3584 |
3768 numberOfSelections |
3585 numberOfSelections |
3769 "return the number of selected rows |
3586 "return the number of selected rows" |
3770 " |
3587 |
3771 multipleSelectOk ifFalse:[ |
3588 multipleSelectOk ifFalse:[ |
3772 ^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
3589 ^ selectedRowIndex ~~ 0 ifTrue:[1] ifFalse:[0] |
3773 ]. |
3590 ]. |
3774 ^ selectedRowIndex size |
3591 ^ selectedRowIndex size |
3775 ! |
3592 ! |
3776 |
3593 |
3777 removeRowFromSelection:aRowNr |
3594 removeRowFromSelection:aRowNr |
3778 "remove a row from the selection |
3595 "remove a row from the selection" |
3779 " |
3596 |
3780 (self isInSelection:aRowNr) ifFalse:[^ self]. |
3597 (self isInSelection:aRowNr) ifFalse:[^ self]. |
3781 |
3598 |
3782 self numberOfSelections == 1 ifTrue:[ |
3599 self numberOfSelections == 1 ifTrue:[ |
3783 self deselect. |
3600 self deselect. |
3784 ] ifFalse:[ |
3601 ] ifFalse:[ |
3865 |
3682 |
3866 self selectionChanged. |
3683 self selectionChanged. |
3867 ! |
3684 ! |
3868 |
3685 |
3869 selectRowIndex:something |
3686 selectRowIndex:something |
3870 "set selection of rows |
3687 "set selection of rows" |
3871 " |
3688 |
3872 self selectColIndex:selectedColIndex rowIndex:something |
3689 self selectColIndex:selectedColIndex rowIndex:something |
3873 |
|
3874 |
|
3875 ! |
3690 ! |
3876 |
3691 |
3877 selectedColIndex |
3692 selectedColIndex |
3878 "returns selected column number or 0 |
3693 "returns selected column number or 0" |
3879 " |
3694 |
3880 ^ selectedColIndex |
3695 ^ selectedColIndex |
3881 ! |
3696 ! |
3882 |
3697 |
3883 selectedColumn |
3698 selectedColumn |
3884 "returns selected column or nil |
3699 "returns selected column or nil" |
3885 " |
3700 |
3886 ^ columnDescriptors at:selectedColIndex ifAbsent:nil. |
3701 ^ columnDescriptors at:selectedColIndex ifAbsent:nil. |
3887 ! |
3702 ! |
3888 |
3703 |
3889 selectedRow |
3704 selectedRow |
3890 "returns selected row (or collection if multiple selection) or nil |
3705 "returns the selected row (or collection if multiple selection) or nil" |
3891 " |
3706 |
3892 multipleSelectOk ifFalse:[ |
3707 multipleSelectOk ifFalse:[ |
3893 ^ self at:selectedRowIndex ifAbsent:nil |
3708 ^ self at:selectedRowIndex ifAbsent:nil |
3894 ]. |
3709 ]. |
3895 |
|
3896 selectedRowIndex size ~~ 0 ifTrue:[ |
3710 selectedRowIndex size ~~ 0 ifTrue:[ |
3897 ^ selectedRowIndex collect:[:i| self at:i] |
3711 ^ selectedRowIndex collect:[:i | self at:i ] |
3898 ]. |
3712 ]. |
3899 ^ nil |
3713 ^ nil |
3900 ! |
3714 ! |
3901 |
3715 |
3902 selectedRow:something |
3716 selectedRow:something |
3903 "select something |
3717 "select something" |
3904 " |
3718 |
3905 self selectedRowIndex:something |
3719 self selectedRowIndex:something |
3906 ! |
3720 ! |
3907 |
3721 |
3908 selectedRowIndex |
3722 selectedRowIndex |
3909 "returns selected row number or 0 |
3723 "returns selected row number or 0" |
3910 " |
3724 |
3911 ^ selectedRowIndex |
3725 ^ selectedRowIndex |
3912 ! |
3726 ! |
3913 |
3727 |
3914 selectedRowIndex:something |
3728 selectedRowIndex:something |
3915 "set the row selection (single or multiple rows); |
3729 "set the row selection (single or multiple rows); |
3916 does NOT change the selectoed column. |
3730 does NOT change the selectoed column." |
3917 " |
3731 |
3918 self selectColIndex:selectedColIndex rowIndex:something |
3732 self selectColIndex:selectedColIndex rowIndex:something |
3919 ! |
3733 ! |
3920 |
3734 |
3921 selectionChanged |
3735 selectionChanged |
3922 "selection has changed |
3736 "selection has changed" |
3923 " |
3737 |
3924 |val| |
3738 |val| |
3925 |
3739 |
3926 model notNil ifTrue:[ |
3740 model notNil ifTrue:[ |
3927 val := self selectedRowIndex copy. |
3741 val := self selectedRowIndex copy. |
3928 |
|
3929 (model respondsTo:#selectionIndex:) ifTrue:[ |
3742 (model respondsTo:#selectionIndex:) ifTrue:[ |
3930 model selectionIndex:val |
3743 model selectionIndex:val |
3931 ] ifFalse:[ |
3744 ] ifFalse:[ |
3932 useIndex ifFalse:[ model value:(self selectedRow) ] |
3745 useIndex ifFalse:[ |
3933 ifTrue:[ model value:val ] |
3746 model value:(self selectedRow) |
3934 ] |
3747 ] ifTrue:[ |
3935 ]. |
3748 model value:val |
3936 |
3749 ] |
|
3750 ] |
|
3751 ]. |
3937 actionBlock notNil ifTrue:[ |
3752 actionBlock notNil ifTrue:[ |
3938 actionBlock value:(self selectedRowIndex) |
3753 actionBlock value:(self selectedRowIndex) |
3939 ] |
3754 ] |
3940 ! |
3755 ! |
3941 |
3756 |
3942 selectionIndicesDo:aOneArgBlock |
3757 selectionIndicesDo:aOneArgBlock |
3943 "evaluate block on each row selected; the argument to the row |
3758 "evaluate block on each row selected; the argument to the row |
3944 is the index of the selected row |
3759 is the index of the selected row" |
3945 " |
3760 |
3946 multipleSelectOk ifFalse:[ |
3761 multipleSelectOk ifFalse:[ |
3947 selectedRowIndex ~~ 0 ifTrue:[ |
3762 selectedRowIndex ~~ 0 ifTrue:[ |
3948 aOneArgBlock value:selectedRowIndex |
3763 aOneArgBlock value:selectedRowIndex |
3949 ] |
3764 ] |
3950 ] ifTrue:[ |
3765 ] ifTrue:[ |
3951 selectedRowIndex size ~~ 0 ifTrue:[ |
3766 selectedRowIndex size ~~ 0 ifTrue:[ |
3952 selectedRowIndex do:[:i| aOneArgBlock value:i ] |
3767 selectedRowIndex do:aOneArgBlock |
3953 ] |
3768 ] |
3954 ] |
3769 ] |
3955 ! |
3770 ! |
3956 |
3771 |
3957 setSelectColIndex:colNrArg rowIndex:rowNrArg |
3772 setSelectColIndex:colNrArg rowIndex:rowNrArg |
3958 "change selection without notification |
3773 "change selection without notification" |
3959 " |
3774 |
3960 |editSpec rowNr colNr newCol oldCol oldRow sensor sglSelRow oldSz |
3775 |editSpec rowNr colNr newCol oldCol oldRow sensor sglSelRow oldSz |
3961 keyBrdFwd filter edView| |
3776 keyBrdFwd filter edView| |
3962 |
3777 |
3963 rowNr := self validateSelection:rowNrArg. |
3778 rowNr := self validateSelection:rowNrArg. |
3964 |
3779 |