'From Squeak3.7 of ''4 September 2004'' [latest update: #5989] on 12 May 2008 at 1:08:10 am'!
!classDefinition: #SliderLW category: #'LightWidgets-Kernel'!
LightWidget subclass: #SliderLW
	instanceVariableNames: 'showAxis valueBounds cursorForm '
	classVariableNames: ''
	poolDictionaries: ''
	category: 'LightWidgets-Kernel'!

!SliderLW methodsFor: 'drawing'!
drawCursorOn: aCanvas
	"aCanvas fillOval: cursorBounds color: borderColor muchLighter borderWidth:1.0 borderColor: borderColor darker."

	| bw h w xIncrement cursorW valueBoxExtent v valueOffset cursorLocation boxExtent cform |
	bw _ self borderWidth.
	h _ bounds extent y.
	w _ bounds  extent x.

	xIncrement _ ( w- (2* bw )) /10.
	cursorW _ xIncrement-2.
	valueBoxExtent _ w - (2 * bw) - cursorW.
	(target notNil and: [aspect notNil]) ifTrue:[v _ self targetAspect] ifFalse:[ v_0].
	valueOffset _  v * (valueBoxExtent/100).
	
	cursorLocation _ (bounds origin x + bw+valueOffset)@ (bounds origin y + bw + bw).
	showAxis
		ifTrue:[ boxExtent _ cursorW@(h/2)]
		ifFalse:[ boxExtent _ cursorW @ h.
				cursorLocation _ cursorLocation + (0@(h/10)) ].
	cform _ self cursorForm: boxExtent.
 	aCanvas drawImage: cform at: cursorLocation

! !

!SliderLW methodsFor: 'drawing'!
drawOn: aCanvas
	aCanvas fillRectangle: bounds color: self backgroundColor.
	
	showAxis ifTrue:[ self drawAxisOn: aCanvas].
	self
		drawValueBoxOn: aCanvas;
		drawCursorOn: aCanvas.
		
	aCanvas frameRectangle: bounds width: self borderWidth color: self borderColor! !

!SliderLW methodsFor: 'drawing'!
drawValueBoxOn: aCanvas
	| axisBoxHeigth plus valueBounds |
	axisBoxHeigth _ (bounds extent y) / 4.
	showAxis 
		ifTrue:[ plus _ (bounds extent y - axisBoxHeigth) /2] 
		ifFalse:[plus _ bounds extent y  /2].
	valueBounds _ (bounds origin + (0@plus asFloat))  extent: (bounds extent x @  (axisBoxHeigth/2)). 
	aCanvas  fillRectangle: valueBounds color: self borderColor muchLighter
	! !

SliderLW removeSelector: #extent:!
SliderLW removeSelector: #position:!
SliderLW removeSelector: #updateValueBox!
SliderLW removeSelector: #updateView!
!classDefinition: #SliderLW category: #'LightWidgets-Kernel'!
LightWidget subclass: #SliderLW
	instanceVariableNames: 'showAxis cursorForm'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'LightWidgets-Kernel'!

!SliderLW reorganize!
('drawing' cursorFormExtent: drawAxisOn: drawCursorOn: drawOn: drawValueBoxOn:)
('private' borderWidth cursorForm)
('accessing' backgroundColor borderColor hideAxis showAxis)
('event handling' keyDown:)
('events-processing' handlesKeyboard:)
('user actions' cursorMovedBack cursorMovedForth)
('initialization' initialize)
!

