'From Cuis 5.0 [latest update: #4782] on 21 August 2021 at 2:03:10 pm'!

!PluggableScrollPane methodsFor: 'event handling testing' stamp: 'jmv 8/21/2021 14:02:36'!
handlesMouseScroll: aMouseScrollEvent
	"Only accept if we can actually do something useful with the event (i.e. not scrolling up when already at the top or down when already at the bottom) or if my owner chain doesn't want it"

	aMouseScrollEvent controlKeyPressed | aMouseScrollEvent rawMacOptionKeyPressed ifTrue: [ ^ false ].

	(aMouseScrollEvent direction = #up and: [ scrollBar scrollValue > 0 ])
		ifTrue: [ ^ true ].
	(aMouseScrollEvent direction = #down and: [ scrollBar scrollValue < 1 ])
		ifTrue: [ ^ true ].
	(aMouseScrollEvent direction = #left and: [ hScrollBar scrollValue > 0 ])
		ifTrue: [ ^ true ].
	(aMouseScrollEvent direction = #right and: [ hScrollBar scrollValue < 1 ])
		ifTrue: [ ^ true ].
	"Even if I don't want it, one of my owners might. (i.e. nested scroll panes)  If my owners don't want it, accept the event to make sure that morphs behind me doesn't get the event."
	(self privateAnyOwnerHandlesMouseScroll: aMouseScrollEvent)
		ifFalse: [ ^ true ].
	^ false! !

