--- a/HStepSlider.st Wed May 28 12:25:55 1997 +0200
+++ b/HStepSlider.st Wed May 28 16:00:37 1997 +0200
@@ -10,8 +10,8 @@
hereby transferred.
"
-HorizontalScrollBar subclass:#HorizontalSteppingSlider
- instanceVariableNames:'stepIncrement'
+SteppingSlider subclass:#HorizontalSteppingSlider
+ instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
@@ -46,116 +46,22 @@
top := StandardSystemView extent:200@200.
sl := HorizontalSteppingSlider in:top.
- sl origin:(0.0@0.0) corner:(1.0@sl height).
+ sl origin:(0.0@0.0) corner:(1.0@(sl preferredExtent y)).
sl scrollAction:[:pos | Transcript showCR:pos].
top open
"
! !
-!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
-!
-
-step:aNumber
- "same as stepIncrement;
- set the value used for stepping (defaults to 1)"
-
- stepIncrement := aNumber
-!
-
-stepIncrement:aNumber
- "set the value used for stepping (defaults to 1)"
-
- stepIncrement := aNumber
-! !
-
-!HorizontalSteppingSlider methodsFor:'events'!
-
-keyPress:key x:x y:y
- (key == #CursorRight or:[key == #CursorUp]) ifTrue:[
- self scrollStepUp.
- ^ self
- ].
- (key == #CursorLeft or:[key == #CursorDown]) ifTrue:[
- self scrollStepDown.
- ^ self
- ].
- super keyPress:key x:x y:y
-! !
+!HorizontalSteppingSlider methodsFor:'queries'!
-!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:'misc'!
-
-doesNotUnderstand:aMessage
- "delegate any unknown messages to my thumb"
-
- ^ aMessage sendTo:thumb
-! !
+orientation
+ ^ #horizontal
-!HorizontalSteppingSlider methodsFor:'private'!
-
-scrollStep:delta
- "step by some delta"
-
- |oldOrg newOrg|
-
- 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
- "step up"
-
- self scrollStep:stepIncrement
-
+ "Created: 28.5.1997 / 15:10:16 / cg"
! !
!HorizontalSteppingSlider class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/Attic/HStepSlider.st,v 1.9 1996-12-12 13:35:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/Attic/HStepSlider.st,v 1.10 1997-05-28 14:00:27 cg Exp $'
! !
--- a/HorizontalSteppingSlider.st Wed May 28 12:25:55 1997 +0200
+++ b/HorizontalSteppingSlider.st Wed May 28 16:00:37 1997 +0200
@@ -10,8 +10,8 @@
hereby transferred.
"
-HorizontalScrollBar subclass:#HorizontalSteppingSlider
- instanceVariableNames:'stepIncrement'
+SteppingSlider subclass:#HorizontalSteppingSlider
+ instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Views-Interactors'
@@ -46,116 +46,22 @@
top := StandardSystemView extent:200@200.
sl := HorizontalSteppingSlider in:top.
- sl origin:(0.0@0.0) corner:(1.0@sl height).
+ sl origin:(0.0@0.0) corner:(1.0@(sl preferredExtent y)).
sl scrollAction:[:pos | Transcript showCR:pos].
top open
"
! !
-!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
-!
-
-step:aNumber
- "same as stepIncrement;
- set the value used for stepping (defaults to 1)"
-
- stepIncrement := aNumber
-!
-
-stepIncrement:aNumber
- "set the value used for stepping (defaults to 1)"
-
- stepIncrement := aNumber
-! !
-
-!HorizontalSteppingSlider methodsFor:'events'!
-
-keyPress:key x:x y:y
- (key == #CursorRight or:[key == #CursorUp]) ifTrue:[
- self scrollStepUp.
- ^ self
- ].
- (key == #CursorLeft or:[key == #CursorDown]) ifTrue:[
- self scrollStepDown.
- ^ self
- ].
- super keyPress:key x:x y:y
-! !
+!HorizontalSteppingSlider methodsFor:'queries'!
-!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:'misc'!
-
-doesNotUnderstand:aMessage
- "delegate any unknown messages to my thumb"
-
- ^ aMessage sendTo:thumb
-! !
+orientation
+ ^ #horizontal
-!HorizontalSteppingSlider methodsFor:'private'!
-
-scrollStep:delta
- "step by some delta"
-
- |oldOrg newOrg|
-
- 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
- "step up"
-
- self scrollStep:stepIncrement
-
+ "Created: 28.5.1997 / 15:10:16 / cg"
! !
!HorizontalSteppingSlider class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg2/HorizontalSteppingSlider.st,v 1.9 1996-12-12 13:35:26 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg2/HorizontalSteppingSlider.st,v 1.10 1997-05-28 14:00:27 cg Exp $'
! !
--- a/StepSlider.st Wed May 28 12:25:55 1997 +0200
+++ b/StepSlider.st Wed May 28 16:00:37 1997 +0200
@@ -10,13 +10,11 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.3 on 27-sep-1994 at 12:56:30'!
-
ScrollBar subclass:#SteppingSlider
- instanceVariableNames:'stepIncrement'
- classVariableNames:''
- poolDictionaries:''
- category:'Views-Interactors'
+ instanceVariableNames:'stepIncrement'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Views-Interactors'
!
!SteppingSlider class methodsFor:'documentation'!
@@ -35,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/Attic/StepSlider.st,v 1.7 1996-05-18 15:43:30 cg Exp $'
-!
-
documentation
"
SteppingSliders are like Sliders, but add step-up and step-down
@@ -51,7 +45,7 @@
examples
"
non model operation:
-
+ [exBegin]
|top sl|
top := StandardSystemView extent:200@200.
@@ -59,10 +53,11 @@
sl origin:(0.0@0.0) corner:(sl width@1.0).
sl scrollAction:[:pos | Transcript showCR:pos].
top open
+ [exEnd]
change the step:
-
+ [exBegin]
|top sl|
top := StandardSystemView extent:200@200.
@@ -71,10 +66,11 @@
sl scrollAction:[:pos | Transcript showCR:pos].
sl stepIncrement:10.
top open
+ [exEnd]
- model operation (look at value in model):
-
+ model operation (watch the value):
+ [exBegin]
|model top sl fld|
model := 0 asValue.
@@ -90,38 +86,63 @@
top label:'inputField on model'.
fld := EditField in:top.
fld origin:(0.0@0.0) corner:(1.0 @ fld height).
- fld model:model; converter:(PrintConverter new initForNumber).
+ fld converter:(PrintConverter new initForNumber); model:model.
top open
-"
-! !
+ [exEnd]
+
-!SteppingSlider methodsFor:'initialization'!
+ two views on the same model:
+ [exBegin]
+ |model top sl fld|
+
+ model := 0 asValue.
-createElements
- button1 := ArrowButton upIn:self.
- button1 name:'UpButton'.
- button2 := ArrowButton downIn:self.
- button2 name:'DownButton'.
- thumb := Slider in:self.
-!
+ top := StandardSystemView extent:200@200.
+ top label:'slider on model'.
+ sl := SteppingSlider in:top.
+ sl origin:(0.0@0.0) corner:(sl width@1.0).
+ sl model:model.
+ top open.
-initialize
- super initialize.
- stepIncrement := 1.
- self scrollDownAction:[self scrollStepUp].
- self scrollUpAction:[self scrollStepDown].
+ top := StandardSystemView extent:200@200.
+ top label:'slider on model'.
+ sl := ThumbWheel in:top.
+ sl origin:(0.0@0.0) corner:(20@1.0).
+ sl model:model.
+ top open.
+ [exEnd]
+"
! !
!SteppingSlider methodsFor:'accessing'!
model:aModel
+ "set the model - forwarded to the thumb.
+ if nonNil, this will get the thumbs origin
+ via #value: messages"
+
thumb model:aModel
+
+ "Modified: 28.5.1997 / 15:07:55 / cg"
!
-stepIncrement:aNumber
- "set the value used for stepping (defaults to 1)"
+start:start stop:stop step:step
+ "set start (min), stop (max) and step increment.
+ The increment is used when clicking on a step button"
+
+ thumb start:start stop:stop.
+ stepIncrement := step
- stepIncrement := aNumber
+ "Modified: 28.5.1997 / 15:03:56 / cg"
+!
+
+step
+ "return the step increment.
+ The increment is used when clicking on a step button"
+
+ ^ stepIncrement
+
+ "Modified: 28.5.1997 / 15:04:01 / cg"
!
step:aNumber
@@ -131,49 +152,120 @@
stepIncrement := aNumber
!
-step
- ^ stepIncrement
-!
+stepIncrement:aNumber
+ "set the value used for stepping (defaults to 1).
+ Same as #step: for compatibility."
-start:start stop:stop step:step
- thumb start:start stop:stop.
- stepIncrement := step
+ stepIncrement := aNumber
+
+ "Modified: 28.5.1997 / 15:04:25 / cg"
! !
!SteppingSlider methodsFor:'events'!
keyPress:key x:x y:y
- key == #CursorRight ifTrue:[
- self scrollStepUp.
- ^ self
+ "handle cursor left/right for stepping"
+
+ (key == #CursorRight or:[key == #CursorUp]) ifTrue:[
+ self scrollStepUp.
+ ^ self
].
- key == #CursorLeft ifTrue:[
- self scrollStepDown.
- ^ self
+ (key == #CursorLeft or:[key == #CursorDown]) ifTrue:[
+ self scrollStepDown.
+ ^ self
].
super keyPress:key x:x y:y
+
+ "Modified: 28.5.1997 / 15:08:36 / cg"
! !
-!SteppingSlider methodsFor:'private'!
+!SteppingSlider methodsFor:'initialization'!
+
+createElements
+ "create the scroller and the two step buttons"
-scrollStepUp
- |nO|
+ self orientation == #horizontal ifTrue:[
+ button1 := ArrowButton leftIn:self.
+ button1 name:'LeftButton'.
+ button2 := ArrowButton rightIn:self.
+ button2 name:'RightButton'.
+ thumb := HorizontalSlider in:self.
+ ] ifFalse:[
+ button1 := ArrowButton upIn:self.
+ button1 name:'UpButton'.
+ button2 := ArrowButton downIn:self.
+ button2 name:'DownButton'.
+ thumb := Slider in:self.
+ ].
- nO := (thumb thumbOrigin + stepIncrement) min:thumb stop.
- thumb thumbOrigin:nO.
- thumb tellOthers.
+ "Modified: 28.5.1997 / 15:09:50 / cg"
!
-scrollStepDown
- |nO|
+initialize
+ "initialize; the increment is set to 1 (one)"
+
+ super initialize.
- nO := (thumb thumbOrigin - stepIncrement) max:thumb start.
- thumb thumbOrigin:nO.
- thumb tellOthers.
+ stepIncrement := 1.
+ self scrollDownAction:[self scrollStepUp].
+ self scrollUpAction:[self scrollStepDown].
+
+ "Modified: 28.5.1997 / 15:06:05 / cg"
! !
!SteppingSlider methodsFor:'misc'!
doesNotUnderstand:aMessage
- ^ aMessage sendTo:thumb
+ "forward any unimplemented message to the scroller"
+
+ ^ aMessage sendTo:thumb
+
+ "Modified: 28.5.1997 / 15:05:37 / cg"
! !
+
+!SteppingSlider methodsFor:'private'!
+
+scrollStep:delta
+ "step by some delta"
+
+ |oldOrg newOrg|
+
+ oldOrg := thumb thumbOrigin.
+ newOrg := ((oldOrg + delta) max:thumb start) min:thumb stop.
+ oldOrg ~= newOrg ifTrue:[
+ thumb thumbOrigin:newOrg.
+ thumb tellOthers.
+ ]
+
+ "Created: 28.5.1997 / 15:10:51 / cg"
+!
+
+scrollStepDown
+ "sent when the step-down button is pressd"
+
+ self scrollStep:stepIncrement negated
+
+ "Modified: 28.5.1997 / 15:11:02 / cg"
+!
+
+scrollStepUp
+ "sent when the step-up button is pressd"
+
+ self scrollStep:stepIncrement
+
+ "Modified: 28.5.1997 / 15:11:08 / cg"
+! !
+
+!SteppingSlider methodsFor:'queries'!
+
+orientation
+ ^ #vertical
+
+ "Created: 28.5.1997 / 15:11:24 / cg"
+! !
+
+!SteppingSlider class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/Attic/StepSlider.st,v 1.8 1997-05-28 14:00:37 cg Exp $'
+! !
--- a/SteppingSlider.st Wed May 28 12:25:55 1997 +0200
+++ b/SteppingSlider.st Wed May 28 16:00:37 1997 +0200
@@ -10,13 +10,11 @@
hereby transferred.
"
-'From Smalltalk/X, Version:2.10.3 on 27-sep-1994 at 12:56:30'!
-
ScrollBar subclass:#SteppingSlider
- instanceVariableNames:'stepIncrement'
- classVariableNames:''
- poolDictionaries:''
- category:'Views-Interactors'
+ instanceVariableNames:'stepIncrement'
+ classVariableNames:''
+ poolDictionaries:''
+ category:'Views-Interactors'
!
!SteppingSlider class methodsFor:'documentation'!
@@ -35,10 +33,6 @@
"
!
-version
- ^ '$Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.7 1996-05-18 15:43:30 cg Exp $'
-!
-
documentation
"
SteppingSliders are like Sliders, but add step-up and step-down
@@ -51,7 +45,7 @@
examples
"
non model operation:
-
+ [exBegin]
|top sl|
top := StandardSystemView extent:200@200.
@@ -59,10 +53,11 @@
sl origin:(0.0@0.0) corner:(sl width@1.0).
sl scrollAction:[:pos | Transcript showCR:pos].
top open
+ [exEnd]
change the step:
-
+ [exBegin]
|top sl|
top := StandardSystemView extent:200@200.
@@ -71,10 +66,11 @@
sl scrollAction:[:pos | Transcript showCR:pos].
sl stepIncrement:10.
top open
+ [exEnd]
- model operation (look at value in model):
-
+ model operation (watch the value):
+ [exBegin]
|model top sl fld|
model := 0 asValue.
@@ -90,38 +86,63 @@
top label:'inputField on model'.
fld := EditField in:top.
fld origin:(0.0@0.0) corner:(1.0 @ fld height).
- fld model:model; converter:(PrintConverter new initForNumber).
+ fld converter:(PrintConverter new initForNumber); model:model.
top open
-"
-! !
+ [exEnd]
+
-!SteppingSlider methodsFor:'initialization'!
+ two views on the same model:
+ [exBegin]
+ |model top sl fld|
+
+ model := 0 asValue.
-createElements
- button1 := ArrowButton upIn:self.
- button1 name:'UpButton'.
- button2 := ArrowButton downIn:self.
- button2 name:'DownButton'.
- thumb := Slider in:self.
-!
+ top := StandardSystemView extent:200@200.
+ top label:'slider on model'.
+ sl := SteppingSlider in:top.
+ sl origin:(0.0@0.0) corner:(sl width@1.0).
+ sl model:model.
+ top open.
-initialize
- super initialize.
- stepIncrement := 1.
- self scrollDownAction:[self scrollStepUp].
- self scrollUpAction:[self scrollStepDown].
+ top := StandardSystemView extent:200@200.
+ top label:'slider on model'.
+ sl := ThumbWheel in:top.
+ sl origin:(0.0@0.0) corner:(20@1.0).
+ sl model:model.
+ top open.
+ [exEnd]
+"
! !
!SteppingSlider methodsFor:'accessing'!
model:aModel
+ "set the model - forwarded to the thumb.
+ if nonNil, this will get the thumbs origin
+ via #value: messages"
+
thumb model:aModel
+
+ "Modified: 28.5.1997 / 15:07:55 / cg"
!
-stepIncrement:aNumber
- "set the value used for stepping (defaults to 1)"
+start:start stop:stop step:step
+ "set start (min), stop (max) and step increment.
+ The increment is used when clicking on a step button"
+
+ thumb start:start stop:stop.
+ stepIncrement := step
- stepIncrement := aNumber
+ "Modified: 28.5.1997 / 15:03:56 / cg"
+!
+
+step
+ "return the step increment.
+ The increment is used when clicking on a step button"
+
+ ^ stepIncrement
+
+ "Modified: 28.5.1997 / 15:04:01 / cg"
!
step:aNumber
@@ -131,49 +152,120 @@
stepIncrement := aNumber
!
-step
- ^ stepIncrement
-!
+stepIncrement:aNumber
+ "set the value used for stepping (defaults to 1).
+ Same as #step: for compatibility."
-start:start stop:stop step:step
- thumb start:start stop:stop.
- stepIncrement := step
+ stepIncrement := aNumber
+
+ "Modified: 28.5.1997 / 15:04:25 / cg"
! !
!SteppingSlider methodsFor:'events'!
keyPress:key x:x y:y
- key == #CursorRight ifTrue:[
- self scrollStepUp.
- ^ self
+ "handle cursor left/right for stepping"
+
+ (key == #CursorRight or:[key == #CursorUp]) ifTrue:[
+ self scrollStepUp.
+ ^ self
].
- key == #CursorLeft ifTrue:[
- self scrollStepDown.
- ^ self
+ (key == #CursorLeft or:[key == #CursorDown]) ifTrue:[
+ self scrollStepDown.
+ ^ self
].
super keyPress:key x:x y:y
+
+ "Modified: 28.5.1997 / 15:08:36 / cg"
! !
-!SteppingSlider methodsFor:'private'!
+!SteppingSlider methodsFor:'initialization'!
+
+createElements
+ "create the scroller and the two step buttons"
-scrollStepUp
- |nO|
+ self orientation == #horizontal ifTrue:[
+ button1 := ArrowButton leftIn:self.
+ button1 name:'LeftButton'.
+ button2 := ArrowButton rightIn:self.
+ button2 name:'RightButton'.
+ thumb := HorizontalSlider in:self.
+ ] ifFalse:[
+ button1 := ArrowButton upIn:self.
+ button1 name:'UpButton'.
+ button2 := ArrowButton downIn:self.
+ button2 name:'DownButton'.
+ thumb := Slider in:self.
+ ].
- nO := (thumb thumbOrigin + stepIncrement) min:thumb stop.
- thumb thumbOrigin:nO.
- thumb tellOthers.
+ "Modified: 28.5.1997 / 15:09:50 / cg"
!
-scrollStepDown
- |nO|
+initialize
+ "initialize; the increment is set to 1 (one)"
+
+ super initialize.
- nO := (thumb thumbOrigin - stepIncrement) max:thumb start.
- thumb thumbOrigin:nO.
- thumb tellOthers.
+ stepIncrement := 1.
+ self scrollDownAction:[self scrollStepUp].
+ self scrollUpAction:[self scrollStepDown].
+
+ "Modified: 28.5.1997 / 15:06:05 / cg"
! !
!SteppingSlider methodsFor:'misc'!
doesNotUnderstand:aMessage
- ^ aMessage sendTo:thumb
+ "forward any unimplemented message to the scroller"
+
+ ^ aMessage sendTo:thumb
+
+ "Modified: 28.5.1997 / 15:05:37 / cg"
! !
+
+!SteppingSlider methodsFor:'private'!
+
+scrollStep:delta
+ "step by some delta"
+
+ |oldOrg newOrg|
+
+ oldOrg := thumb thumbOrigin.
+ newOrg := ((oldOrg + delta) max:thumb start) min:thumb stop.
+ oldOrg ~= newOrg ifTrue:[
+ thumb thumbOrigin:newOrg.
+ thumb tellOthers.
+ ]
+
+ "Created: 28.5.1997 / 15:10:51 / cg"
+!
+
+scrollStepDown
+ "sent when the step-down button is pressd"
+
+ self scrollStep:stepIncrement negated
+
+ "Modified: 28.5.1997 / 15:11:02 / cg"
+!
+
+scrollStepUp
+ "sent when the step-up button is pressd"
+
+ self scrollStep:stepIncrement
+
+ "Modified: 28.5.1997 / 15:11:08 / cg"
+! !
+
+!SteppingSlider methodsFor:'queries'!
+
+orientation
+ ^ #vertical
+
+ "Created: 28.5.1997 / 15:11:24 / cg"
+! !
+
+!SteppingSlider class methodsFor:'documentation'!
+
+version
+ ^ '$Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.8 1997-05-28 14:00:37 cg Exp $'
+! !