52 this class implements the scroller for scrollbars. |
52 this class implements the scroller for scrollbars. |
53 it can also be used by itself for scrollbars without step-buttons. |
53 it can also be used by itself for scrollbars without step-buttons. |
54 When moved, either a predefined action is performed (scrollAction), |
54 When moved, either a predefined action is performed (scrollAction), |
55 or a model is informed via the changeMsg (which is #value: by default). |
55 or a model is informed via the changeMsg (which is #value: by default). |
56 |
56 |
|
57 The scroller can work synchronous (i.e. every move leads to an immediate evaluation |
|
58 of the action, or asynchronous (i.e. perform action on end-of move). |
|
59 By default, scrollers are synchronous. Asynchronous operation makes sense, |
|
60 if the scroll operation (redraw) is expensive and takes a long time. |
|
61 |
|
62 This class is used both for concrete instances (vertical scrollers) |
|
63 and as an abstract superclass for horizontalScrollers, sliders and |
|
64 miniScrollers. |
|
65 |
|
66 range: |
|
67 the value passed to the model or via the action blocks is scaled according |
|
68 to the min/maxRange instance variables. |
|
69 These default to 0..100 for percentage values. |
|
70 It does not make sense to change the range for scrollbar-scrollers, |
|
71 but may be useful with Sliders or in special applications. |
|
72 |
|
73 style stuff: |
|
74 |
57 Beside the obvious 3D rectangle, a scroller may draw a know-form |
75 Beside the obvious 3D rectangle, a scroller may draw a know-form |
58 (as in NeXT) or little tally marks (as on SGI) in itself. |
76 (as in NeXT) or little tally marks (as on SGI) in itself. |
59 These are controlled by the shadowForm, lightForm, tallyLevel and tallyMarks |
77 These are controlled by the shadowForm, lightForm, tallyLevel and tallyMarks |
60 instance variables. |
78 instance variables. |
61 |
|
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). |
|
64 By default, scrollers are synchronous. Asynchronous operation makes sense, |
|
65 if the scroll operation (redraw) is expensive and takes a long time. |
|
66 |
|
67 This class is used both for concrete instances (vertical scrollers) |
|
68 and as an abstract superclass for horizontalScrollers, sliders and |
|
69 miniScrollers. |
|
70 |
79 |
71 Instance variables: |
80 Instance variables: |
72 |
81 |
73 thumbOrigin <Number> origin of thumb (in percent) |
82 thumbOrigin <Number> origin of thumb (in percent) |
74 thumbHeight <Number> height of thumb (in percent) |
83 thumbHeight <Number> height of thumb (in percent) |
75 thumbColor <Color> color of thumb |
84 thumbColor <Color> color of thumb |
76 thumbFrameColor <Color> color of the frame around the thumb |
85 thumbFrameColor <Color> color of the frame around the thumb |
77 scrollAction <Block> 1 arg block to be evaluated when scrolled |
86 scrollAction <Block> 1 arg block to be evaluated when scrolled |
78 (arg is position in percent) |
87 (arg is position in percent) |
79 orientation <Symbol> #horizontal or #vertical |
88 orientation <Symbol> #horizontal or #vertical |
80 thumbFrame <Rectangle> frame of thumb in pixels (cached) |
89 thumbFrame <Rectangle> frame of thumb in pixels (cached) |
81 thumbLevel <Number> level of thumb if 3d |
90 thumbLevel <Number> level of thumb if 3d |
82 scrolling <Boolean> true during scroll |
91 scrolling <Boolean> true during scroll |
83 pressOffset <Number> temporary (offset into frame when move started) |
92 pressOffset <Number> temporary (offset into frame when move started) |
84 synchronousOperation <Boolean> true if synchronous (i.e. dont wait till release |
93 synchronousOperation <Boolean> true if synchronous (i.e. dont wait till release |
85 to perform action) |
94 to perform action) |
86 shadowForm <Form> bitmap of knob if any (shadow part) |
95 shadowForm <Form> bitmap of knob if any (shadow part) |
87 lightForm <Form> bitmap of knob if any (light part) |
96 lightForm <Form> bitmap of knob if any (light part) |
88 inset <Integer> number of pixels to inset thumb from view borders |
97 inset <Integer> number of pixels to inset thumb from view borders |
89 thumbShadowColor <Color> color do draw dark parts of thumb |
98 thumbShadowColor <Color> color do draw dark parts of thumb |
90 thumblightColor <Color> color to draw light parts of thumb |
99 thumblightColor <Color> color to draw light parts of thumb |
91 thumbEdgeStyle <SymbolOrNil> #soft or nil |
100 thumbEdgeStyle <SymbolOrNil> #soft or nil |
92 thumbHalfShadowColor <Color> used to draw smooth edges |
101 thumbHalfShadowColor <Color> used to draw smooth edges |
93 thumbHalfLightColor <Color> used to draw smooth edges |
102 thumbHalfLightColor <Color> used to draw smooth edges |
94 thumbFrameSizeDifference <Integer> number of pixels the thumb is larger than |
103 thumbFrameSizeDifference <Integer> number of pixels the thumb is larger than |
95 it should be (can be negative for mswin-style) |
104 it should be (can be negative for mswin-style) |
96 tallyLevel <Integer> if not zero, specifies if tally-marks should |
105 tallyLevel <Integer> if not zero, specifies if tally-marks should |
97 go into or out of the display (actually only <0/>0 is checked) |
106 go into or out of the display (actually only <0/>0 is checked) |
98 I dont know of a better word for these ... |
107 I dont know of a better word for these ... |
99 tallyMarks <Integer> number of tally marks |
108 tallyMarks <Integer> number of tally marks |
100 fixThumbHeight <Boolean> perform 'wrong' height computation a la mswindows |
109 fixThumbHeight <Boolean> perform 'wrong' height computation a la mswindows |
101 rangeStart <Number> the range of the scroller |
110 rangeStart <Number> the range of the scroller |
102 rangeEnd (defaults to 0..100) |
111 rangeEnd (defaults to 0..100) |
103 rangeStep not currently implemented |
112 rangeStep not currently implemented |
135 |
144 |
136 examples |
145 examples |
137 " |
146 " |
138 basic scroller setup: |
147 basic scroller setup: |
139 |
148 |
140 |top s| |
149 |top s| |
141 |
150 |
142 top := StandardSystemView new extent:200@200. |
151 top := StandardSystemView new extent:200@200. |
143 s := Scroller in:top. |
152 s := Scroller in:top. |
144 s origin:(0.0@0.0) corner:(20@1.0). |
153 s origin:(0.0@0.0) corner:(20@1.0). |
145 s thumbHeight:10. 'percent'. |
154 s thumbHeight:10. 'percent'. |
146 top open |
155 top open |
147 |
156 |
148 |
157 |
149 setting its thumb-height: |
158 setting its thumb-height: |
150 |top s| |
159 |top s| |
151 |
160 |
152 top := StandardSystemView new extent:200@200. |
161 top := StandardSystemView new extent:200@200. |
153 s := Scroller in:top. |
162 s := Scroller in:top. |
154 s origin:(0.0@0.0) corner:(20@1.0). |
163 s origin:(0.0@0.0) corner:(20@1.0). |
155 s thumbHeight:50. 'percent'. |
164 s thumbHeight:50. 'percent'. |
156 top open |
165 top open |
157 |
166 |
158 |
167 |
159 setting its thumb-origin: |
168 setting its thumb-origin: |
160 |top s| |
169 |top s| |
161 |
170 |
162 top := StandardSystemView new extent:200@200. |
171 top := StandardSystemView new extent:200@200. |
163 s := Scroller in:top. |
172 s := Scroller in:top. |
164 s origin:(0.0@0.0) corner:(20@1.0). |
173 s origin:(0.0@0.0) corner:(20@1.0). |
165 s thumbHeight:10. 'percent'. |
174 s thumbHeight:10. 'percent'. |
166 s thumbOrigin:30. 'percent'. |
175 s thumbOrigin:30. 'percent'. |
167 top open |
176 top open |
168 |
177 |
169 |
178 |
170 a scroller with action block (ST/X style): |
179 a scroller with action block (ST/X style): |
171 |
180 |
172 |top s| |
181 |top s| |
173 |
182 |
174 top := StandardSystemView new extent:200@200. |
183 top := StandardSystemView new extent:200@200. |
175 s := Scroller in:top. |
184 s := Scroller in:top. |
176 s origin:(0.0@0.0) corner:(20@1.0). |
185 s origin:(0.0@0.0) corner:(20@1.0). |
177 s thumbHeight:10. 'percent'. |
186 s thumbHeight:10. 'percent'. |
178 s scrollAction:[:percent | Transcript show:'moved to: '; showCr:percent asFloat]. |
187 s scrollAction:[:percent | Transcript show:'moved to: '; showCr:percent asFloat]. |
179 top open |
188 top open |
|
189 |
|
190 |
|
191 setting its range: |
|
192 |
|
193 |top s| |
|
194 |
|
195 top := StandardSystemView new extent:200@200. |
|
196 s := Scroller in:top. |
|
197 s origin:(0.0@0.0) corner:(20@1.0). |
|
198 s thumbHeight:10. 'percent'. |
|
199 s scrollAction:[:percent | Transcript show:'moved to: '; showCr:percent asFloat]. |
|
200 s start:0 stop:1. |
|
201 top open |
180 |
202 |
181 |
203 |
182 create a scroller in its default extent and have it positioned |
204 create a scroller in its default extent and have it positioned |
183 at the right; beside another view: |
205 at the side; beside another view: |
184 |
206 |
185 |top s v| |
207 |top s v| |
186 |
208 |
187 top := StandardSystemView new extent:200@200. |
209 top := StandardSystemView new extent:200@200. |
188 s := Scroller in:top. |
210 s := Scroller in:top. |
189 s origin:(0.0@0.0) corner:(0.0@1.0). |
211 s origin:(0.0@0.0) corner:(0.0@1.0). |
190 s rightInset:(s preferredExtent x negated). |
212 s rightInset:(s preferredExtent x negated). |
191 s thumbHeight:10. |
213 s thumbHeight:10. |
192 s level:1. |
214 s level:1. |
193 |
215 |
194 v := View in:top. |
216 v := View in:top. |
195 v origin:0.0@0.0 corner:1.0@1.0. |
217 v origin:0.0@0.0 corner:1.0@1.0. |
196 v leftInset:(s preferredExtent x). |
218 v leftInset:(s preferredExtent x). |
197 v viewBackground:Color red. |
219 v viewBackground:Color red. |
198 v level:2. |
220 v level:2. |
199 |
221 |
200 top open |
222 top open |
201 |
223 |
202 |
224 |
203 using a model (ST-80 style): |
225 using a model (ST-80 style): |
204 |
226 |
205 |top s m| |
227 |top s m| |
206 |
228 |
207 m := 0 asValue. |
229 m := 0 asValue. |
208 m inspect. 'look at value'. |
230 InspectorView openOn:m monitor:'value'. 'look at value'. |
209 top := StandardSystemView new extent:200@200. |
231 |
210 s := Scroller in:top. |
232 top := StandardSystemView new extent:200@200. |
211 s origin:(0.0@0.0) corner:(20@1.0). |
233 s := Scroller in:top. |
212 s thumbHeight:10. 'percent'. |
234 s origin:(0.0@0.0) corner:(20@1.0). |
213 s model:m. |
235 s thumbHeight:10. 'percent'. |
214 top open |
236 s model:m. |
|
237 top open |
215 |
238 |
216 |
239 |
217 using a different changeSelector: |
240 using a different changeSelector: |
218 |
241 |
219 |top s1 s2 m| |
242 |top s1 s2 m| |
220 |
243 |
221 m := Plug new. |
244 m := Plug new. |
222 m respondTo:#value1: with:[:v | Transcript show:'scroller 1 moved to: '; showCr:v]. |
245 m respondTo:#value1: with:[:v | Transcript show:'scroller 1 moved to: '; showCr:v]. |
223 m respondTo:#value2: with:[:v | Transcript show:'scroller 2 moved to: '; showCr:v]. |
246 m respondTo:#value2: with:[:v | Transcript show:'scroller 2 moved to: '; showCr:v]. |
224 |
247 |
225 top := StandardSystemView new extent:200@200. |
248 top := StandardSystemView new extent:200@200. |
226 s1 := Scroller in:top. |
249 s1 := Scroller in:top. |
227 s1 origin:(0.0@0.0) corner:(20@1.0). |
250 s1 origin:(0.0@0.0) corner:(20@1.0). |
228 s1 thumbHeight:10. 'percent'. |
251 s1 thumbHeight:10. 'percent'. |
229 s1 model:m; change:#value1:. |
252 s1 model:m; change:#value1:. |
230 |
253 |
231 s2 := Scroller in:top. |
254 s2 := Scroller in:top. |
232 s2 origin:(30@0.0) corner:(50@1.0). |
255 s2 origin:(30@0.0) corner:(50@1.0). |
233 s2 thumbHeight:10. 'percent'. |
256 s2 thumbHeight:10. 'percent'. |
234 s2 model:m; change:#value2:. |
257 s2 model:m; change:#value2:. |
235 top open |
258 top open |
236 " |
259 " |
237 ! ! |
260 ! ! |
238 |
261 |
239 !Scroller class methodsFor:'defaults'! |
262 !Scroller class methodsFor:'defaults'! |
240 |
263 |
350 ^ rangeStart |
373 ^ rangeStart |
351 |
374 |
352 "Modified: 1.3.1996 / 19:12:10 / cg" |
375 "Modified: 1.3.1996 / 19:12:10 / cg" |
353 ! |
376 ! |
354 |
377 |
355 start:start |
378 or may be not available for the copy |
356 "set the scrollers range start" |
|
357 |
|
358 rangeStart := start. |
|
359 ! |
|
360 |
|
361 start:start stop:stop |
|
362 "set the scrollers range" |
|
363 |
|
364 rangeStart := start. |
|
365 rangeEnd := stop |
|
366 ! |
|
367 |
|
368 step |
|
369 "return the scrollers range step" |
|
370 |
|
371 ^ rangeStep |
|
372 |
|
373 "Modified: 1.3.1996 / 19:12:16 / cg" |
|
374 ! |
|
375 |
|
376 step:step |
|
377 "set the scrollers range step" |
|
378 |
|
379 rangeStep := step |
|
380 ! |
|
381 |
|
382 stop |
|
383 "return the scrollers range max" |
|
384 |
|
385 ^ rangeEnd |
|
386 |
|
387 "Modified: 1.3.1996 / 19:12:20 / cg" |
|
388 ! |
|
389 |
|
390 stop:stop |
|
391 "set the scrollers range stop" |
|
392 |
|
393 rangeEnd := stop |
|
394 ! |
|
395 |
|
396 thumbFrame |
|
397 "return the area used by the thumbFrame (in device coordinates). |
|
398 Allows access to the thumbs physical screen position, for |
|
399 example to position a label below (see Slider-Examples)" |
|
400 |
|
401 thumbFrame isNil ifTrue:[ self computeThumbFrame]. |
|
402 ^ thumbFrame |
|
403 ! |
|
404 |
|
405 thumbHeight |
|
406 "return the thumbs height (in percent by default)" |
|
407 |
|
408 ^ thumbHeight * (rangeEnd - rangeStart) / 100 |
|
409 |
|
410 "Modified: 1.3.1996 / 19:12:28 / cg" |
|
411 ! |
|
412 |
|
413 thumbHeight:aNumber |
|
414 "set the thumbs height (in percent by default)" |
|
415 |
|
416 |newHeight realNewHeight oldFrame nBg| |
|
417 |
|
418 newHeight := aNumber / (rangeEnd - rangeStart / 100). |
|
419 |
|
420 (newHeight > 100) ifTrue:[ |
|
421 realNewHeight := 100 |
|
422 ] ifFalse:[ |
|
423 realNewHeight := newHeight |
|
424 ]. |
|
425 ((realNewHeight ~= thumbHeight) or:[thumbFrame isNil]) ifTrue:[ |
|
426 thumbHeight := realNewHeight. |
|
427 |
|
428 (DefaultFullViewBackground notNil |
|
429 and:[DefaultViewBackground notNil |
|
430 and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[ |
|
431 realNewHeight >= 100 ifTrue:[ |
|
432 nBg := DefaultFullViewBackground. |
|
433 ] ifFalse:[ |
|
434 nBg := DefaultViewBackground |
|
435 ]. |
|
436 nBg := nBg on:device. |
|
437 nBg ~~ viewBackground ifTrue:[ |
|
438 self viewBackground:nBg. |
|
439 shown ifTrue:[self clear]. |
|
440 ] |
|
441 ]. |
|
442 |
|
443 shown ifTrue:[ |
|
444 oldFrame := thumbFrame. |
|
445 self computeThumbFrame. |
|
446 (fixThumbHeight or:[oldFrame ~~ thumbFrame]) ifTrue:[ |
|
447 oldFrame notNil ifTrue:[ |
|
448 self drawThumbBackgroundInX:(oldFrame left) |
|
449 y:(oldFrame top) |
|
450 width:(oldFrame width) |
|
451 height:(oldFrame height). |
|
452 ]. |
|
453 self drawThumb |
|
454 ] |
|
455 ] ifFalse:[ |
|
456 thumbFrame := nil |
|
457 ] |
|
458 ] |
|
459 ! |
|
460 |
|
461 thumbOrigin |
|
462 "return the thumbs origin (in percent by default)" |
|
463 |
|
464 ^ thumbOrigin * (rangeEnd - rangeStart) / 100 + rangeStart |
|
465 |
|
466 "Modified: 1.3.1996 / 19:12:37 / cg" |
|
467 ! |
|
468 |
|
469 thumbOrigin:aNumber |
|
470 "set the thumbs origin (in percent by default)" |
|
471 |
|
472 |newOrigin realNewOrigin |
|
473 oldFrame oldTop oldBot oldLeft oldRight |
|
474 thumbTop thumbBot thumbLeft thumbRight |
|
475 tH "{ Class: SmallInteger }" |
|
476 tW |
|
477 delta needFullDraw |
|
478 bgLeft bgTop bgWidth bgHeight| |
|
479 |
|
480 newOrigin := (aNumber - rangeStart) asFloat / (rangeEnd - rangeStart / 100). |
|
481 |
|
482 ((newOrigin + thumbHeight) > 100) ifTrue:[ |
|
483 realNewOrigin := 100 - thumbHeight |
|
484 ] ifFalse: [ |
|
485 realNewOrigin := newOrigin |
|
486 ]. |
|
487 (realNewOrigin > 100) ifTrue:[ |
|
488 realNewOrigin := 100 |
|
489 ] ifFalse: [ |
|
490 (realNewOrigin < 0) ifTrue:[ |
|
491 realNewOrigin := 0 |
|
492 ] |
|
493 ]. |
|
494 ((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[ |
|
495 thumbOrigin := realNewOrigin. |
|
496 |
|
497 shown ifTrue:[ |
|
498 oldFrame := thumbFrame. |
|
499 self computeThumbFrame. |
|
500 (thumbHeight = 100) ifTrue:[ |
|
501 "/ full: don't draw |
|
502 ^ self |
|
503 ]. |
|
504 |
|
505 (thumbFrame ~~ oldFrame) ifTrue:[ |
|
506 oldFrame isNil ifTrue:[ |
|
507 self drawThumb. |
|
508 ^ self |
|
509 ]. |
|
510 tH := thumbFrame height. |
|
511 tW := thumbFrame width. |
|
512 |
|
513 oldTop := oldFrame top. |
|
514 oldBot := oldTop + tH. |
|
515 oldLeft := oldFrame left. |
|
516 oldRight := oldLeft + tW. |
|
517 |
|
518 thumbTop := thumbFrame top. |
|
519 thumbBot := thumbTop + tH. |
|
520 thumbLeft := thumbFrame left. |
|
521 thumbRight := thumbLeft + tW. |
|
522 |
|
523 needFullDraw := self exposeEventPending |
|
524 or:[((orientation == #vertical) and:[oldBot >= height]) |
|
525 or:[((orientation ~~ #vertical) and:[oldRight >= width])]]. |
|
526 |
|
527 needFullDraw ifTrue:[ |
|
528 " |
|
529 cannot copy since thumb was below the end |
|
530 or may be not available for the copy |
|
531 " |
379 " |
532 (orientation == #vertical) ifTrue:[ |
380 (orientation == #vertical) ifTrue:[ |
533 self drawThumbBackgroundInX:thumbLeft y:oldTop |
381 self drawThumbBackgroundInX:thumbLeft y:oldTop |
534 width:tW height:(height - oldTop). |
382 width:tW height:(height - oldTop). |
535 ] ifFalse:[ |
383 ] ifFalse:[ |
609 thumbFrame := nil |
457 thumbFrame := nil |
610 ] |
458 ] |
611 ] |
459 ] |
612 ! |
460 ! |
613 |
461 |
614 thumbOrigin:originNumber thumbHeight:heightNumber |
462 ifTrue:[ |
615 "set both thumbs height and origin (in percent by default)" |
463 self drawThumbBackgroundInX:thumbLeft y:oldTop |
616 |
464 width:tW height:(height - oldTop). |
617 |newHeight newOrigin realNewOrigin realNewHeight old new changed nBg| |
465 ] ifFalse:[ |
618 |
466 self drawThumbBackgroundInX:oldLeft y:thumbTop |
619 newOrigin := originNumber - rangeStart / (rangeEnd - rangeStart / 100). |
467 width:(width - oldLeft) height:tH. |
620 newHeight := heightNumber / (rangeEnd - rangeStart / 100). |
468 ]. |
621 |
469 self drawThumb. |
622 (newHeight > 100) ifTrue:[ |
470 ^ self |
623 realNewHeight := 100 |
471 ]. |
624 ] ifFalse:[ |
472 |
625 realNewHeight := newHeight |
473 self catchExpose. |
626 ]. |
474 " |
627 ((newOrigin + realNewHeight) > 100) ifTrue:[ |
475 copy the thumbs pixels |
628 realNewOrigin := 100 - realNewHeight |
476 " |
629 ] ifFalse: [ |
477 (orientation == #vertical) ifTrue:[ |
630 realNewOrigin := newOrigin |
478 self copyFrom:self x:thumbLeft y:oldTop |
631 ]. |
479 toX:thumbLeft y:thumbTop |
632 (realNewOrigin < 0) ifTrue: [ |
480 width:tW height:tH. |
633 realNewOrigin := 0 |
481 ] ifFalse:[ |
634 ]. |
482 self copyFrom:self x:oldLeft y:thumbTop |
635 |
483 toX:thumbLeft y:thumbTop |
636 changed := (realNewHeight ~= thumbHeight) or:[realNewOrigin ~= thumbOrigin]. |
484 width:tW height:tH. |
637 (changed or:[thumbFrame isNil]) ifTrue:[ |
485 ]. |
638 old := self absFromPercent:thumbOrigin. |
486 |
639 new := self absFromPercent:realNewOrigin. |
487 " |
640 changed := old ~~ new. |
488 clear some of the previous thumbs area to background |
|
489 " |
|
490 (orientation == #vertical) ifTrue:[ |
|
491 bgLeft := thumbLeft. |
|
492 bgWidth := tW. |
|
493 oldTop > thumbTop ifTrue:[ |
|
494 delta := oldTop - thumbTop. |
|
495 oldTop > thumbBot ifTrue:[ |
|
496 bgTop := oldTop. |
|
497 bgHeight := tH + 1 |
|
498 ] ifFalse:[ |
|
499 bgTop := thumbBot. |
|
500 bgHeight := delta |
|
501 ] |
|
502 ] ifFalse:[ |
|
503 delta := thumbTop - oldTop. |
|
504 oldBot < thumbTop ifTrue:[ |
|
505 bgTop := oldTop. |
|
506 bgHeight := tH + 1 |
|
507 ] ifFalse:[ |
|
508 bgTop := oldTop. |
|
509 bgHeight := delta |
|
510 ] |
|
511 ]. |
|
512 ] ifFalse:[ |
|
513 bgTop := thumbTop. |
|
514 bgHeight := tH. |
|
515 oldLeft > thumbLeft ifTrue:[ |
|
516 delta := oldLeft - thumbLeft. |
|
517 oldLeft > thumbRight ifTrue:[ |
|
518 bgLeft := oldLeft. |
|
519 bgWidth := tW + 1. |
|
520 ] ifFalse:[ |
|
521 bgLeft := thumbRight. |
|
522 bgWidth := delta. |
|
523 ] |
|
524 ] ifFalse:[ |
|
525 delta := thumbLeft - oldLeft. |
|
526 oldRight < thumbLeft ifTrue:[ |
|
527 bgLeft := oldLeft. |
|
528 bgWidth := tW + 1. |
|
529 ] ifFalse:[ |
|
530 bgLeft := oldLeft. |
|
531 bgWidth := delta. |
|
532 ] |
|
533 ]. |
|
534 ]. |
|
535 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
536 self waitForExpose |
|
537 ] |
|
538 ] ifFalse:[ |
|
539 thumbFrame := nil |
|
540 ] |
|
541 ] |
|
542 ! |
|
543 |
|
544 start:start stop:stop step:step |
|
545 "set the scrollers range" |
|
546 |
|
547 rangeStart := start. |
|
548 rangeEnd := stop. |
|
549 rangeStep := step. |
|
550 |
|
551 "Created: 1.3.1996 / 19:39:18 / cg" |
|
552 ! |
|
553 |
|
554 step |
|
555 "return the scrollers range step" |
|
556 |
|
557 ^ rangeStep |
|
558 |
|
559 "Modified: 1.3.1996 / 19:12:16 / cg" |
|
560 ! |
|
561 |
|
562 :thumbTop |
|
563 width:(width - oldLeft) height:tH. |
|
564 ]. |
|
565 self drawThumb. |
|
566 ^ self |
|
567 ]. |
|
568 |
|
569 self catchExpose. |
|
570 " |
|
571 copy the thumbs pixels |
|
572 " |
|
573 (orientation == #vertical) ifTrue:[ |
|
574 self copyFrom:self x:thumbLeft y:oldTop |
|
575 toX:thumbLeft y:thumbTop |
|
576 width:tW height:tH. |
|
577 ] ifFalse:[ |
|
578 self copyFrom:self x:oldLeft y:thumbTop |
|
579 toX:thumbLeft y:thumbTop |
|
580 width:tW height:tH. |
|
581 ]. |
|
582 |
|
583 " |
|
584 clear some of the previous thumbs area to background |
|
585 " |
|
586 (orientation == #vertical) ifTrue:[ |
|
587 bgLeft := thumbLeft. |
|
588 bgWidth := tW. |
|
589 oldTop > thumbTop ifTrue:[ |
|
590 delta := oldTop - thumbTop. |
|
591 oldTop > thumbBot ifTrue:[ |
|
592 bgTop := oldTop. |
|
593 bgHeight := tH + 1 |
|
594 ] ifFalse:[ |
|
595 bgTop := thumbBot. |
|
596 bgHeight := delta |
|
597 ] |
|
598 ] ifFalse:[ |
|
599 delta := thumbTop - oldTop. |
|
600 oldBot < thumbTop ifTrue:[ |
|
601 bgTop := oldTop. |
|
602 bgHeight := tH + 1 |
|
603 ] ifFalse:[ |
|
604 bgTop := oldTop. |
|
605 bgHeight := delta |
|
606 ] |
|
607 ]. |
|
608 ] ifFalse:[ |
|
609 bgTop := thumbTop. |
|
610 bgHeight := tH. |
|
611 oldLeft > thumbLeft ifTrue:[ |
|
612 delta := oldLeft - thumbLeft. |
|
613 oldLeft > thumbRight ifTrue:[ |
|
614 bgLeft := oldLeft. |
|
615 bgWidth := tW + 1. |
|
616 ] ifFalse:[ |
|
617 bgLeft := thumbRight. |
|
618 bgWidth := delta. |
|
619 ] |
|
620 ] ifFalse:[ |
|
621 delta := thumbLeft - oldLeft. |
|
622 oldRight < thumbLeft ifTrue:[ |
|
623 bgLeft := oldLeft. |
|
624 bgWidth := tW + 1. |
|
625 ] ifFalse:[ |
|
626 bgLeft := oldLeft. |
|
627 bgWidth := delta. |
|
628 ] |
|
629 ]. |
|
630 ]. |
|
631 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
632 self waitForExpose |
|
633 ] |
|
634 ] ifFalse:[ |
|
635 thumbFrame := nil |
|
636 ] |
|
637 ] |
|
638 ! |
|
639 |
|
640 stop |
|
641 "return the scrollers range max" |
|
642 |
|
643 ^ rangeEnd |
|
644 |
|
645 "Modified: 1.3.1996 / 19:12:20 / cg" |
|
646 ! |
|
647 |
|
648 copy the thumbs pixels |
|
649 " |
|
650 (orientation == #vertical) ifTrue:[ |
|
651 self copyFrom:self x:thumbLeft y:oldTop |
|
652 toX:thumbLeft y:thumbTop |
|
653 width:tW height:tH. |
|
654 ] ifFalse:[ |
|
655 self copyFrom:self x:oldLeft y:thumbTop |
|
656 toX:thumbLeft y:thumbTop |
|
657 width:tW height:tH. |
|
658 ]. |
|
659 |
|
660 " |
|
661 clear some of the previous thumbs area to background |
|
662 " |
|
663 (orientation == #vertical) ifTrue:[ |
|
664 bgLeft := thumbLeft. |
|
665 bgWidth := tW. |
|
666 oldTop > thumbTop ifTrue:[ |
|
667 delta := oldTop - thumbTop. |
|
668 oldTop > thumbBot ifTrue:[ |
|
669 bgTop := oldTop. |
|
670 bgHeight := tH + 1 |
|
671 ] ifFalse:[ |
|
672 bgTop := thumbBot. |
|
673 bgHeight := delta |
|
674 ] |
|
675 ] ifFalse:[ |
|
676 delta := thumbTop - oldTop. |
|
677 oldBot < thumbTop ifTrue:[ |
|
678 bgTop := oldTop. |
|
679 bgHeight := tH + 1 |
|
680 ] ifFalse:[ |
|
681 bgTop := oldTop. |
|
682 bgHeight := delta |
|
683 ] |
|
684 ]. |
|
685 ] ifFalse:[ |
|
686 bgTop := thumbTop. |
|
687 bgHeight := tH. |
|
688 oldLeft > thumbLeft ifTrue:[ |
|
689 delta := oldLeft - thumbLeft. |
|
690 oldLeft > thumbRight ifTrue:[ |
|
691 bgLeft := oldLeft. |
|
692 bgWidth := tW + 1. |
|
693 ] ifFalse:[ |
|
694 bgLeft := thumbRight. |
|
695 bgWidth := delta. |
|
696 ] |
|
697 ] ifFalse:[ |
|
698 delta := thumbLeft - oldLeft. |
|
699 oldRight < thumbLeft ifTrue:[ |
|
700 bgLeft := oldLeft. |
|
701 bgWidth := tW + 1. |
|
702 ] ifFalse:[ |
|
703 bgLeft := oldLeft. |
|
704 bgWidth := delta. |
|
705 ] |
|
706 ]. |
|
707 ]. |
|
708 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
709 self waitForExpose |
|
710 ] |
|
711 ] ifFalse:[ |
|
712 thumbFrame := nil |
|
713 ] |
|
714 ] |
|
715 ! |
|
716 |
|
717 umbTop - oldTop. |
|
718 oldBot < thumbTop ifTrue:[ |
|
719 bgTop := oldTop. |
|
720 bgHeight := tH + 1 |
|
721 ] ifFalse:[ |
|
722 bgTop := oldTop. |
|
723 bgHeight := delta |
|
724 ] |
|
725 ]. |
|
726 ] ifFalse:[ |
|
727 bgTop := thumbTop. |
|
728 bgHeight := tH. |
|
729 oldLeft > thumbLeft ifTrue:[ |
|
730 delta := oldLeft - thumbLeft. |
|
731 oldLeft > thumbRight ifTrue:[ |
|
732 bgLeft := oldLeft. |
|
733 bgWidth := tW + 1. |
|
734 ] ifFalse:[ |
|
735 bgLeft := thumbRight. |
|
736 bgWidth := delta. |
|
737 ] |
|
738 ] ifFalse:[ |
|
739 delta := thumbLeft - oldLeft. |
|
740 oldRight < thumbLeft ifTrue:[ |
|
741 bgLeft := oldLeft. |
|
742 bgWidth := tW + 1. |
|
743 ] ifFalse:[ |
|
744 bgLeft := oldLeft. |
|
745 bgWidth := delta. |
|
746 ] |
|
747 ]. |
|
748 ]. |
|
749 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
750 self waitForExpose |
|
751 ] |
|
752 ] ifFalse:[ |
|
753 thumbFrame := nil |
|
754 ] |
|
755 ] |
|
756 ! |
|
757 |
|
758 thumbHeight |
|
759 "return the thumbs height (in percent by default)" |
|
760 |
|
761 ^ thumbHeight * (rangeEnd - rangeStart) / 100 |
|
762 |
|
763 "Modified: 1.3.1996 / 19:12:28 / cg" |
|
764 ! |
|
765 |
|
766 [ |
|
767 bgLeft := thumbRight. |
|
768 bgWidth := delta. |
|
769 ] |
|
770 ] ifFalse:[ |
|
771 delta := thumbLeft - oldLeft. |
|
772 oldRight < thumbLeft ifTrue:[ |
|
773 bgLeft := oldLeft. |
|
774 bgWidth := tW + 1. |
|
775 ] ifFalse:[ |
|
776 bgLeft := oldLeft. |
|
777 bgWidth := delta. |
|
778 ] |
|
779 ]. |
|
780 ]. |
|
781 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
782 self waitForExpose |
|
783 ] |
|
784 ] ifFalse:[ |
|
785 thumbFrame := nil |
|
786 ] |
|
787 ] |
|
788 ! |
|
789 |
|
790 thumbOrigin |
|
791 "return the thumbs origin (in percent by default)" |
|
792 |
|
793 ^ thumbOrigin * (rangeEnd - rangeStart) / 100 + rangeStart |
|
794 |
|
795 "Modified: 1.3.1996 / 19:12:37 / cg" |
|
796 ! |
|
797 |
|
798 old ~~ new. |
641 changed ifFalse:[ |
799 changed ifFalse:[ |
642 old := self absFromPercent:thumbHeight. |
800 old := self absFromPercent:thumbHeight. |
643 new := self absFromPercent:realNewHeight. |
801 new := self absFromPercent:realNewHeight. |
644 changed := (old ~~ new) |
802 changed := (old ~~ new) |
645 ]. |
803 ]. |
674 ] ifFalse:[ |
832 ] ifFalse:[ |
675 thumbFrame := nil |
833 thumbFrame := nil |
676 ] |
834 ] |
677 ] |
835 ] |
678 ] |
836 ] |
679 ! ! |
837 ! |
680 |
838 |
681 !Scroller methodsFor:'accessing-behavior'! |
839 humbColor. |
682 |
|
683 action:aBlock |
|
684 "for protocol compatibility; same as scrollAction:" |
|
685 |
|
686 self scrollAction:aBlock |
|
687 ! |
|
688 |
|
689 asynchronousOperation |
|
690 "set scroll-mode to be asynchronous - scroll action is performed after |
|
691 scrolling, when mouse-button is finally released" |
|
692 |
|
693 synchronousOperation := false |
|
694 ! |
|
695 |
|
696 scrollAction |
|
697 "answer the scroll action block" |
|
698 |
|
699 ^ scrollAction |
|
700 ! |
|
701 |
|
702 scrollAction:aBlock |
|
703 "set the scroll action, aBlock which is evaluated when scrolled" |
|
704 |
|
705 scrollAction := aBlock |
|
706 ! |
|
707 |
|
708 scrollDownAction:aBlock |
|
709 "ignored - |
|
710 but implemented, so that scroller can be used in place of a scrollbar" |
|
711 ! |
|
712 |
|
713 scrollUpAction:aBlock |
|
714 "ignored - |
|
715 but implemented, so that scroller can be used in place of a scrollbar" |
|
716 ! |
|
717 |
|
718 synchronousOperation |
|
719 "set scroll-mode to be synchronous - scroll action is performed for |
|
720 every movement of thumb" |
|
721 |
|
722 synchronousOperation := true |
|
723 ! ! |
|
724 |
|
725 !Scroller methodsFor:'accessing-look'! |
|
726 |
|
727 is3D |
|
728 styleSheet name = #mswindows ifTrue:[^ true]. |
|
729 ^ super is3D |
|
730 ! |
|
731 |
|
732 orientation |
|
733 "return the scrollers orientation (#vertical or #horizontal)" |
|
734 |
|
735 ^ orientation |
|
736 ! |
|
737 |
|
738 thumbColor |
|
739 "return the thumbs color" |
|
740 |
|
741 ^ thumbColor |
|
742 ! |
|
743 |
|
744 thumbColor:aColor |
|
745 "change the color of the thumb" |
|
746 |
|
747 thumbColor := aColor on:device. |
|
748 (styleSheet name ~~ #normal) ifTrue:[ |
|
749 thumbShadowColor := aColor darkened on:device. |
|
750 thumbLightColor := aColor lightened on:device. |
|
751 thumbHalfShadowColor := thumbShadowColor darkened on:device. |
|
752 thumbHalfLightColor := thumbLightColor lightened on:device. |
|
753 ]. |
|
754 shown ifTrue:[ |
|
755 self redraw |
|
756 ] |
|
757 ! ! |
|
758 |
|
759 !Scroller methodsFor:'drawing'! |
|
760 |
|
761 drawHandleFormAtX:x y:y |
|
762 thumbShadowColor := thumbShadowColor on:device. |
|
763 thumbLightColor := thumbLightColor on:device. |
|
764 |
|
765 self paint:thumbShadowColor. |
|
766 self displayForm:shadowForm x:x y:y. |
|
767 self paint:thumbLightColor. |
|
768 self displayForm:lightForm x:x y:y. |
|
769 ! |
|
770 |
|
771 drawThumb |
|
772 "draw the thumb" |
|
773 |
|
774 |handleX handleY l t |
|
775 w "{ Class: SmallInteger }" |
|
776 h "{ Class: SmallInteger }" |
|
777 x "{ Class: SmallInteger }" |
|
778 y "{ Class: SmallInteger }" |
|
779 mm xL xR yT yB color1 color2| |
|
780 |
|
781 (thumbHeight >= 100) ifTrue:[^ self]. |
|
782 orientation == #vertical ifTrue:[ |
|
783 thumbFrame height >= height ifTrue:[^ self]. |
|
784 ] ifFalse:[ |
|
785 thumbFrame width >= width ifTrue:[^ self]. |
|
786 ]. |
|
787 |
|
788 l := thumbFrame left. |
|
789 t := thumbFrame top. |
|
790 w := thumbFrame width. |
|
791 h := thumbFrame height. |
|
792 self paint:thumbColor. |
|
793 self fillRectangleX:l y:t width:w-1 height:h. |
840 self fillRectangleX:l y:t width:w-1 height:h. |
794 |
841 |
795 thumbLevel == 0 ifTrue:[ |
842 thumbLevel == 0 ifTrue:[ |
796 thumbFrameColor notNil ifTrue:[ |
843 thumbFrameColor notNil ifTrue:[ |
797 self paint:thumbFrameColor. |
844 self paint:thumbFrameColor. |
895 self paint:color2. |
942 self paint:color2. |
896 self displayLineFromX:x y:yT toX:x y:yB |
943 self displayLineFromX:x y:yT toX:x y:yB |
897 ] |
944 ] |
898 ] |
945 ] |
899 ] |
946 ] |
900 ! |
947 ! ! |
901 |
948 |
902 drawThumbBackgroundInX:x y:y width:w height:h |
949 !Scroller methodsFor:'accessing-behavior'! |
903 "draw part of the thumbs background; defined as a separate |
950 |
904 method, to allow drawing of arbitrary patterns under thumb |
951 start |
905 (see ColorSlider)." |
952 "return the scrollers range min" |
906 |
953 |
907 shown ifTrue:[ |
954 ^ rangeStart |
908 self clearRectangleX:x y:y width:w height:h. |
955 |
909 frameBeforeMove notNil ifTrue:[ |
956 "Modified: 1.3.1996 / 19:12:10 / cg" |
910 self clippedTo:(Rectangle left:x top:y width:w height:h) do:[ |
957 ! |
911 |gX gY gW gH| |
958 |
912 |
959 g" |
913 gX := frameBeforeMove left. |
960 ! |
914 gY := frameBeforeMove top. |
961 |
915 gW := frameBeforeMove width. |
962 return the scrollers range max" |
916 gH := frameBeforeMove height. |
963 |
917 |
964 ^ rangeEnd |
918 ghostColor notNil ifTrue:[ |
965 |
919 self fillRectangle:frameBeforeMove with:ghostColor. |
966 "Modified: 1.3.1996 / 19:12:20 / cg" |
920 ]. |
967 ! |
921 (ghostLevel ~~ 0) ifTrue:[ |
968 |
922 self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel |
969 / 19:12:20 / cg" |
923 ]. |
970 ! |
924 ghostFrameColor notNil ifTrue:[ |
971 |
925 self paint:ghostFrameColor. |
972 a used by the thumbFrame (in device coordinates). |
926 self displayRectangleX:gX y:gY width:gW height:gH |
973 Allows access to the thumbs physical screen position, for |
927 ] |
974 example to position a label below (see Slider-Examples)" |
|
975 |
|
976 thumbFrame isNil ifTrue:[ self computeThumbFrame]. |
|
977 ^ thumbFrame |
|
978 ! |
|
979 |
|
980 example to position a label below (see Slider-Examples)" |
|
981 |
|
982 thumbFrame isNil ifTrue:[ self computeThumbFrame]. |
|
983 ^ thumbFrame |
|
984 ! |
|
985 |
|
986 self copyFrom:self x:thumbLeft y:oldTop |
|
987 toX:thumbLeft y:thumbTop |
|
988 width:tW height:tH. |
|
989 ] ifFalse:[ |
|
990 self copyFrom:self x:oldLeft y:thumbTop |
|
991 toX:thumbLeft y:thumbTop |
|
992 width:tW height:tH. |
|
993 ]. |
|
994 |
|
995 " |
|
996 clear some of the previous thumbs area to background |
|
997 " |
|
998 (orientation == #vertical) ifTrue:[ |
|
999 bgLeft := thumbLeft. |
|
1000 bgWidth := tW. |
|
1001 oldTop > thumbTop ifTrue:[ |
|
1002 delta := oldTop - thumbTop. |
|
1003 oldTop > thumbBot ifTrue:[ |
|
1004 bgTop := oldTop. |
|
1005 bgHeight := tH + 1 |
|
1006 ] ifFalse:[ |
|
1007 bgTop := thumbBot. |
|
1008 bgHeight := delta |
|
1009 ] |
|
1010 ] ifFalse:[ |
|
1011 delta := thumbTop - oldTop. |
|
1012 oldBot < thumbTop ifTrue:[ |
|
1013 bgTop := oldTop. |
|
1014 bgHeight := tH + 1 |
|
1015 ] ifFalse:[ |
|
1016 bgTop := oldTop. |
|
1017 bgHeight := delta |
|
1018 ] |
|
1019 ]. |
|
1020 ] ifFalse:[ |
|
1021 bgTop := thumbTop. |
|
1022 bgHeight := tH. |
|
1023 oldLeft > thumbLeft ifTrue:[ |
|
1024 delta := oldLeft - thumbLeft. |
|
1025 oldLeft > thumbRight ifTrue:[ |
|
1026 bgLeft := oldLeft. |
|
1027 bgWidth := tW + 1. |
|
1028 ] ifFalse:[ |
|
1029 bgLeft := thumbRight. |
|
1030 bgWidth := delta. |
|
1031 ] |
|
1032 ] ifFalse:[ |
|
1033 delta := thumbLeft - oldLeft. |
|
1034 oldRight < thumbLeft ifTrue:[ |
|
1035 bgLeft := oldLeft. |
|
1036 bgWidth := tW + 1. |
|
1037 ] ifFalse:[ |
|
1038 bgLeft := oldLeft. |
|
1039 bgWidth := delta. |
|
1040 ] |
|
1041 ]. |
|
1042 ]. |
|
1043 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
1044 self waitForExpose |
928 ] |
1045 ] |
|
1046 ] ifFalse:[ |
|
1047 thumbFrame := nil |
929 ] |
1048 ] |
930 ] |
1049 ] |
931 ! ! |
1050 ! ! |
932 |
1051 |
933 !Scroller methodsFor:'event handling'! |
1052 !Scroller methodsFor:'accessing-look'! |
934 |
1053 |
935 buttonMotion:state x:x y:y |
1054 return the scrollers range step" |
936 "mouse-button was moved while pressed; |
1055 |
937 redraw thumb at its new position and, if scroll-mode is asynchronous, |
1056 ^ rangeStep |
938 the scroll action is performed" |
1057 |
939 |
1058 "Modified: 1.3.1996 / 19:12:16 / cg" |
940 |pos curr limit prevOrigin newOrigin| |
1059 ! |
941 |
1060 |
942 scrolling ifFalse: [^ self]. "should not happen" |
1061 / 19:12:16 / cg" |
943 |
1062 ! |
944 frameBeforeMove isNil ifTrue:[ |
1063 |
945 (ghostColor notNil |
1064 toX:thumbLeft y:thumbTop |
946 or:[ghostFrameColor notNil |
1065 width:tW height:tH. |
947 or:[ghostLevel ~~ 0]]) ifTrue:[ |
1066 ]. |
948 frameBeforeMove := thumbFrame insetBy:1@1 |
1067 |
949 ] |
1068 " |
950 ]. |
1069 clear some of the previous thumbs area to background |
951 |
1070 " |
952 (orientation == #vertical) ifTrue:[ |
1071 (orientation == #vertical) ifTrue:[ |
953 curr := y. |
1072 bgLeft := thumbLeft. |
954 limit := height |
1073 bgWidth := tW. |
955 ] ifFalse:[ |
1074 oldTop > thumbTop ifTrue:[ |
956 curr := x. |
1075 delta := oldTop - thumbTop. |
957 limit := width |
1076 oldTop > thumbBot ifTrue:[ |
958 ]. |
1077 bgTop := oldTop. |
959 |
1078 bgHeight := tH + 1 |
960 (curr < 0) ifTrue:[ "check against limits" |
1079 ] ifFalse:[ |
961 pos := 0 |
1080 bgTop := thumbBot. |
962 ] ifFalse:[ |
1081 bgHeight := delta |
963 (curr > limit) ifTrue:[ |
1082 ] |
964 pos := limit |
1083 ] ifFalse:[ |
|
1084 delta := thumbTop - oldTop. |
|
1085 oldBot < thumbTop ifTrue:[ |
|
1086 bgTop := oldTop. |
|
1087 bgHeight := tH + 1 |
|
1088 ] ifFalse:[ |
|
1089 bgTop := oldTop. |
|
1090 bgHeight := delta |
|
1091 ] |
|
1092 ]. |
|
1093 ] ifFalse:[ |
|
1094 bgTop := thumbTop. |
|
1095 bgHeight := tH. |
|
1096 oldLeft > thumbLeft ifTrue:[ |
|
1097 delta := oldLeft - thumbLeft. |
|
1098 oldLeft > thumbRight ifTrue:[ |
|
1099 bgLeft := oldLeft. |
|
1100 bgWidth := tW + 1. |
|
1101 ] ifFalse:[ |
|
1102 bgLeft := thumbRight. |
|
1103 bgWidth := delta. |
|
1104 ] |
|
1105 ] ifFalse:[ |
|
1106 delta := thumbLeft - oldLeft. |
|
1107 oldRight < thumbLeft ifTrue:[ |
|
1108 bgLeft := oldLeft. |
|
1109 bgWidth := tW + 1. |
|
1110 ] ifFalse:[ |
|
1111 bgLeft := oldLeft. |
|
1112 bgWidth := delta. |
|
1113 ] |
|
1114 ]. |
|
1115 ]. |
|
1116 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
1117 self waitForExpose |
|
1118 ] |
965 ] ifFalse:[ |
1119 ] ifFalse:[ |
966 pos := curr |
1120 thumbFrame := nil |
967 ] |
1121 ] |
968 ]. |
1122 ] |
969 |
1123 ! |
970 prevOrigin := self thumbOrigin. |
1124 |
971 newOrigin := self percentFromAbs:(pos - pressOffset). |
1125 . |
972 prevOrigin ~= newOrigin ifTrue:[ |
1126 |
973 self thumbOrigin:newOrigin. |
1127 " |
974 |
1128 clear some of the previous thumbs area to background |
975 synchronousOperation ifTrue: [ |
1129 " |
976 self tellOthers. |
1130 (orientation == #vertical) ifTrue:[ |
977 ] |
1131 bgLeft := thumbLeft. |
978 ] |
1132 bgWidth := tW. |
979 ! |
1133 oldTop > thumbTop ifTrue:[ |
980 |
1134 delta := oldTop - thumbTop. |
981 buttonMultiPress:button x:x y:y |
1135 oldTop > thumbBot ifTrue:[ |
982 ^ self buttonPress:button x:x y:y |
1136 bgTop := oldTop. |
983 ! |
1137 bgHeight := tH + 1 |
984 |
1138 ] ifFalse:[ |
985 buttonPress:button x:x y:y |
1139 bgTop := thumbBot. |
986 "button was pressed - if above thumb, page up; if below thumb, page down; |
1140 bgHeight := delta |
987 otherwise start scrolling" |
1141 ] |
988 |
1142 ] ifFalse:[ |
989 |curr limit1 limit2| |
1143 delta := thumbTop - oldTop. |
990 |
1144 oldBot < thumbTop ifTrue:[ |
991 shown ifFalse:[^ self]. |
1145 bgTop := oldTop. |
992 |
1146 bgHeight := tH + 1 |
993 (orientation == #vertical) ifTrue:[ |
1147 ] ifFalse:[ |
994 curr := y. |
1148 bgTop := oldTop. |
995 limit1 := thumbFrame top. |
1149 bgHeight := delta |
996 limit2 := thumbFrame bottom |
1150 ] |
997 ] ifFalse:[ |
1151 ]. |
998 curr := x. |
1152 ] ifFalse:[ |
999 limit1 := thumbFrame left. |
1153 bgTop := thumbTop. |
1000 limit2 := thumbFrame right |
1154 bgHeight := tH. |
1001 ]. |
1155 oldLeft > thumbLeft ifTrue:[ |
1002 |
1156 delta := oldLeft - thumbLeft. |
1003 (curr < limit1) ifTrue:[ |
1157 oldLeft > thumbRight ifTrue:[ |
1004 "page up/left" |
1158 bgLeft := oldLeft. |
1005 self pageUp |
1159 bgWidth := tW + 1. |
1006 ] ifFalse:[ |
1160 ] ifFalse:[ |
1007 (curr > limit2) ifTrue:[ |
1161 bgLeft := thumbRight. |
1008 "page down/right" |
1162 bgWidth := delta. |
1009 self pageDown |
1163 ] |
|
1164 ] ifFalse:[ |
|
1165 delta := thumbLeft - oldLeft. |
|
1166 oldRight < thumbLeft ifTrue:[ |
|
1167 bgLeft := oldLeft. |
|
1168 bgWidth := tW + 1. |
|
1169 ] ifFalse:[ |
|
1170 bgLeft := oldLeft. |
|
1171 bgWidth := delta. |
|
1172 ] |
|
1173 ]. |
|
1174 ]. |
|
1175 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
1176 self waitForExpose |
|
1177 ] |
1010 ] ifFalse:[ |
1178 ] ifFalse:[ |
1011 pressOffset := curr - limit1. |
1179 thumbFrame := nil |
1012 scrolling := true |
1180 ] |
1013 ] |
1181 ] |
1014 ] |
1182 ! ! |
1015 ! |
1183 |
1016 |
1184 !Scroller methodsFor:'drawing'! |
1017 buttonRelease:button x:x y:y |
1185 |
1018 "mouse-button was released - if scroll-mode is asynchronous, the scroll |
1186 self displayLineFromX:xL y:y toX:xR y:y |
|
1187 ] |
|
1188 ] |
|
1189 ] ifFalse:[ |
|
1190 x := l + (w // 2) - 1. |
|
1191 yT := t + thumbLevel - 1. |
|
1192 yB := t + h - thumbLevel "+ 1". |
|
1193 self paint:color1. |
|
1194 self displayLineFromX:x y:yT toX:x y:yB. |
|
1195 self paint:color2. |
|
1196 x := x + 1. |
|
1197 self displayLineFromX:x y:yT toX:x y:yB. |
|
1198 |
|
1199 tallyMarks > 1 ifTrue:[ |
|
1200 "dont draw other marks if there is not enough space" |
|
1201 |
|
1202 mm := device horizontalPixelPerMillimeter rounded. |
|
1203 w > (mm * (tallyMarks * 2)) ifTrue:[ |
|
1204 x := x - 1 - mm. |
|
1205 self paint:color1. |
|
1206 self displayLineFromX:x y:yT toX:x y:yB. |
|
1207 x := x + 1. |
|
1208 self paint:color2. |
|
1209 self displayLineFromX:x y:yT toX:x y:yB. |
|
1210 |
|
1211 x := x - 1 + mm + mm. |
|
1212 self paint:color1. |
|
1213 self displayLineFromX:x y:yT toX:x y:yB. |
|
1214 x := x + 1. |
|
1215 self paint:color2. |
|
1216 self displayLineFromX:x y:yT toX:x y:yB |
|
1217 ] |
|
1218 ] |
|
1219 ] |
|
1220 ! |
|
1221 |
|
1222 T toX:x y:yB. |
|
1223 |
|
1224 tallyMarks > 1 ifTrue:[ |
|
1225 "dont draw other marks if there is not enough space" |
|
1226 |
|
1227 mm := device horizontalPixelPerMillimeter rounded. |
|
1228 w > (mm * (tallyMarks * 2)) ifTrue:[ |
|
1229 x := x - 1 - mm. |
|
1230 self paint:color1. |
|
1231 self displayLineFromX:x y:yT toX:x y:yB. |
|
1232 x := x + 1. |
|
1233 self paint:color2. |
|
1234 self displayLineFromX:x y:yT toX:x y:yB. |
|
1235 |
|
1236 x := x - 1 + mm + mm. |
|
1237 self paint:color1. |
|
1238 self displayLineFromX:x y:yT toX:x y:yB. |
|
1239 x := x + 1. |
|
1240 self paint:color2. |
|
1241 self displayLineFromX:x y:yT toX:x y:yB |
|
1242 ] |
|
1243 ] |
|
1244 ] |
|
1245 ! |
|
1246 |
|
1247 roll |
1019 action is now performed" |
1248 action is now performed" |
1020 |
1249 |
1021 |rect| |
1250 |rect| |
1022 |
1251 |
1023 scrolling ifTrue:[ |
1252 scrolling ifTrue:[ |
1293 drawableId notNil ifTrue:[ |
1438 drawableId notNil ifTrue:[ |
1294 self computeThumbFrame |
1439 self computeThumbFrame |
1295 ] |
1440 ] |
1296 ! |
1441 ! |
1297 |
1442 |
|
1443 mbFrameColor := DefaultThumbFrameColor on:device. |
|
1444 ]. |
|
1445 DefaultThumbShadowColor notNil ifTrue:[ |
|
1446 thumbShadowColor := DefaultThumbShadowColor |
|
1447 ] ifFalse:[ |
|
1448 thumbShadowColor := shadowColor. |
|
1449 ]. |
|
1450 DefaultThumbLightColor notNil ifTrue:[ |
|
1451 thumbLightColor := DefaultThumbLightColor |
|
1452 ] ifFalse:[ |
|
1453 thumbLightColor := lightColor. |
|
1454 ]. |
|
1455 |
|
1456 thumbEdgeStyle notNil ifTrue:[ |
|
1457 DefaultThumbHalfShadowColor notNil ifTrue:[ |
|
1458 thumbHalfShadowColor := DefaultThumbHalfShadowColor |
|
1459 ]. |
|
1460 DefaultThumbHalfLightColor notNil ifTrue:[ |
|
1461 thumbHalfLightColor := DefaultThumbHalfLightColor |
|
1462 ]. |
|
1463 ]. |
|
1464 |
|
1465 device hasGreyscales ifFalse:[ |
|
1466 thumbEdgeStyle notNil ifTrue:[ |
|
1467 thumbHalfShadowColor := Color darkGrey. |
|
1468 thumbHalfLightColor := White |
|
1469 ]. |
|
1470 |
|
1471 thumbShadowColor := Black. |
|
1472 "/ thumbLightColor := White. |
|
1473 |
|
1474 styleSheet name = #motif ifTrue:[ |
|
1475 DefaultThumbColor isNil ifTrue:[ |
|
1476 thumbColor := White . |
|
1477 ]. |
|
1478 ] |
|
1479 ]. |
|
1480 |
|
1481 DefaultThumbColor notNil ifTrue:[ |
|
1482 thumbColor := DefaultThumbColor on:device |
|
1483 ] ifFalse:[ |
|
1484 thumbColor := White. |
|
1485 styleSheet name ~= #normal ifTrue:[ |
|
1486 device hasGreyscales ifFalse:[ |
|
1487 thumbColor := Color grey |
|
1488 ]. |
|
1489 ]. |
|
1490 ]. |
|
1491 |
|
1492 thumbColor := thumbColor on:device. |
|
1493 thumbShadowColor notNil ifTrue:[ |
|
1494 thumbShadowColor := thumbShadowColor on:device. |
|
1495 ]. |
|
1496 thumbLightColor notNil ifTrue:[ |
|
1497 thumbLightColor := thumbLightColor on:device. |
|
1498 ]. |
|
1499 thumbHalfShadowColor notNil ifTrue:[ |
|
1500 thumbHalfShadowColor := thumbHalfShadowColor on:device. |
|
1501 ]. |
|
1502 thumbHalfLightColor notNil ifTrue:[ |
|
1503 thumbHalfLightColor := thumbHalfLightColor on:device. |
|
1504 ]. |
|
1505 thumbEdgeStyle notNil ifTrue:[ |
|
1506 thumbHalfShadowColor isNil ifTrue:[ |
|
1507 thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1508 ] |
|
1509 ]. |
|
1510 |
|
1511 styleSheet name = #next ifTrue:[ |
|
1512 shadowForm := self class handleShadowFormOn:device. |
|
1513 lightForm := self class handleLightFormOn:device |
|
1514 ] ifFalse:[ |
|
1515 shadowForm := lightForm := nil |
|
1516 ]. |
|
1517 |
|
1518 drawableId notNil ifTrue:[ |
|
1519 self computeThumbFrame |
|
1520 ] |
|
1521 ! |
|
1522 |
|
1523 rue:[ |
|
1524 thumbShadowColor := DefaultThumbShadowColor |
|
1525 ] ifFalse:[ |
|
1526 thumbShadowColor := shadowColor. |
|
1527 ]. |
|
1528 DefaultThumbLightColor notNil ifTrue:[ |
|
1529 thumbLightColor := DefaultThumbLightColor |
|
1530 ] ifFalse:[ |
|
1531 thumbLightColor := lightColor. |
|
1532 ]. |
|
1533 |
|
1534 thumbEdgeStyle notNil ifTrue:[ |
|
1535 DefaultThumbHalfShadowColor notNil ifTrue:[ |
|
1536 thumbHalfShadowColor := DefaultThumbHalfShadowColor |
|
1537 ]. |
|
1538 DefaultThumbHalfLightColor notNil ifTrue:[ |
|
1539 thumbHalfLightColor := DefaultThumbHalfLightColor |
|
1540 ]. |
|
1541 ]. |
|
1542 |
|
1543 device hasGreyscales ifFalse:[ |
|
1544 thumbEdgeStyle notNil ifTrue:[ |
|
1545 thumbHalfShadowColor := Color darkGrey. |
|
1546 thumbHalfLightColor := White |
|
1547 ]. |
|
1548 |
|
1549 thumbShadowColor := Black. |
|
1550 "/ thumbLightColor := White. |
|
1551 |
|
1552 styleSheet name = #motif ifTrue:[ |
|
1553 DefaultThumbColor isNil ifTrue:[ |
|
1554 thumbColor := White . |
|
1555 ]. |
|
1556 ] |
|
1557 ]. |
|
1558 |
|
1559 DefaultThumbColor notNil ifTrue:[ |
|
1560 thumbColor := DefaultThumbColor on:device |
|
1561 ] ifFalse:[ |
|
1562 thumbColor := White. |
|
1563 styleSheet name ~= #normal ifTrue:[ |
|
1564 device hasGreyscales ifFalse:[ |
|
1565 thumbColor := Color grey |
|
1566 ]. |
|
1567 ]. |
|
1568 ]. |
|
1569 |
|
1570 thumbColor := thumbColor on:device. |
|
1571 thumbShadowColor notNil ifTrue:[ |
|
1572 thumbShadowColor := thumbShadowColor on:device. |
|
1573 ]. |
|
1574 thumbLightColor notNil ifTrue:[ |
|
1575 thumbLightColor := thumbLightColor on:device. |
|
1576 ]. |
|
1577 thumbHalfShadowColor notNil ifTrue:[ |
|
1578 thumbHalfShadowColor := thumbHalfShadowColor on:device. |
|
1579 ]. |
|
1580 thumbHalfLightColor notNil ifTrue:[ |
|
1581 thumbHalfLightColor := thumbHalfLightColor on:device. |
|
1582 ]. |
|
1583 thumbEdgeStyle notNil ifTrue:[ |
|
1584 thumbHalfShadowColor isNil ifTrue:[ |
|
1585 thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1586 ] |
|
1587 ]. |
|
1588 |
|
1589 styleSheet name = #next ifTrue:[ |
|
1590 shadowForm := self class handleShadowFormOn:device. |
|
1591 lightForm := self class handleLightFormOn:device |
|
1592 ] ifFalse:[ |
|
1593 shadowForm := lightForm := nil |
|
1594 ]. |
|
1595 |
|
1596 drawableId notNil ifTrue:[ |
|
1597 self computeThumbFrame |
|
1598 ] |
|
1599 ! |
|
1600 |
|
1601 :[ |
|
1602 DefaultThumbHalfShadowColor notNil ifTrue:[ |
|
1603 thumbHalfShadowColor := DefaultThumbHalfShadowColor |
|
1604 ]. |
|
1605 DefaultThumbHalfLightColor notNil ifTrue:[ |
|
1606 thumbHalfLightColor := DefaultThumbHalfLightColor |
|
1607 ]. |
|
1608 ]. |
|
1609 |
|
1610 device hasGreyscales ifFalse:[ |
|
1611 thumbEdgeStyle notNil ifTrue:[ |
|
1612 thumbHalfShadowColor := Color darkGrey. |
|
1613 thumbHalfLightColor := White |
|
1614 ]. |
|
1615 |
|
1616 thumbShadowColor := Black. |
|
1617 "/ thumbLightColor := White. |
|
1618 |
|
1619 styleSheet name = #motif ifTrue:[ |
|
1620 DefaultThumbColor isNil ifTrue:[ |
|
1621 thumbColor := White . |
|
1622 ]. |
|
1623 ] |
|
1624 ]. |
|
1625 |
|
1626 DefaultThumbColor notNil ifTrue:[ |
|
1627 thumbColor := DefaultThumbColor on:device |
|
1628 ] ifFalse:[ |
|
1629 thumbColor := White. |
|
1630 styleSheet name ~= #normal ifTrue:[ |
|
1631 device hasGreyscales ifFalse:[ |
|
1632 thumbColor := Color grey |
|
1633 ]. |
|
1634 ]. |
|
1635 ]. |
|
1636 |
|
1637 thumbColor := thumbColor on:device. |
|
1638 thumbShadowColor notNil ifTrue:[ |
|
1639 thumbShadowColor := thumbShadowColor on:device. |
|
1640 ]. |
|
1641 thumbLightColor notNil ifTrue:[ |
|
1642 thumbLightColor := thumbLightColor on:device. |
|
1643 ]. |
|
1644 thumbHalfShadowColor notNil ifTrue:[ |
|
1645 thumbHalfShadowColor := thumbHalfShadowColor on:device. |
|
1646 ]. |
|
1647 thumbHalfLightColor notNil ifTrue:[ |
|
1648 thumbHalfLightColor := thumbHalfLightColor on:device. |
|
1649 ]. |
|
1650 thumbEdgeStyle notNil ifTrue:[ |
|
1651 thumbHalfShadowColor isNil ifTrue:[ |
|
1652 thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1653 ] |
|
1654 ]. |
|
1655 |
|
1656 styleSheet name = #next ifTrue:[ |
|
1657 shadowForm := self class handleShadowFormOn:device. |
|
1658 lightForm := self class handleLightFormOn:device |
|
1659 ] ifFalse:[ |
|
1660 shadowForm := lightForm := nil |
|
1661 ]. |
|
1662 |
|
1663 drawableId notNil ifTrue:[ |
|
1664 self computeThumbFrame |
|
1665 ] |
|
1666 ! |
|
1667 |
|
1668 thumbEdgeStyle notNil ifTrue:[ |
|
1669 thumbHalfShadowColor := Color darkGrey. |
|
1670 thumbHalfLightColor := White |
|
1671 ]. |
|
1672 |
|
1673 thumbShadowColor := Black. |
|
1674 "/ thumbLightColor := White. |
|
1675 |
|
1676 styleSheet name = #motif ifTrue:[ |
|
1677 DefaultThumbColor isNil ifTrue:[ |
|
1678 thumbColor := White . |
|
1679 ]. |
|
1680 ] |
|
1681 ]. |
|
1682 |
|
1683 DefaultThumbColor notNil ifTrue:[ |
|
1684 thumbColor := DefaultThumbColor on:device |
|
1685 ] ifFalse:[ |
|
1686 thumbColor := White. |
|
1687 styleSheet name ~= #normal ifTrue:[ |
|
1688 device hasGreyscales ifFalse:[ |
|
1689 thumbColor := Color grey |
|
1690 ]. |
|
1691 ]. |
|
1692 ]. |
|
1693 |
|
1694 thumbColor := thumbColor on:device. |
|
1695 thumbShadowColor notNil ifTrue:[ |
|
1696 thumbShadowColor := thumbShadowColor on:device. |
|
1697 ]. |
|
1698 thumbLightColor notNil ifTrue:[ |
|
1699 thumbLightColor := thumbLightColor on:device. |
|
1700 ]. |
|
1701 thumbHalfShadowColor notNil ifTrue:[ |
|
1702 thumbHalfShadowColor := thumbHalfShadowColor on:device. |
|
1703 ]. |
|
1704 thumbHalfLightColor notNil ifTrue:[ |
|
1705 thumbHalfLightColor := thumbHalfLightColor on:device. |
|
1706 ]. |
|
1707 thumbEdgeStyle notNil ifTrue:[ |
|
1708 thumbHalfShadowColor isNil ifTrue:[ |
|
1709 thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1710 ] |
|
1711 ]. |
|
1712 |
|
1713 styleSheet name = #next ifTrue:[ |
|
1714 shadowForm := self class handleShadowFormOn:device. |
|
1715 lightForm := self class handleLightFormOn:device |
|
1716 ] ifFalse:[ |
|
1717 shadowForm := lightForm := nil |
|
1718 ]. |
|
1719 |
|
1720 drawableId notNil ifTrue:[ |
|
1721 self computeThumbFrame |
|
1722 ] |
|
1723 ! ! |
|
1724 |
|
1725 !Scroller methodsFor:'forced scroll'! |
|
1726 |
|
1727 il ifTrue:[ |
|
1728 thumbColor := DefaultThumbColor on:device |
|
1729 ] ifFalse:[ |
|
1730 thumbColor := White. |
|
1731 styleSheet name ~= #normal ifTrue:[ |
|
1732 device hasGreyscales ifFalse:[ |
|
1733 thumbColor := Color grey |
|
1734 ]. |
|
1735 ]. |
|
1736 ]. |
|
1737 |
|
1738 thumbColor := thumbColor on:device. |
|
1739 thumbShadowColor notNil ifTrue:[ |
|
1740 thumbShadowColor := thumbShadowColor on:device. |
|
1741 ]. |
|
1742 thumbLightColor notNil ifTrue:[ |
|
1743 thumbLightColor := thumbLightColor on:device. |
|
1744 ]. |
|
1745 thumbHalfShadowColor notNil ifTrue:[ |
|
1746 thumbHalfShadowColor := thumbHalfShadowColor on:device. |
|
1747 ]. |
|
1748 thumbHalfLightColor notNil ifTrue:[ |
|
1749 thumbHalfLightColor := thumbHalfLightColor on:device. |
|
1750 ]. |
|
1751 thumbEdgeStyle notNil ifTrue:[ |
|
1752 thumbHalfShadowColor isNil ifTrue:[ |
|
1753 thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1754 ] |
|
1755 ]. |
|
1756 |
|
1757 styleSheet name = #next ifTrue:[ |
|
1758 shadowForm := self class handleShadowFormOn:device. |
|
1759 lightForm := self class handleLightFormOn:device |
|
1760 ] ifFalse:[ |
|
1761 shadowForm := lightForm := nil |
|
1762 ]. |
|
1763 |
|
1764 drawableId notNil ifTrue:[ |
|
1765 self computeThumbFrame |
|
1766 ] |
|
1767 ! |
|
1768 |
|
1769 name ~= #normal ifTrue:[ |
|
1770 device hasGreyscales ifFalse:[ |
|
1771 thumbColor := Color grey |
|
1772 ]. |
|
1773 ]. |
|
1774 ]. |
|
1775 |
|
1776 thumbColor := thumbColor on:device. |
|
1777 thumbShadowColor notNil ifTrue:[ |
|
1778 thumbShadowColor := thumbShadowColor on:device. |
|
1779 ]. |
|
1780 thumbLightColor notNil ifTrue:[ |
|
1781 thumbLightColor := thumbLightColor on:device. |
|
1782 ]. |
|
1783 thumbHalfShadowColor notNil ifTrue:[ |
|
1784 thumbHalfShadowColor := thumbHalfShadowColor on:device. |
|
1785 ]. |
|
1786 thumbHalfLightColor notNil ifTrue:[ |
|
1787 thumbHalfLightColor := thumbHalfLightColor on:device. |
|
1788 ]. |
|
1789 thumbEdgeStyle notNil ifTrue:[ |
|
1790 thumbHalfShadowColor isNil ifTrue:[ |
|
1791 thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1792 ] |
|
1793 ]. |
|
1794 |
|
1795 styleSheet name = #next ifTrue:[ |
|
1796 shadowForm := self class handleShadowFormOn:device. |
|
1797 lightForm := self class handleLightFormOn:device |
|
1798 ] ifFalse:[ |
|
1799 shadowForm := lightForm := nil |
|
1800 ]. |
|
1801 |
|
1802 drawableId notNil ifTrue:[ |
|
1803 self computeThumbFrame |
|
1804 ] |
|
1805 ! ! |
|
1806 |
|
1807 !Scroller methodsFor:'forwarding changed origin'! |
|
1808 |
|
1809 humbShadowColor notNil ifTrue:[ |
|
1810 thumbShadowColor := thumbShadowColor on:device. |
|
1811 ]. |
|
1812 thumbLightColor notNil ifTrue:[ |
|
1813 thumbLightColor := thumbLightColor on:device. |
|
1814 ]. |
|
1815 thumbHalfShadowColor notNil ifTrue:[ |
|
1816 thumbHalfShadowColor := thumbHalfShadowColor on:device. |
|
1817 ]. |
|
1818 thumbHalfLightColor notNil ifTrue:[ |
|
1819 thumbHalfLightColor := thumbHalfLightColor on:device. |
|
1820 ]. |
|
1821 thumbEdgeStyle notNil ifTrue:[ |
|
1822 thumbHalfShadowColor isNil ifTrue:[ |
|
1823 thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1824 ] |
|
1825 ]. |
|
1826 |
|
1827 styleSheet name = #next ifTrue:[ |
|
1828 shadowForm := self class handleShadowFormOn:device. |
|
1829 lightForm := self class handleLightFormOn:device |
|
1830 ] ifFalse:[ |
|
1831 shadowForm := lightForm := nil |
|
1832 ]. |
|
1833 |
|
1834 drawableId notNil ifTrue:[ |
|
1835 self computeThumbFrame |
|
1836 ] |
|
1837 ! ! |
|
1838 |
|
1839 !Scroller methodsFor:'initialization'! |
|
1840 |
|
1841 defaultExtent |
|
1842 "compute my extent from sub-components" |
|
1843 |
|
1844 ^ self preferredExtent |
|
1845 |
|
1846 "Created: 1.3.1996 / 19:22:21 / cg" |
|
1847 ! |
|
1848 |
|
1849 eStyle notNil ifTrue:[ |
|
1850 thumbHalfShadowColor isNil ifTrue:[ |
|
1851 thumbHalfShadowColor := thumbShadowColor lightened on:device |
|
1852 ] |
|
1853 ]. |
|
1854 |
|
1855 styleSheet name = #next ifTrue:[ |
|
1856 shadowForm := self class handleShadowFormOn:device. |
|
1857 lightForm := self class handleLightFormOn:device |
|
1858 ] ifFalse:[ |
|
1859 shadowForm := lightForm := nil |
|
1860 ]. |
|
1861 |
|
1862 drawableId notNil ifTrue:[ |
|
1863 self computeThumbFrame |
|
1864 ] |
|
1865 ! |
|
1866 |
|
1867 alfShadowColor := thumbShadowColor lightened on:device |
|
1868 ] |
|
1869 ]. |
|
1870 |
|
1871 styleSheet name = #next ifTrue:[ |
|
1872 shadowForm := self class handleShadowFormOn:device. |
|
1873 lightForm := self class handleLightFormOn:device |
|
1874 ] ifFalse:[ |
|
1875 shadowForm := lightForm := nil |
|
1876 ]. |
|
1877 |
|
1878 drawableId notNil ifTrue:[ |
|
1879 self computeThumbFrame |
|
1880 ] |
|
1881 ! |
|
1882 |
1298 initialize |
1883 initialize |
1299 "initialize - setup instvars from defaults" |
1884 "initialize - setup instvars from defaults" |
1300 |
1885 |
1301 super initialize. |
1886 super initialize. |
1302 self computeInitialExtent. |
|
1303 orientation := #vertical. |
1887 orientation := #vertical. |
1304 |
1888 |
1305 scrolling := false. |
1889 scrolling := false. |
1306 synchronousOperation := true. |
1890 synchronousOperation := true. |
1307 |
1891 |
1313 rangeEnd := 100. |
1897 rangeEnd := 100. |
1314 rangeStep := nil. "/ meaning: arbitrary precision |
1898 rangeStep := nil. "/ meaning: arbitrary precision |
1315 "/ inset := 1. |
1899 "/ inset := 1. |
1316 |
1900 |
1317 "/ self computeThumbFrame |
1901 "/ self computeThumbFrame |
1318 ! |
1902 |
1319 |
1903 "Modified: 1.3.1996 / 19:22:51 / cg" |
1320 realize |
1904 ! |
1321 super realize. |
1905 |
1322 model notNil ifTrue:[ |
1906 ame left) ifTrue:[ |
1323 self thumbOrigin:(model value). |
|
1324 ]. |
|
1325 ! ! |
|
1326 |
|
1327 !Scroller methodsFor:'private'! |
|
1328 |
|
1329 absFromPercent:percent |
|
1330 "given a percentage, compute number of pixels" |
|
1331 |
|
1332 |fullSize| |
|
1333 |
|
1334 (orientation == #vertical) ifTrue:[ |
|
1335 fullSize := height |
|
1336 ] ifFalse:[ |
|
1337 fullSize := width |
|
1338 ]. |
|
1339 "/ ^ ((percent * (fullSize - (margin * 2))) / 100) rounded |
|
1340 "/ 20-apr-94 |
|
1341 |
|
1342 ^ ((percent * (fullSize - thumbFrameSizeDifference- (margin * 2))) / 100) rounded |
|
1343 ! |
|
1344 |
|
1345 computeThumbFrame |
|
1346 "compute the thumbs frame (a rectangle) whenever thumb is moved, |
|
1347 changed height or the scrollers size has changed. |
|
1348 We take care, that the thumb will not become too small (i.e. |
|
1349 invisible or uncatchable). |
|
1350 Also, for mswindows style, its height/width is constant." |
|
1351 |
|
1352 |newPos1 newPos2 newSize1 newSize2 nh nw ny nx |
|
1353 computedSize minSz sz1 sz2| |
|
1354 |
|
1355 "compute position & size" |
|
1356 newPos1 := (self absFromPercent:thumbOrigin) + margin. |
|
1357 newSize1 := computedSize := self absFromPercent:thumbHeight. |
|
1358 (orientation == #vertical) ifTrue:[ |
|
1359 sz1 := height. |
|
1360 sz2 := width |
|
1361 ] ifFalse:[ |
|
1362 sz1 := width. |
|
1363 sz2 := height |
|
1364 ]. |
|
1365 |
|
1366 " |
|
1367 do we have to adjust the computed size ? |
|
1368 " |
|
1369 newPos2 := margin + inset. |
|
1370 newSize2 := sz2 - (2 * newPos2). |
|
1371 "/ (style ~~ #normal) ifTrue:[ |
|
1372 thumbLevel ~~ 0 ifTrue:[ |
|
1373 " |
|
1374 do not make thumb too small (for handle & to be catchable) |
|
1375 " |
|
1376 minSz := 10 + (2 * thumbLevel) |
|
1377 ] ifFalse:[ |
|
1378 " |
|
1379 do not make thumb too small (uncatchable) |
|
1380 " |
|
1381 minSz := 4 |
|
1382 ]. |
|
1383 |
|
1384 (newSize1 < minSz) ifTrue:[ |
|
1385 newSize1 := minSz. |
|
1386 thumbFrameSizeDifference := newSize1 - computedSize |
|
1387 ] ifFalse:[ |
|
1388 thumbFrameSizeDifference := 0. |
|
1389 ]. |
|
1390 |
|
1391 fixThumbHeight ifTrue:[ |
|
1392 "have a fix-size thumb (i.e. mswindows style)" |
|
1393 |
|
1394 newSize1 := sz2 - (2 * inset). "make it square" |
|
1395 thumbFrameSizeDifference := newSize1 - computedSize. |
|
1396 ]. |
|
1397 |
|
1398 " |
|
1399 oops - if height does not relect real visibible area, we have to adjust the origin |
|
1400 " |
|
1401 (thumbFrameSizeDifference == 0) ifFalse:[ |
|
1402 newPos1 := (self absFromPercent:thumbOrigin) + margin. |
|
1403 "/ newPos1 := ((thumbOrigin * (sz1 - thumbFrameSizeDifference - (margin * 2))) / 100) rounded + margin |
|
1404 ]. |
|
1405 |
|
1406 (orientation == #vertical) ifTrue:[ |
|
1407 ny := newPos1. |
|
1408 nx := newPos2. |
|
1409 nh := newSize1. |
|
1410 nw := newSize2. |
|
1411 ny + nh + margin > height ifTrue:[ |
|
1412 ny := height - margin - nh |
|
1413 ] |
|
1414 ] ifFalse:[ |
|
1415 nx := newPos1. |
|
1416 ny := newPos2. |
|
1417 nw := newSize1. |
|
1418 nh := newSize2. |
|
1419 nx + nw + margin > width ifTrue:[ |
|
1420 nx := width - margin - nw |
|
1421 ] |
|
1422 ]. |
|
1423 |
|
1424 " |
|
1425 do not create new Rectangle if its the same anyway |
|
1426 " |
|
1427 thumbFrame notNil ifTrue:[ |
|
1428 (ny == thumbFrame top) ifTrue:[ |
|
1429 (nx == thumbFrame left) ifTrue:[ |
|
1430 (nh == thumbFrame height) ifTrue:[ |
1907 (nh == thumbFrame height) ifTrue:[ |
1431 (nw == thumbFrame width) ifTrue:[ ^ self] |
1908 (nw == thumbFrame width) ifTrue:[ ^ self] |
1432 ] |
1909 ] |
1433 ] |
1910 ] |
1434 ] |
1911 ] |
1435 ]. |
1912 ]. |
1436 thumbFrame := Rectangle left:nx top:ny width:nw height:nh |
1913 thumbFrame := Rectangle left:nx top:ny width:nw height:nh |
1437 ! |
1914 ! ! |
1438 |
1915 |
1439 percentFromAbs:absValue |
1916 !Scroller methodsFor:'private'! |
1440 "given a number of pixels, compute percentage" |
1917 |
1441 |
1918 thumbFrame := Rectangle left:nx top:ny width:nw height:nh |
1442 |fullSize val t| |
1919 ! |
1443 |
1920 |
1444 (orientation == #vertical) ifTrue:[ |
1921 ases, this happens ... |
1445 fullSize := height |
|
1446 ] ifFalse:[ |
|
1447 fullSize := width |
|
1448 ]. |
|
1449 |
|
1450 t := fullSize - thumbFrameSizeDifference - (margin * 2). |
|
1451 t = 0 ifTrue:[ |
|
1452 "/ in rare cases, this happens ... |
|
1453 val := 0 |
1922 val := 0 |
1454 ] ifFalse:[ |
1923 ] ifFalse:[ |
1455 val := absValue / t * (rangeEnd - rangeStart). |
1924 val := absValue / t * (rangeEnd - rangeStart). |
1456 ]. |
1925 ]. |
1457 val := val + rangeStart. |
1926 val := val + rangeStart. |
1458 |
1927 |
1459 val < rangeStart ifTrue:[^ rangeStart]. |
1928 val < rangeStart ifTrue:[^ rangeStart]. |
1460 val > rangeEnd ifTrue:[^ rangeEnd]. |
1929 val > rangeEnd ifTrue:[^ rangeEnd]. |
1461 ^ val |
1930 ^ val |
1462 |
1931 |
1463 ! ! |
1932 ! |
1464 |
1933 |
1465 !Scroller methodsFor:'private-scrollView interface'! |
1934 (orientation == #vertical) ifTrue:[aView innerHeight] |
1466 |
|
1467 setThumbFor:aView |
|
1468 "get contents and size info from aView and adjust thumb" |
|
1469 |
|
1470 |percentSize percentOrigin contentsSize contentsPosition viewsSize| |
|
1471 |
|
1472 " |
|
1473 get the content's size |
|
1474 " |
|
1475 aView isNil ifTrue:[ |
|
1476 contentsSize := 0 |
|
1477 ] ifFalse:[ |
|
1478 orientation == #vertical ifTrue:[ |
|
1479 contentsSize := aView heightOfContents. |
|
1480 aView transformation notNil ifTrue:[ |
|
1481 contentsSize := aView transformation applyScaleY:contentsSize. |
|
1482 ]. |
|
1483 ] ifFalse:[ |
|
1484 contentsSize := aView widthOfContents. |
|
1485 aView transformation notNil ifTrue:[ |
|
1486 contentsSize := aView transformation applyScaleX:contentsSize. |
|
1487 ]. |
|
1488 ] |
|
1489 ]. |
|
1490 |
|
1491 (contentsSize = 0) ifTrue:[ |
|
1492 percentSize := 100. |
|
1493 percentOrigin := 100 |
|
1494 ] ifFalse:[ |
|
1495 (orientation == #vertical) ifTrue:[ |
|
1496 viewsSize := aView innerHeight. |
|
1497 contentsPosition := aView yOriginOfContents. |
|
1498 ] ifFalse:[ |
|
1499 viewsSize := aView innerWidth. |
|
1500 contentsPosition := aView xOriginOfContents |
|
1501 ]. |
|
1502 |
|
1503 percentSize := viewsSize * 100.0 / contentsSize. |
|
1504 percentOrigin := contentsPosition * 100.0 / contentsSize. |
|
1505 percentOrigin + percentSize > 100.0 ifTrue:[ |
|
1506 "actually showing stuff below contents of view" |
|
1507 " |
|
1508 contentsSize := contentsPosition + aView innerHeight. |
|
1509 percentSize := viewsSize * 100.0 / contentsSize. |
|
1510 percentOrigin := contentsPosition * 100.0 / contentsSize |
|
1511 " |
|
1512 ] |
|
1513 ]. |
|
1514 (percentSize = thumbHeight) ifTrue:[ |
|
1515 self thumbOrigin:percentOrigin |
|
1516 ] ifFalse:[ |
|
1517 (percentOrigin = thumbOrigin) ifTrue:[ |
|
1518 self thumbHeight:percentSize |
|
1519 ] ifFalse:[ |
|
1520 self thumbOrigin:percentOrigin thumbHeight:percentSize |
|
1521 ] |
|
1522 ] |
|
1523 ! |
|
1524 |
|
1525 setThumbHeightFor:aView |
|
1526 "get contents and size info from aView and adjust thumb height" |
|
1527 |
|
1528 |percent total viewsSize| |
|
1529 |
|
1530 (orientation == #vertical) ifTrue:[ |
|
1531 total := aView heightOfContents. |
|
1532 aView transformation notNil ifTrue:[ |
|
1533 total := aView transformation applyScaleY:total. |
|
1534 ]. |
|
1535 ] ifFalse:[ |
|
1536 total := aView widthOfContents. |
|
1537 aView transformation notNil ifTrue:[ |
|
1538 total := aView transformation applyScaleX:total. |
|
1539 ]. |
|
1540 ]. |
|
1541 (total = 0) ifTrue:[ |
|
1542 percent := 100 |
|
1543 ] ifFalse:[ |
|
1544 viewsSize := (orientation == #vertical) ifTrue:[aView innerHeight] |
|
1545 ifFalse:[aView innerWidth]. |
1935 ifFalse:[aView innerWidth]. |
1546 percent := viewsSize * 100.0 / total |
1936 percent := viewsSize * 100.0 / total |
1547 ]. |
1937 ]. |
1548 self thumbHeight:percent |
1938 self thumbHeight:percent |
1549 ! |
1939 ! ! |
1550 |
1940 |
1551 setThumbOriginFor:aView |
1941 !Scroller methodsFor:'private-scrollView interface'! |
1552 "get contents and size info from aView and adjust thumb origin" |
1942 |
1553 |
1943 ^ thumbFrame |
1554 |percent total contentsPosition| |
1944 ! |
1555 |
1945 |
1556 (orientation == #vertical) ifTrue:[ |
1946 wOrigin realNewOrigin |
1557 total := aView heightOfContents. |
1947 oldFrame oldTop oldBot oldLeft oldRight |
1558 aView transformation notNil ifTrue:[ |
1948 thumbTop thumbBot thumbLeft thumbRight |
1559 total := aView transformation applyScaleY:total. |
1949 tH "{ Class: SmallInteger }" |
1560 ]. |
1950 tW |
1561 ] ifFalse:[ |
1951 delta needFullDraw |
1562 total := aView widthOfContents. |
1952 bgLeft bgTop bgWidth bgHeight| |
1563 aView transformation notNil ifTrue:[ |
1953 |
1564 total := aView transformation applyScaleX:total. |
1954 newOrigin := (aNumber - rangeStart) asFloat / (rangeEnd - rangeStart / 100). |
|
1955 |
|
1956 ((newOrigin + thumbHeight) > 100) ifTrue:[ |
|
1957 realNewOrigin := 100 - thumbHeight |
|
1958 ] ifFalse: [ |
|
1959 realNewOrigin := newOrigin |
|
1960 ]. |
|
1961 (realNewOrigin > 100) ifTrue:[ |
|
1962 realNewOrigin := 100 |
|
1963 ] ifFalse: [ |
|
1964 (realNewOrigin < 0) ifTrue:[ |
|
1965 realNewOrigin := 0 |
|
1966 ] |
|
1967 ]. |
|
1968 ((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[ |
|
1969 thumbOrigin := realNewOrigin. |
|
1970 |
|
1971 shown ifTrue:[ |
|
1972 oldFrame := thumbFrame. |
|
1973 self computeThumbFrame. |
|
1974 (thumbHeight = 100) ifTrue:[ |
|
1975 "/ full: don't draw |
|
1976 ^ self |
|
1977 ]. |
|
1978 |
|
1979 (thumbFrame ~~ oldFrame) ifTrue:[ |
|
1980 oldFrame isNil ifTrue:[ |
|
1981 self drawThumb. |
|
1982 ^ self |
|
1983 ]. |
|
1984 tH := thumbFrame height. |
|
1985 tW := thumbFrame width. |
|
1986 |
|
1987 oldTop := oldFrame top. |
|
1988 oldBot := oldTop + tH. |
|
1989 oldLeft := oldFrame left. |
|
1990 oldRight := oldLeft + tW. |
|
1991 |
|
1992 thumbTop := thumbFrame top. |
|
1993 thumbBot := thumbTop + tH. |
|
1994 thumbLeft := thumbFrame left. |
|
1995 thumbRight := thumbLeft + tW. |
|
1996 |
|
1997 needFullDraw := self exposeEventPending |
|
1998 or:[((orientation == #vertical) and:[oldBot >= height]) |
|
1999 or:[((orientation ~~ #vertical) and:[oldRight >= width])]]. |
|
2000 |
|
2001 needFullDraw ifTrue:[ |
|
2002 " |
|
2003 cannot copy since thumb was below the end |
|
2004 or may be not available for the copy |
|
2005 " |
|
2006 (orientation == #vertical) ifTrue:[ |
|
2007 self drawThumbBackgroundInX:thumbLeft y:oldTop |
|
2008 width:tW height:(height - oldTop). |
|
2009 ] ifFalse:[ |
|
2010 self drawThumbBackgroundInX:oldLeft y:thumbTop |
|
2011 width:(width - oldLeft) height:tH. |
|
2012 ]. |
|
2013 self drawThumb. |
|
2014 ^ self |
|
2015 ]. |
|
2016 |
|
2017 self catchExpose. |
|
2018 " |
|
2019 copy the thumbs pixels |
|
2020 " |
|
2021 (orientation == #vertical) ifTrue:[ |
|
2022 self copyFrom:self x:thumbLeft y:oldTop |
|
2023 toX:thumbLeft y:thumbTop |
|
2024 width:tW height:tH. |
|
2025 ] ifFalse:[ |
|
2026 self copyFrom:self x:oldLeft y:thumbTop |
|
2027 toX:thumbLeft y:thumbTop |
|
2028 width:tW height:tH. |
|
2029 ]. |
|
2030 |
|
2031 " |
|
2032 clear some of the previous thumbs area to background |
|
2033 " |
|
2034 (orientation == #vertical) ifTrue:[ |
|
2035 bgLeft := thumbLeft. |
|
2036 bgWidth := tW. |
|
2037 oldTop > thumbTop ifTrue:[ |
|
2038 delta := oldTop - thumbTop. |
|
2039 oldTop > thumbBot ifTrue:[ |
|
2040 bgTop := oldTop. |
|
2041 bgHeight := tH + 1 |
|
2042 ] ifFalse:[ |
|
2043 bgTop := thumbBot. |
|
2044 bgHeight := delta |
|
2045 ] |
|
2046 ] ifFalse:[ |
|
2047 delta := thumbTop - oldTop. |
|
2048 oldBot < thumbTop ifTrue:[ |
|
2049 bgTop := oldTop. |
|
2050 bgHeight := tH + 1 |
|
2051 ] ifFalse:[ |
|
2052 bgTop := oldTop. |
|
2053 bgHeight := delta |
|
2054 ] |
|
2055 ]. |
|
2056 ] ifFalse:[ |
|
2057 bgTop := thumbTop. |
|
2058 bgHeight := tH. |
|
2059 oldLeft > thumbLeft ifTrue:[ |
|
2060 delta := oldLeft - thumbLeft. |
|
2061 oldLeft > thumbRight ifTrue:[ |
|
2062 bgLeft := oldLeft. |
|
2063 bgWidth := tW + 1. |
|
2064 ] ifFalse:[ |
|
2065 bgLeft := thumbRight. |
|
2066 bgWidth := delta. |
|
2067 ] |
|
2068 ] ifFalse:[ |
|
2069 delta := thumbLeft - oldLeft. |
|
2070 oldRight < thumbLeft ifTrue:[ |
|
2071 bgLeft := oldLeft. |
|
2072 bgWidth := tW + 1. |
|
2073 ] ifFalse:[ |
|
2074 bgLeft := oldLeft. |
|
2075 bgWidth := delta. |
|
2076 ] |
|
2077 ]. |
|
2078 ]. |
|
2079 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
2080 self waitForExpose |
|
2081 ] |
|
2082 ] ifFalse:[ |
|
2083 thumbFrame := nil |
|
2084 ] |
|
2085 ] |
|
2086 ! |
|
2087 |
|
2088 e:[ |
|
2089 oldFrame := thumbFrame. |
|
2090 self computeThumbFrame. |
|
2091 (thumbHeight = 100) ifTrue:[ |
|
2092 "/ full: don't draw |
|
2093 ^ self |
|
2094 ]. |
|
2095 |
|
2096 (thumbFrame ~~ oldFrame) ifTrue:[ |
|
2097 oldFrame isNil ifTrue:[ |
|
2098 self drawThumb. |
|
2099 ^ self |
|
2100 ]. |
|
2101 tH := thumbFrame height. |
|
2102 tW := thumbFrame width. |
|
2103 |
|
2104 oldTop := oldFrame top. |
|
2105 oldBot := oldTop + tH. |
|
2106 oldLeft := oldFrame left. |
|
2107 oldRight := oldLeft + tW. |
|
2108 |
|
2109 thumbTop := thumbFrame top. |
|
2110 thumbBot := thumbTop + tH. |
|
2111 thumbLeft := thumbFrame left. |
|
2112 thumbRight := thumbLeft + tW. |
|
2113 |
|
2114 needFullDraw := self exposeEventPending |
|
2115 or:[((orientation == #vertical) and:[oldBot >= height]) |
|
2116 or:[((orientation ~~ #vertical) and:[oldRight >= width])]]. |
|
2117 |
|
2118 needFullDraw ifTrue:[ |
|
2119 " |
|
2120 cannot copy since thumb was below the end |
|
2121 or may be not available for the copy |
|
2122 " |
|
2123 (orientation == #vertical) ifTrue:[ |
|
2124 self drawThumbBackgroundInX:thumbLeft y:oldTop |
|
2125 width:tW height:(height - oldTop). |
|
2126 ] ifFalse:[ |
|
2127 self drawThumbBackgroundInX:oldLeft y:thumbTop |
|
2128 width:(width - oldLeft) height:tH. |
|
2129 ]. |
|
2130 self drawThumb. |
|
2131 ^ self |
|
2132 ]. |
|
2133 |
|
2134 self catchExpose. |
|
2135 " |
|
2136 copy the thumbs pixels |
|
2137 " |
|
2138 (orientation == #vertical) ifTrue:[ |
|
2139 self copyFrom:self x:thumbLeft y:oldTop |
|
2140 toX:thumbLeft y:thumbTop |
|
2141 width:tW height:tH. |
|
2142 ] ifFalse:[ |
|
2143 self copyFrom:self x:oldLeft y:thumbTop |
|
2144 toX:thumbLeft y:thumbTop |
|
2145 width:tW height:tH. |
|
2146 ]. |
|
2147 |
|
2148 " |
|
2149 clear some of the previous thumbs area to background |
|
2150 " |
|
2151 (orientation == #vertical) ifTrue:[ |
|
2152 bgLeft := thumbLeft. |
|
2153 bgWidth := tW. |
|
2154 oldTop > thumbTop ifTrue:[ |
|
2155 delta := oldTop - thumbTop. |
|
2156 oldTop > thumbBot ifTrue:[ |
|
2157 bgTop := oldTop. |
|
2158 bgHeight := tH + 1 |
|
2159 ] ifFalse:[ |
|
2160 bgTop := thumbBot. |
|
2161 bgHeight := delta |
|
2162 ] |
|
2163 ] ifFalse:[ |
|
2164 delta := thumbTop - oldTop. |
|
2165 oldBot < thumbTop ifTrue:[ |
|
2166 bgTop := oldTop. |
|
2167 bgHeight := tH + 1 |
|
2168 ] ifFalse:[ |
|
2169 bgTop := oldTop. |
|
2170 bgHeight := delta |
|
2171 ] |
|
2172 ]. |
|
2173 ] ifFalse:[ |
|
2174 bgTop := thumbTop. |
|
2175 bgHeight := tH. |
|
2176 oldLeft > thumbLeft ifTrue:[ |
|
2177 delta := oldLeft - thumbLeft. |
|
2178 oldLeft > thumbRight ifTrue:[ |
|
2179 bgLeft := oldLeft. |
|
2180 bgWidth := tW + 1. |
|
2181 ] ifFalse:[ |
|
2182 bgLeft := thumbRight. |
|
2183 bgWidth := delta. |
|
2184 ] |
|
2185 ] ifFalse:[ |
|
2186 delta := thumbLeft - oldLeft. |
|
2187 oldRight < thumbLeft ifTrue:[ |
|
2188 bgLeft := oldLeft. |
|
2189 bgWidth := tW + 1. |
|
2190 ] ifFalse:[ |
|
2191 bgLeft := oldLeft. |
|
2192 bgWidth := delta. |
|
2193 ] |
|
2194 ]. |
|
2195 ]. |
|
2196 self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
2197 self waitForExpose |
|
2198 ] |
|
2199 ] ifFalse:[ |
|
2200 thumbFrame := nil |
|
2201 ] |
|
2202 ] |
|
2203 ! ! |
|
2204 |
|
2205 !Scroller methodsFor:'queries'! |
|
2206 |
|
2207 otal := aView transformation applyScaleX:total. |
1565 ]. |
2208 ]. |
1566 ]. |
2209 ]. |
1567 (total = 0) ifTrue:[ |
2210 (total = 0) ifTrue:[ |
1568 percent := 100 |
2211 percent := 100 |
1569 ] ifFalse:[ |
2212 ] ifFalse:[ |