23
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
49
|
3 |
All Rights Reserved
|
23
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
'From Smalltalk/X, Version:2.10.3 on 27-sep-1994 at 12:56:30'!
|
|
14 |
|
|
15 |
ScrollBar subclass:#SteppingSlider
|
57
|
16 |
instanceVariableNames:'stepIncrement'
|
23
|
17 |
classVariableNames:''
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Views-Interactors'
|
|
20 |
!
|
|
21 |
|
|
22 |
SteppingSlider comment:'
|
|
23 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
49
|
24 |
All Rights Reserved
|
23
|
25 |
|
57
|
26 |
$Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.3 1995-05-12 18:40:34 claus Exp $
|
23
|
27 |
'!
|
|
28 |
|
|
29 |
!SteppingSlider class methodsFor:'documentation'!
|
|
30 |
|
|
31 |
copyright
|
|
32 |
"
|
|
33 |
COPYRIGHT (c) 1994 by Claus Gittinger
|
49
|
34 |
All Rights Reserved
|
23
|
35 |
|
|
36 |
This software is furnished under a license and may be used
|
|
37 |
only in accordance with the terms of that license and with the
|
|
38 |
inclusion of the above copyright notice. This software may not
|
|
39 |
be provided or otherwise made available to, or used by, any
|
|
40 |
other person. No title to or ownership of the software is
|
|
41 |
hereby transferred.
|
|
42 |
"
|
|
43 |
!
|
|
44 |
|
|
45 |
version
|
|
46 |
"
|
57
|
47 |
$Header: /cvs/stx/stx/libwidg2/SteppingSlider.st,v 1.3 1995-05-12 18:40:34 claus Exp $
|
23
|
48 |
"
|
|
49 |
!
|
|
50 |
|
|
51 |
documentation
|
|
52 |
"
|
|
53 |
SteppingSliders are like Sliders, but add step-up and step-down
|
|
54 |
buttons (which increment/decrement the value).
|
57
|
55 |
(you can also think of them as a ScrollBar with a slider instead of
|
|
56 |
a scroller as component)
|
23
|
57 |
"
|
49
|
58 |
!
|
|
59 |
|
|
60 |
examples
|
|
61 |
"
|
|
62 |
non model operation:
|
|
63 |
|
|
64 |
|top sl|
|
|
65 |
|
|
66 |
top := StandardSystemView extent:200@200.
|
|
67 |
sl := SteppingSlider in:top.
|
|
68 |
sl origin:(0.0@0.0) corner:(sl width@1.0).
|
|
69 |
sl scrollAction:[:pos | Transcript showCr:pos].
|
|
70 |
top open
|
|
71 |
|
|
72 |
|
57
|
73 |
change the step:
|
49
|
74 |
|
57
|
75 |
|top sl|
|
49
|
76 |
|
|
77 |
top := StandardSystemView extent:200@200.
|
|
78 |
sl := SteppingSlider in:top.
|
|
79 |
sl origin:(0.0@0.0) corner:(sl width@1.0).
|
57
|
80 |
sl scrollAction:[:pos | Transcript showCr:pos].
|
|
81 |
sl stepIncrement:10.
|
|
82 |
top open
|
|
83 |
|
|
84 |
|
|
85 |
model operation (look at value in model):
|
|
86 |
|
|
87 |
|model top sl fld|
|
|
88 |
|
|
89 |
model := 0 asValue.
|
|
90 |
|
|
91 |
top := StandardSystemView extent:200@200.
|
|
92 |
top label:'slider on model'.
|
|
93 |
sl := SteppingSlider in:top.
|
|
94 |
sl origin:(0.0@0.0) corner:(sl width@1.0).
|
49
|
95 |
sl model:model.
|
57
|
96 |
top open.
|
|
97 |
|
|
98 |
top := StandardSystemView extent:200@200.
|
|
99 |
top label:'inputField on model'.
|
|
100 |
fld := EditField in:top.
|
|
101 |
fld origin:(0.0@0.0) corner:(1.0 @ fld height).
|
|
102 |
fld model:model; converter:(PrintConverter new initForNumber).
|
49
|
103 |
top open
|
|
104 |
"
|
23
|
105 |
! !
|
|
106 |
|
|
107 |
!SteppingSlider methodsFor:'initialization'!
|
|
108 |
|
|
109 |
createElements
|
|
110 |
button1 := ArrowButton upIn:self.
|
|
111 |
button1 name:'UpButton'.
|
|
112 |
button2 := ArrowButton downIn:self.
|
|
113 |
button2 name:'DownButton'.
|
|
114 |
thumb := Slider in:self.
|
|
115 |
!
|
|
116 |
|
|
117 |
initialize
|
|
118 |
super initialize.
|
57
|
119 |
stepIncrement := 1.
|
23
|
120 |
self scrollDownAction:[|nO|
|
57
|
121 |
nO := (thumb thumbOrigin + stepIncrement) min:100.
|
49
|
122 |
thumb thumbOrigin:nO.
|
|
123 |
thumb tellOthers "scrollAction value:nO"].
|
23
|
124 |
self scrollUpAction:[|nO|
|
57
|
125 |
nO := (thumb thumbOrigin - stepIncrement) max:0.
|
49
|
126 |
thumb thumbOrigin:nO.
|
|
127 |
thumb tellOthers "scrollAction value:nO"].
|
|
128 |
! !
|
|
129 |
|
|
130 |
!SteppingSlider methodsFor:'accessing'!
|
|
131 |
|
|
132 |
model:aModel
|
|
133 |
thumb model:aModel
|
57
|
134 |
!
|
|
135 |
|
|
136 |
stepIncrement:aNumber
|
|
137 |
"set the value used for stepping (defaults to 1)"
|
|
138 |
|
|
139 |
stepIncrement := aNumber
|
23
|
140 |
! !
|
|
141 |
|
|
142 |
!SteppingSlider methodsFor:'misc'!
|
|
143 |
|
|
144 |
doesNotUnderstand:aMessage
|
|
145 |
^ aMessage sendTo:thumb
|
|
146 |
! !
|