author | Claus Gittinger <cg@exept.de> |
Tue, 28 May 1996 21:19:41 +0200 | |
changeset 709 | a738bd76ace4 |
parent 705 | e2e7e718eb93 |
child 713 | 0c38ad51016d |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 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 |
View subclass:#Scroller |
|
268
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
14 |
instanceVariableNames:'thumbOrigin thumbHeight thumbColor thumbFrameColor scrollAction |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
15 |
orientation thumbFrame thumbLevel scrolling pressOffset |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
16 |
synchronousOperation shadowForm lightForm inset thumbShadowColor |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
17 |
thumbLightColor thumbEdgeStyle thumbHalfShadowColor |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
18 |
thumbHalfLightColor thumbEnteredColor thumbFrameSizeDifference |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
19 |
tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
20 |
ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered |
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
21 |
thumbActiveLevel' |
268
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
22 |
classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
23 |
DefaultShadowColor DefaultLightColor DefaultThumbColor |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
24 |
DefaultThumbShadowColor DefaultThumbLightColor |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
25 |
DefaultThumbHalfShadowColor DefaultThumbHalfLightColor |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
26 |
DefaultHalfShadowColor DefaultHalfLightColor DefaultTallyMarks |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
27 |
DefaultTallyLevel DefaultLevel DefaultBorderWidth |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
28 |
DefaultThumbLevel DefaultInset DefaultThumbFrameColor |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
29 |
DefaultGhostColor DefaultGhostFrameColor DefaultGhostLevel |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
30 |
DefaultFixThumbHeight DefaultEdgeStyle DefaultFullViewBackground |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
31 |
DefaultThumbEnteredColor DefaultThumbActiveLevel' |
268
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
32 |
poolDictionaries:'' |
d2cf9aeab1b8
handle buttonRelease with nil thumbFrame (happens sometimes)
Claus Gittinger <cg@exept.de>
parents:
243
diff
changeset
|
33 |
category:'Views-Interactors' |
0 | 34 |
! |
35 |
||
3 | 36 |
!Scroller class methodsFor:'documentation'! |
37 |
||
38 | 38 |
copyright |
39 |
" |
|
40 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 41 |
All Rights Reserved |
38 | 42 |
|
43 |
This software is furnished under a license and may be used |
|
44 |
only in accordance with the terms of that license and with the |
|
45 |
inclusion of the above copyright notice. This software may not |
|
46 |
be provided or otherwise made available to, or used by, any |
|
47 |
other person. No title to or ownership of the software is |
|
48 |
hereby transferred. |
|
49 |
" |
|
50 |
! |
|
51 |
||
3 | 52 |
documentation |
53 |
" |
|
38 | 54 |
this class implements the scroller for scrollbars. |
55 |
it can also be used by itself for scrollbars without step-buttons. |
|
63 | 56 |
When moved, either a predefined action is performed (scrollAction), |
119 | 57 |
or a model is informed via the changeMsg (which is #value: by default). |
63 | 58 |
|
38 | 59 |
The scroller can work synchronous (i.e. every move leads to an immediate evaluation |
60 |
of the action, or asynchronous (i.e. perform action on end-of move). |
|
63 | 61 |
By default, scrollers are synchronous. Asynchronous operation makes sense, |
62 |
if the scroll operation (redraw) is expensive and takes a long time. |
|
0 | 63 |
|
127 | 64 |
This class is used both for concrete instances (vertical scrollers) |
65 |
and as an abstract superclass for horizontalScrollers, sliders and |
|
66 |
miniScrollers. |
|
67 |
||
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
68 |
range: |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
69 |
the value passed to the model or via the action blocks is scaled according |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
70 |
to the min/maxRange instance variables. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
71 |
These default to 0..100 for percentage values. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
72 |
It does not make sense to change the range for scrollbar-scrollers, |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
73 |
but may be useful with Sliders or in special applications. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
74 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
75 |
style stuff: |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
76 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
77 |
Beside the obvious 3D rectangle, a scroller may draw a know-form |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
78 |
(as in NeXT) or little tally marks (as on SGI) in itself. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
79 |
These are controlled by the shadowForm, lightForm, tallyLevel and tallyMarks |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
80 |
instance variables. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
81 |
|
585 | 82 |
[Instance variables:] |
0 | 83 |
|
38 | 84 |
thumbOrigin <Number> origin of thumb (in percent) |
85 |
thumbHeight <Number> height of thumb (in percent) |
|
86 |
thumbColor <Color> color of thumb |
|
87 |
thumbFrameColor <Color> color of the frame around the thumb |
|
88 |
scrollAction <Block> 1 arg block to be evaluated when scrolled |
|
617 | 89 |
(arg is position in percent) |
119 | 90 |
orientation <Symbol> #horizontal or #vertical |
38 | 91 |
thumbFrame <Rectangle> frame of thumb in pixels (cached) |
92 |
thumbLevel <Number> level of thumb if 3d |
|
93 |
scrolling <Boolean> true during scroll |
|
94 |
pressOffset <Number> temporary (offset into frame when move started) |
|
95 |
synchronousOperation <Boolean> true if synchronous (i.e. dont wait till release |
|
617 | 96 |
to perform action) |
38 | 97 |
shadowForm <Form> bitmap of knob if any (shadow part) |
98 |
lightForm <Form> bitmap of knob if any (light part) |
|
99 |
inset <Integer> number of pixels to inset thumb from view borders |
|
100 |
thumbShadowColor <Color> color do draw dark parts of thumb |
|
101 |
thumblightColor <Color> color to draw light parts of thumb |
|
63 | 102 |
thumbEdgeStyle <SymbolOrNil> #soft or nil |
38 | 103 |
thumbHalfShadowColor <Color> used to draw smooth edges |
104 |
thumbHalfLightColor <Color> used to draw smooth edges |
|
105 |
thumbFrameSizeDifference <Integer> number of pixels the thumb is larger than |
|
617 | 106 |
it should be (can be negative for mswin-style) |
38 | 107 |
tallyLevel <Integer> if not zero, specifies if tally-marks should |
617 | 108 |
go into or out of the display (actually only <0/>0 is checked) |
109 |
I dont know of a better word for these ... |
|
38 | 110 |
tallyMarks <Integer> number of tally marks |
111 |
fixThumbHeight <Boolean> perform 'wrong' height computation a la mswindows |
|
117 | 112 |
rangeStart <Number> the range of the scroller |
113 |
rangeEnd (defaults to 0..100) |
|
119 | 114 |
rangeStep not currently implemented |
63 | 115 |
|
585 | 116 |
[style settings:] |
63 | 117 |
|
118 |
scrollerLevel <Integer> the level of the scroller w.r.t. its enclosing view |
|
119 |
scrollerBorderWidth <Integer> the borderWidth (ignored for 3D styles) |
|
120 |
||
121 |
scrollerViewBackground <Color> the viewBackground (color or image) |
|
122 |
scrollerShadowColor <Color> the color of 3D shadowed edges (ignored in 2D styles) |
|
123 |
scrollerLightColor <Color> the color of 3D lighted edges (ignored in 2D styles) |
|
124 |
||
125 |
scrollerThumbColor <Color> the thumbs color (color or image) |
|
126 |
scrollerThumbShadowColor <Color> the color of the thumbs shadowed edges (ignored in 2D styles) |
|
127 |
scrollerThumbLightColor <Color> the color of the thumbs shadowed edges (ignored in 2D styles) |
|
128 |
scrollerThumbEdgeStyle <Symbol> the edge style for the thumb (#soft or nil) |
|
129 |
scrollerThumbLevel <Integer> the 3D height of the thumb |
|
130 |
scrollerThumbHalfShadowColor<Color> the halfShadow for soft edged thumbs |
|
131 |
scrollerThumbHalfLightColor <Color> the halfLight for soft edged thumbs |
|
132 |
scrollerThumbFrameColor <Color> if non-nil, a rectangle is drawn around the thumb is this color |
|
133 |
scrollerThumbInset <Integer> inset of thumb from the scrollers boundary |
|
134 |
scrollerThumbFixHeight <Boolean> if true, use a fix thumb height (as in mswindows) |
|
135 |
scrollerGhostColor <Color> the color in which a ghost-rectangle is drawn |
|
136 |
scrollerGhostFrameColor <Color> if non-nil, a rectangle is drawn around the ghost is this color |
|
137 |
scrollerGhostLevel <Color> the 3D level of the ghost rectangle |
|
138 |
scrollerNTallyMarks <Integer> number of tally-marks to draw on the thumb |
|
139 |
scrollerTallyLevel. <Integer> the 3D level of any tally marks |
|
140 |
||
38 | 141 |
notice: for mswindows style, we force a WRONG thumb-frame |
142 |
computation, to make the thumb have constant size; |
|
63 | 143 |
if you dont like that (I do not :-), set scrollerThumbFixHeight to false (in the StyleSheet). |
585 | 144 |
|
145 |
[author:] |
|
617 | 146 |
Claus Gittinger |
585 | 147 |
|
148 |
[see also:] |
|
617 | 149 |
ScrollBar |
150 |
ScrollableView HVScrollableView |
|
3 | 151 |
" |
117 | 152 |
! |
153 |
||
154 |
examples |
|
155 |
" |
|
133 | 156 |
basic scroller setup: |
617 | 157 |
[exBegin] |
158 |
|top s| |
|
133 | 159 |
|
617 | 160 |
top := StandardSystemView new extent:200@200. |
161 |
s := Scroller in:top. |
|
162 |
s origin:(0.0@0.0) corner:(20@1.0). |
|
163 |
s thumbHeight:10. 'percent'. |
|
164 |
top open |
|
165 |
[exEnd] |
|
133 | 166 |
|
167 |
setting its thumb-height: |
|
617 | 168 |
[exBegin] |
169 |
|top s| |
|
133 | 170 |
|
617 | 171 |
top := StandardSystemView new extent:200@200. |
172 |
s := Scroller in:top. |
|
173 |
s origin:(0.0@0.0) corner:(20@1.0). |
|
174 |
s thumbHeight:50. 'percent'. |
|
175 |
top open |
|
176 |
[exEnd] |
|
133 | 177 |
|
178 |
setting its thumb-origin: |
|
617 | 179 |
[exBegin] |
180 |
|top s| |
|
133 | 181 |
|
617 | 182 |
top := StandardSystemView new extent:200@200. |
183 |
s := Scroller in:top. |
|
184 |
s origin:(0.0@0.0) corner:(20@1.0). |
|
185 |
s thumbHeight:10. 'percent'. |
|
186 |
s thumbOrigin:30. 'percent'. |
|
187 |
top open |
|
188 |
[exEnd] |
|
133 | 189 |
|
117 | 190 |
a scroller with action block (ST/X style): |
617 | 191 |
[exBegin] |
192 |
|top s| |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
193 |
|
617 | 194 |
top := StandardSystemView new extent:200@200. |
195 |
s := Scroller in:top. |
|
196 |
s origin:(0.0@0.0) corner:(20@1.0). |
|
197 |
s thumbHeight:10. 'percent'. |
|
655 | 198 |
s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat]. |
617 | 199 |
top open |
200 |
[exEnd] |
|
117 | 201 |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
202 |
setting its range: |
617 | 203 |
[exBegin] |
204 |
|top s| |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
205 |
|
617 | 206 |
top := StandardSystemView new extent:200@200. |
207 |
s := Scroller in:top. |
|
208 |
s origin:(0.0@0.0) corner:(20@1.0). |
|
209 |
s thumbHeight:10. 'percent'. |
|
655 | 210 |
s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat]. |
617 | 211 |
s start:0 stop:1. |
212 |
top open |
|
213 |
[exEnd] |
|
117 | 214 |
|
130 | 215 |
create a scroller in its default extent and have it positioned |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
216 |
at the side; beside another view: |
617 | 217 |
[exBegin] |
218 |
|top s v| |
|
130 | 219 |
|
617 | 220 |
top := StandardSystemView new extent:200@200. |
221 |
s := Scroller in:top. |
|
222 |
s origin:(0.0@0.0) corner:(0.0@1.0). |
|
223 |
s rightInset:(s preferredExtent x negated). |
|
224 |
s thumbHeight:10. |
|
225 |
s level:1. |
|
130 | 226 |
|
617 | 227 |
v := View in:top. |
228 |
v origin:0.0@0.0 corner:1.0@1.0. |
|
229 |
v leftInset:(s preferredExtent x). |
|
230 |
v viewBackground:Color red. |
|
231 |
v level:2. |
|
130 | 232 |
|
617 | 233 |
top open |
234 |
[exEnd] |
|
130 | 235 |
|
117 | 236 |
using a model (ST-80 style): |
617 | 237 |
[exBegin] |
238 |
|top s m| |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
239 |
|
617 | 240 |
m := 0 asValue. |
241 |
InspectorView openOn:m monitor:'value'. 'look at value'. |
|
117 | 242 |
|
617 | 243 |
top := StandardSystemView new extent:200@200. |
244 |
s := Scroller in:top. |
|
245 |
s origin:(0.0@0.0) corner:(20@1.0). |
|
246 |
s thumbHeight:10. 'percent'. |
|
247 |
s model:m. |
|
248 |
top open |
|
249 |
[exEnd] |
|
119 | 250 |
|
117 | 251 |
using a different changeSelector: |
617 | 252 |
[exBegin] |
253 |
|top s1 s2 m| |
|
117 | 254 |
|
617 | 255 |
m := Plug new. |
655 | 256 |
m respondTo:#value1: with:[:v | Transcript show:'scroller 1 moved to: '; showCR:v]. |
257 |
m respondTo:#value2: with:[:v | Transcript show:'scroller 2 moved to: '; showCR:v]. |
|
117 | 258 |
|
617 | 259 |
top := StandardSystemView new extent:200@200. |
260 |
s1 := Scroller in:top. |
|
261 |
s1 origin:(0.0@0.0) corner:(20@1.0). |
|
262 |
s1 thumbHeight:10. 'percent'. |
|
263 |
s1 model:m; change:#value1:. |
|
117 | 264 |
|
617 | 265 |
s2 := Scroller in:top. |
266 |
s2 origin:(30@0.0) corner:(50@1.0). |
|
267 |
s2 thumbHeight:10. 'percent'. |
|
268 |
s2 model:m; change:#value2:. |
|
269 |
top open |
|
270 |
[exEnd] |
|
117 | 271 |
" |
3 | 272 |
! ! |
0 | 273 |
|
274 |
!Scroller class methodsFor:'defaults'! |
|
275 |
||
205 | 276 |
handleLightFormOn:aDisplay |
277 |
"answer the form used for the handles light area; |
|
278 |
cache the one for Display for the next round" |
|
279 |
||
280 |
|f| |
|
281 |
||
282 |
((aDisplay == Display) and:[HandleLightForm notNil]) ifTrue:[ |
|
283 |
^ HandleLightForm |
|
284 |
]. |
|
285 |
f := Form fromFile:'HandleLight.xbm' resolution:100 on:aDisplay. |
|
286 |
f isNil ifTrue:[ |
|
287 |
f := Form width:8 height:8 fromArray:#[2r00000000 |
|
288 |
2r00000010 |
|
289 |
2r00000011 |
|
290 |
2r00000011 |
|
291 |
2r00000011 |
|
292 |
2r00000011 |
|
293 |
2r00000110 |
|
294 |
2r00111100] |
|
295 |
on:aDisplay |
|
296 |
]. |
|
297 |
(aDisplay == Display) ifTrue:[ |
|
298 |
HandleLightForm := f |
|
299 |
]. |
|
300 |
^ f |
|
301 |
! |
|
302 |
||
303 |
handleShadowFormOn:aDisplay |
|
304 |
"answer the form used for the handles shadow area; |
|
305 |
cache the one for Display for the next round" |
|
306 |
||
307 |
|f| |
|
308 |
||
309 |
((aDisplay == Display) and:[HandleShadowForm notNil]) ifTrue:[ |
|
310 |
^ HandleShadowForm |
|
311 |
]. |
|
312 |
f := Form fromFile:'HandleShadow.xbm' resolution:100 on:aDisplay. |
|
313 |
f isNil ifTrue:[ |
|
314 |
f := Form width:8 height:8 fromArray:#[2r00111100 |
|
315 |
2r01100000 |
|
316 |
2r11000000 |
|
317 |
2r11000000 |
|
318 |
2r11000000 |
|
319 |
2r11000000 |
|
320 |
2r01000000 |
|
321 |
2r00000000] |
|
322 |
on:aDisplay |
|
323 |
]. |
|
324 |
(aDisplay == Display) ifTrue:[ |
|
325 |
HandleShadowForm := f |
|
326 |
]. |
|
327 |
^ f |
|
328 |
! |
|
329 |
||
59 | 330 |
updateStyleCache |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
331 |
"extract values from the styleSheet and cache them in class variables" |
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
332 |
|
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
333 |
<resource: #style (#scrollerViewBackground #scrollerFullViewBackground |
617 | 334 |
#scrollerThumbColor |
335 |
#scrollerShadowColor #scrollerLightColor |
|
336 |
#scrollerThumbShadowColor #scrollerThumbLightColor |
|
337 |
#scrollerThumbHalfShadowColor #scrollerThumbHalfLightColor |
|
338 |
#scrollerThumbFrameColor #scrollerGhostColor |
|
339 |
#scrollerGhostLevel #scrollerGhostFrameColor |
|
340 |
#scrollerNTallyMarks #scrollerTallyLevel |
|
341 |
#scrollerLevel #scrollerBorderWidth |
|
342 |
#scrollerThumbLevel #scrollerThumbInset |
|
343 |
#scrollerThumbFixHeight #scrollerThumbEdgeStyle |
|
344 |
#scrollerThumbEnteredColor #scrollerThumbActiveLevel )> |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
345 |
|
60 | 346 |
DefaultViewBackground := StyleSheet colorAt:'scrollerViewBackground'. |
128 | 347 |
DefaultFullViewBackground := StyleSheet colorAt:'scrollerFullViewBackground'. |
60 | 348 |
DefaultThumbColor := StyleSheet colorAt:'scrollerThumbColor'. |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
349 |
DefaultThumbEnteredColor := StyleSheet colorAt:'scrollerThumbEnteredColor'. |
63 | 350 |
DefaultShadowColor := StyleSheet colorAt:'scrollerShadowColor'. |
351 |
DefaultLightColor := StyleSheet colorAt:'scrollerLightColor'. |
|
352 |
DefaultThumbShadowColor := StyleSheet colorAt:'scrollerThumbShadowColor'. |
|
353 |
DefaultThumbLightColor := StyleSheet colorAt:'scrollerThumbLightColor'. |
|
354 |
DefaultThumbHalfShadowColor := StyleSheet colorAt:'scrollerThumbHalfShadowColor'. |
|
355 |
DefaultThumbHalfLightColor := StyleSheet colorAt:'scrollerThumbHalfLightColor'. |
|
60 | 356 |
DefaultThumbFrameColor := StyleSheet colorAt:'scrollerThumbFrameColor'. |
63 | 357 |
DefaultGhostColor := StyleSheet colorAt:'scrollerGhostColor' default:nil. |
358 |
DefaultGhostFrameColor := StyleSheet colorAt:'scrollerGhostFrameColor' default:nil. |
|
359 |
DefaultGhostLevel := StyleSheet at:'scrollerGhostLevel' default:0. |
|
59 | 360 |
DefaultTallyMarks := StyleSheet at:'scrollerNTallyMarks' default:0. |
361 |
DefaultTallyLevel := 0. |
|
362 |
DefaultTallyMarks ~~ 0 ifTrue:[ |
|
617 | 363 |
DefaultTallyLevel := StyleSheet at:'scrollerTallyLevel' default:1. |
59 | 364 |
]. |
365 |
DefaultLevel := StyleSheet at:'scrollerLevel' default:0. |
|
366 |
DefaultBorderWidth := StyleSheet at:'scrollerBorderWidth' default:(StyleSheet at:'borderWidth'). |
|
367 |
DefaultThumbLevel := StyleSheet at:'scrollerThumbLevel' default:0. |
|
507 | 368 |
DefaultThumbActiveLevel := StyleSheet at:'scrollerThumbActiveLevel' default:DefaultThumbLevel. |
59 | 369 |
DefaultInset := StyleSheet at:'scrollerThumbInset' default:0. |
370 |
DefaultFixThumbHeight := StyleSheet at:'scrollerThumbFixHeight' default:false. |
|
63 | 371 |
DefaultEdgeStyle := StyleSheet at:'scrollerThumbEdgeStyle'. |
130 | 372 |
|
373 |
StyleSheet fileReadFailed ifTrue:[ |
|
617 | 374 |
DefaultViewBackground := Grey. |
375 |
DefaultThumbColor := White. |
|
376 |
DefaultThumbFrameColor := Black. |
|
377 |
DefaultInset := 1. |
|
130 | 378 |
] |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
379 |
|
507 | 380 |
"Modified: 20.3.1996 / 16:26:44 / cg" |
205 | 381 |
! ! |
59 | 382 |
|
205 | 383 |
!Scroller methodsFor:'accessing'! |
0 | 384 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
385 |
start |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
386 |
"return the scrollers range min. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
387 |
(not used with Scrollers, but provided for subclasses)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
388 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
389 |
^ rangeStart |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
390 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
391 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
392 |
start:start |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
393 |
"set the scrollers range min. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
394 |
(not used with Scrollers, but provided for subclasses)" |
205 | 395 |
|
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
396 |
self start:start stop:rangeEnd. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
397 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
398 |
"Modified: 25.5.1996 / 11:28:22 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
399 |
! |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
400 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
401 |
start:start stop:stop |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
402 |
"set the range. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
403 |
(not used with Scrollers, but provided for subclasses)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
404 |
|
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
405 |
|org| |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
406 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
407 |
org := self thumbOrigin. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
408 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
409 |
rangeStart := start. |
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
410 |
rangeEnd := stop. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
411 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
412 |
org < rangeStart ifTrue:[ |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
413 |
org := rangeStart |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
414 |
] ifFalse:[ |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
415 |
org > rangeEnd ifTrue:[ |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
416 |
org := rangeEnd |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
417 |
] |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
418 |
]. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
419 |
self thumbOrigin:org. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
420 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
421 |
"Modified: 25.5.1996 / 11:34:56 / cg" |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
422 |
! |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
423 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
424 |
start:start stop:stop step:step |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
425 |
"set the range. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
426 |
(not used with Scrollers, but provided for subclasses)" |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
427 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
428 |
self start:start stop:stop. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
429 |
rangeStep := step. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
430 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
431 |
"Created: 25.5.1996 / 11:24:09 / cg" |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
432 |
"Modified: 25.5.1996 / 11:27:43 / cg" |
205 | 433 |
! |
434 |
||
435 |
step |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
436 |
"return the scrollers range step. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
437 |
(not used with Scrollers, but provided for subclasses)" |
446 | 438 |
|
205 | 439 |
^ rangeStep |
105 | 440 |
! |
441 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
442 |
step:step |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
443 |
"set the scrollers range step. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
444 |
(not used with Scrollers, but provided for subclasses)" |
205 | 445 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
446 |
rangeStep := step |
205 | 447 |
! |
105 | 448 |
|
205 | 449 |
stop |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
450 |
"return the scrollers range max. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
451 |
(not used with Scrollers, but provided for subclasses)" |
446 | 452 |
|
205 | 453 |
^ rangeEnd |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
454 |
! |
446 | 455 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
456 |
stop:stop |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
457 |
"set the scrollers range max. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
458 |
(not used with Scrollers, but provided for subclasses)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
459 |
|
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
460 |
self start:rangeStart stop:stop. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
461 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
462 |
"Modified: 25.5.1996 / 11:28:35 / cg" |
205 | 463 |
! |
0 | 464 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
465 |
thumbFrame |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
466 |
"return the area used by the thumbFrame (in device coordinates). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
467 |
Allows access to the thumbs physical screen position, for |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
468 |
example to position a label below (see Slider-Examples)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
469 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
470 |
thumbFrame isNil ifTrue:[ self computeThumbFrame]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
471 |
^ thumbFrame |
119 | 472 |
! |
473 |
||
205 | 474 |
thumbHeight |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
475 |
"answer the thumbs height (in percent by default)" |
119 | 476 |
|
205 | 477 |
^ thumbHeight * (rangeEnd - rangeStart) / 100 |
119 | 478 |
! |
479 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
480 |
thumbHeight:aNumber |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
481 |
"set the thumbs height (in percent by default)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
482 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
483 |
|newHeight realNewHeight oldFrame nBg| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
484 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
485 |
newHeight := aNumber / (rangeEnd - rangeStart / 100). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
486 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
487 |
(newHeight > 100) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
488 |
realNewHeight := 100 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
489 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
490 |
realNewHeight := newHeight |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
491 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
492 |
((realNewHeight ~= thumbHeight) or:[thumbFrame isNil]) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
493 |
thumbHeight := realNewHeight. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
494 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
495 |
(DefaultFullViewBackground notNil |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
496 |
and:[DefaultViewBackground notNil |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
497 |
and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
498 |
realNewHeight >= 100 ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
499 |
nBg := DefaultFullViewBackground. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
500 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
501 |
nBg := DefaultViewBackground |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
502 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
503 |
nBg := nBg on:device. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
504 |
nBg ~~ viewBackground ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
505 |
self viewBackground:nBg. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
506 |
shown ifTrue:[self clear]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
507 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
508 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
509 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
510 |
shown ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
511 |
oldFrame := thumbFrame. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
512 |
self computeThumbFrame. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
513 |
(fixThumbHeight or:[oldFrame ~~ thumbFrame]) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
514 |
oldFrame notNil ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
515 |
self drawThumbBackgroundInX:(oldFrame left) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
516 |
y:(oldFrame top) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
517 |
width:(oldFrame width) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
518 |
height:(oldFrame height). |
119 | 519 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
520 |
self drawThumb |
119 | 521 |
] |
522 |
] ifFalse:[ |
|
523 |
thumbFrame := nil |
|
524 |
] |
|
525 |
] |
|
526 |
! |
|
527 |
||
205 | 528 |
thumbOrigin |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
529 |
"answer the thumbs origin (in percent by default)" |
205 | 530 |
|
531 |
^ thumbOrigin * (rangeEnd - rangeStart) / 100 + rangeStart |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
532 |
! |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
533 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
534 |
thumbOrigin:aNumber |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
535 |
"set the thumbs origin (in percent by default)" |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
536 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
537 |
|newOrigin realNewOrigin |
119 | 538 |
oldFrame oldTop oldBot oldLeft oldRight |
539 |
thumbTop thumbBot thumbLeft thumbRight |
|
105 | 540 |
tH "{ Class: SmallInteger }" |
119 | 541 |
tW |
132 | 542 |
delta needFullDraw |
119 | 543 |
bgLeft bgTop bgWidth bgHeight| |
105 | 544 |
|
133 | 545 |
newOrigin := (aNumber - rangeStart) asFloat / (rangeEnd - rangeStart / 100). |
117 | 546 |
|
105 | 547 |
((newOrigin + thumbHeight) > 100) ifTrue:[ |
548 |
realNewOrigin := 100 - thumbHeight |
|
549 |
] ifFalse: [ |
|
550 |
realNewOrigin := newOrigin |
|
551 |
]. |
|
552 |
(realNewOrigin > 100) ifTrue:[ |
|
553 |
realNewOrigin := 100 |
|
554 |
] ifFalse: [ |
|
555 |
(realNewOrigin < 0) ifTrue:[ |
|
556 |
realNewOrigin := 0 |
|
557 |
] |
|
558 |
]. |
|
559 |
((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[ |
|
560 |
thumbOrigin := realNewOrigin. |
|
561 |
||
562 |
shown ifTrue:[ |
|
563 |
oldFrame := thumbFrame. |
|
564 |
self computeThumbFrame. |
|
117 | 565 |
(thumbHeight = 100) ifTrue:[ |
566 |
"/ full: don't draw |
|
567 |
^ self |
|
568 |
]. |
|
105 | 569 |
|
570 |
(thumbFrame ~~ oldFrame) ifTrue:[ |
|
571 |
oldFrame isNil ifTrue:[ |
|
572 |
self drawThumb. |
|
573 |
^ self |
|
574 |
]. |
|
575 |
tH := thumbFrame height. |
|
576 |
tW := thumbFrame width. |
|
119 | 577 |
|
105 | 578 |
oldTop := oldFrame top. |
579 |
oldBot := oldTop + tH. |
|
119 | 580 |
oldLeft := oldFrame left. |
581 |
oldRight := oldLeft + tW. |
|
105 | 582 |
|
583 |
thumbTop := thumbFrame top. |
|
584 |
thumbBot := thumbTop + tH. |
|
119 | 585 |
thumbLeft := thumbFrame left. |
586 |
thumbRight := thumbLeft + tW. |
|
105 | 587 |
|
119 | 588 |
needFullDraw := self exposeEventPending |
589 |
or:[((orientation == #vertical) and:[oldBot >= height]) |
|
590 |
or:[((orientation ~~ #vertical) and:[oldRight >= width])]]. |
|
105 | 591 |
|
119 | 592 |
needFullDraw ifTrue:[ |
593 |
" |
|
594 |
cannot copy since thumb was below the end |
|
595 |
or may be not available for the copy |
|
596 |
" |
|
597 |
(orientation == #vertical) ifTrue:[ |
|
598 |
self drawThumbBackgroundInX:thumbLeft y:oldTop |
|
599 |
width:tW height:(height - oldTop). |
|
600 |
] ifFalse:[ |
|
601 |
self drawThumbBackgroundInX:oldLeft y:thumbTop |
|
602 |
width:(width - oldLeft) height:tH. |
|
603 |
]. |
|
105 | 604 |
self drawThumb. |
605 |
^ self |
|
606 |
]. |
|
607 |
||
608 |
self catchExpose. |
|
119 | 609 |
" |
610 |
copy the thumbs pixels |
|
611 |
" |
|
612 |
(orientation == #vertical) ifTrue:[ |
|
613 |
self copyFrom:self x:thumbLeft y:oldTop |
|
614 |
toX:thumbLeft y:thumbTop |
|
615 |
width:tW height:tH. |
|
616 |
] ifFalse:[ |
|
617 |
self copyFrom:self x:oldLeft y:thumbTop |
|
618 |
toX:thumbLeft y:thumbTop |
|
619 |
width:tW height:tH. |
|
620 |
]. |
|
105 | 621 |
|
119 | 622 |
" |
623 |
clear some of the previous thumbs area to background |
|
624 |
" |
|
625 |
(orientation == #vertical) ifTrue:[ |
|
626 |
bgLeft := thumbLeft. |
|
627 |
bgWidth := tW. |
|
628 |
oldTop > thumbTop ifTrue:[ |
|
629 |
delta := oldTop - thumbTop. |
|
630 |
oldTop > thumbBot ifTrue:[ |
|
631 |
bgTop := oldTop. |
|
632 |
bgHeight := tH + 1 |
|
633 |
] ifFalse:[ |
|
634 |
bgTop := thumbBot. |
|
635 |
bgHeight := delta |
|
636 |
] |
|
105 | 637 |
] ifFalse:[ |
119 | 638 |
delta := thumbTop - oldTop. |
639 |
oldBot < thumbTop ifTrue:[ |
|
640 |
bgTop := oldTop. |
|
641 |
bgHeight := tH + 1 |
|
642 |
] ifFalse:[ |
|
643 |
bgTop := oldTop. |
|
644 |
bgHeight := delta |
|
645 |
] |
|
646 |
]. |
|
105 | 647 |
] ifFalse:[ |
119 | 648 |
bgTop := thumbTop. |
649 |
bgHeight := tH. |
|
650 |
oldLeft > thumbLeft ifTrue:[ |
|
651 |
delta := oldLeft - thumbLeft. |
|
652 |
oldLeft > thumbRight ifTrue:[ |
|
653 |
bgLeft := oldLeft. |
|
654 |
bgWidth := tW + 1. |
|
655 |
] ifFalse:[ |
|
656 |
bgLeft := thumbRight. |
|
657 |
bgWidth := delta. |
|
658 |
] |
|
105 | 659 |
] ifFalse:[ |
119 | 660 |
delta := thumbLeft - oldLeft. |
661 |
oldRight < thumbLeft ifTrue:[ |
|
662 |
bgLeft := oldLeft. |
|
663 |
bgWidth := tW + 1. |
|
664 |
] ifFalse:[ |
|
665 |
bgLeft := oldLeft. |
|
666 |
bgWidth := delta. |
|
667 |
] |
|
668 |
]. |
|
105 | 669 |
]. |
119 | 670 |
self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
105 | 671 |
self waitForExpose |
672 |
] |
|
673 |
] ifFalse:[ |
|
674 |
thumbFrame := nil |
|
675 |
] |
|
676 |
] |
|
677 |
! |
|
678 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
679 |
thumbOrigin:originNumber thumbHeight:heightNumber |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
680 |
"set both thumbs height and origin (in percent by default)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
681 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
682 |
|newHeight newOrigin realNewOrigin realNewHeight old new changed nBg| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
683 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
684 |
newOrigin := originNumber - rangeStart / (rangeEnd - rangeStart / 100). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
685 |
newHeight := heightNumber / (rangeEnd - rangeStart / 100). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
686 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
687 |
(newHeight > 100) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
688 |
realNewHeight := 100 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
689 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
690 |
realNewHeight := newHeight |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
691 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
692 |
((newOrigin + realNewHeight) > 100) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
693 |
realNewOrigin := 100 - realNewHeight |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
694 |
] ifFalse: [ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
695 |
realNewOrigin := newOrigin |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
696 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
697 |
(realNewOrigin < 0) ifTrue: [ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
698 |
realNewOrigin := 0 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
699 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
700 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
701 |
changed := (realNewHeight ~= thumbHeight) or:[realNewOrigin ~= thumbOrigin]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
702 |
(changed or:[thumbFrame isNil]) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
703 |
old := self absFromPercent:thumbOrigin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
704 |
new := self absFromPercent:realNewOrigin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
705 |
changed := old ~~ new. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
706 |
changed ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
707 |
old := self absFromPercent:thumbHeight. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
708 |
new := self absFromPercent:realNewHeight. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
709 |
changed := (old ~~ new) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
710 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
711 |
(changed or:[thumbFrame isNil]) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
712 |
thumbOrigin := realNewOrigin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
713 |
thumbHeight := realNewHeight. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
714 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
715 |
(DefaultFullViewBackground notNil |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
716 |
and:[DefaultViewBackground notNil |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
717 |
and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
718 |
realNewHeight >= 100 ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
719 |
nBg := DefaultFullViewBackground. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
720 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
721 |
nBg := DefaultViewBackground |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
722 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
723 |
nBg := nBg on:device. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
724 |
nBg ~~ viewBackground ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
725 |
self viewBackground:nBg. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
726 |
shown ifTrue:[self clear]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
727 |
] |
128 | 728 |
]. |
729 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
730 |
shown ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
731 |
thumbFrame notNil ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
732 |
self drawThumbBackgroundInX:(thumbFrame left) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
733 |
y:(thumbFrame top) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
734 |
width:(thumbFrame width) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
735 |
height:(thumbFrame height). |
105 | 736 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
737 |
self computeThumbFrame. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
738 |
self drawThumb |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
739 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
740 |
thumbFrame := nil |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
741 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
742 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
743 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
744 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
745 |
|
454 | 746 |
!Scroller methodsFor:'accessing-behavior'! |
747 |
||
748 |
action:aBlock |
|
749 |
"for protocol compatibility; same as scrollAction:" |
|
750 |
||
751 |
self scrollAction:aBlock |
|
752 |
! |
|
753 |
||
754 |
asynchronousOperation |
|
755 |
"set scroll-mode to be asynchronous - scroll action is performed after |
|
756 |
scrolling, when mouse-button is finally released" |
|
757 |
||
758 |
synchronousOperation := false |
|
759 |
! |
|
760 |
||
761 |
scrollAction |
|
762 |
"answer the scroll action block" |
|
763 |
||
764 |
^ scrollAction |
|
765 |
! |
|
766 |
||
767 |
scrollAction:aBlock |
|
768 |
"set the scroll action, aBlock which is evaluated when scrolled" |
|
769 |
||
770 |
scrollAction := aBlock |
|
771 |
! |
|
772 |
||
773 |
scrollDownAction:aBlock |
|
774 |
"ignored - |
|
775 |
but implemented, so that scroller can be used in place of a scrollbar" |
|
776 |
! |
|
777 |
||
778 |
scrollUpAction:aBlock |
|
779 |
"ignored - |
|
780 |
but implemented, so that scroller can be used in place of a scrollbar" |
|
781 |
! |
|
782 |
||
783 |
synchronousOperation |
|
784 |
"set scroll-mode to be synchronous - scroll action is performed for |
|
785 |
every movement of thumb" |
|
786 |
||
787 |
synchronousOperation := true |
|
788 |
! ! |
|
789 |
||
790 |
!Scroller methodsFor:'accessing-look'! |
|
791 |
||
792 |
is3D |
|
793 |
styleSheet name = #mswindows ifTrue:[^ true]. |
|
794 |
^ super is3D |
|
795 |
! |
|
796 |
||
797 |
orientation |
|
798 |
"return the scrollers orientation (#vertical or #horizontal)" |
|
799 |
||
800 |
^ orientation |
|
801 |
! |
|
802 |
||
689 | 803 |
thumb |
804 |
"for compatibility with scrollBars, return the receiver" |
|
805 |
||
806 |
^ self |
|
807 |
||
808 |
"Created: 26.5.1996 / 12:21:12 / cg" |
|
809 |
! |
|
810 |
||
454 | 811 |
thumbColor |
812 |
"return the thumbs color" |
|
813 |
||
814 |
^ thumbColor |
|
815 |
! |
|
816 |
||
817 |
thumbColor:aColor |
|
818 |
"change the color of the thumb" |
|
819 |
||
820 |
thumbColor := aColor on:device. |
|
821 |
(styleSheet name ~~ #normal) ifTrue:[ |
|
822 |
thumbShadowColor := aColor darkened on:device. |
|
823 |
thumbLightColor := aColor lightened on:device. |
|
824 |
thumbHalfShadowColor := thumbShadowColor darkened on:device. |
|
825 |
thumbHalfLightColor := thumbLightColor lightened on:device. |
|
826 |
]. |
|
827 |
shown ifTrue:[ |
|
828 |
self redraw |
|
829 |
] |
|
830 |
! ! |
|
831 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
832 |
!Scroller methodsFor:'drawing'! |
446 | 833 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
834 |
drawHandleFormAtX:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
835 |
thumbShadowColor := thumbShadowColor on:device. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
836 |
thumbLightColor := thumbLightColor on:device. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
837 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
838 |
self paint:thumbShadowColor. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
839 |
self displayForm:shadowForm x:x y:y. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
840 |
self paint:thumbLightColor. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
841 |
self displayForm:lightForm x:x y:y. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
842 |
! |
446 | 843 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
844 |
drawThumb |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
845 |
"draw the thumb" |
446 | 846 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
847 |
|handleX handleY l t lvl |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
848 |
w "{ Class: SmallInteger }" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
849 |
h "{ Class: SmallInteger }" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
850 |
x "{ Class: SmallInteger }" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
851 |
y "{ Class: SmallInteger }" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
852 |
mm xL xR yT yB color1 color2| |
446 | 853 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
854 |
(thumbHeight >= 100) ifTrue:[^ self]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
855 |
orientation == #vertical ifTrue:[ |
617 | 856 |
thumbFrame height >= height ifTrue:[^ self]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
857 |
] ifFalse:[ |
617 | 858 |
thumbFrame width >= width ifTrue:[^ self]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
859 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
860 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
861 |
l := thumbFrame left. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
862 |
t := thumbFrame top. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
863 |
w := thumbFrame width. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
864 |
h := thumbFrame height. |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
865 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
866 |
self paint:(entered ifTrue:[thumbEnteredColor] ifFalse:[thumbColor]). |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
867 |
self fillRectangleX:l y:t width:w-1 height:h. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
868 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
869 |
lvl := thumbLevel. |
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
870 |
scrolling ifTrue:[ |
617 | 871 |
lvl := thumbActiveLevel |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
872 |
]. |
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
873 |
|
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
874 |
lvl == 0 ifTrue:[ |
617 | 875 |
thumbFrameColor notNil ifTrue:[ |
876 |
self paint:thumbFrameColor. |
|
877 |
self displayRectangle:thumbFrame. |
|
878 |
]. |
|
879 |
^ self |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
880 |
]. |
105 | 881 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
882 |
"what a kludge - must be a parameter to drawEdge..." |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
883 |
self drawEdgesForX:l y:t width:w height:h level:lvl |
617 | 884 |
shadow:thumbShadowColor light:thumbLightColor |
885 |
halfShadow:thumbHalfShadowColor halfLight:thumbHalfLightColor |
|
886 |
style:thumbEdgeStyle. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
887 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
888 |
thumbFrameColor notNil ifTrue:[ |
617 | 889 |
self paint:thumbFrameColor. |
890 |
orientation == #vertical ifTrue:[ |
|
891 |
self displayRectangleX:l y:t width:w"-1" height:h. |
|
892 |
] ifFalse:[ |
|
893 |
self displayRectangleX:l y:t width:w height:h"-1". |
|
894 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
895 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
896 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
897 |
(tallyLevel == 0 or:[tallyMarks == 0]) ifTrue:[ |
617 | 898 |
shadowForm notNil ifTrue:[ |
899 |
handleX := l + ((w - 8) // 2). |
|
900 |
handleY := t + ((h - 8) // 2). |
|
901 |
self drawHandleFormAtX:handleX y:handleY |
|
902 |
]. |
|
903 |
^ self |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
904 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
905 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
906 |
"iris style - draw tallys" |
205 | 907 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
908 |
tallyLevel > 0 ifTrue:[ |
617 | 909 |
color1 := thumbLightColor. |
910 |
color2 := thumbShadowColor. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
911 |
] ifFalse:[ |
617 | 912 |
color1 := thumbShadowColor. |
913 |
color2 := thumbLightColor. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
914 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
915 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
916 |
"draw tally marks" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
917 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
918 |
(orientation == #vertical) ifTrue:[ |
617 | 919 |
self paint:color1. |
920 |
y := t + (h // 2) - 1. |
|
921 |
xL := l + lvl - 1. |
|
922 |
xR := l + w - lvl "+ 1". |
|
923 |
self displayLineFromX:xL y:y toX:xR y:y. |
|
924 |
y := y + 1. |
|
925 |
self paint:color2. |
|
926 |
self displayLineFromX:xL y:y toX:xR y:y. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
927 |
|
617 | 928 |
tallyMarks > 1 ifTrue:[ |
929 |
"dont draw other marks if there is not enough space" |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
930 |
|
617 | 931 |
mm := device verticalPixelPerMillimeter rounded. |
932 |
h > (mm * (tallyMarks * 2)) ifTrue:[ |
|
933 |
y := y - 1 - mm. |
|
934 |
self paint:color1. |
|
935 |
self displayLineFromX:xL y:y toX:xR y:y. |
|
936 |
y := y + 1. |
|
937 |
self paint:color2. |
|
938 |
self displayLineFromX:xL y:y toX:xR y:y. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
939 |
|
617 | 940 |
y := y - 1 + mm + mm. |
941 |
self paint:color1. |
|
942 |
self displayLineFromX:xL y:y toX:xR y:y. |
|
943 |
y := y + 1. |
|
944 |
self paint:color2. |
|
945 |
self displayLineFromX:xL y:y toX:xR y:y |
|
946 |
] |
|
947 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
948 |
] ifFalse:[ |
617 | 949 |
x := l + (w // 2) - 1. |
950 |
yT := t + lvl - 1. |
|
951 |
yB := t + h - lvl "+ 1". |
|
952 |
self paint:color1. |
|
953 |
self displayLineFromX:x y:yT toX:x y:yB. |
|
954 |
self paint:color2. |
|
955 |
x := x + 1. |
|
956 |
self displayLineFromX:x y:yT toX:x y:yB. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
957 |
|
617 | 958 |
tallyMarks > 1 ifTrue:[ |
959 |
"dont draw other marks if there is not enough space" |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
960 |
|
617 | 961 |
mm := device horizontalPixelPerMillimeter rounded. |
962 |
w > (mm * (tallyMarks * 2)) ifTrue:[ |
|
963 |
x := x - 1 - mm. |
|
964 |
self paint:color1. |
|
965 |
self displayLineFromX:x y:yT toX:x y:yB. |
|
966 |
x := x + 1. |
|
967 |
self paint:color2. |
|
968 |
self displayLineFromX:x y:yT toX:x y:yB. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
969 |
|
617 | 970 |
x := x - 1 + mm + mm. |
971 |
self paint:color1. |
|
972 |
self displayLineFromX:x y:yT toX:x y:yB. |
|
973 |
x := x + 1. |
|
974 |
self paint:color2. |
|
975 |
self displayLineFromX:x y:yT toX:x y:yB |
|
976 |
] |
|
977 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
978 |
] |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
979 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
980 |
"Modified: 20.3.1996 / 10:55:29 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
981 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
982 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
983 |
drawThumbBackgroundInX:x y:y width:w height:h |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
984 |
"draw part of the thumbs background; defined as a separate |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
985 |
method, to allow drawing of arbitrary patterns under thumb |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
986 |
(see ColorSlider)." |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
987 |
|
699 | 988 |
|oldClip gX gY gW gH| |
989 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
990 |
shown ifTrue:[ |
695 | 991 |
self clearRectangleX:x y:y width:w height:h. |
992 |
frameBeforeMove notNil ifTrue:[ |
|
699 | 993 |
oldClip := self clippingRectangleOrNil. |
994 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
995 |
|
699 | 996 |
gX := frameBeforeMove left. |
997 |
gY := frameBeforeMove top. |
|
998 |
gW := frameBeforeMove width. |
|
999 |
gH := frameBeforeMove height. |
|
1000 |
||
1001 |
ghostColor notNil ifTrue:[ |
|
1002 |
self paint:ghostColor. |
|
1003 |
self fillRectangle:frameBeforeMove. |
|
1004 |
]. |
|
1005 |
(ghostLevel ~~ 0) ifTrue:[ |
|
1006 |
self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel |
|
1007 |
]. |
|
1008 |
ghostFrameColor notNil ifTrue:[ |
|
1009 |
self paint:ghostFrameColor. |
|
1010 |
self displayRectangleX:gX y:gY width:gW height:gH |
|
1011 |
]. |
|
1012 |
self clippingRectangle:oldClip |
|
695 | 1013 |
] |
205 | 1014 |
] |
695 | 1015 |
|
699 | 1016 |
"Modified: 28.5.1996 / 19:53:40 / cg" |
205 | 1017 |
! ! |
1018 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1019 |
!Scroller methodsFor:'event handling'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1020 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1021 |
buttonMotion:state x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1022 |
"mouse-button was moved while pressed; |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1023 |
redraw thumb at its new position and, if scroll-mode is asynchronous, |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1024 |
the scroll action is performed" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1025 |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1026 |
|pos curr limit prevOrigin newOrigin in| |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1027 |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1028 |
scrolling ifFalse: [ |
617 | 1029 |
self highlightThumbForPointerX:x y:y. |
1030 |
^ self |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1031 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1032 |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1033 |
entered := true. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1034 |
frameBeforeMove isNil ifTrue:[ |
617 | 1035 |
(ghostColor notNil |
1036 |
or:[ghostFrameColor notNil |
|
1037 |
or:[ghostLevel ~~ 0]]) ifTrue:[ |
|
1038 |
frameBeforeMove := thumbFrame insetBy:1@1 |
|
1039 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1040 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1041 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1042 |
(orientation == #vertical) ifTrue:[ |
617 | 1043 |
curr := y. |
1044 |
limit := height |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1045 |
] ifFalse:[ |
617 | 1046 |
curr := x. |
1047 |
limit := width |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1048 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1049 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1050 |
(curr < 0) ifTrue:[ "check against limits" |
617 | 1051 |
pos := 0 |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1052 |
] ifFalse:[ |
617 | 1053 |
(curr > limit) ifTrue:[ |
1054 |
pos := limit |
|
1055 |
] ifFalse:[ |
|
1056 |
pos := curr |
|
1057 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1058 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1059 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1060 |
prevOrigin := self thumbOrigin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1061 |
newOrigin := self percentFromAbs:(pos - pressOffset). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1062 |
prevOrigin ~= newOrigin ifTrue:[ |
617 | 1063 |
self thumbOrigin:newOrigin. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1064 |
|
617 | 1065 |
synchronousOperation ifTrue: [ |
1066 |
self tellOthers. |
|
1067 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1068 |
] |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1069 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1070 |
"Modified: 6.3.1996 / 17:35:26 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1071 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1072 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1073 |
buttonMultiPress:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1074 |
^ self buttonPress:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1075 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1076 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1077 |
buttonPress:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1078 |
"button was pressed - if above thumb, page up; if below thumb, page down; |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1079 |
otherwise start scrolling" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1080 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1081 |
|curr limit1 limit2| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1082 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1083 |
shown ifFalse:[^ self]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1084 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1085 |
(orientation == #vertical) ifTrue:[ |
617 | 1086 |
curr := y. |
1087 |
limit1 := thumbFrame top. |
|
1088 |
limit2 := thumbFrame bottom |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1089 |
] ifFalse:[ |
617 | 1090 |
curr := x. |
1091 |
limit1 := thumbFrame left. |
|
1092 |
limit2 := thumbFrame right |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1093 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1094 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1095 |
(curr < limit1) ifTrue:[ |
617 | 1096 |
"page up/left" |
1097 |
self pageUp |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1098 |
] ifFalse:[ |
617 | 1099 |
(curr > limit2) ifTrue:[ |
1100 |
"page down/right" |
|
1101 |
self pageDown |
|
1102 |
] ifFalse:[ |
|
1103 |
pressOffset := curr - limit1. |
|
1104 |
scrolling := true |
|
1105 |
] |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1106 |
]. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1107 |
self highlightThumbForPointerX:x y:y |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1108 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1109 |
"Modified: 6.3.1996 / 17:34:01 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1110 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1111 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1112 |
buttonRelease:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1113 |
"mouse-button was released - if scroll-mode is asynchronous, the scroll |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1114 |
action is now performed" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1115 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1116 |
|rect mustDrawThumb| |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1117 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1118 |
scrolling ifTrue:[ |
617 | 1119 |
thumbFrame notNil ifTrue:[ |
1120 |
mustDrawThumb := false. |
|
1121 |
scrolling := false. |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1122 |
|
617 | 1123 |
frameBeforeMove notNil ifTrue:[ |
1124 |
rect := frameBeforeMove. |
|
1125 |
frameBeforeMove := nil. |
|
1126 |
self drawThumbBackgroundInX:rect left |
|
1127 |
y:rect top |
|
1128 |
width:rect width |
|
1129 |
height:rect height. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1130 |
|
617 | 1131 |
(rect intersects:thumbFrame) ifTrue:[ |
1132 |
mustDrawThumb := true. |
|
1133 |
] |
|
1134 |
]. |
|
1135 |
thumbLevel ~~ thumbActiveLevel ifTrue:[ |
|
1136 |
mustDrawThumb := true |
|
1137 |
]. |
|
1138 |
mustDrawThumb ifTrue:[ |
|
1139 |
self drawThumb |
|
1140 |
]. |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1141 |
|
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1142 |
"/ scrolling := false. |
617 | 1143 |
synchronousOperation ifFalse: [ |
1144 |
self tellOthers. |
|
1145 |
] |
|
1146 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1147 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1148 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1149 |
"Modified: 20.3.1996 / 10:58:25 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1150 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1151 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1152 |
buttonShiftPress:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1153 |
"mouse-click with shift - jump to position" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1154 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1155 |
|pos curr curr2 limit1 limit2| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1156 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1157 |
(orientation == #vertical) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1158 |
curr := y. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1159 |
curr2 := y - (thumbFrame height // 2). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1160 |
limit1 := height. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1161 |
limit2 := thumbFrame top |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1162 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1163 |
curr := x. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1164 |
curr2 := x - (thumbFrame width // 2). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1165 |
limit1 := width. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1166 |
limit2 := thumbFrame left |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1167 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1168 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1169 |
(curr2 < 0) ifTrue:[ "check against limits" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1170 |
pos := 0 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1171 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1172 |
(curr2 > limit1) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1173 |
pos := limit1 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1174 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1175 |
pos := curr2 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1176 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1177 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1178 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1179 |
frameBeforeMove := thumbFrame insetBy:1@1. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1180 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1181 |
self thumbOrigin:(self percentFromAbs:pos). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1182 |
self tellOthers. |
105 | 1183 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1184 |
(orientation == #vertical) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1185 |
limit2 := thumbFrame top |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1186 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1187 |
limit2 := thumbFrame left |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1188 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1189 |
pressOffset := curr - limit2. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1190 |
scrolling := true |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1191 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1192 |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1193 |
highlightThumbForPointerX:x y:y |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1194 |
"if x/y is within the thumb frame, highlight it" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1195 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1196 |
|in| |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1197 |
|
617 | 1198 |
in := self thumbFrame containsPoint:(x@y). |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1199 |
(in ~~ entered |
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1200 |
or:[thumbLevel ~~ thumbActiveLevel]) ifTrue:[ |
617 | 1201 |
entered := in. |
1202 |
(thumbColor ~~ thumbEnteredColor |
|
1203 |
or:[thumbLevel ~~ thumbActiveLevel]) ifTrue: [ |
|
1204 |
self drawThumb |
|
1205 |
]. |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1206 |
]. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1207 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1208 |
"Created: 6.3.1996 / 17:35:07 / cg" |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1209 |
"Modified: 20.3.1996 / 10:59:59 / cg" |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1210 |
! |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1211 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1212 |
pointerLeave:state |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1213 |
"mouse-button left view |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1214 |
redraw thumb if enteredColor ~~ thumbColor" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1215 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1216 |
(entered and:[state == 0]) ifTrue: [ |
617 | 1217 |
entered := false. |
1218 |
self drawThumb |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1219 |
]. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1220 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1221 |
"Modified: 6.3.1996 / 17:27:12 / cg" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1222 |
"Created: 6.3.1996 / 17:31:16 / cg" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1223 |
! |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1224 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1225 |
redraw |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1226 |
"redraw" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1227 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1228 |
self redrawX:0 y:0 width:width height:height. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1229 |
self redrawEdges |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1230 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1231 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1232 |
redrawX:x y:y width:w height:h |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1233 |
shown ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1234 |
thumbFrame isNil ifTrue:[self computeThumbFrame]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1235 |
self drawThumbBackgroundInX:x y:y width:w height:h. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1236 |
(y > thumbFrame bottom) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1237 |
^ self |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1238 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1239 |
((y + h) < thumbFrame top) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1240 |
^ self |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1241 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1242 |
self drawThumb |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1243 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1244 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1245 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1246 |
sizeChanged:how |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1247 |
"size of scroller changed - recompute thumbs frame and redraw it" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1248 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1249 |
|sensor| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1250 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1251 |
shown ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1252 |
self computeThumbFrame. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1253 |
(sensor := self sensor) notNil ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1254 |
self redraw. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1255 |
sensor flushExposeEventsFor:self |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1256 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1257 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1258 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1259 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1260 |
update:something with:aParameter from:changedObject |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1261 |
"handle update from a model (if any)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1262 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1263 |
(changedObject == model |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1264 |
"and:[something == aspectMsg]") ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1265 |
self thumbOrigin:(model value). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1266 |
^ self |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1267 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1268 |
super update:something with:aParameter from:changedObject |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1269 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1270 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1271 |
!Scroller methodsFor:'forced scroll'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1272 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1273 |
pageDown |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1274 |
"page down/right" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1275 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1276 |
self thumbOrigin:(thumbOrigin + thumbHeight). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1277 |
self tellOthers |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1278 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1279 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1280 |
pageUp |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1281 |
"page up/left" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1282 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1283 |
self thumbOrigin:(thumbOrigin - thumbHeight). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1284 |
self tellOthers |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1285 |
! |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1286 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1287 |
scrollToBeginning |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1288 |
"scroll to the beginning" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1289 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1290 |
self thumbOrigin:rangeStart. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1291 |
self tellOthers |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1292 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1293 |
"Created: 6.3.1996 / 17:55:13 / cg" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1294 |
! |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1295 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1296 |
scrollToEnd |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1297 |
"scroll to the end" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1298 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1299 |
self thumbOrigin:rangeEnd. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1300 |
self tellOthers |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1301 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1302 |
"Created: 6.3.1996 / 17:55:25 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1303 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1304 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1305 |
!Scroller methodsFor:'forwarding changed origin'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1306 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1307 |
tellOthers |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1308 |
|org| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1309 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1310 |
org := self thumbOrigin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1311 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1312 |
the ST/X way of notifying scrolls |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1313 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1314 |
scrollAction notNil ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1315 |
scrollAction value:org |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1316 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1317 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1318 |
the ST-80 way of notifying scrolls |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1319 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1320 |
self sendChangeMessageWith:org. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1321 |
self changed:#scrollerPosition. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1322 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1323 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1324 |
!Scroller methodsFor:'initialization'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1325 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
452
diff
changeset
|
1326 |
defaultExtent |
571 | 1327 |
"compute my extent from sub-components" |
1328 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
452
diff
changeset
|
1329 |
^ self preferredExtent |
571 | 1330 |
|
1331 |
"Modified: 22.4.1996 / 23:37:53 / cg" |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1332 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1333 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1334 |
initCursor |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1335 |
"set the cursor - a hand" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1336 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1337 |
cursor := Cursor hand |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1338 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1339 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1340 |
initStyle |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1341 |
"initialize style dep. stuff" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1342 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1343 |
super initStyle. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1344 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1345 |
DefaultViewBackground notNil ifTrue:[ |
705 | 1346 |
viewBackground := DefaultViewBackground on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1347 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1348 |
DefaultShadowColor notNil ifTrue:[ |
705 | 1349 |
shadowColor := DefaultShadowColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1350 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1351 |
DefaultLightColor notNil ifTrue:[ |
705 | 1352 |
lightColor := DefaultLightColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1353 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1354 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1355 |
tallyMarks := DefaultTallyMarks. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1356 |
tallyLevel := DefaultTallyLevel. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1357 |
DefaultLevel ~~ level ifTrue:[ |
705 | 1358 |
self level:DefaultLevel. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1359 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1360 |
DefaultBorderWidth ~~ borderWidth ifTrue:[ |
705 | 1361 |
self borderWidth:DefaultBorderWidth. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1362 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1363 |
thumbLevel := DefaultThumbLevel. |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1364 |
thumbActiveLevel := DefaultThumbActiveLevel. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1365 |
inset := DefaultInset. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1366 |
fixThumbHeight := DefaultFixThumbHeight. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1367 |
thumbEdgeStyle := DefaultEdgeStyle. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1368 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1369 |
DefaultGhostColor notNil ifTrue:[ |
705 | 1370 |
ghostColor := DefaultGhostColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1371 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1372 |
DefaultGhostFrameColor notNil ifTrue:[ |
705 | 1373 |
ghostFrameColor := DefaultGhostFrameColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1374 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1375 |
ghostLevel := DefaultGhostLevel. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1376 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1377 |
DefaultThumbFrameColor notNil ifTrue:[ |
705 | 1378 |
thumbFrameColor := DefaultThumbFrameColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1379 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1380 |
DefaultThumbShadowColor notNil ifTrue:[ |
705 | 1381 |
thumbShadowColor := DefaultThumbShadowColor |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1382 |
] ifFalse:[ |
705 | 1383 |
thumbShadowColor := shadowColor. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1384 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1385 |
DefaultThumbLightColor notNil ifTrue:[ |
705 | 1386 |
thumbLightColor := DefaultThumbLightColor |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1387 |
] ifFalse:[ |
705 | 1388 |
thumbLightColor := lightColor. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1389 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1390 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1391 |
thumbEdgeStyle notNil ifTrue:[ |
705 | 1392 |
DefaultThumbHalfShadowColor notNil ifTrue:[ |
1393 |
thumbHalfShadowColor := DefaultThumbHalfShadowColor |
|
1394 |
]. |
|
1395 |
DefaultThumbHalfLightColor notNil ifTrue:[ |
|
1396 |
thumbHalfLightColor := DefaultThumbHalfLightColor |
|
1397 |
]. |
|
446 | 1398 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1399 |
|
709 | 1400 |
device hasGrayscales ifFalse:[ |
705 | 1401 |
thumbEdgeStyle notNil ifTrue:[ |
1402 |
thumbHalfShadowColor := Color darkGray. |
|
1403 |
thumbHalfLightColor := White |
|
1404 |
]. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1405 |
|
705 | 1406 |
thumbShadowColor := Black. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1407 |
"/ thumbLightColor := White. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1408 |
|
705 | 1409 |
styleSheet name = #motif ifTrue:[ |
1410 |
DefaultThumbColor isNil ifTrue:[ |
|
1411 |
thumbColor := White . |
|
1412 |
]. |
|
1413 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1414 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1415 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1416 |
DefaultThumbColor notNil ifTrue:[ |
705 | 1417 |
thumbColor := DefaultThumbColor on:device |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1418 |
] ifFalse:[ |
705 | 1419 |
thumbColor := White. |
1420 |
styleSheet name ~= #normal ifTrue:[ |
|
709 | 1421 |
device hasGrayscales ifFalse:[ |
705 | 1422 |
thumbColor := Color grey |
1423 |
]. |
|
1424 |
]. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1425 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1426 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1427 |
thumbColor := thumbColor on:device. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1428 |
thumbShadowColor notNil ifTrue:[ |
705 | 1429 |
thumbShadowColor := thumbShadowColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1430 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1431 |
thumbLightColor notNil ifTrue:[ |
705 | 1432 |
thumbLightColor := thumbLightColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1433 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1434 |
thumbHalfShadowColor notNil ifTrue:[ |
705 | 1435 |
thumbHalfShadowColor := thumbHalfShadowColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1436 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1437 |
thumbHalfLightColor notNil ifTrue:[ |
705 | 1438 |
thumbHalfLightColor := thumbHalfLightColor on:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1439 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1440 |
thumbEdgeStyle notNil ifTrue:[ |
705 | 1441 |
thumbHalfShadowColor isNil ifTrue:[ |
1442 |
thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1443 |
] |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1444 |
]. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1445 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1446 |
DefaultThumbEnteredColor notNil ifTrue:[ |
705 | 1447 |
thumbEnteredColor := DefaultThumbEnteredColor on:device. |
1448 |
self enableMotionEvents. |
|
1449 |
self enableEnterLeaveEvents. |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1450 |
] ifFalse:[ |
705 | 1451 |
thumbEnteredColor := thumbColor. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1452 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1453 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1454 |
styleSheet name = #next ifTrue:[ |
705 | 1455 |
shadowForm := self class handleShadowFormOn:device. |
1456 |
lightForm := self class handleLightFormOn:device |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1457 |
] ifFalse:[ |
705 | 1458 |
shadowForm := lightForm := nil |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1459 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1460 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1461 |
drawableId notNil ifTrue:[ |
705 | 1462 |
self computeThumbFrame |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1463 |
] |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1464 |
|
709 | 1465 |
"Modified: 28.5.1996 / 21:13:34 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1466 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1467 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1468 |
initialize |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1469 |
"initialize - setup instvars from defaults" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1470 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1471 |
super initialize. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
452
diff
changeset
|
1472 |
|
556 | 1473 |
orientation isNil ifTrue:[orientation := #vertical]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1474 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1475 |
scrolling := false. |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1476 |
entered := false. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1477 |
synchronousOperation := true. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1478 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1479 |
thumbOrigin := 0. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1480 |
thumbHeight := 100. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1481 |
thumbFrameSizeDifference := 0. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1482 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1483 |
rangeStart := 0. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1484 |
rangeEnd := 100. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1485 |
rangeStep := nil. "/ meaning: arbitrary precision |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1486 |
"/ inset := 1. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1487 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1488 |
"/ self computeThumbFrame |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1489 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1490 |
"Modified: 6.3.1996 / 17:25:59 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1491 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1492 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1493 |
realize |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1494 |
super realize. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1495 |
model notNil ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1496 |
self thumbOrigin:(model value). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1497 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1498 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1499 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1500 |
!Scroller methodsFor:'private'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1501 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1502 |
absFromPercent:percent |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1503 |
"given a percentage, compute number of pixels" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1504 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1505 |
|fullSize| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1506 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1507 |
(orientation == #vertical) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1508 |
fullSize := height |
446 | 1509 |
] ifFalse:[ |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1510 |
fullSize := width |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1511 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1512 |
"/ ^ ((percent * (fullSize - (margin * 2))) / 100) rounded |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1513 |
"/ 20-apr-94 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1514 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1515 |
^ ((percent * (fullSize - thumbFrameSizeDifference- (margin * 2))) / 100) rounded |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1516 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1517 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1518 |
computeThumbFrame |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1519 |
"compute the thumbs frame (a rectangle) whenever thumb is moved, |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1520 |
changed height or the scrollers size has changed. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1521 |
We take care, that the thumb will not become too small (i.e. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1522 |
invisible or uncatchable). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1523 |
Also, for mswindows style, its height/width is constant." |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1524 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1525 |
|newPos1 newPos2 newSize1 newSize2 nh nw ny nx |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1526 |
computedSize minSz sz1 sz2| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1527 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1528 |
"compute position & size" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1529 |
newPos1 := (self absFromPercent:thumbOrigin) + margin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1530 |
newSize1 := computedSize := self absFromPercent:thumbHeight. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1531 |
(orientation == #vertical) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1532 |
sz1 := height. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1533 |
sz2 := width |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1534 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1535 |
sz1 := width. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1536 |
sz2 := height |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1537 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1538 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1539 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1540 |
do we have to adjust the computed size ? |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1541 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1542 |
newPos2 := margin + inset. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1543 |
newSize2 := sz2 - (2 * newPos2). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1544 |
"/ (style ~~ #normal) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1545 |
thumbLevel ~~ 0 ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1546 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1547 |
do not make thumb too small (for handle & to be catchable) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1548 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1549 |
minSz := 10 + (2 * thumbLevel) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1550 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1551 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1552 |
do not make thumb too small (uncatchable) |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1553 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1554 |
minSz := 4 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1555 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1556 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1557 |
(newSize1 < minSz) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1558 |
newSize1 := minSz. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1559 |
thumbFrameSizeDifference := newSize1 - computedSize |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1560 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1561 |
thumbFrameSizeDifference := 0. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1562 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1563 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1564 |
fixThumbHeight ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1565 |
"have a fix-size thumb (i.e. mswindows style)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1566 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1567 |
newSize1 := sz2 - (2 * inset). "make it square" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1568 |
thumbFrameSizeDifference := newSize1 - computedSize. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1569 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1570 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1571 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1572 |
oops - if height does not relect real visibible area, we have to adjust the origin |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1573 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1574 |
(thumbFrameSizeDifference == 0) ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1575 |
newPos1 := (self absFromPercent:thumbOrigin) + margin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1576 |
"/ newPos1 := ((thumbOrigin * (sz1 - thumbFrameSizeDifference - (margin * 2))) / 100) rounded + margin |
446 | 1577 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1578 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1579 |
(orientation == #vertical) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1580 |
ny := newPos1. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1581 |
nx := newPos2. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1582 |
nh := newSize1. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1583 |
nw := newSize2. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1584 |
ny + nh + margin > height ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1585 |
ny := height - margin - nh |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1586 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1587 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1588 |
nx := newPos1. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1589 |
ny := newPos2. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1590 |
nw := newSize1. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1591 |
nh := newSize2. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1592 |
nx + nw + margin > width ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1593 |
nx := width - margin - nw |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1594 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1595 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1596 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1597 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1598 |
do not create new Rectangle if its the same anyway |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1599 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1600 |
thumbFrame notNil ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1601 |
(ny == thumbFrame top) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1602 |
(nx == thumbFrame left) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1603 |
(nh == thumbFrame height) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1604 |
(nw == thumbFrame width) ifTrue:[ ^ self] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1605 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1606 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1607 |
] |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1608 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1609 |
thumbFrame := Rectangle left:nx top:ny width:nw height:nh |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1610 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1611 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1612 |
percentFromAbs:absValue |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1613 |
"given a number of pixels, compute percentage" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1614 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1615 |
|fullSize val t| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1616 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1617 |
(orientation == #vertical) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1618 |
fullSize := height |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1619 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1620 |
fullSize := width |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1621 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1622 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1623 |
t := fullSize - thumbFrameSizeDifference - (margin * 2). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1624 |
t = 0 ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1625 |
"/ in rare cases, this happens ... |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1626 |
val := 0 |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1627 |
] ifFalse:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1628 |
val := absValue / t * (rangeEnd - rangeStart). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1629 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1630 |
val := val + rangeStart. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1631 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1632 |
val < rangeStart ifTrue:[^ rangeStart]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1633 |
val > rangeEnd ifTrue:[^ rangeEnd]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1634 |
^ val |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1635 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1636 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1637 |
|
454 | 1638 |
!Scroller methodsFor:'private scrollbar & scrollview interface'! |
1639 |
||
1640 |
setThumbFor:aView |
|
1641 |
"get contents and size info from aView and adjust thumb" |
|
1642 |
||
1643 |
|percentSize percentOrigin contentsSize contentsPosition viewsSize| |
|
1644 |
||
1645 |
" |
|
1646 |
get the content's size |
|
1647 |
" |
|
1648 |
aView isNil ifTrue:[ |
|
1649 |
contentsSize := 0 |
|
1650 |
] ifFalse:[ |
|
1651 |
orientation == #vertical ifTrue:[ |
|
1652 |
contentsSize := aView heightOfContents. |
|
1653 |
aView transformation notNil ifTrue:[ |
|
1654 |
contentsSize := aView transformation applyScaleY:contentsSize. |
|
1655 |
]. |
|
1656 |
] ifFalse:[ |
|
1657 |
contentsSize := aView widthOfContents. |
|
1658 |
aView transformation notNil ifTrue:[ |
|
1659 |
contentsSize := aView transformation applyScaleX:contentsSize. |
|
1660 |
]. |
|
1661 |
] |
|
1662 |
]. |
|
1663 |
||
1664 |
(contentsSize = 0) ifTrue:[ |
|
1665 |
percentSize := 100. |
|
1666 |
percentOrigin := 100 |
|
1667 |
] ifFalse:[ |
|
1668 |
(orientation == #vertical) ifTrue:[ |
|
1669 |
viewsSize := aView innerHeight. |
|
1670 |
contentsPosition := aView yOriginOfContents. |
|
1671 |
] ifFalse:[ |
|
1672 |
viewsSize := aView innerWidth. |
|
1673 |
contentsPosition := aView xOriginOfContents |
|
1674 |
]. |
|
1675 |
||
1676 |
percentSize := viewsSize * 100.0 / contentsSize. |
|
1677 |
percentOrigin := contentsPosition * 100.0 / contentsSize. |
|
1678 |
percentOrigin + percentSize > 100.0 ifTrue:[ |
|
1679 |
"actually showing stuff below contents of view" |
|
1680 |
" |
|
1681 |
contentsSize := contentsPosition + aView innerHeight. |
|
1682 |
percentSize := viewsSize * 100.0 / contentsSize. |
|
1683 |
percentOrigin := contentsPosition * 100.0 / contentsSize |
|
1684 |
" |
|
1685 |
] |
|
1686 |
]. |
|
1687 |
(percentSize = thumbHeight) ifTrue:[ |
|
1688 |
self thumbOrigin:percentOrigin |
|
1689 |
] ifFalse:[ |
|
1690 |
(percentOrigin = thumbOrigin) ifTrue:[ |
|
1691 |
self thumbHeight:percentSize |
|
1692 |
] ifFalse:[ |
|
1693 |
self thumbOrigin:percentOrigin thumbHeight:percentSize |
|
1694 |
] |
|
1695 |
] |
|
1696 |
! |
|
1697 |
||
1698 |
setThumbHeightFor:aView |
|
1699 |
"get contents and size info from aView and adjust thumb height" |
|
1700 |
||
1701 |
|percent total viewsSize| |
|
1702 |
||
1703 |
(orientation == #vertical) ifTrue:[ |
|
1704 |
total := aView heightOfContents. |
|
1705 |
aView transformation notNil ifTrue:[ |
|
1706 |
total := aView transformation applyScaleY:total. |
|
1707 |
]. |
|
1708 |
] ifFalse:[ |
|
1709 |
total := aView widthOfContents. |
|
1710 |
aView transformation notNil ifTrue:[ |
|
1711 |
total := aView transformation applyScaleX:total. |
|
1712 |
]. |
|
1713 |
]. |
|
1714 |
(total = 0) ifTrue:[ |
|
1715 |
percent := 100 |
|
1716 |
] ifFalse:[ |
|
1717 |
viewsSize := (orientation == #vertical) ifTrue:[aView innerHeight] |
|
1718 |
ifFalse:[aView innerWidth]. |
|
1719 |
percent := viewsSize * 100.0 / total |
|
1720 |
]. |
|
1721 |
self thumbHeight:percent |
|
1722 |
! |
|
1723 |
||
1724 |
setThumbOriginFor:aView |
|
1725 |
"get contents and size info from aView and adjust thumb origin" |
|
1726 |
||
1727 |
|percent total contentsPosition| |
|
1728 |
||
1729 |
(orientation == #vertical) ifTrue:[ |
|
1730 |
total := aView heightOfContents. |
|
1731 |
aView transformation notNil ifTrue:[ |
|
1732 |
total := aView transformation applyScaleY:total. |
|
1733 |
]. |
|
1734 |
] ifFalse:[ |
|
1735 |
total := aView widthOfContents. |
|
1736 |
aView transformation notNil ifTrue:[ |
|
1737 |
total := aView transformation applyScaleX:total. |
|
1738 |
]. |
|
1739 |
]. |
|
1740 |
(total = 0) ifTrue:[ |
|
1741 |
percent := 100 |
|
1742 |
] ifFalse:[ |
|
1743 |
contentsPosition := (orientation == #vertical) ifTrue:[aView yOriginOfContents] |
|
1744 |
ifFalse:[aView xOriginOfContents]. |
|
1745 |
percent := contentsPosition * 100.0 / total |
|
1746 |
]. |
|
1747 |
self thumbOrigin:percent |
|
1748 |
! ! |
|
1749 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1750 |
!Scroller methodsFor:'queries'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1751 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1752 |
preferredExtent |
572 | 1753 |
"return my preferredExtent" |
1754 |
||
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
1755 |
|defExt w h| |
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
1756 |
|
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
1757 |
defExt := self class defaultExtent. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1758 |
|
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
1759 |
orientation == #vertical ifTrue:[ |
617 | 1760 |
h := defExt y. |
1761 |
w := (device horizontalPixelPerMillimeter asFloat * 6) rounded. |
|
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
1762 |
] ifFalse:[ |
617 | 1763 |
w := defExt x. |
1764 |
h := (device verticalPixelPerMillimeter asFloat * 6) rounded. |
|
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
1765 |
]. |
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
1766 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1767 |
^ w @ h. |
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
1768 |
|
572 | 1769 |
"Modified: 23.4.1996 / 00:18:04 / cg" |
446 | 1770 |
! ! |
1771 |
||
205 | 1772 |
!Scroller class methodsFor:'documentation'! |
105 | 1773 |
|
205 | 1774 |
version |
709 | 1775 |
^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.57 1996-05-28 19:18:12 cg Exp $' |
105 | 1776 |
! ! |