'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 25 September 2008 at 11:08:58 am'!

!ListLW methodsFor: 'geometry' stamp: 'jmv 9/25/2008 10:49'!
scrollInterval
	"Answer an interval to draw the proportional thumb of a scroll bar"

	| b top bottom subTop subBottom thumbTop thumbBottom scale |
	top _ bounds top.
	bottom _ bounds bottom.
	subTop _ top.
	subBottom _ bottom.
	self submorphsDo:[:m |
		b _ m bounds.
		subTop _ subTop min: b top.
		subBottom _ subBottom max: b bottom ].
	scale _ 1.0 /  (subBottom - subTop) * (bottom - top ).
	thumbTop _ 1.0 * top - subTop * scale + top.
	thumbBottom _ 1.0 * bottom - subTop * scale + top.
	^ Interval from: thumbTop rounded to: thumbBottom rounded! !


!MenuListLW methodsFor: 'drawing' stamp: 'jmv 9/25/2008 10:25'!
drawOn: aCanvas

	aCanvas fillRectangle: bounds color: backColor.
	self drawScrollbarOn: aCanvas! !

!MenuListLW methodsFor: 'drawing' stamp: 'jmv 9/25/2008 10:46'!
drawScrollbarOn: aCanvas

	| thumb |
	thumb _ self scrollInterval.
	(thumb first = bounds top and: [thumb last = bounds bottom ]) ifFalse: [
		aCanvas
			fillRectangle: (bounds right - 18 @ bounds top corner: bounds right @ bounds bottom)
			color: scrollBarColor.
		aCanvas
			fillRectangle: (bounds right - 18 @ thumb first corner: bounds right @ thumb last)
			color: scrollThumbColor ]! !

!MenuListLW methodsFor: 'event handling' stamp: 'jmv 9/25/2008 11:07'!
mouseDown: evt
	| y current |
	current _ ActiveHand navigationFocus.
	(current notNil and: [current owner == self]) ifTrue: [
		y _ evt position y.
		y - bounds top < 30 ifTrue: [
			ActiveHand navigationFocusPrevious].
		bounds bottom - y < 30 ifTrue: [
			ActiveHand navigationFocusNext]
	]
	! !

!MenuListLW methodsFor: 'events-processing' stamp: 'jmv 9/25/2008 10:54'!
handlesMouseDown: evt
	^  true
! !


!MenuListLW reorganize!
('drawing' drawOn: drawScrollbarOn:)
('initialization' initialize)
('accessing' backColor: scrollBarColor: scrollThumbColor:)
('event handling' mouseDown:)
('events-processing' handlesMouseDown:)
!

