--- a/HorizontalSteppingSlider.st Thu Nov 21 19:59:58 1996 +0100
+++ b/HorizontalSteppingSlider.st Thu Dec 12 14:35:26 1996 +0100
@@ -55,15 +55,22 @@
!HorizontalSteppingSlider methodsFor:'accessing'!
model:aModel
+ "set the model; this will get the thumbs origin
+ via #value: messages"
+
thumb model:aModel
!
start:start stop:stop step:step
+ "set the range and stepIncrement"
+
thumb start:start stop:stop.
stepIncrement := step
!
step
+ "retrieve the stepIncrement"
+
^ stepIncrement
!
@@ -114,29 +121,41 @@
!HorizontalSteppingSlider methodsFor:'misc'!
doesNotUnderstand:aMessage
+ "delegate any unknown messages to my thumb"
+
^ aMessage sendTo:thumb
! !
!HorizontalSteppingSlider methodsFor:'private'!
-scrollStepDown
- |nO|
+scrollStep:delta
+ "step by some delta"
+
+ |oldOrg newOrg|
- nO := (thumb thumbOrigin - stepIncrement) max:thumb start.
- thumb thumbOrigin:nO.
- thumb tellOthers.
+ oldOrg := thumb thumbOrigin.
+ newOrg := ((oldOrg + delta) max:thumb start) min:thumb stop.
+ oldOrg ~= newOrg ifTrue:[
+ thumb thumbOrigin:newOrg.
+ thumb tellOthers.
+ ]
+!
+
+scrollStepDown
+ "stepDown"
+
+ self scrollStep:stepIncrement negated
!
scrollStepUp
- |nO|
+ "step up"
- nO := (thumb thumbOrigin + stepIncrement) min:thumb stop.
- thumb thumbOrigin:nO.
- thumb tellOthers.
+ self scrollStep:stepIncrement
+
! !
!HorizontalSteppingSlider class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/HorizontalSteppingSlider.st,v 1.8 1996-05-18 15:43:18 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/HorizontalSteppingSlider.st,v 1.9 1996-12-12 13:35:26 cg Exp $'
! !