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