453 !ViewScroller methodsFor:'event handling'! |
453 !ViewScroller methodsFor:'event handling'! |
454 |
454 |
455 processEvent:anEvent |
455 processEvent:anEvent |
456 "return true, if the event was eaten" |
456 "return true, if the event was eaten" |
457 |
457 |
458 |appl evView focusView wg viewToScroll| |
458 |appl evView viewToScroll| |
459 |
459 |
460 anEvent isMouseWheelEvent ifTrue:[ |
460 anEvent isMouseWheelEvent ifTrue:[ |
|
461 scrolledView isNil ifTrue:[ |
|
462 ^ false |
|
463 ]. |
|
464 |
461 appl := self application. |
465 appl := self application. |
462 appl notNil ifTrue:[ "/ might happen that my application is nil |
466 appl notNil ifTrue:[ "/ might happen that my application is nil |
463 evView := anEvent view. |
467 evView := anEvent view. |
464 wg := evView windowGroup. |
468 viewToScroll := anEvent targetView. |
465 wg notNil ifTrue:[ |
|
466 focusView := evView windowGroup focusView ? evView. |
|
467 ]. |
|
468 viewToScroll := focusView ? evView. |
|
469 |
469 |
470 "/ because I am catching all scroll events (which is a kludge), |
470 "/ because I am catching all scroll events (which is a kludge), |
471 "/ walk up the hierarchy and see if there is no other scrolled view involved. |
471 "/ walk up the hierarchy and see if there is no other scrolled view involved. |
472 "/ if not, handle the scroll. |
472 "/ if not, handle the scroll. |
473 "/ BETTER SOLUTION: |
473 "/ BETTER SOLUTION: |
474 "/ unhandled mouseWheel events should be forwarded to the container |
474 "/ unhandled mouseWheel events should be forwarded to the container |
475 |
475 |
476 [ viewToScroll ~~ scrolledView |
476 [ viewToScroll ~~ scrolledView |
477 and:[ viewToScroll ~~ self |
477 and:[ viewToScroll ~~ self |
478 and:[ viewToScroll notNil |
478 and:[ viewToScroll notNil |
479 and:[ viewToScroll isScrollWrapper not |
479 and:[ (viewToScroll isScrollWrapper not |
480 or:[ viewToScroll isVerticalScrollable not ]]]] |
480 or:[ viewToScroll isVerticalScrollable not ]) |
|
481 and:[ (viewToScroll handlesMouseWheelMotion:anEvent inView:evView) not ]]]] |
481 ] whileTrue:[ |
482 ] whileTrue:[ |
482 viewToScroll := viewToScroll container. |
483 viewToScroll := viewToScroll container. |
483 ]. |
484 ]. |
484 viewToScroll isNil ifTrue:[ |
485 viewToScroll isNil ifTrue:[ |
485 ^ false |
|
486 ]. |
|
487 scrolledView isNil ifTrue:[ |
|
488 ^ false |
486 ^ false |
489 ]. |
487 ]. |
490 |
488 |
491 viewToScroll == scrolledView ifTrue:[ |
489 viewToScroll == scrolledView ifTrue:[ |
492 appl |
490 appl |