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