author | Claus Gittinger <cg@exept.de> |
Sat, 11 Nov 1995 17:30:31 +0100 | |
changeset 86 | 4d7dbb5f1719 |
parent 71 | 9f9243f5813b |
child 121 | 282bd6d40bf0 |
permissions | -rw-r--r-- |
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 |
HorizontalScrollBar subclass:#HorizontalSteppingSlider |
|
65 | 16 |
instanceVariableNames:'stepIncrement' |
23 | 17 |
classVariableNames:'' |
18 |
poolDictionaries:'' |
|
19 |
category:'Views-Interactors' |
|
20 |
! |
|
21 |
||
22 |
!HorizontalSteppingSlider class methodsFor:'documentation'! |
|
23 |
||
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
49 | 27 |
All Rights Reserved |
23 | 28 |
|
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
version |
|
86
4d7dbb5f1719
uff - version methods changed to return stings
Claus Gittinger <cg@exept.de>
parents:
71
diff
changeset
|
39 |
^ '$Header: /cvs/stx/stx/libwidg2/HorizontalSteppingSlider.st,v 1.5 1995-11-11 16:28:59 cg Exp $' |
23 | 40 |
! |
41 |
||
42 |
documentation |
|
43 |
" |
|
44 |
HorizontalSteppingSliders are like HorizontalSliders, but add step-up and step-down |
|
45 |
buttons (which increment/decrement the value). |
|
46 |
" |
|
49 | 47 |
! |
48 |
||
49 |
examples |
|
50 |
" |
|
51 |
|top sl| |
|
52 |
||
53 |
top := StandardSystemView extent:200@200. |
|
54 |
sl := HorizontalSteppingSlider in:top. |
|
55 |
sl origin:(0.0@0.0) corner:(1.0@sl height). |
|
56 |
sl scrollAction:[:pos | Transcript showCr:pos]. |
|
57 |
top open |
|
58 |
" |
|
23 | 59 |
! ! |
60 |
||
61 |
||
62 |
!HorizontalSteppingSlider methodsFor:'initialization'! |
|
63 |
||
64 |
createElements |
|
65 |
button1 := ArrowButton leftIn:self. |
|
66 |
button1 name:'LeftButton'. |
|
67 |
button2 := ArrowButton rightIn:self. |
|
68 |
button2 name:'RightButton'. |
|
69 |
thumb := HorizontalSlider in:self. |
|
70 |
! |
|
71 |
||
72 |
initialize |
|
73 |
super initialize. |
|
65 | 74 |
stepIncrement := 1. |
75 |
self scrollDownAction:[self scrollStepUp]. |
|
76 |
self scrollUpAction:[self scrollStepDown]. |
|
49 | 77 |
! ! |
78 |
||
79 |
!HorizontalSteppingSlider methodsFor:'accessing'! |
|
80 |
||
81 |
model:aModel |
|
82 |
thumb model:aModel |
|
65 | 83 |
! |
84 |
||
85 |
stepIncrement:aNumber |
|
86 |
"set the value used for stepping (defaults to 1)" |
|
87 |
||
88 |
stepIncrement := aNumber |
|
89 |
! |
|
90 |
||
91 |
step:aNumber |
|
92 |
"same as stepIncrement; |
|
93 |
set the value used for stepping (defaults to 1)" |
|
94 |
||
95 |
stepIncrement := aNumber |
|
96 |
! |
|
97 |
||
98 |
step |
|
99 |
^ stepIncrement |
|
100 |
! |
|
101 |
||
102 |
start:start stop:stop step:step |
|
103 |
thumb start:start stop:stop. |
|
104 |
stepIncrement := step |
|
105 |
! ! |
|
106 |
||
107 |
!HorizontalSteppingSlider methodsFor:'events'! |
|
108 |
||
109 |
keyPress:key x:x y:y |
|
110 |
key == #CursorRight ifTrue:[ |
|
111 |
self scrollStepUp. |
|
112 |
^ self |
|
113 |
]. |
|
114 |
key == #CursorLeft ifTrue:[ |
|
115 |
self scrollStepDown. |
|
116 |
^ self |
|
117 |
]. |
|
118 |
super keyPress:key x:x y:y |
|
119 |
! ! |
|
120 |
||
121 |
!HorizontalSteppingSlider methodsFor:'private'! |
|
122 |
||
123 |
scrollStepUp |
|
124 |
|nO| |
|
125 |
||
126 |
nO := (thumb thumbOrigin + stepIncrement) min:thumb stop. |
|
127 |
thumb thumbOrigin:nO. |
|
128 |
thumb tellOthers. |
|
129 |
! |
|
130 |
||
131 |
scrollStepDown |
|
132 |
|nO| |
|
133 |
||
134 |
nO := (thumb thumbOrigin - stepIncrement) max:thumb start. |
|
135 |
thumb thumbOrigin:nO. |
|
136 |
thumb tellOthers. |
|
23 | 137 |
! ! |
138 |
||
139 |
!HorizontalSteppingSlider methodsFor:'misc'! |
|
140 |
||
141 |
doesNotUnderstand:aMessage |
|
142 |
^ aMessage sendTo:thumb |
|
143 |
! ! |