"
COPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
'From Smalltalk/X, Version:2.10.3 on 27-sep-1994 at 12:56:30'!
HorizontalScrollBar subclass:#HorizontalSteppingSlider
instanceVariableNames:'stepIncrement'
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
!
!HorizontalSteppingSlider class methodsFor:'documentation'!
copyright
"
COPYRIGHT (c) 1994 by Claus Gittinger
All Rights Reserved
This software is furnished under a license and may be used
only in accordance with the terms of that license and with the
inclusion of the above copyright notice. This software may not
be provided or otherwise made available to, or used by, any
other person. No title to or ownership of the software is
hereby transferred.
"
!
version
^ '$Header: /cvs/stx/stx/libwidg2/HorizontalSteppingSlider.st,v 1.5 1995-11-11 16:28:59 cg Exp $'
!
documentation
"
HorizontalSteppingSliders are like HorizontalSliders, but add step-up and step-down
buttons (which increment/decrement the value).
"
!
examples
"
|top sl|
top := StandardSystemView extent:200@200.
sl := HorizontalSteppingSlider in:top.
sl origin:(0.0@0.0) corner:(1.0@sl height).
sl scrollAction:[:pos | Transcript showCr:pos].
top open
"
! !
!HorizontalSteppingSlider methodsFor:'initialization'!
createElements
button1 := ArrowButton leftIn:self.
button1 name:'LeftButton'.
button2 := ArrowButton rightIn:self.
button2 name:'RightButton'.
thumb := HorizontalSlider in:self.
!
initialize
super initialize.
stepIncrement := 1.
self scrollDownAction:[self scrollStepUp].
self scrollUpAction:[self scrollStepDown].
! !
!HorizontalSteppingSlider methodsFor:'accessing'!
model:aModel
thumb model:aModel
!
stepIncrement:aNumber
"set the value used for stepping (defaults to 1)"
stepIncrement := aNumber
!
step:aNumber
"same as stepIncrement;
set the value used for stepping (defaults to 1)"
stepIncrement := aNumber
!
step
^ stepIncrement
!
start:start stop:stop step:step
thumb start:start stop:stop.
stepIncrement := step
! !
!HorizontalSteppingSlider methodsFor:'events'!
keyPress:key x:x y:y
key == #CursorRight ifTrue:[
self scrollStepUp.
^ self
].
key == #CursorLeft ifTrue:[
self scrollStepDown.
^ self
].
super keyPress:key x:x y:y
! !
!HorizontalSteppingSlider methodsFor:'private'!
scrollStepUp
|nO|
nO := (thumb thumbOrigin + stepIncrement) min:thumb stop.
thumb thumbOrigin:nO.
thumb tellOthers.
!
scrollStepDown
|nO|
nO := (thumb thumbOrigin - stepIncrement) max:thumb start.
thumb thumbOrigin:nO.
thumb tellOthers.
! !
!HorizontalSteppingSlider methodsFor:'misc'!
doesNotUnderstand:aMessage
^ aMessage sendTo:thumb
! !