ListView.st
changeset 6663 ab25cb13f8f8
parent 6653 3519d5a67834
child 6707 187a9556ae38
equal deleted inserted replaced
6662:435986a48b63 6663:ab25cb13f8f8
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 1989 by Claus Gittinger
     4  COPYRIGHT (c) 1989 by Claus Gittinger
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
  4466 startAutoScrollDown:yDistance
  4468 startAutoScrollDown:yDistance
  4467     "setup for auto-scroll down (when button-press-moving below view)
  4469     "setup for auto-scroll down (when button-press-moving below view)
  4468      - timeDelta for scroll is computed from distance.
  4470      - timeDelta for scroll is computed from distance.
  4469      Return true, to tell caller that scrolling is allowed (redefined in editField)"
  4471      Return true, to tell caller that scrolling is allowed (redefined in editField)"
  4470 
  4472 
  4471     self
  4473     self startAutoScrollVertical:yDistance scrollSelector:#scrollSelectDown.
  4472 	startAutoScrollVertical:yDistance
       
  4473 	scrollSelector:#scrollSelectDown.
       
  4474     ^ true
  4474     ^ true
  4475 !
  4475 !
  4476 
  4476 
  4477 startAutoScrollHorizontal:xDistance scrollSelector:scrollSelector
  4477 startAutoScrollHorizontal:xDistance scrollSelector:scrollSelector
  4478     "setup for auto-scroll left/right (when button-press-moving to the right of the view)
  4478     "setup for auto-scroll left/right (when button-press-moving to the right of the view)
  4481     |deltaT mm|
  4481     |deltaT mm|
  4482 
  4482 
  4483     autoScroll ifFalse:[^ self].
  4483     autoScroll ifFalse:[^ self].
  4484 
  4484 
  4485     mm := xDistance // self horizontalIntegerPixelPerMillimeter + 1.
  4485     mm := xDistance // self horizontalIntegerPixelPerMillimeter + 1.
  4486     deltaT := 0.5 / mm.
  4486     deltaT := 0.25 / mm.
  4487 
  4487 
  4488     (deltaT = autoScrollDeltaT) ifFalse:[
  4488     true "(deltaT ~= autoScrollDeltaT)" ifTrue:[
  4489 	autoScrollDeltaT := deltaT.
  4489         autoScrollDeltaT := deltaT.
  4490 	autoScrollBlock isNil ifTrue:[
  4490         autoScrollBlock isNil ifTrue:[
  4491 	    autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]].
  4491             autoScrollBlock := [
  4492 	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
  4492                                 self realized ifTrue:[
  4493 	]
  4493                                     self sensor enqueueMessage:scrollSelector for:self
       
  4494                                 ]
       
  4495                                ].
       
  4496             Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
       
  4497         ]
  4494     ]
  4498     ]
  4495 !
  4499 !
  4496 
  4500 
  4497 startAutoScrollLeft:xDistance
  4501 startAutoScrollLeft:xDistance
  4498     "setup for auto-scroll up (when button-press-moving to the left of the view)
  4502     "setup for auto-scroll up (when button-press-moving to the left of the view)
  4499      - timeDelta for scroll is computed from distance"
  4503      - timeDelta for scroll is computed from distance"
  4500 
  4504 
  4501     self
  4505     self startAutoScrollHorizontal:(xDistance negated) scrollSelector:#scrollSelectLeft.
  4502 	startAutoScrollHorizontal:xDistance negated
       
  4503 	scrollSelector:#scrollSelectLeft.
       
  4504     ^ true
  4506     ^ true
  4505 !
  4507 !
  4506 
  4508 
  4507 startAutoScrollRight:xDistance
  4509 startAutoScrollRight:xDistance
  4508     "setup for auto-scroll down (when button-press-moving to the right of the view)
  4510     "setup for auto-scroll down (when button-press-moving to the right of the view)
  4509      - timeDelta for scroll is computed from distance"
  4511      - timeDelta for scroll is computed from distance"
  4510 
  4512 
  4511     self
  4513     self startAutoScrollHorizontal:xDistance scrollSelector:#scrollSelectRight.
  4512 	startAutoScrollHorizontal:xDistance
       
  4513 	scrollSelector:#scrollSelectRight.
       
  4514     ^ true
  4514     ^ true
  4515 !
  4515 !
  4516 
  4516 
  4517 startAutoScrollUp:yDistance
  4517 startAutoScrollUp:yDistance
  4518     "setup for auto-scroll up (when button-press-moving below view)
  4518     "setup for auto-scroll up (when button-press-moving below view)
  4519      - timeDelta for scroll is computed from distance.
  4519      - timeDelta for scroll is computed from distance.
  4520      Return true, to tell caller that scrolling is allowed (redefined in editField)"
  4520      Return true, to tell caller that scrolling is allowed (redefined in editField)"
  4521 
  4521 
  4522     self
  4522     self startAutoScrollVertical:(yDistance negated) scrollSelector:#scrollSelectUp.
  4523 	startAutoScrollVertical:yDistance negated
       
  4524 	scrollSelector:#scrollSelectUp.
       
  4525     ^ true
  4523     ^ true
  4526 !
  4524 !
  4527 
  4525 
  4528 startAutoScrollVertical:yDistance scrollSelector:scrollSelector
  4526 startAutoScrollVertical:yDistance scrollSelector:scrollSelector
  4529     "setup for auto-scroll up (when button-press-moving below view)
  4527     "setup for auto-scroll up (when button-press-moving below view)
  4532     |deltaT mm|
  4530     |deltaT mm|
  4533 
  4531 
  4534     autoScroll ifFalse:[^ self].
  4532     autoScroll ifFalse:[^ self].
  4535 
  4533 
  4536     mm := (yDistance abs // self verticalIntegerPixelPerMillimeter) + 1.
  4534     mm := (yDistance abs // self verticalIntegerPixelPerMillimeter) + 1.
  4537     deltaT := 0.5 / mm.
  4535     "/ the number of millimeters distance shortens the delaytime
  4538 
  4536     deltaT := 0.25 / mm.
  4539     (deltaT = autoScrollDeltaT) ifFalse:[
  4537 
  4540 	autoScrollDeltaT := deltaT.
  4538     true "(deltaT ~= autoScrollDeltaT)" ifTrue:[
  4541 	autoScrollBlock isNil ifTrue:[
  4539         autoScrollDeltaT := deltaT.
  4542 	    autoScrollBlock := [self realized ifTrue:[self perform:scrollSelector]].
  4540         autoScrollBlock isNil ifTrue:[
  4543 	    Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
  4541             autoScrollBlock := [
  4544 	]
  4542                                 self realized ifTrue:[
       
  4543                                     self sensor enqueueMessage:scrollSelector for:self
       
  4544                                 ]
       
  4545                                ].
       
  4546             Processor addTimedBlock:autoScrollBlock afterSeconds:deltaT
       
  4547         ]
  4545     ]
  4548     ]
  4546 
  4549 
  4547     "Modified: / 08-08-2010 / 11:26:26 / cg"
  4550     "Modified: / 08-08-2010 / 11:26:26 / cg"
  4548 !
  4551 !
  4549 
  4552