ViewScroller.st
changeset 3641 e466ec0abd6e
parent 3544 2ec9f306cc7b
child 3925 bbcb5ef3a451
equal deleted inserted replaced
3640:7ca6eee17c97 3641:e466ec0abd6e
   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
   669 ! !
   667 ! !
   670 
   668 
   671 !ViewScroller class methodsFor:'documentation'!
   669 !ViewScroller class methodsFor:'documentation'!
   672 
   670 
   673 version
   671 version
   674     ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.39 2008-10-06 20:03:50 cg Exp $'
   672     ^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.40 2009-02-24 18:29:34 stefan Exp $'
   675 ! !
   673 ! !