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