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