author | Claus Gittinger <cg@exept.de> |
Thu, 23 Nov 2000 14:21:00 +0100 | |
changeset 2321 | e1fa2ff7d945 |
parent 2313 | c3c2415333bb |
child 2333 | 725d7913a406 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
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 |
||
2171 | 13 |
"{ Package: 'stx:libwidg' }" |
14 |
||
0 | 15 |
View subclass:#Scroller |
1011 | 16 |
instanceVariableNames:'thumbOrigin thumbHeight thumbColor thumbFrameColor scrollAction |
17 |
orientation thumbFrame thumbLevel scrolling pressOffset |
|
18 |
synchronousOperation shadowForm lightForm inset thumbShadowColor |
|
19 |
thumbLightColor thumbEdgeStyle thumbHalfShadowColor |
|
20 |
thumbHalfLightColor thumbEnteredColor thumbFrameSizeDifference |
|
21 |
tallyLevel tallyMarks fixThumbHeight frameBeforeMove ghostColor |
|
22 |
ghostFrameColor ghostLevel rangeStart rangeEnd rangeStep entered |
|
1830 | 23 |
thumbActiveLevel originBeforeMove thumbImage enabled keyboardStep |
24 |
autoRepeat repeatBlock initialRepeatDelay repeatDelay' |
|
1011 | 25 |
classVariableNames:'HandleShadowForm HandleLightForm DefaultViewBackground |
26 |
DefaultShadowColor DefaultLightColor DefaultThumbColor |
|
27 |
DefaultThumbShadowColor DefaultThumbLightColor |
|
28 |
DefaultThumbHalfShadowColor DefaultThumbHalfLightColor |
|
29 |
DefaultHalfShadowColor DefaultHalfLightColor DefaultTallyMarks |
|
30 |
DefaultTallyLevel DefaultLevel DefaultBorderWidth |
|
31 |
DefaultThumbLevel DefaultInset DefaultThumbFrameColor |
|
32 |
DefaultGhostColor DefaultGhostFrameColor DefaultGhostLevel |
|
33 |
DefaultFixThumbHeight DefaultEdgeStyle DefaultFullViewBackground |
|
1301 | 34 |
DefaultThumbEnteredColor DefaultThumbActiveLevel SnapBackDistance |
1886 | 35 |
DefaultMiddleButtonJump NewCursors DefaultThumbImage HandleImage |
36 |
DefaultHScrollerHeight DefaultVScrollerWidth' |
|
1011 | 37 |
poolDictionaries:'' |
38 |
category:'Views-Interactors' |
|
0 | 39 |
! |
40 |
||
897 | 41 |
!Scroller class methodsFor:'documentation'! |
3 | 42 |
|
38 | 43 |
copyright |
44 |
" |
|
45 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
46 |
All Rights Reserved |
38 | 47 |
|
48 |
This software is furnished under a license and may be used |
|
49 |
only in accordance with the terms of that license and with the |
|
50 |
inclusion of the above copyright notice. This software may not |
|
51 |
be provided or otherwise made available to, or used by, any |
|
52 |
other person. No title to or ownership of the software is |
|
53 |
hereby transferred. |
|
54 |
" |
|
55 |
! |
|
56 |
||
3 | 57 |
documentation |
58 |
" |
|
38 | 59 |
this class implements the scroller for scrollbars. |
60 |
it can also be used by itself for scrollbars without step-buttons. |
|
63 | 61 |
When moved, either a predefined action is performed (scrollAction), |
119 | 62 |
or a model is informed via the changeMsg (which is #value: by default). |
63 | 63 |
|
38 | 64 |
The scroller can work synchronous (i.e. every move leads to an immediate evaluation |
65 |
of the action, or asynchronous (i.e. perform action on end-of move). |
|
63 | 66 |
By default, scrollers are synchronous. Asynchronous operation makes sense, |
67 |
if the scroll operation (redraw) is expensive and takes a long time. |
|
0 | 68 |
|
127 | 69 |
This class is used both for concrete instances (vertical scrollers) |
70 |
and as an abstract superclass for horizontalScrollers, sliders and |
|
71 |
miniScrollers. |
|
72 |
||
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
73 |
range: |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
74 |
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
|
75 |
to the min/maxRange instance variables. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
76 |
These default to 0..100 for percentage values. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
77 |
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
|
78 |
but may be useful with Sliders or in special applications. |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
79 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
80 |
style stuff: |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
81 |
|
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
82 |
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
|
83 |
(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
|
84 |
These are controlled by the shadowForm, lightForm, tallyLevel and tallyMarks |
1302 | 85 |
instance variables. All of this is initialized from the styleSheet. |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
86 |
|
585 | 87 |
[Instance variables:] |
0 | 88 |
|
38 | 89 |
thumbOrigin <Number> origin of thumb (in percent) |
90 |
thumbHeight <Number> height of thumb (in percent) |
|
91 |
thumbColor <Color> color of thumb |
|
92 |
thumbFrameColor <Color> color of the frame around the thumb |
|
93 |
scrollAction <Block> 1 arg block to be evaluated when scrolled |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
94 |
(arg is position in percent) |
119 | 95 |
orientation <Symbol> #horizontal or #vertical |
38 | 96 |
thumbFrame <Rectangle> frame of thumb in pixels (cached) |
97 |
thumbLevel <Number> level of thumb if 3d |
|
98 |
scrolling <Boolean> true during scroll |
|
99 |
pressOffset <Number> temporary (offset into frame when move started) |
|
100 |
synchronousOperation <Boolean> true if synchronous (i.e. dont wait till release |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
101 |
to perform action) |
38 | 102 |
shadowForm <Form> bitmap of knob if any (shadow part) |
103 |
lightForm <Form> bitmap of knob if any (light part) |
|
104 |
inset <Integer> number of pixels to inset thumb from view borders |
|
105 |
thumbShadowColor <Color> color do draw dark parts of thumb |
|
106 |
thumblightColor <Color> color to draw light parts of thumb |
|
63 | 107 |
thumbEdgeStyle <SymbolOrNil> #soft or nil |
38 | 108 |
thumbHalfShadowColor <Color> used to draw smooth edges |
109 |
thumbHalfLightColor <Color> used to draw smooth edges |
|
110 |
thumbFrameSizeDifference <Integer> number of pixels the thumb is larger than |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
111 |
it should be (can be negative for mswin-style) |
38 | 112 |
tallyLevel <Integer> if not zero, specifies if tally-marks should |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
113 |
go into or out of the display (actually only <0/>0 is checked) |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
114 |
I dont know of a better word for these ... |
38 | 115 |
tallyMarks <Integer> number of tally marks |
116 |
fixThumbHeight <Boolean> perform 'wrong' height computation a la mswindows |
|
117 | 117 |
rangeStart <Number> the range of the scroller |
118 |
rangeEnd (defaults to 0..100) |
|
119 | 119 |
rangeStep not currently implemented |
63 | 120 |
|
585 | 121 |
[style settings:] |
63 | 122 |
|
123 |
scrollerLevel <Integer> the level of the scroller w.r.t. its enclosing view |
|
124 |
scrollerBorderWidth <Integer> the borderWidth (ignored for 3D styles) |
|
125 |
||
126 |
scrollerViewBackground <Color> the viewBackground (color or image) |
|
127 |
scrollerShadowColor <Color> the color of 3D shadowed edges (ignored in 2D styles) |
|
128 |
scrollerLightColor <Color> the color of 3D lighted edges (ignored in 2D styles) |
|
129 |
||
130 |
scrollerThumbColor <Color> the thumbs color (color or image) |
|
131 |
scrollerThumbShadowColor <Color> the color of the thumbs shadowed edges (ignored in 2D styles) |
|
132 |
scrollerThumbLightColor <Color> the color of the thumbs shadowed edges (ignored in 2D styles) |
|
133 |
scrollerThumbEdgeStyle <Symbol> the edge style for the thumb (#soft or nil) |
|
134 |
scrollerThumbLevel <Integer> the 3D height of the thumb |
|
135 |
scrollerThumbHalfShadowColor<Color> the halfShadow for soft edged thumbs |
|
136 |
scrollerThumbHalfLightColor <Color> the halfLight for soft edged thumbs |
|
137 |
scrollerThumbFrameColor <Color> if non-nil, a rectangle is drawn around the thumb is this color |
|
138 |
scrollerThumbInset <Integer> inset of thumb from the scrollers boundary |
|
139 |
scrollerThumbFixHeight <Boolean> if true, use a fix thumb height (as in mswindows) |
|
140 |
scrollerGhostColor <Color> the color in which a ghost-rectangle is drawn |
|
141 |
scrollerGhostFrameColor <Color> if non-nil, a rectangle is drawn around the ghost is this color |
|
142 |
scrollerGhostLevel <Color> the 3D level of the ghost rectangle |
|
143 |
scrollerNTallyMarks <Integer> number of tally-marks to draw on the thumb |
|
1302 | 144 |
scrollerTallyLevel <Integer> the 3D level of any tally marks |
145 |
scrollerSnapBack <Boolean> win95 behavior: snap back to original position if scrollers view |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
146 |
is left by mouse (with some distance) |
1302 | 147 |
scrollerMiddleButtonJump <Boolean> xterm behavior: middle button has shift-click behavior |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
148 |
(positions absolute to click position) |
63 | 149 |
|
38 | 150 |
notice: for mswindows style, we force a WRONG thumb-frame |
151 |
computation, to make the thumb have constant size; |
|
1302 | 152 |
if you dont like that (I do not :-), |
153 |
set scrollerThumbFixHeight to false (in the StyleSheet). |
|
585 | 154 |
|
155 |
[author:] |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
156 |
Claus Gittinger |
585 | 157 |
|
158 |
[see also:] |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
159 |
ScrollBar |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
160 |
ScrollableView HVScrollableView |
3 | 161 |
" |
117 | 162 |
! |
163 |
||
164 |
examples |
|
165 |
" |
|
133 | 166 |
basic scroller setup: |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
167 |
[exBegin] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
168 |
|top s| |
133 | 169 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
170 |
top := StandardSystemView new extent:200@200. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
171 |
s := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
172 |
s origin:(0.0@0.0) corner:(20@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
173 |
s thumbHeight:10. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
174 |
top open |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
175 |
[exEnd] |
133 | 176 |
|
177 |
setting its thumb-height: |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
178 |
[exBegin] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
179 |
|top s| |
133 | 180 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
181 |
top := StandardSystemView new extent:200@200. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
182 |
s := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
183 |
s origin:(0.0@0.0) corner:(20@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
184 |
s thumbHeight:50. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
185 |
top open |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
186 |
[exEnd] |
133 | 187 |
|
188 |
setting its thumb-origin: |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
189 |
[exBegin] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
190 |
|top s| |
133 | 191 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
192 |
top := StandardSystemView new extent:200@200. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
193 |
s := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
194 |
s origin:(0.0@0.0) corner:(20@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
195 |
s thumbHeight:10. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
196 |
s thumbOrigin:30. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
197 |
top open |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
198 |
[exEnd] |
133 | 199 |
|
117 | 200 |
a scroller with action block (ST/X style): |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
201 |
[exBegin] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
202 |
|top s| |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
203 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
204 |
top := StandardSystemView new extent:200@200. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
205 |
s := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
206 |
s origin:(0.0@0.0) corner:(20@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
207 |
s thumbHeight:10. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
208 |
s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat]. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
209 |
top open |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
210 |
[exEnd] |
117 | 211 |
|
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
212 |
setting its range: |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
213 |
[exBegin] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
214 |
|top s| |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
215 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
216 |
top := StandardSystemView new extent:200@200. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
217 |
s := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
218 |
s origin:(0.0@0.0) corner:(20@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
219 |
s thumbHeight:10. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
220 |
s scrollAction:[:percent | Transcript show:'moved to: '; showCR:percent asFloat]. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
221 |
s start:0 stop:1. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
222 |
top open |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
223 |
[exEnd] |
117 | 224 |
|
130 | 225 |
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
|
226 |
at the side; beside another view: |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
227 |
[exBegin] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
228 |
|top s v| |
130 | 229 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
230 |
top := StandardSystemView new extent:200@200. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
231 |
s := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
232 |
s origin:(0.0@0.0) corner:(0.0@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
233 |
s rightInset:(s preferredExtent x negated). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
234 |
s thumbHeight:10. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
235 |
s level:1. |
130 | 236 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
237 |
v := View in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
238 |
v origin:0.0@0.0 corner:1.0@1.0. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
239 |
v leftInset:(s preferredExtent x). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
240 |
v viewBackground:Color red. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
241 |
v level:2. |
130 | 242 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
243 |
top open |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
244 |
[exEnd] |
130 | 245 |
|
117 | 246 |
using a model (ST-80 style): |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
247 |
[exBegin] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
248 |
|top s m| |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
249 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
250 |
m := 0 asValue. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
251 |
InspectorView openOn:m monitor:'value'. 'look at value'. |
117 | 252 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
253 |
top := StandardSystemView new extent:200@200. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
254 |
s := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
255 |
s origin:(0.0@0.0) corner:(20@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
256 |
s thumbHeight:10. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
257 |
s model:m. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
258 |
top open |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
259 |
[exEnd] |
119 | 260 |
|
117 | 261 |
using a different changeSelector: |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
262 |
[exBegin] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
263 |
|top s1 s2 m| |
117 | 264 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
265 |
m := Plug new. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
266 |
m respondTo:#value1: with:[:v | Transcript show:'scroller 1 moved to: '; showCR:v]. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
267 |
m respondTo:#value2: with:[:v | Transcript show:'scroller 2 moved to: '; showCR:v]. |
117 | 268 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
269 |
top := StandardSystemView new extent:200@200. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
270 |
s1 := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
271 |
s1 origin:(0.0@0.0) corner:(20@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
272 |
s1 thumbHeight:10. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
273 |
s1 model:m; change:#value1:. |
117 | 274 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
275 |
s2 := Scroller in:top. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
276 |
s2 origin:(30@0.0) corner:(50@1.0). |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
277 |
s2 thumbHeight:10. 'percent'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
278 |
s2 model:m; change:#value2:. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
279 |
top open |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
280 |
[exEnd] |
117 | 281 |
" |
3 | 282 |
! ! |
0 | 283 |
|
897 | 284 |
!Scroller class methodsFor:'defaults'! |
0 | 285 |
|
205 | 286 |
handleLightFormOn:aDisplay |
287 |
"answer the form used for the handles light area; |
|
288 |
cache the one for Display for the next round" |
|
289 |
||
290 |
|f| |
|
291 |
||
292 |
((aDisplay == Display) and:[HandleLightForm notNil]) ifTrue:[ |
|
2061
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
293 |
^ HandleLightForm |
205 | 294 |
]. |
2075 | 295 |
f := Smalltalk imageFromFileNamed:'HandleLight.xbm' forClass:self. |
2061
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
296 |
f notNil ifTrue:[ |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
297 |
f := f onDevice:aDisplay |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
298 |
] ifFalse:[ |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
299 |
f := Form width:8 height:8 fromArray:#[2r00000000 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
300 |
2r00000010 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
301 |
2r00000011 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
302 |
2r00000011 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
303 |
2r00000011 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
304 |
2r00000011 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
305 |
2r00000110 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
306 |
2r00111100] |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
307 |
on:aDisplay |
205 | 308 |
]. |
309 |
(aDisplay == Display) ifTrue:[ |
|
2061
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
310 |
HandleLightForm := f |
205 | 311 |
]. |
312 |
^ f |
|
897 | 313 |
|
314 |
"Modified: 23.10.2031 / 01:00:00 / cg" |
|
205 | 315 |
! |
316 |
||
317 |
handleShadowFormOn:aDisplay |
|
318 |
"answer the form used for the handles shadow area; |
|
319 |
cache the one for Display for the next round" |
|
320 |
||
321 |
|f| |
|
322 |
||
323 |
((aDisplay == Display) and:[HandleShadowForm notNil]) ifTrue:[ |
|
2061
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
324 |
^ HandleShadowForm |
205 | 325 |
]. |
2075 | 326 |
f := Smalltalk imageFromFileNamed:'HandleShadow.xbm' forClass:self. |
2061
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
327 |
f notNil ifTrue:[ |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
328 |
f := f onDevice:aDisplay |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
329 |
] ifFalse:[ |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
330 |
f := Form width:8 height:8 fromArray:#[2r00111100 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
331 |
2r01100000 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
332 |
2r11000000 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
333 |
2r11000000 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
334 |
2r11000000 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
335 |
2r11000000 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
336 |
2r01000000 |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
337 |
2r00000000] |
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
338 |
on:aDisplay |
205 | 339 |
]. |
340 |
(aDisplay == Display) ifTrue:[ |
|
2061
fd67d71cc107
try my bitmaps in package directory
Claus Gittinger <cg@exept.de>
parents:
2032
diff
changeset
|
341 |
HandleShadowForm := f |
205 | 342 |
]. |
343 |
^ f |
|
897 | 344 |
|
345 |
"Modified: 19.12.1996 / 01:00:00 / cg" |
|
205 | 346 |
! |
347 |
||
59 | 348 |
updateStyleCache |
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
349 |
"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
|
350 |
|
1347
dc1bf0e46865
new viewStyle resource naming
Claus Gittinger <cg@exept.de>
parents:
1315
diff
changeset
|
351 |
<resource: #style (#'scroller.viewBackground' #'scroller.fullViewBackground' |
2010 | 352 |
#'scroller.thumbColor' |
353 |
#'scroller.shadowColor' #'scroller.lightColor' |
|
354 |
#'scroller.thumbShadowColor' #'scroller.thumbLightColor' |
|
355 |
#'scroller.thumbHalfShadowColor' #'scroller.thumbHalfLightColor' |
|
356 |
#'scroller.thumbFrameColor' #'scroller.ghostColor' |
|
357 |
#'scroller.ghostLevel' #'scroller.ghostFrameColor' |
|
358 |
#'scroller.NTallyMarks' #'scroller.tallyLevel' |
|
359 |
#'scroller.level' #'scroller.borderWidth' |
|
360 |
#'scroller.thumbLevel' #'scroller.thumbInset' |
|
361 |
#'scroller.thumbFixHeight' #'scroller.thumbEdgeStyle' |
|
362 |
#'scroller.thumbEnteredColor' #'scroller.thumbActiveLevel' |
|
363 |
#'scroller.middleButtonJump' |
|
364 |
#'scroller.newCursors' |
|
365 |
#'scroller.thumbImage' #'scroller.handleImage' |
|
366 |
#'scroller.vScrollerWidth' #'scroller.hScrollerHeight' |
|
367 |
)> |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
368 |
|
1870 | 369 |
DefaultViewBackground := StyleSheet colorAt:#'scroller.viewBackground'. |
370 |
DefaultFullViewBackground := StyleSheet colorAt:#'scroller.fullViewBackground'. |
|
371 |
DefaultThumbColor := StyleSheet colorAt:#'scroller.thumbColor'. |
|
372 |
DefaultThumbEnteredColor := StyleSheet colorAt:#'scroller.thumbEnteredColor'. |
|
373 |
DefaultShadowColor := StyleSheet colorAt:#'scroller.shadowColor'. |
|
374 |
DefaultLightColor := StyleSheet colorAt:#'scroller.lightColor'. |
|
375 |
DefaultThumbShadowColor := StyleSheet colorAt:#'scroller.thumbShadowColor'. |
|
376 |
DefaultThumbLightColor := StyleSheet colorAt:#'scroller.thumbLightColor'. |
|
377 |
DefaultThumbHalfShadowColor := StyleSheet colorAt:#'scroller.thumbHalfShadowColor'. |
|
378 |
DefaultThumbHalfLightColor := StyleSheet colorAt:#'scroller.thumbHalfLightColor'. |
|
379 |
DefaultThumbFrameColor := StyleSheet colorAt:#'scroller.thumbFrameColor'. |
|
380 |
DefaultGhostColor := StyleSheet colorAt:#'scroller.ghostColor' default:nil. |
|
381 |
DefaultGhostFrameColor := StyleSheet colorAt:#'scroller.ghostFrameColor' default:nil. |
|
382 |
DefaultGhostLevel := StyleSheet at:#'scroller.ghostLevel' default:0. |
|
383 |
DefaultTallyMarks := StyleSheet at:#'scroller.NTallyMarks' default:0. |
|
59 | 384 |
DefaultTallyLevel := 0. |
385 |
DefaultTallyMarks ~~ 0 ifTrue:[ |
|
2010 | 386 |
DefaultTallyLevel := StyleSheet at:#'scroller.tallyLevel' default:1. |
59 | 387 |
]. |
1870 | 388 |
DefaultLevel := StyleSheet at:#'scroller.level' default:0. |
389 |
DefaultBorderWidth := StyleSheet at:#'scroller.borderWidth' default:(StyleSheet at:#'borderWidth'). |
|
390 |
DefaultThumbLevel := StyleSheet at:#'scroller.thumbLevel' default:0. |
|
391 |
DefaultThumbActiveLevel := StyleSheet at:#'scroller.thumbActiveLevel' default:DefaultThumbLevel. |
|
392 |
DefaultInset := StyleSheet at:#'scroller.thumbInset' default:0. |
|
393 |
DefaultFixThumbHeight := StyleSheet at:#'scroller.thumbFixHeight' default:false. |
|
394 |
DefaultEdgeStyle := StyleSheet at:#'scroller.thumbEdgeStyle'. |
|
395 |
DefaultMiddleButtonJump := StyleSheet at:#'scroller.middleButtonJump' default:false. |
|
396 |
NewCursors := StyleSheet at:#'scroller.newCursors' default:true. |
|
397 |
DefaultThumbImage := StyleSheet at:#'scroller.thumbImage'. |
|
398 |
HandleImage := StyleSheet at:#'scroller.handleImage'. |
|
130 | 399 |
|
1886 | 400 |
DefaultVScrollerWidth := StyleSheet at:#'scroller.vScrollerWidth' default:nil. |
401 |
DefaultHScrollerHeight := StyleSheet at:#'scroller.hScrollerHeight' default:nil. |
|
402 |
||
130 | 403 |
StyleSheet fileReadFailed ifTrue:[ |
2010 | 404 |
DefaultViewBackground := Grey. |
405 |
DefaultThumbColor := White. |
|
406 |
DefaultThumbFrameColor := Black. |
|
407 |
DefaultInset := 1. |
|
1203 | 408 |
]. |
409 |
||
410 |
SnapBackDistance := 30. |
|
441
e170bca66a78
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
268
diff
changeset
|
411 |
|
1121 | 412 |
" |
413 |
self updateStyleCache |
|
414 |
" |
|
415 |
||
1887
3e9d0074808d
allow for forced scrollBar width/height (instead of computing)
Claus Gittinger <cg@exept.de>
parents:
1886
diff
changeset
|
416 |
"Modified: / 28.4.1999 / 19:23:24 / cg" |
205 | 417 |
! ! |
59 | 418 |
|
205 | 419 |
!Scroller methodsFor:'accessing'! |
0 | 420 |
|
1737
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
421 |
keyboardStep |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
422 |
"return the scrollers keyboard step. If non-nil, |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
423 |
thats the stepping value used with cursorUp/cursorDown keys. |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
424 |
(not used with Scrollers, but provided for subclasses)" |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
425 |
|
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
426 |
^ keyboardStep |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
427 |
! |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
428 |
|
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
429 |
keyboardStep:aNumber |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
430 |
"set the scrollers keyboard step. If non-nil, |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
431 |
thats the stepping value used with cursorUp/cursorDown keys. |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
432 |
(not used with Scrollers, but provided for subclasses)" |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
433 |
|
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
434 |
keyboardStep := aNumber |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
435 |
! |
1b57cb702892
preps for separate keyboardStep value.
Claus Gittinger <cg@exept.de>
parents:
1731
diff
changeset
|
436 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
437 |
start |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
438 |
"return the scrollers range min. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
439 |
(not used with Scrollers, but provided for subclasses)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
440 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
441 |
^ rangeStart |
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 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
444 |
start:start |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
445 |
"set the scrollers range min. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
446 |
(not used with Scrollers, but provided for subclasses)" |
205 | 447 |
|
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
448 |
self start:start stop:rangeEnd. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
449 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
450 |
"Modified: 25.5.1996 / 11:28:22 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
451 |
! |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
452 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
453 |
start:start stop:stop |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
454 |
"set the range. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
455 |
(not used with Scrollers, but provided for subclasses)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
456 |
|
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
457 |
|org| |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
458 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
459 |
org := self thumbOrigin. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
460 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
461 |
rangeStart := start. |
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
462 |
rangeEnd := stop. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
463 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
464 |
rangeStart = rangeEnd ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
465 |
self halt:'invalud slider range (start = stop)'. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
466 |
rangeStep isNil ifTrue:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
467 |
rangeEnd := rangeStart + 1 |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
468 |
] ifFalse:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
469 |
rangeEnd := rangeStart + rangeStep. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
470 |
] |
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
471 |
]. |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
472 |
|
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
473 |
org < rangeStart ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
474 |
org := rangeStart |
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
475 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
476 |
org > rangeEnd ifTrue:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
477 |
org := rangeEnd |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
478 |
] |
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
479 |
]. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
480 |
self thumbOrigin:org. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
481 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
482 |
"Modified: / 21.1.1998 / 19:22:07 / cg" |
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
483 |
! |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
484 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
485 |
start:start stop:stop step:step |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
486 |
"set the range. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
487 |
(not used with Scrollers, but provided for subclasses)" |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
488 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
489 |
self start:start stop:stop. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
490 |
rangeStep := step. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
491 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
492 |
"Created: 25.5.1996 / 11:24:09 / cg" |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
493 |
"Modified: 25.5.1996 / 11:27:43 / cg" |
205 | 494 |
! |
495 |
||
496 |
step |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
497 |
"return the scrollers range step. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
498 |
(not used with Scrollers, but provided for subclasses)" |
446 | 499 |
|
205 | 500 |
^ rangeStep |
105 | 501 |
! |
502 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
503 |
step:step |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
504 |
"set the scrollers range step. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
505 |
(not used with Scrollers, but provided for subclasses)" |
205 | 506 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
507 |
rangeStep := step |
205 | 508 |
! |
105 | 509 |
|
205 | 510 |
stop |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
511 |
"return the scrollers range max. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
512 |
(not used with Scrollers, but provided for subclasses)" |
446 | 513 |
|
205 | 514 |
^ rangeEnd |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
515 |
! |
446 | 516 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
517 |
stop:stop |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
518 |
"set the scrollers range max. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
519 |
(not used with Scrollers, but provided for subclasses)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
520 |
|
679
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
521 |
self start:rangeStart stop:stop. |
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
522 |
|
c702b3d82f01
recompute frame, when range changes
Claus Gittinger <cg@exept.de>
parents:
655
diff
changeset
|
523 |
"Modified: 25.5.1996 / 11:28:35 / cg" |
205 | 524 |
! |
0 | 525 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
526 |
thumbFrame |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
527 |
"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
|
528 |
Allows access to the thumbs physical screen position, for |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
529 |
example to position a label below (see Slider-Examples)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
530 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
531 |
thumbFrame isNil ifTrue:[ self computeThumbFrame]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
532 |
^ thumbFrame |
119 | 533 |
! |
534 |
||
205 | 535 |
thumbHeight |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
536 |
"answer the thumbs height (in percent by default)" |
119 | 537 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
538 |
^ thumbHeight * (rangeEnd - rangeStart) abs / 100 |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
539 |
|
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
540 |
"Modified: / 21.1.1998 / 19:25:33 / cg" |
119 | 541 |
! |
542 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
543 |
thumbHeight:aNumber |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
544 |
"set the thumbs height (in percent by default)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
545 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
546 |
|newHeight realNewHeight oldFrame nBg| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
547 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
548 |
newHeight := aNumber / ((rangeEnd - rangeStart) abs / 100). |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
549 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
550 |
(newHeight > 100) ifTrue:[ |
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
551 |
realNewHeight := 100 |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
552 |
] ifFalse:[ |
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
553 |
realNewHeight := newHeight |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
554 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
555 |
((realNewHeight ~= thumbHeight) or:[thumbFrame isNil]) ifTrue:[ |
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
556 |
thumbHeight := realNewHeight. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
557 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
558 |
(DefaultFullViewBackground notNil |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
559 |
and:[DefaultViewBackground notNil |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
560 |
and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
561 |
realNewHeight >= 100 ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
562 |
nBg := DefaultFullViewBackground. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
563 |
] ifFalse:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
564 |
nBg := DefaultViewBackground |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
565 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
566 |
nBg := nBg onDevice:device. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
567 |
nBg ~~ viewBackground ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
568 |
self viewBackground:nBg. |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
569 |
shown ifTrue:[self invalidate]. |
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
570 |
] |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
571 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
572 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
573 |
shown ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
574 |
"/ thumbFrame := nil. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
575 |
oldFrame := thumbFrame. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
576 |
self computeThumbFrame. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
577 |
oldFrame ~= thumbFrame ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
578 |
self invalidate. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
579 |
] |
1189
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
580 |
|
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
581 |
"/ self computeThumbFrame. |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
582 |
"/ (fixThumbHeight or:[oldFrame ~= thumbFrame]) ifTrue:[ |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
583 |
"/ oldFrame notNil ifTrue:[ |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
584 |
"/ self drawThumbBackgroundInX:(oldFrame left) |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
585 |
"/ y:(oldFrame top) |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
586 |
"/ width:(oldFrame width) |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
587 |
"/ height:(oldFrame height). |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
588 |
"/ ]. |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
589 |
"/ self drawThumb |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
590 |
"/ ] |
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
591 |
] ifFalse:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
592 |
thumbFrame := nil |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
593 |
] |
119 | 594 |
] |
1127 | 595 |
|
1709 | 596 |
"Modified: / 21.10.1998 / 22:35:31 / cg" |
119 | 597 |
! |
598 |
||
205 | 599 |
thumbOrigin |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
600 |
"answer the thumbs origin (in percent by default)" |
205 | 601 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
602 |
|org| |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
603 |
|
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
604 |
org := thumbOrigin * (rangeEnd - rangeStart) / 100 + rangeStart. |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
605 |
rangeStep notNil ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
606 |
org := org roundTo:rangeStep. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
607 |
rangeStep isInteger ifTrue:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
608 |
org := org asInteger |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
609 |
] |
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
610 |
]. |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
611 |
^ org |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
612 |
|
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
613 |
"Modified: / 21.1.1998 / 19:13:48 / cg" |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
614 |
! |
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
615 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
616 |
thumbOrigin:aNumber |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
617 |
"set the thumbs origin (in percent by default)" |
448
e23465aad9e8
use new defaultExtent protocol
Claus Gittinger <cg@exept.de>
parents:
446
diff
changeset
|
618 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
619 |
|org newOrigin realNewOrigin |
119 | 620 |
oldFrame oldTop oldBot oldLeft oldRight |
621 |
thumbTop thumbBot thumbLeft thumbRight |
|
105 | 622 |
tH "{ Class: SmallInteger }" |
1897 | 623 |
tW "{ Class: SmallInteger }" |
132 | 624 |
delta needFullDraw |
119 | 625 |
bgLeft bgTop bgWidth bgHeight| |
105 | 626 |
|
1250
5e4f96c330de
handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents:
1203
diff
changeset
|
627 |
aNumber isNil ifTrue:[ |
2010 | 628 |
newOrigin := 0 |
1250
5e4f96c330de
handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents:
1203
diff
changeset
|
629 |
] ifFalse:[ |
2010 | 630 |
org := aNumber. |
631 |
rangeStep notNil ifTrue:[ |
|
632 |
org := org roundTo:rangeStep. |
|
633 |
rangeStep isInteger ifTrue:[ |
|
634 |
org := org asInteger |
|
635 |
] |
|
636 |
]. |
|
637 |
newOrigin := (org - rangeStart) asFloat / (rangeEnd - rangeStart / 100). |
|
1250
5e4f96c330de
handle a nil thumbOrigin argument (uninitialized model)
Claus Gittinger <cg@exept.de>
parents:
1203
diff
changeset
|
638 |
]. |
117 | 639 |
|
105 | 640 |
((newOrigin + thumbHeight) > 100) ifTrue:[ |
2010 | 641 |
realNewOrigin := 100 - thumbHeight |
105 | 642 |
] ifFalse: [ |
2010 | 643 |
realNewOrigin := newOrigin |
105 | 644 |
]. |
645 |
(realNewOrigin > 100) ifTrue:[ |
|
2010 | 646 |
realNewOrigin := 100 |
105 | 647 |
] ifFalse: [ |
2010 | 648 |
(realNewOrigin < 0) ifTrue:[ |
649 |
realNewOrigin := 0 |
|
650 |
] |
|
105 | 651 |
]. |
652 |
((realNewOrigin ~= thumbOrigin) or:[thumbFrame isNil]) ifTrue:[ |
|
2010 | 653 |
thumbOrigin := realNewOrigin. |
654 |
||
655 |
shown ifTrue:[ |
|
656 |
oldFrame := thumbFrame. |
|
657 |
self computeThumbFrame. |
|
658 |
(thumbHeight = 100) ifTrue:[ |
|
659 |
"/ full: don't draw |
|
660 |
^ self |
|
661 |
]. |
|
662 |
||
663 |
(thumbFrame ~= oldFrame) ifTrue:[ |
|
664 |
oldFrame isNil ifTrue:[ |
|
665 |
self invalidate. |
|
666 |
"/ self drawThumb. |
|
667 |
^ self |
|
668 |
]. |
|
669 |
tH := thumbFrame height. |
|
670 |
tW := thumbFrame width. |
|
671 |
||
672 |
oldTop := oldFrame top. |
|
673 |
oldBot := oldTop + tH. |
|
674 |
oldLeft := oldFrame left. |
|
675 |
oldRight := oldLeft + tW. |
|
676 |
||
677 |
thumbTop := thumbFrame top. |
|
678 |
thumbBot := thumbTop + tH. |
|
679 |
thumbLeft := thumbFrame left. |
|
680 |
thumbRight := thumbLeft + tW. |
|
681 |
||
682 |
needFullDraw := self exposeEventPending |
|
683 |
or:[((orientation == #vertical) and:[oldBot >= height]) |
|
684 |
or:[((orientation ~~ #vertical) and:[oldRight >= width])]]. |
|
685 |
||
686 |
needFullDraw ifTrue:[ |
|
687 |
" |
|
688 |
cannot copy since thumb was below the end |
|
689 |
or may be not available for the copy |
|
690 |
" |
|
691 |
self invalidate. |
|
1189
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
692 |
"/ (orientation == #vertical) ifTrue:[ |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
693 |
"/ self drawThumbBackgroundInX:thumbLeft y:oldTop |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
694 |
"/ width:tW height:(height - oldTop). |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
695 |
"/ ] ifFalse:[ |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
696 |
"/ self drawThumbBackgroundInX:oldLeft y:thumbTop |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
697 |
"/ width:(width - oldLeft) height:tH. |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
698 |
"/ ]. |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
699 |
"/ self drawThumb. |
2010 | 700 |
^ self |
701 |
]. |
|
702 |
||
703 |
self catchExpose. |
|
704 |
" |
|
705 |
copy the thumbs pixels |
|
706 |
" |
|
707 |
(orientation == #vertical) ifTrue:[ |
|
708 |
self |
|
709 |
copyFrom:self |
|
710 |
x:thumbLeft y:oldTop |
|
711 |
toX:thumbLeft y:thumbTop |
|
712 |
width:tW height:tH |
|
713 |
async:true. |
|
714 |
] ifFalse:[ |
|
715 |
self |
|
716 |
copyFrom:self |
|
717 |
x:oldLeft y:thumbTop |
|
718 |
toX:thumbLeft y:thumbTop |
|
719 |
width:tW height:tH |
|
720 |
async:true. |
|
721 |
]. |
|
722 |
||
723 |
" |
|
724 |
clear some of the previous thumbs area to background |
|
725 |
" |
|
726 |
(orientation == #vertical) ifTrue:[ |
|
727 |
bgLeft := thumbLeft. |
|
728 |
bgWidth := tW. |
|
729 |
oldTop > thumbTop ifTrue:[ |
|
730 |
delta := oldTop - thumbTop. |
|
731 |
oldTop > thumbBot ifTrue:[ |
|
732 |
bgTop := oldTop. |
|
733 |
bgHeight := tH + 1 |
|
734 |
] ifFalse:[ |
|
735 |
bgTop := thumbBot. |
|
736 |
bgHeight := delta |
|
737 |
] |
|
738 |
] ifFalse:[ |
|
739 |
delta := thumbTop - oldTop. |
|
740 |
oldBot < thumbTop ifTrue:[ |
|
741 |
bgTop := oldTop. |
|
742 |
bgHeight := tH + 1 |
|
743 |
] ifFalse:[ |
|
744 |
bgTop := oldTop. |
|
745 |
bgHeight := delta |
|
746 |
] |
|
747 |
]. |
|
748 |
] ifFalse:[ |
|
749 |
bgTop := thumbTop. |
|
750 |
bgHeight := tH. |
|
751 |
oldLeft > thumbLeft ifTrue:[ |
|
752 |
delta := oldLeft - thumbLeft. |
|
753 |
oldLeft > thumbRight ifTrue:[ |
|
754 |
bgLeft := oldLeft. |
|
755 |
bgWidth := tW + 1. |
|
756 |
] ifFalse:[ |
|
757 |
bgLeft := thumbRight. |
|
758 |
bgWidth := delta. |
|
759 |
] |
|
760 |
] ifFalse:[ |
|
761 |
delta := thumbLeft - oldLeft. |
|
762 |
oldRight < thumbLeft ifTrue:[ |
|
763 |
bgLeft := oldLeft. |
|
764 |
bgWidth := tW + 1. |
|
765 |
] ifFalse:[ |
|
766 |
bgLeft := oldLeft. |
|
767 |
bgWidth := delta. |
|
768 |
] |
|
769 |
]. |
|
770 |
]. |
|
771 |
self drawThumbBackgroundInX:bgLeft y:bgTop width:bgWidth height:bgHeight. |
|
772 |
self waitForExpose |
|
773 |
] |
|
774 |
] ifFalse:[ |
|
775 |
thumbFrame := nil |
|
776 |
] |
|
105 | 777 |
] |
983 | 778 |
|
1897 | 779 |
"Modified: / 4.5.1999 / 18:57:28 / cg" |
105 | 780 |
! |
781 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
782 |
thumbOrigin:originNumber thumbHeight:heightNumber |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
783 |
"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
|
784 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
785 |
|newHeight newOrigin realNewOrigin realNewHeight old new changed |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
786 |
nBg range| |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
787 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
788 |
range := rangeEnd - rangeStart. |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
789 |
|
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
790 |
newOrigin := originNumber - rangeStart / (range / 100). |
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
791 |
newHeight := heightNumber / (range abs / 100). |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
792 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
793 |
(newHeight > 100) ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
794 |
realNewHeight := 100 |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
795 |
] ifFalse:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
796 |
realNewHeight := newHeight |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
797 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
798 |
((newOrigin + realNewHeight) > 100) ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
799 |
realNewOrigin := 100 - realNewHeight |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
800 |
] ifFalse: [ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
801 |
realNewOrigin := newOrigin |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
802 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
803 |
(realNewOrigin < 0) ifTrue: [ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
804 |
realNewOrigin := 0 |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
805 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
806 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
807 |
changed := (realNewHeight ~= thumbHeight) or:[realNewOrigin ~= thumbOrigin]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
808 |
(changed or:[thumbFrame isNil]) ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
809 |
old := self absFromPercent:thumbOrigin. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
810 |
new := self absFromPercent:realNewOrigin. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
811 |
changed := old ~~ new. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
812 |
changed ifFalse:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
813 |
old := self absFromPercent:thumbHeight. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
814 |
new := self absFromPercent:realNewHeight. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
815 |
changed := (old ~~ new) |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
816 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
817 |
(changed or:[thumbFrame isNil]) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
818 |
thumbOrigin := realNewOrigin. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
819 |
thumbHeight := realNewHeight. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
820 |
|
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
821 |
(DefaultFullViewBackground notNil |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
822 |
and:[DefaultViewBackground notNil |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
823 |
and:[DefaultFullViewBackground ~~ DefaultViewBackground]]) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
824 |
realNewHeight >= 100 ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
825 |
nBg := DefaultFullViewBackground. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
826 |
] ifFalse:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
827 |
nBg := DefaultViewBackground |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
828 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
829 |
nBg := nBg onDevice:device. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
830 |
nBg ~~ viewBackground ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
831 |
self viewBackground:nBg. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
832 |
shown ifTrue:[self invalidate]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
833 |
] |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
834 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
835 |
|
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
836 |
shown ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
837 |
thumbFrame := nil. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
838 |
self invalidate. |
1189
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
839 |
|
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
840 |
"/ thumbFrame notNil ifTrue:[ |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
841 |
"/ self drawThumbBackgroundInX:(thumbFrame left) |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
842 |
"/ y:(thumbFrame top) |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
843 |
"/ width:(thumbFrame width) |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
844 |
"/ height:(thumbFrame height). |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
845 |
"/ ]. |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
846 |
"/ self computeThumbFrame. |
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
847 |
"/ self drawThumb |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
848 |
] ifFalse:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
849 |
thumbFrame := nil |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
850 |
] |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
851 |
] |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
852 |
] |
1189
909fd985eb2c
use asynchronous invalidate, instead of syncronous redraws.
Claus Gittinger <cg@exept.de>
parents:
1167
diff
changeset
|
853 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
854 |
"Modified: / 21.1.1998 / 19:32:41 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
855 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
856 |
|
454 | 857 |
!Scroller methodsFor:'accessing-behavior'! |
858 |
||
859 |
action:aBlock |
|
860 |
"for protocol compatibility; same as scrollAction:" |
|
861 |
||
862 |
self scrollAction:aBlock |
|
863 |
! |
|
864 |
||
865 |
asynchronousOperation |
|
866 |
"set scroll-mode to be asynchronous - scroll action is performed after |
|
867 |
scrolling, when mouse-button is finally released" |
|
868 |
||
869 |
synchronousOperation := false |
|
870 |
! |
|
871 |
||
1830 | 872 |
enabled |
873 |
"return enable/disable state of the scoller" |
|
1652 | 874 |
|
1830 | 875 |
^ enabled |
876 |
||
877 |
"Created: / 30.3.1999 / 15:24:50 / stefan" |
|
1652 | 878 |
! |
879 |
||
1830 | 880 |
enabled:aBoolean |
881 |
"enable/disable the scoller" |
|
1652 | 882 |
|
1830 | 883 |
enabled ~~ aBoolean ifTrue:[ |
2010 | 884 |
enabled := aBoolean. |
885 |
self updateBackground. |
|
886 |
aBoolean ifFalse:[ |
|
887 |
self cursor: Cursor normal |
|
888 |
] |
|
1652 | 889 |
] |
890 |
||
1830 | 891 |
"Created: / 30.3.1999 / 15:23:14 / stefan" |
1652 | 892 |
! |
893 |
||
454 | 894 |
scrollAction |
895 |
"answer the scroll action block" |
|
896 |
||
897 |
^ scrollAction |
|
898 |
! |
|
899 |
||
900 |
scrollAction:aBlock |
|
901 |
"set the scroll action, aBlock which is evaluated when scrolled" |
|
902 |
||
903 |
scrollAction := aBlock |
|
904 |
! |
|
905 |
||
906 |
scrollDownAction:aBlock |
|
907 |
"ignored - |
|
908 |
but implemented, so that scroller can be used in place of a scrollbar" |
|
909 |
! |
|
910 |
||
911 |
scrollUpAction:aBlock |
|
912 |
"ignored - |
|
913 |
but implemented, so that scroller can be used in place of a scrollbar" |
|
914 |
! |
|
915 |
||
916 |
synchronousOperation |
|
917 |
"set scroll-mode to be synchronous - scroll action is performed for |
|
918 |
every movement of thumb" |
|
919 |
||
920 |
synchronousOperation := true |
|
921 |
! ! |
|
922 |
||
1652 | 923 |
!Scroller methodsFor:'accessing-bg & border'! |
924 |
||
925 |
allViewBackground:something |
|
1957 | 926 |
"ignore here for all scrollers (I want my own background)" |
927 |
||
1652 | 928 |
! ! |
929 |
||
454 | 930 |
!Scroller methodsFor:'accessing-look'! |
931 |
||
932 |
is3D |
|
958 | 933 |
"return true, if I use a 3D style" |
934 |
||
764 | 935 |
<resource: #style (#name)> |
936 |
||
454 | 937 |
styleSheet name = #mswindows ifTrue:[^ true]. |
938 |
^ super is3D |
|
764 | 939 |
|
958 | 940 |
"Modified: 17.1.1997 / 23:21:42 / cg" |
454 | 941 |
! |
942 |
||
943 |
orientation |
|
944 |
"return the scrollers orientation (#vertical or #horizontal)" |
|
945 |
||
946 |
^ orientation |
|
947 |
! |
|
948 |
||
1167
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
949 |
orientation:aSymbol |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
950 |
"set the scrollers orientation (#vertical or #horizontal)" |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
951 |
|
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
952 |
|oldFrame| |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
953 |
|
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
954 |
orientation := aSymbol. |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
955 |
preferredExtent := nil. |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
956 |
|
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
957 |
shown ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
958 |
oldFrame := thumbFrame. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
959 |
self computeThumbFrame. |
1167
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
960 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
961 |
oldFrame ~= thumbFrame ifTrue:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
962 |
self invalidate. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
963 |
] |
1167
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
964 |
] |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
965 |
|
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
966 |
"Created: 1.4.1997 / 12:18:32 / cg" |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
967 |
"Modified: 1.4.1997 / 12:20:46 / cg" |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
968 |
! |
90104d2f94d6
allow the orientation to be changed dynamically
Claus Gittinger <cg@exept.de>
parents:
1166
diff
changeset
|
969 |
|
689 | 970 |
thumb |
971 |
"for compatibility with scrollBars, return the receiver" |
|
972 |
||
973 |
^ self |
|
974 |
||
975 |
"Created: 26.5.1996 / 12:21:12 / cg" |
|
976 |
! |
|
977 |
||
454 | 978 |
thumbColor |
979 |
"return the thumbs color" |
|
980 |
||
981 |
^ thumbColor |
|
982 |
! |
|
983 |
||
984 |
thumbColor:aColor |
|
985 |
"change the color of the thumb" |
|
986 |
||
764 | 987 |
<resource: #style (#name)> |
988 |
||
1875
745aed60b0b2
when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
989 |
|avgColor| |
745aed60b0b2
when lighting/darkening colors, take the average in the topLeft
Claus Gittinger <cg@exept.de>
parents:
1870
diff
changeset
|
990 |
|
1988 | 991 |
thumbColor := aColor onDevice:device. |
454 | 992 |
(styleSheet name ~~ #normal) ifTrue:[ |
2010 | 993 |
avgColor := aColor averageColorIn:(0@0 corner:7@7). |
994 |
thumbShadowColor := avgColor darkened onDevice:device. |
|
995 |
thumbLightColor := avgColor lightened onDevice:device. |
|
996 |
thumbHalfShadowColor := thumbShadowColor darkened onDevice:device. |
|
997 |
thumbHalfLightColor := thumbLightColor lightened onDevice:device. |
|
454 | 998 |
]. |
993 | 999 |
self invalidate |
721
4a01084cf643
use #invalidate instead of #redraw
Claus Gittinger <cg@exept.de>
parents:
713
diff
changeset
|
1000 |
|
993 | 1001 |
"Modified: 8.2.1997 / 15:15:58 / cg" |
454 | 1002 |
! ! |
1003 |
||
1794 | 1004 |
!Scroller methodsFor:'autoRepeat'! |
1005 |
||
2313
c3c2415333bb
make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents:
2301
diff
changeset
|
1006 |
installRepeat |
2321 | 1007 |
repeatBlock notNil ifTrue:[ |
1008 |
self windowGroup repairDamage. |
|
1009 |
Processor addTimedBlock:repeatBlock afterSeconds:repeatDelay |
|
1010 |
] |
|
2313
c3c2415333bb
make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents:
2301
diff
changeset
|
1011 |
! |
c3c2415333bb
make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents:
2301
diff
changeset
|
1012 |
|
1794 | 1013 |
repeatPageDown |
2321 | 1014 |
repeatBlock notNil ifTrue:[ |
1015 |
self pageDown. |
|
1016 |
self installRepeat. |
|
1017 |
] |
|
1794 | 1018 |
! |
1019 |
||
1020 |
repeatPageUp |
|
2321 | 1021 |
repeatBlock notNil ifTrue:[ |
1022 |
self pageUp. |
|
1023 |
self installRepeat. |
|
1024 |
] |
|
1794 | 1025 |
! ! |
1026 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1027 |
!Scroller methodsFor:'drawing'! |
446 | 1028 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1029 |
drawHandleFormAtX:x y:y |
1988 | 1030 |
thumbShadowColor := thumbShadowColor onDevice:device. |
452
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 |
self paint:thumbShadowColor. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1033 |
self displayForm:shadowForm x:x y:y. |
1531
c5f2cfee9998
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1518
diff
changeset
|
1034 |
lightForm notNil ifTrue:[ |
2010 | 1035 |
thumbLightColor := thumbLightColor onDevice:device. |
1036 |
self paint:thumbLightColor. |
|
1037 |
self displayForm:lightForm x:x y:y. |
|
1531
c5f2cfee9998
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1518
diff
changeset
|
1038 |
]. |
c5f2cfee9998
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1518
diff
changeset
|
1039 |
|
c5f2cfee9998
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1518
diff
changeset
|
1040 |
"Modified: / 19.5.1998 / 16:26:49 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1041 |
! |
446 | 1042 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1043 |
drawThumb |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1044 |
"draw the thumb" |
446 | 1045 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1046 |
|handleX handleY l t lvl |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1047 |
w "{ Class: SmallInteger }" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1048 |
h "{ Class: SmallInteger }" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1049 |
x "{ Class: SmallInteger }" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1050 |
y "{ Class: SmallInteger }" |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1051 |
mm xL xR yT yB color1 color2 b r| |
446 | 1052 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1053 |
(thumbHeight >= 100) ifTrue:[^ self]. |
2177
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
1054 |
thumbFrame isNil ifTrue:[^ self]. |
1890 | 1055 |
|
1056 |
w := thumbFrame width. |
|
1057 |
h := thumbFrame height. |
|
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1058 |
l := thumbFrame left. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1059 |
t := thumbFrame top. |
1890 | 1060 |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1061 |
self paint:(entered ifTrue:[thumbEnteredColor] ifFalse:[thumbColor]). |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1062 |
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
|
1063 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1064 |
lvl := thumbLevel. |
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1065 |
scrolling ifTrue:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1066 |
lvl := thumbActiveLevel |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1067 |
]. |
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1068 |
|
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1069 |
lvl == 0 ifTrue:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1070 |
thumbFrameColor notNil ifTrue:[ |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1071 |
self paint:thumbFrameColor. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1072 |
self displayRectangleX:l y:t width:w height:h. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1073 |
]. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1074 |
thumbImage notNil ifTrue:[ |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1075 |
thumbImage displayOn:self x:l y:t |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1076 |
]. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1077 |
^ self |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1078 |
]. |
105 | 1079 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1080 |
self drawEdgesForX:l y:t width:w height:h level:lvl |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1081 |
shadow:thumbShadowColor light:thumbLightColor |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1082 |
halfShadow:thumbHalfShadowColor halfLight:thumbHalfLightColor |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1083 |
style:thumbEdgeStyle. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1084 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1085 |
thumbFrameColor notNil ifTrue:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1086 |
self paint:thumbFrameColor. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1087 |
self displayRectangleX:l y:t width:w height:h. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1088 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1089 |
|
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
1090 |
thumbImage notNil ifTrue:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1091 |
thumbImage displayOn:self x:l y:t |
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
1092 |
]. |
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
1093 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1094 |
(tallyLevel == 0 or:[tallyMarks == 0]) ifTrue:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1095 |
shadowForm notNil ifTrue:[ |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1096 |
handleX := l + ((w - 8) // 2). |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1097 |
handleY := t + ((h - 8) // 2). |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1098 |
self drawHandleFormAtX:handleX y:handleY |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1099 |
]. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1100 |
^ self |
452
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 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1103 |
"iris style - draw tallys" |
205 | 1104 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1105 |
tallyLevel > 0 ifTrue:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1106 |
color1 := thumbLightColor. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1107 |
color2 := thumbShadowColor. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1108 |
] ifFalse:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1109 |
color1 := thumbShadowColor. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1110 |
color2 := thumbLightColor. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1111 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1112 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1113 |
"draw tally marks" |
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 |
(orientation == #vertical) ifTrue:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1116 |
self paint:color1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1117 |
y := t + (h // 2) - 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1118 |
xL := l + lvl - 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1119 |
xR := l + w - lvl "+ 1". |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1120 |
self displayLineFromX:xL y:y toX:xR y:y. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1121 |
y := y + 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1122 |
self paint:color2. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1123 |
self displayLineFromX:xL y:y toX:xR y:y. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1124 |
|
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1125 |
tallyMarks > 1 ifTrue:[ |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1126 |
"dont draw other marks if there is not enough space" |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1127 |
|
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1128 |
mm := device verticalPixelPerMillimeter rounded. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1129 |
h > (mm * (tallyMarks * 2)) ifTrue:[ |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1130 |
y := y - 1 - mm. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1131 |
self paint:color1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1132 |
self displayLineFromX:xL y:y toX:xR y:y. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1133 |
y := y + 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1134 |
self paint:color2. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1135 |
self displayLineFromX:xL y:y toX:xR y:y. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1136 |
|
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1137 |
y := y - 1 + mm + mm. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1138 |
self paint:color1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1139 |
self displayLineFromX:xL y:y toX:xR y:y. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1140 |
y := y + 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1141 |
self paint:color2. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1142 |
self displayLineFromX:xL y:y toX:xR y:y |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1143 |
] |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1144 |
] |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1145 |
] ifFalse:[ |
2176
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1146 |
x := l + (w // 2) - 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1147 |
yT := t + lvl - 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1148 |
yB := t + h - lvl "+ 1". |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1149 |
self paint:color1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1150 |
self displayLineFromX:x y:yT toX:x y:yB. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1151 |
self paint:color2. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1152 |
x := x + 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1153 |
self displayLineFromX:x y:yT toX:x y:yB. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1154 |
|
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1155 |
tallyMarks > 1 ifTrue:[ |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1156 |
"dont draw other marks if there is not enough space" |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1157 |
|
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1158 |
mm := device horizontalPixelPerMillimeter rounded. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1159 |
w > (mm * (tallyMarks * 2)) ifTrue:[ |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1160 |
x := x - 1 - mm. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1161 |
self paint:color1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1162 |
self displayLineFromX:x y:yT toX:x y:yB. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1163 |
x := x + 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1164 |
self paint:color2. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1165 |
self displayLineFromX:x y:yT toX:x y:yB. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1166 |
|
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1167 |
x := x - 1 + mm + mm. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1168 |
self paint:color1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1169 |
self displayLineFromX:x y:yT toX:x y:yB. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1170 |
x := x + 1. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1171 |
self paint:color2. |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1172 |
self displayLineFromX:x y:yT toX:x y:yB |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1173 |
] |
7069af4213d6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2175
diff
changeset
|
1174 |
] |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1175 |
] |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1176 |
|
1890 | 1177 |
"Modified: / 29.4.1999 / 09:35:52 / cg" |
452
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 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1180 |
drawThumbBackgroundInX:x y:y width:w height:h |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1181 |
"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
|
1182 |
method, to allow drawing of arbitrary patterns under thumb |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1183 |
(see ColorSlider)." |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1184 |
|
699 | 1185 |
|oldClip gX gY gW gH| |
1186 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1187 |
shown ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1188 |
oldClip := self clippingRectangleOrNil. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1189 |
self clippingRectangle:(Rectangle left:x top:y width:w height:h). |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1190 |
self clearDeviceRectangleX:x y:y width:w height:h. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1191 |
|
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1192 |
frameBeforeMove notNil ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1193 |
(ghostColor notNil |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1194 |
or:[ghostFrameColor notNil |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1195 |
or:[ghostLevel ~~ 0]]) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1196 |
(frameBeforeMove intersects:(x@y extent:w@h)) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1197 |
gX := frameBeforeMove left. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1198 |
gY := frameBeforeMove top. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1199 |
gW := frameBeforeMove width. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1200 |
gH := frameBeforeMove height. |
1896 | 1201 |
|
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1202 |
ghostColor notNil ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1203 |
self paint:ghostColor. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1204 |
self fillRectangle:frameBeforeMove. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1205 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1206 |
(ghostLevel ~~ 0) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1207 |
self drawEdgesForX:gX y:gY width:gW height:gH level:ghostLevel |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1208 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1209 |
ghostFrameColor notNil ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1210 |
self paint:ghostFrameColor. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1211 |
self displayRectangleX:gX y:gY width:gW height:gH |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1212 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1213 |
] |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1214 |
] |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1215 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1216 |
self clippingRectangle:oldClip |
205 | 1217 |
] |
695 | 1218 |
|
1896 | 1219 |
"Modified: / 4.5.1999 / 18:51:53 / cg" |
205 | 1220 |
! ! |
1221 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1222 |
!Scroller methodsFor:'event handling'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1223 |
|
2297
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1224 |
buttonControlPress:button x:x y:y |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1225 |
"mouse-click with control - jump to top/bottom" |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1226 |
|
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1227 |
|curr limit1 limit2| |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1228 |
|
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1229 |
thumbFrame isNil ifTrue:[ |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1230 |
self computeThumbFrame. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1231 |
thumbFrame isNil ifTrue:[ |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1232 |
^ self. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1233 |
] |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1234 |
]. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1235 |
(orientation == #vertical) ifTrue:[ |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1236 |
curr := y. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1237 |
limit1 := thumbFrame top. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1238 |
limit2 := thumbFrame bottom |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1239 |
] ifFalse:[ |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1240 |
curr := x. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1241 |
limit1 := thumbFrame left. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1242 |
limit2 := thumbFrame right |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1243 |
]. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1244 |
|
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1245 |
(curr < limit1) ifTrue:[ |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1246 |
"to top" |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1247 |
self thumbOrigin:0. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1248 |
self tellOthers |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1249 |
] ifFalse:[ |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1250 |
(curr > limit2) ifTrue:[ |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1251 |
"to bottom" |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1252 |
self thumbOrigin:100. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1253 |
self tellOthers |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1254 |
] |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1255 |
]. |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1256 |
! |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1257 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1258 |
buttonMotion:state x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1259 |
"mouse-button was moved while pressed; |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1260 |
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
|
1261 |
the scroll action is performed" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1262 |
|
1800 | 1263 |
<resource: #style (#name |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1264 |
#'scroller.snapBack')> |
1800 | 1265 |
|
1279 | 1266 |
|pos curr limit prevOrigin newOrigin snap| |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1267 |
|
1652 | 1268 |
enabled ifFalse:[^ self]. |
1269 |
||
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1270 |
scrolling ifFalse: [ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1271 |
thumbFrame notNil ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1272 |
self highlightThumbForPointerX:x y:y. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1273 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1274 |
^ self |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1275 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1276 |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1277 |
entered := true. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1278 |
frameBeforeMove isNil ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1279 |
self startMove. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1280 |
]. |
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 |
(orientation == #vertical) ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1283 |
curr := y. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1284 |
limit := height. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1285 |
snap := (x < SnapBackDistance negated) or:[x > (width + SnapBackDistance)]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1286 |
] ifFalse:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1287 |
curr := x. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1288 |
limit := width. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1289 |
snap := (y < SnapBackDistance negated) or:[y > (height + SnapBackDistance)]. |
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 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1292 |
(curr < 0) ifTrue:[ "check against limits" |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1293 |
pos := 0 |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1294 |
] ifFalse:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1295 |
(curr > limit) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1296 |
pos := limit |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1297 |
] ifFalse:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1298 |
pos := curr |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1299 |
] |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1300 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1301 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1302 |
prevOrigin := self thumbOrigin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1303 |
newOrigin := self percentFromAbs:(pos - pressOffset). |
1133
4395bae7e94e
added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents:
1127
diff
changeset
|
1304 |
|
4395bae7e94e
added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents:
1127
diff
changeset
|
1305 |
snap ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1306 |
(styleSheet at:#'scroller.snapBack' default:false) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1307 |
newOrigin := originBeforeMove. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1308 |
] |
1133
4395bae7e94e
added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents:
1127
diff
changeset
|
1309 |
]. |
4395bae7e94e
added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents:
1127
diff
changeset
|
1310 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1311 |
prevOrigin ~= newOrigin ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1312 |
self thumbOrigin:newOrigin. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1313 |
|
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1314 |
synchronousOperation ifTrue: [ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1315 |
self tellOthers. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1316 |
] |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1317 |
] |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1318 |
|
1485
5716db1ccb4e
care for nil thumbFrame (race condition)
Claus Gittinger <cg@exept.de>
parents:
1444
diff
changeset
|
1319 |
"Modified: / 14.4.1998 / 18:37:34 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1320 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1321 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1322 |
buttonMultiPress:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1323 |
^ self buttonPress:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1324 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1325 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1326 |
buttonPress:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1327 |
"button was pressed - if above thumb, page up; if below thumb, page down; |
1301 | 1328 |
otherwise start scrolling. |
1329 |
If either shift is pressed, or the 'scrollerMiddleButtonJump' styleSheet |
|
1330 |
value is true and its the middle button, do a jump to the clicked position." |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1331 |
|
1514 | 1332 |
|curr limit1 limit2 sensor| |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1333 |
|
1652 | 1334 |
enabled ifFalse:[^ self]. |
1335 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1336 |
shown ifFalse:[^ self]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1337 |
|
1420
e9999993396f
ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents:
1366
diff
changeset
|
1338 |
scrolling ifTrue:[^ self]. |
e9999993396f
ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents:
1366
diff
changeset
|
1339 |
|
1514 | 1340 |
sensor := self sensor. |
1341 |
(((sensor notNil and:[sensor shiftDown])) |
|
2301 | 1342 |
or:[DefaultMiddleButtonJump and:[button ~~ #select and:[button ~~ 1]]]) ifTrue:[ |
2146 | 1343 |
^ self buttonShiftPress:button x:x y:y |
811
7271a0746af6
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
1344 |
]. |
2297
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1345 |
(sensor notNil and:[sensor ctrlDown]) ifTrue:[ |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1346 |
^ self buttonControlPress:button x:x y:y |
b09f0d274532
ctrl-click: move to top/bottom
Claus Gittinger <cg@exept.de>
parents:
2215
diff
changeset
|
1347 |
]. |
2301 | 1348 |
(button ~~ #select and:[button ~~ 1]) ifTrue:[ |
2146 | 1349 |
^ self |
1441 | 1350 |
]. |
811
7271a0746af6
Display no longer sends buttonShiftPress messages
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
1351 |
|
1295 | 1352 |
thumbFrame isNil ifTrue:[ |
2146 | 1353 |
self computeThumbFrame. |
1354 |
thumbFrame isNil ifTrue:[^ self]. |
|
1295 | 1355 |
]. |
1356 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1357 |
(orientation == #vertical) ifTrue:[ |
2146 | 1358 |
curr := y. |
1359 |
limit1 := thumbFrame top. |
|
1360 |
limit2 := thumbFrame bottom |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1361 |
] ifFalse:[ |
2146 | 1362 |
curr := x. |
1363 |
limit1 := thumbFrame left. |
|
1364 |
limit2 := thumbFrame right |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1365 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1366 |
|
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1367 |
self highlightThumbForPointerX:x y:y. |
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1368 |
self changeCursorFor:(x@y). |
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1369 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1370 |
(curr < limit1) ifTrue:[ |
2146 | 1371 |
"page up/left" |
1372 |
self pageUp. |
|
1373 |
autoRepeat ifTrue:[ |
|
1374 |
repeatBlock notNil ifTrue:[ |
|
1375 |
Processor removeTimedBlock:repeatBlock. |
|
1376 |
]. |
|
1377 |
repeatBlock := [|sensor| |
|
1378 |
(sensor := self sensor) notNil ifTrue:[ |
|
1379 |
sensor pushUserEvent:#repeatPageUp for:self |
|
1380 |
] |
|
1381 |
]. |
|
2313
c3c2415333bb
make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents:
2301
diff
changeset
|
1382 |
sensor pushUserEvent:#installRepeat for:self. |
c3c2415333bb
make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents:
2301
diff
changeset
|
1383 |
"/ Processor addTimedBlock:repeatBlock afterSeconds:initialRepeatDelay |
2146 | 1384 |
] |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1385 |
] ifFalse:[ |
2146 | 1386 |
(curr > limit2) ifTrue:[ |
1387 |
"page down/right" |
|
1388 |
self pageDown. |
|
1389 |
autoRepeat ifTrue:[ |
|
1390 |
repeatBlock notNil ifTrue:[ |
|
1391 |
Processor removeTimedBlock:repeatBlock. |
|
1392 |
]. |
|
1393 |
repeatBlock := [|sensor| |
|
1394 |
(sensor := self sensor) notNil ifTrue:[ |
|
1395 |
sensor pushUserEvent:#repeatPageDown for:self |
|
1396 |
] |
|
1397 |
]. |
|
2313
c3c2415333bb
make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents:
2301
diff
changeset
|
1398 |
sensor pushUserEvent:#installRepeat for:self. |
c3c2415333bb
make sure, that autorepeat happens AFTER damages have been
Claus Gittinger <cg@exept.de>
parents:
2301
diff
changeset
|
1399 |
"/ Processor addTimedBlock:repeatBlock afterSeconds:initialRepeatDelay |
2146 | 1400 |
] |
1401 |
] ifFalse:[ |
|
1402 |
pressOffset := curr - limit1. |
|
1403 |
scrolling := true |
|
1404 |
] |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1405 |
]. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1406 |
|
1441 | 1407 |
"Modified: / 2.2.1998 / 23:30:26 / stefan" |
1514 | 1408 |
"Modified: / 7.5.1998 / 02:05:41 / 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 |
buttonRelease:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1412 |
"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
|
1413 |
action is now performed" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1414 |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1415 |
|rect mustDrawThumb| |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1416 |
|
1794 | 1417 |
repeatBlock notNil ifTrue:[ |
2321 | 1418 |
repeatBlock := nil. |
2301 | 1419 |
Processor removeTimedBlock:repeatBlock. |
1420 |
repeatBlock := nil |
|
1794 | 1421 |
]. |
1422 |
||
2301 | 1423 |
(button == 1 or:[button == #select or:[DefaultMiddleButtonJump]]) |
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1424 |
ifFalse:[ |
2301 | 1425 |
^ super buttonRelease:button x:x y:y |
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1426 |
]. |
1420
e9999993396f
ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents:
1366
diff
changeset
|
1427 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1428 |
scrolling ifTrue:[ |
2301 | 1429 |
scrolling := false. |
1430 |
thumbFrame notNil ifTrue:[ |
|
1431 |
mustDrawThumb := false. |
|
1432 |
||
1433 |
frameBeforeMove notNil ifTrue:[ |
|
1434 |
rect := frameBeforeMove. |
|
1435 |
frameBeforeMove := nil. |
|
1436 |
self drawThumbBackgroundInX:rect left |
|
1437 |
y:rect top |
|
1438 |
width:rect width |
|
1439 |
height:rect height. |
|
1440 |
||
1441 |
(rect intersects:thumbFrame) ifTrue:[ |
|
1442 |
mustDrawThumb := true. |
|
1443 |
] |
|
1444 |
]. |
|
1445 |
thumbLevel ~~ thumbActiveLevel ifTrue:[ |
|
1446 |
mustDrawThumb := true |
|
1447 |
]. |
|
1448 |
mustDrawThumb ifTrue:[ |
|
1449 |
self drawThumb |
|
1450 |
]. |
|
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1451 |
|
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1452 |
"/ scrolling := false. |
2301 | 1453 |
synchronousOperation ifFalse: [ |
1454 |
self tellOthers. |
|
1455 |
] |
|
1456 |
] |
|
1359 | 1457 |
]. |
1458 |
self changeCursorFor:(x@y) |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1459 |
|
1420
e9999993396f
ignore other button press/release while scrolling
Claus Gittinger <cg@exept.de>
parents:
1366
diff
changeset
|
1460 |
"Modified: / 19.1.1998 / 13:45:59 / cg" |
1441 | 1461 |
"Modified: / 2.2.1998 / 23:37:27 / stefan" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1462 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1463 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1464 |
buttonShiftPress:button x:x y:y |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1465 |
"mouse-click with shift - jump to position" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1466 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1467 |
|pos curr curr2 limit1 limit2| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1468 |
|
2189 | 1469 |
thumbFrame isNil ifTrue:[ |
1470 |
self computeThumbFrame. |
|
1471 |
thumbFrame isNil ifTrue:[ |
|
1472 |
^ self. |
|
1473 |
] |
|
1474 |
]. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1475 |
(orientation == #vertical) ifTrue:[ |
2189 | 1476 |
curr := y. |
1477 |
curr2 := y - (thumbFrame height // 2). |
|
1478 |
limit1 := height. |
|
1479 |
limit2 := thumbFrame top |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1480 |
] ifFalse:[ |
2189 | 1481 |
curr := x. |
1482 |
curr2 := x - (thumbFrame width // 2). |
|
1483 |
limit1 := width. |
|
1484 |
limit2 := thumbFrame left |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1485 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1486 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1487 |
(curr2 < 0) ifTrue:[ "check against limits" |
2189 | 1488 |
pos := 0 |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1489 |
] ifFalse:[ |
2189 | 1490 |
(curr2 > limit1) ifTrue:[ |
1491 |
pos := limit1 |
|
1492 |
] ifFalse:[ |
|
1493 |
pos := curr2 |
|
1494 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1495 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1496 |
|
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1497 |
self startMove. |
1432 | 1498 |
|
1499 |
self thumbOrigin:(self percentFromAbs:pos). |
|
1500 |
self tellOthers. |
|
1501 |
||
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1502 |
(orientation == #vertical) ifTrue:[ |
2189 | 1503 |
limit2 := thumbFrame top |
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1504 |
] ifFalse:[ |
2189 | 1505 |
limit2 := thumbFrame left |
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1506 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1507 |
pressOffset := curr - limit2. |
1441 | 1508 |
scrolling := true. |
1133
4395bae7e94e
added snapBack (win95 behavior)
Claus Gittinger <cg@exept.de>
parents:
1127
diff
changeset
|
1509 |
|
1801 | 1510 |
self changeCursorFor:(x@y). |
1511 |
||
1512 |
||
1441 | 1513 |
"Modified: / 19.3.1997 / 11:29:08 / cg" |
1514 |
"Modified: / 2.2.1998 / 23:35:18 / stefan" |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1515 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1516 |
|
1359 | 1517 |
changeCursorFor:p |
1518 |
"update the mouse cursor" |
|
1519 |
||
1808 | 1520 |
|frm sensor which| |
1359 | 1521 |
|
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1522 |
enabled ifFalse:[ |
2215
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1523 |
self cursor:Cursor normal. |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1524 |
^ self |
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1525 |
]. |
1359 | 1526 |
NewCursors ifFalse:[^ self]. |
1527 |
||
1528 |
frm := self thumbFrame. |
|
2215
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1529 |
frm isNil ifTrue:[^ self]. |
1359 | 1530 |
|
1531 |
thumbHeight = 100 ifTrue:[ |
|
2215
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1532 |
which := #normal. |
1359 | 1533 |
] ifFalse:[ |
2215
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1534 |
sensor := self sensor. |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1535 |
|
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1536 |
(((frm containsPoint:p) and:[sensor notNil and:[sensor leftButtonPressed]]) |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1537 |
"or:[sensor notNil and:[sensor shiftDown]]") ifTrue:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1538 |
orientation == #horizontal ifTrue:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1539 |
which := #xMarker |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1540 |
] ifFalse:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1541 |
which := #marker |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1542 |
]. |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1543 |
] ifFalse:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1544 |
orientation == #horizontal ifTrue:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1545 |
p x > frm right ifTrue:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1546 |
which := #right |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1547 |
] ifFalse:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1548 |
p x < frm left ifTrue:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1549 |
which := #left |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1550 |
] ifFalse:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1551 |
which := #hand |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1552 |
] |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1553 |
] |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1554 |
] ifFalse:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1555 |
p y > frm bottom ifTrue:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1556 |
which := #down |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1557 |
] ifFalse:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1558 |
p y < frm top ifTrue:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1559 |
which := #up |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1560 |
] ifFalse:[ |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1561 |
which := #hand |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1562 |
] |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1563 |
] |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1564 |
] |
7757d56a38ab
care for nil thumbFrame in changeCursor
Claus Gittinger <cg@exept.de>
parents:
2189
diff
changeset
|
1565 |
] |
1359 | 1566 |
]. |
1567 |
self cursor:(Cursor perform:which). |
|
1568 |
||
1514 | 1569 |
"Created: / 23.10.1997 / 03:55:24 / cg" |
1570 |
"Modified: / 7.5.1998 / 02:06:10 / cg" |
|
1359 | 1571 |
! |
1572 |
||
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1573 |
highlightThumbForPointerX:x y:y |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1574 |
"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
|
1575 |
|
2010 | 1576 |
|frm in| |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1577 |
|
1359 | 1578 |
in := (frm := self thumbFrame) containsPoint:(x@y). |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1579 |
(in ~~ entered |
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1580 |
or:[thumbLevel ~~ thumbActiveLevel]) ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
1581 |
entered := in. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
1582 |
(thumbColor ~~ thumbEnteredColor |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
1583 |
or:[thumbLevel ~~ thumbActiveLevel]) ifTrue: [ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
1584 |
self drawThumb |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
1585 |
]. |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1586 |
]. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1587 |
|
1359 | 1588 |
self changeCursorFor:(x@y) |
1589 |
||
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1590 |
"Created: 6.3.1996 / 17:35:07 / cg" |
1359 | 1591 |
"Modified: 23.10.1997 / 03:56:31 / cg" |
1592 |
! |
|
1593 |
||
1594 |
keyPress:key x:x y:y |
|
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1595 |
"/ stupid - due to delegation, this is never invoked ... |
1652 | 1596 |
enabled ifFalse:[^ self]. |
1597 |
||
1359 | 1598 |
self changeCursorFor:(x@y). |
1599 |
super keyPress:key x:x y:y |
|
1600 |
||
1601 |
"Created: 23.10.1997 / 03:57:34 / cg" |
|
1602 |
! |
|
1603 |
||
1604 |
keyRelease:key x:x y:y |
|
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
1605 |
"/ stupid - due to delegation, this is never invoked ... |
1359 | 1606 |
self changeCursorFor:(x@y). |
1607 |
super keyRelease:key x:x y:y |
|
1608 |
||
1609 |
"Created: 23.10.1997 / 03:58:25 / cg" |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1610 |
! |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1611 |
|
1706
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1612 |
pointerEnter:state x:x y:y |
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1613 |
"mouse-button left view |
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1614 |
redraw thumb if enteredColor ~~ thumbColor" |
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1615 |
|
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1616 |
scrolling ifTrue:[ |
2010 | 1617 |
(state bitAnd:(device anyButtonMotionMask)) == 0 ifTrue: [ |
1618 |
self buttonRelease:1 x:x y:y |
|
1619 |
]. |
|
1706
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1620 |
]. |
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1621 |
super pointerEnter:state x:x y:y |
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1622 |
|
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1623 |
"Modified: / 14.10.1998 / 15:40:51 / cg" |
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1624 |
! |
eb2f9e689f5e
when reentering with no button pressed,
Claus Gittinger <cg@exept.de>
parents:
1673
diff
changeset
|
1625 |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1626 |
pointerLeave:state |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1627 |
"mouse-button left view |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1628 |
redraw thumb if enteredColor ~~ thumbColor" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1629 |
|
759
9defb0b4883a
oops - ignore caps-lock/scroll-lock etc. in pointerLeave
Claus Gittinger <cg@exept.de>
parents:
721
diff
changeset
|
1630 |
(entered and:[(state bitAnd:(device anyButtonMotionMask)) == 0]) ifTrue: [ |
2010 | 1631 |
entered := false. |
1632 |
thumbEnteredColor ~= thumbColor ifTrue:[ |
|
1633 |
self invalidate. |
|
1634 |
"/ self drawThumb |
|
1635 |
] |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1636 |
]. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1637 |
|
1673
ff43258f2224
only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
1638 |
"Created: / 6.3.1996 / 17:31:16 / cg" |
ff43258f2224
only redraw in pointerLeave, if thumbColor will change
Claus Gittinger <cg@exept.de>
parents:
1662
diff
changeset
|
1639 |
"Modified: / 11.9.1998 / 00:13:53 / cg" |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1640 |
! |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1641 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1642 |
redraw |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1643 |
"redraw" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1644 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1645 |
self redrawX:0 y:0 width:width height:height. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1646 |
self redrawEdges |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1647 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1648 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1649 |
redrawX:x y:y width:w height:h |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1650 |
shown ifTrue:[ |
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1651 |
thumbFrame isNil ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1652 |
self computeThumbFrame |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1653 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1654 |
self drawThumbBackgroundInX:x y:y width:w height:h. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1655 |
thumbFrame isNil ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1656 |
"/ thumb hidden |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1657 |
^ self |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1658 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1659 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1660 |
orientation == #vertical ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1661 |
(y > thumbFrame bottom) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1662 |
^ self |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1663 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1664 |
((y + h) < thumbFrame top) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1665 |
^ self |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1666 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1667 |
] ifFalse:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1668 |
(x > thumbFrame right) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1669 |
^ self |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1670 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1671 |
((x + w) < thumbFrame left) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1672 |
^ self |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1673 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1674 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1675 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1676 |
self drawThumb |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1677 |
] |
767
c96a1130b833
oops - tiny bug in redraw-optimization
Claus Gittinger <cg@exept.de>
parents:
764
diff
changeset
|
1678 |
|
1366 | 1679 |
"Modified: / 29.10.1997 / 15:48:48 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1680 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1681 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1682 |
sizeChanged:how |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1683 |
"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
|
1684 |
|
1908 | 1685 |
|oldThumbFrame oldTop oldBot newTop newBot oldLeft oldRight newLeft newRight| |
1718 | 1686 |
|
1687 |
oldThumbFrame := thumbFrame. |
|
1444
eff7016070f8
no need for invalidate on sizeChange (will get expose event anyway)
Claus Gittinger <cg@exept.de>
parents:
1441
diff
changeset
|
1688 |
thumbFrame := nil. |
1507 | 1689 |
shown ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1690 |
"/ oldThumbFrame notNil ifTrue:[ |
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1691 |
self computeThumbFrame. |
2177
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
1692 |
|
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1693 |
"/ any change ? |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1694 |
thumbFrame = oldThumbFrame ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1695 |
^ self |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1696 |
]. |
2177
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
1697 |
thumbFrame isNil ifTrue:[ |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
1698 |
self invalidate. |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
1699 |
^ self |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
1700 |
]. |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1701 |
oldThumbFrame isNil ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1702 |
self invalidate:thumbFrame. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1703 |
^ self. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1704 |
]. |
2175
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1705 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1706 |
"/ try to redraw as little as possible |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1707 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1708 |
oldTop := oldThumbFrame top. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1709 |
oldBot := oldThumbFrame bottom. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1710 |
newTop := thumbFrame top. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1711 |
newBot := thumbFrame bottom. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1712 |
oldLeft := oldThumbFrame left. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1713 |
oldRight := oldThumbFrame right. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1714 |
newLeft := thumbFrame left. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1715 |
newRight := thumbFrame right. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1716 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1717 |
(orientation == #vertical |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1718 |
and:[oldLeft == newLeft |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1719 |
and:[oldRight == newRight]]) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1720 |
(oldTop == newTop) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1721 |
oldBot < newBot ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1722 |
"/ thumb became larger, but origin remains |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1723 |
"/ (view became smaller) |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1724 |
self invalidate:(Rectangle |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1725 |
left:newLeft top:oldBot-thumbLevel |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1726 |
right:newRight bottom:newBot). |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1727 |
^ self. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1728 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1729 |
oldBot > newBot ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1730 |
"/ thumb became smaller, but origin remains |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1731 |
"/ (view became larger) |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1732 |
self invalidate:(Rectangle |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1733 |
left:newLeft top:newBot-thumbLevel |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1734 |
right:newRight bottom:oldBot). |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1735 |
^ self. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1736 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1737 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1738 |
(oldBot == newBot) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1739 |
newTop < oldTop ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1740 |
"/ thumb became larger, but corner remains |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1741 |
"/ (view became smaller) |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1742 |
self invalidate:(Rectangle |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1743 |
left:newLeft top:newTop |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1744 |
right:newRight bottom:oldTop+thumbLevel). |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1745 |
^ self. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1746 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1747 |
newTop > oldTop ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1748 |
"/ thumb became smaller, but corner remains |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1749 |
"/ (view became larger) |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1750 |
self invalidate:(Rectangle |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1751 |
left:newLeft top:oldTop |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1752 |
right:newRight bottom:newTop+thumbLevel). |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1753 |
^ self. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1754 |
] |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1755 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1756 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1757 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1758 |
(orientation == #horizontal |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1759 |
and:[oldTop == newTop |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1760 |
and:[oldBot == newBot]]) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1761 |
(oldLeft == newLeft) ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1762 |
oldRight < newRight ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1763 |
"/ thumb became larger, but origin remains |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1764 |
"/ (view became smaller) |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1765 |
self invalidate:(Rectangle |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1766 |
left:oldRight-thumbLevel top:newTop |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1767 |
right:newRight bottom:newBot). |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1768 |
^ self. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1769 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1770 |
oldRight > newRight ifTrue:[ |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1771 |
"/ thumb became smaller, but origin remains |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1772 |
"/ (view became larger) |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1773 |
self invalidate:(Rectangle |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1774 |
left:newRight-thumbLevel top:newTop |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1775 |
right:oldRight bottom:newBot). |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1776 |
^ self. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1777 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1778 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1779 |
]. |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1780 |
|
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1781 |
self invalidate:(oldThumbFrame merge: thumbFrame). |
5042e15f3cf6
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2171
diff
changeset
|
1782 |
^ self. |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1783 |
"/ ]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
1784 |
"/ self invalidate |
1507 | 1785 |
]. |
1127 | 1786 |
|
1913
37653d123b68
redraw optimizations when resized.
Claus Gittinger <cg@exept.de>
parents:
1908
diff
changeset
|
1787 |
"Modified: / 23.5.1999 / 13:50:41 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1788 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1789 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1790 |
update:something with:aParameter from:changedObject |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1791 |
"handle update from a model (if any)" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1792 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1793 |
(changedObject == model |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1794 |
"and:[something == aspectMsg]") ifTrue:[ |
2010 | 1795 |
self thumbOrigin:(model value). |
1796 |
^ self |
|
1652 | 1797 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1798 |
super update:something with:aParameter from:changedObject |
1830 | 1799 |
|
1800 |
"Modified: / 30.3.1999 / 14:26:28 / stefan" |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1801 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1802 |
|
1821
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1803 |
!Scroller methodsFor:'focus handling'! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1804 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1805 |
wantsFocusWithButtonPress |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1806 |
"no, do not catch the keyboard focus on button click" |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1807 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1808 |
^ false |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1809 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1810 |
|
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1811 |
! ! |
b57cc9dc2c08
changed request-focus-with-Button press
Claus Gittinger <cg@exept.de>
parents:
1808
diff
changeset
|
1812 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1813 |
!Scroller methodsFor:'forced scroll'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1814 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1815 |
pageDown |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1816 |
"page down/right" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1817 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1818 |
self thumbOrigin:(thumbOrigin + thumbHeight). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1819 |
self tellOthers |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1820 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1821 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1822 |
pageUp |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1823 |
"page up/left" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1824 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1825 |
self thumbOrigin:(thumbOrigin - thumbHeight). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1826 |
self tellOthers |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1827 |
! |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1828 |
|
1493
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1829 |
scrollStep:delta |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1830 |
"step by some delta" |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1831 |
|
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1832 |
|oldOrg newOrg| |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1833 |
|
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1834 |
oldOrg := self thumbOrigin. |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1835 |
newOrg := ((oldOrg + delta) max:rangeStart) min:rangeEnd. |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1836 |
oldOrg ~= newOrg ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
1837 |
self thumbOrigin:newOrg. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
1838 |
self tellOthers. |
1493
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1839 |
] |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1840 |
|
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1841 |
"Created: / 21.4.1998 / 20:51:57 / cg" |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1842 |
"Modified: / 21.4.1998 / 20:52:22 / cg" |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1843 |
! |
3b76c81608e5
moved #scrollStep: from SteppingSlider
Claus Gittinger <cg@exept.de>
parents:
1485
diff
changeset
|
1844 |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1845 |
scrollToBeginning |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1846 |
"scroll to the beginning" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1847 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1848 |
self thumbOrigin:rangeStart. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1849 |
self tellOthers |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1850 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1851 |
"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
|
1852 |
! |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1853 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1854 |
scrollToEnd |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1855 |
"scroll to the end" |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1856 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1857 |
self thumbOrigin:rangeEnd. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1858 |
self tellOthers |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1859 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
1860 |
"Created: 6.3.1996 / 17:55:25 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1861 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1862 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1863 |
!Scroller methodsFor:'forwarding changed origin'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1864 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1865 |
tellOthers |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1866 |
|org| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1867 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1868 |
org := self thumbOrigin. |
1011 | 1869 |
|
1870 |
" |
|
1871 |
the ST-80 way of notifying scrolls |
|
1872 |
" |
|
1873 |
self sendChangeMessageWith:org. |
|
1874 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1875 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1876 |
the ST/X way of notifying scrolls |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1877 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1878 |
scrollAction notNil ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
1879 |
scrollAction value:org |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1880 |
]. |
1011 | 1881 |
|
1882 |
"/ |
|
1883 |
"/ this will vanish - the scroller should share |
|
1884 |
"/ a valueHolder with the scrolledView. |
|
1885 |
"/ |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1886 |
self changed:#scrollerPosition. |
1011 | 1887 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
1888 |
"Modified: / 21.1.1998 / 19:12:55 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1889 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1890 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1891 |
!Scroller methodsFor:'initialization'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1892 |
|
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
452
diff
changeset
|
1893 |
defaultExtent |
571 | 1894 |
"compute my extent from sub-components" |
1895 |
||
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
452
diff
changeset
|
1896 |
^ self preferredExtent |
571 | 1897 |
|
1898 |
"Modified: 22.4.1996 / 23:37:53 / cg" |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1899 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1900 |
|
930 | 1901 |
fetchDeviceResources |
931 | 1902 |
"fetch device colors, to avoid reallocation at redraw time" |
930 | 1903 |
|
931 | 1904 |
super fetchDeviceResources. |
930 | 1905 |
|
1988 | 1906 |
thumbShadowColor notNil ifTrue:[thumbShadowColor := thumbShadowColor onDevice:device]. |
1907 |
thumbLightColor notNil ifTrue:[thumbLightColor := thumbLightColor onDevice:device]. |
|
1908 |
thumbHalfShadowColor notNil ifTrue:[thumbHalfShadowColor := thumbHalfShadowColor onDevice:device]. |
|
1909 |
thumbHalfLightColor notNil ifTrue:[thumbHalfLightColor := thumbHalfLightColor onDevice:device]. |
|
1910 |
||
1911 |
thumbEnteredColor notNil ifTrue:[thumbEnteredColor := thumbEnteredColor onDevice:device]. |
|
1912 |
ghostColor notNil ifTrue:[ghostColor := ghostColor onDevice:device]. |
|
1913 |
ghostFrameColor notNil ifTrue:[ghostFrameColor := ghostFrameColor onDevice:device]. |
|
930 | 1914 |
|
931 | 1915 |
"Modified: 13.1.1997 / 21:56:38 / cg" |
930 | 1916 |
! |
1917 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1918 |
initCursor |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1919 |
"set the cursor - a hand" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1920 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1921 |
cursor := Cursor hand |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1922 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1923 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1924 |
initStyle |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1925 |
"initialize style dep. stuff" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1926 |
|
1794 | 1927 |
<resource: #style (#name |
2321 | 1928 |
#'scroller.autoRepeat' |
1929 |
#'scroller.initialRepeatDelay' |
|
1930 |
#'scroller.repeatDelay')> |
|
764 | 1931 |
|
1932 |
|nm| |
|
1933 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1934 |
super initStyle. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1935 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1936 |
DefaultViewBackground notNil ifTrue:[ |
2321 | 1937 |
viewBackground := DefaultViewBackground onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1938 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1939 |
DefaultShadowColor notNil ifTrue:[ |
2321 | 1940 |
shadowColor := DefaultShadowColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1941 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1942 |
DefaultLightColor notNil ifTrue:[ |
2321 | 1943 |
lightColor := DefaultLightColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1944 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1945 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1946 |
tallyMarks := DefaultTallyMarks. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1947 |
tallyLevel := DefaultTallyLevel. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1948 |
DefaultLevel ~~ level ifTrue:[ |
2321 | 1949 |
self level:DefaultLevel. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1950 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1951 |
DefaultBorderWidth ~~ borderWidth ifTrue:[ |
2321 | 1952 |
self borderWidth:DefaultBorderWidth. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1953 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1954 |
thumbLevel := DefaultThumbLevel. |
505
e13ee348dcc4
added thumbActiveLevel styleSheet variable
Claus Gittinger <cg@exept.de>
parents:
483
diff
changeset
|
1955 |
thumbActiveLevel := DefaultThumbActiveLevel. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1956 |
inset := DefaultInset. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1957 |
fixThumbHeight := DefaultFixThumbHeight. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1958 |
thumbEdgeStyle := DefaultEdgeStyle. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1959 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1960 |
DefaultGhostColor notNil ifTrue:[ |
2321 | 1961 |
ghostColor := DefaultGhostColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1962 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1963 |
DefaultGhostFrameColor notNil ifTrue:[ |
2321 | 1964 |
ghostFrameColor := DefaultGhostFrameColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1965 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1966 |
ghostLevel := DefaultGhostLevel. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1967 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1968 |
DefaultThumbFrameColor notNil ifTrue:[ |
2321 | 1969 |
thumbFrameColor := DefaultThumbFrameColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1970 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1971 |
DefaultThumbShadowColor notNil ifTrue:[ |
2321 | 1972 |
thumbShadowColor := DefaultThumbShadowColor |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1973 |
] ifFalse:[ |
2321 | 1974 |
thumbShadowColor := shadowColor. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1975 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1976 |
DefaultThumbLightColor notNil ifTrue:[ |
2321 | 1977 |
thumbLightColor := DefaultThumbLightColor |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1978 |
] ifFalse:[ |
2321 | 1979 |
thumbLightColor := lightColor. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1980 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1981 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1982 |
thumbEdgeStyle notNil ifTrue:[ |
2321 | 1983 |
DefaultThumbHalfShadowColor notNil ifTrue:[ |
1984 |
thumbHalfShadowColor := DefaultThumbHalfShadowColor |
|
1985 |
]. |
|
1986 |
||
1987 |
DefaultThumbHalfLightColor notNil ifTrue:[ |
|
1988 |
thumbHalfLightColor := DefaultThumbHalfLightColor |
|
1989 |
]. |
|
446 | 1990 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
1991 |
|
764 | 1992 |
nm := styleSheet name. |
1993 |
||
709 | 1994 |
device hasGrayscales ifFalse:[ |
2321 | 1995 |
thumbEdgeStyle notNil ifTrue:[ |
1996 |
thumbHalfShadowColor := Color darkGray. |
|
1997 |
thumbHalfLightColor := White |
|
1998 |
]. |
|
1999 |
||
2000 |
thumbShadowColor := Black. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2001 |
"/ thumbLightColor := White. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2002 |
|
2321 | 2003 |
nm = #motif ifTrue:[ |
2004 |
DefaultThumbColor isNil ifTrue:[ |
|
2005 |
thumbColor := White . |
|
2006 |
]. |
|
2007 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2008 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2009 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2010 |
DefaultThumbColor notNil ifTrue:[ |
2321 | 2011 |
thumbColor := DefaultThumbColor onDevice:device |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2012 |
] ifFalse:[ |
2321 | 2013 |
thumbColor := White. |
2014 |
nm ~= #normal ifTrue:[ |
|
2015 |
device hasGrayscales ifFalse:[ |
|
2016 |
thumbColor := Color grey |
|
2017 |
]. |
|
2018 |
]. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2019 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2020 |
|
1988 | 2021 |
thumbColor := thumbColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2022 |
thumbShadowColor notNil ifTrue:[ |
2321 | 2023 |
thumbShadowColor := thumbShadowColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2024 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2025 |
thumbLightColor notNil ifTrue:[ |
2321 | 2026 |
thumbLightColor := thumbLightColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2027 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2028 |
thumbHalfShadowColor notNil ifTrue:[ |
2321 | 2029 |
thumbHalfShadowColor := thumbHalfShadowColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2030 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2031 |
thumbHalfLightColor notNil ifTrue:[ |
2321 | 2032 |
thumbHalfLightColor := thumbHalfLightColor onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2033 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2034 |
thumbEdgeStyle notNil ifTrue:[ |
2321 | 2035 |
thumbHalfShadowColor isNil ifTrue:[ |
2036 |
thumbHalfShadowColor := thumbShadowColor lightened onDevice:device |
|
2037 |
] |
|
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
2038 |
]. |
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
2039 |
|
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
2040 |
DefaultThumbEnteredColor notNil ifTrue:[ |
2321 | 2041 |
thumbEnteredColor := DefaultThumbEnteredColor onDevice:device. |
1366 | 2042 |
] ifFalse:[ |
2321 | 2043 |
thumbEnteredColor := thumbColor. |
1366 | 2044 |
]. |
2045 |
||
2046 |
(DefaultThumbEnteredColor notNil or:[NewCursors]) ifTrue:[ |
|
2321 | 2047 |
self enableMotionEvents. |
2048 |
self enableEnterLeaveEvents. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2049 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2050 |
|
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2051 |
DefaultThumbImage notNil ifTrue:[ |
2321 | 2052 |
thumbImage := DefaultThumbImage onDevice:device. |
2053 |
fixThumbHeight := true. |
|
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2054 |
]. |
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2055 |
|
1531
c5f2cfee9998
allow handleImage to be specified in styleSheet
Claus Gittinger <cg@exept.de>
parents:
1518
diff
changeset
|
2056 |
HandleImage notNil ifTrue:[ |
2321 | 2057 |
shadowForm := HandleImage onDevice:device. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2058 |
] ifFalse:[ |
2321 | 2059 |
nm = #next ifTrue:[ |
2060 |
shadowForm := self class handleShadowFormOn:device. |
|
2061 |
lightForm := self class handleLightFormOn:device |
|
2062 |
] ifFalse:[ |
|
2063 |
shadowForm := lightForm := nil |
|
2064 |
]. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2065 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2066 |
drawableId notNil ifTrue:[ |
2321 | 2067 |
self computeThumbFrame |
1794 | 2068 |
]. |
2069 |
||
2070 |
autoRepeat := styleSheet at:#'scroller.autoRepeat' default:true. |
|
2071 |
initialRepeatDelay := styleSheet at:#'scroller.initialRepeatDelay' default:0.2. |
|
2321 | 2072 |
repeatDelay := styleSheet at:#'scroller.repeatDelay' default:0.15. |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
2073 |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2074 |
"Modified: / 5.9.1998 / 20:21:41 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2075 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2076 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2077 |
initialize |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2078 |
"initialize - setup instvars from defaults" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2079 |
|
1768 | 2080 |
orientation isNil ifTrue:[orientation := #vertical]. |
453
dc035dd8b9eb
oops - checked in corrupted files
Claus Gittinger <cg@exept.de>
parents:
452
diff
changeset
|
2081 |
|
1768 | 2082 |
super initialize. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2083 |
|
1652 | 2084 |
scrolling := entered := false. |
2085 |
enabled := synchronousOperation := true. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2086 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2087 |
thumbOrigin := 0. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2088 |
thumbHeight := 100. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2089 |
thumbFrameSizeDifference := 0. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2090 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2091 |
rangeStart := 0. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2092 |
rangeEnd := 100. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2093 |
rangeStep := nil. "/ meaning: arbitrary precision |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2094 |
"/ inset := 1. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2095 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2096 |
"/ self computeThumbFrame |
483
368b5f8862b1
added scrollToBeginning/scrollToEnd & enteredColor stuff (for SGI)
Claus Gittinger <cg@exept.de>
parents:
454
diff
changeset
|
2097 |
|
1768 | 2098 |
"Modified: / 7.3.1999 / 00:07:32 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2099 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2100 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2101 |
realize |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2102 |
super realize. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2103 |
model notNil ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2104 |
self thumbOrigin:(model value). |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2105 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2106 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2107 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2108 |
!Scroller methodsFor:'private'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2109 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2110 |
absFromPercent:percent |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2111 |
"given a percentage, compute number of pixels" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2112 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2113 |
|fullSize| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2114 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2115 |
(orientation == #vertical) ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2116 |
fullSize := height |
446 | 2117 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2118 |
fullSize := width |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2119 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2120 |
|
1115 | 2121 |
"/ avoid hitting the boundary if no frame and no level (i.e. st80 style) |
2122 |
(thumbLevel == 0 and:[thumbFrameColor isNil]) ifTrue:[ |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2123 |
fullSize := fullSize - 1 |
1115 | 2124 |
]. |
2125 |
||
2126 |
^ ((percent * (fullSize - thumbFrameSizeDifference - (margin * 2))) / 100) rounded |
|
2127 |
||
2128 |
"Modified: 7.3.1997 / 16:05:57 / cg" |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2129 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2130 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2131 |
computeThumbFrame |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2132 |
"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
|
2133 |
changed height or the scrollers size has changed. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2134 |
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
|
2135 |
invisible or uncatchable). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2136 |
Also, for mswindows style, its height/width is constant." |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2137 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2138 |
|newPos1 newPos2 newSize1 newSize2 nh nw ny nx |
2177
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2139 |
computedSize minSz sz1 sz2 nb nr| |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2140 |
|
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2141 |
thumbHeight >= 100 ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2142 |
thumbFrame := nil. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2143 |
^ self |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2144 |
]. |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2145 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2146 |
"compute position & size" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2147 |
newPos1 := (self absFromPercent:thumbOrigin) + margin. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2148 |
newSize1 := computedSize := self absFromPercent:thumbHeight. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2149 |
(orientation == #vertical) ifTrue:[ |
2171 | 2150 |
sz1 := height. |
2151 |
sz2 := width |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2152 |
] ifFalse:[ |
2171 | 2153 |
sz1 := width. |
2154 |
sz2 := height |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2155 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2156 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2157 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2158 |
do we have to adjust the computed size ? |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2159 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2160 |
newPos2 := margin + inset. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2161 |
newSize2 := sz2 - (2 * newPos2). |
1662
1b1401869566
make certain thumb is visible (at least 2 pixels wide)
Claus Gittinger <cg@exept.de>
parents:
1657
diff
changeset
|
2162 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2163 |
"/ (style ~~ #normal) ifTrue:[ |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2164 |
thumbLevel ~~ 0 ifTrue:[ |
2171 | 2165 |
" |
2166 |
do not make thumb too small (for handle & to be catchable) |
|
2167 |
" |
|
2168 |
minSz := 10 + (2 * thumbLevel) |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2169 |
] ifFalse:[ |
2171 | 2170 |
" |
2171 |
do not make thumb too small (uncatchable) |
|
2172 |
" |
|
2173 |
minSz := 4 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2174 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2175 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2176 |
(newSize1 < minSz) ifTrue:[ |
2171 | 2177 |
newSize1 := minSz. |
2178 |
thumbFrameSizeDifference := newSize1 - computedSize |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2179 |
] ifFalse:[ |
2171 | 2180 |
thumbFrameSizeDifference := 0. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2181 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2182 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2183 |
fixThumbHeight ifTrue:[ |
2171 | 2184 |
"have a fix-size thumb (i.e. mswindows style)" |
2185 |
||
2186 |
newSize1 := sz2 - (2 * inset). "make it square" |
|
2187 |
thumbImage notNil ifTrue:[ |
|
2188 |
newSize1 := (newSize1 max:(thumbImage height)) max:(thumbImage width) |
|
2189 |
]. |
|
2190 |
thumbFrameSizeDifference := newSize1 - computedSize. |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2191 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2192 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2193 |
" |
2171 | 2194 |
oops - if height does not reflect real visibible area, we have to adjust the origin |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2195 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2196 |
(thumbFrameSizeDifference == 0) ifFalse:[ |
2171 | 2197 |
newPos1 := (self absFromPercent:thumbOrigin) + margin. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2198 |
"/ newPos1 := ((thumbOrigin * (sz1 - thumbFrameSizeDifference - (margin * 2))) / 100) rounded + margin |
446 | 2199 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2200 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2201 |
(orientation == #vertical) ifTrue:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2202 |
ny := newPos1 max:margin. |
2171 | 2203 |
nx := newPos2. |
2204 |
nh := newSize1. |
|
2205 |
nw := newSize2 max:2. |
|
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2206 |
ny + nh >= (height - margin) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2207 |
ny := (height - 1 - margin - nh) max:margin. |
2171 | 2208 |
]. |
2209 |
(nx+nw) >= width ifTrue:[ |
|
2210 |
nx := ((width - nw) // 2) max:0. |
|
2211 |
]. |
|
2177
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2212 |
|
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2213 |
nb := ny + nh - 1. |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2214 |
nb >= (height - margin) ifTrue:[ |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2215 |
ny <= margin ifTrue:[ |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2216 |
thumbFrame := nil. |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2217 |
^ self |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2218 |
] |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2219 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2220 |
] ifFalse:[ |
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2221 |
nx := newPos1 max:margin. |
2171 | 2222 |
ny := newPos2. |
2223 |
nw := newSize1. |
|
2224 |
nh := newSize2 max:2. |
|
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2225 |
nx + nw >= (width - margin) ifTrue:[ |
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2226 |
nx := (width - 1 - margin - nw) max:margin. |
2171 | 2227 |
]. |
2228 |
(ny+nh) >= height ifTrue:[ |
|
2229 |
ny := ((height - nh) // 2) max:0. |
|
2230 |
]. |
|
2177
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2231 |
nr := nx + nw - 1. |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2232 |
nr >= (width - margin) ifTrue:[ |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2233 |
nx <= margin ifTrue:[ |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2234 |
thumbFrame := nil. |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2235 |
^ self |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2236 |
] |
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2237 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2238 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2239 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2240 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2241 |
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
|
2242 |
" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2243 |
thumbFrame notNil ifTrue:[ |
2171 | 2244 |
(ny == thumbFrame top) ifTrue:[ |
2245 |
(nx == thumbFrame left) ifTrue:[ |
|
2246 |
(nh == thumbFrame height) ifTrue:[ |
|
2247 |
(nw == thumbFrame width) ifTrue:[ ^ self] |
|
2248 |
] |
|
2249 |
] |
|
2250 |
] |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2251 |
]. |
2177
f554919e10ab
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2176
diff
changeset
|
2252 |
|
2178
ba7c746da7c9
invalidation when size changes and thumbHeight becomes >= 100
Claus Gittinger <cg@exept.de>
parents:
2177
diff
changeset
|
2253 |
thumbFrame := Rectangle left:nx top:ny width:nw height:nh. |
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2254 |
|
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2255 |
"Modified: / 12.5.1998 / 20:58:51 / cg" |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2256 |
! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2257 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2258 |
percentFromAbs:absValue |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2259 |
"given a number of pixels, compute percentage" |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2260 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2261 |
|fullSize val t| |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2262 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2263 |
(orientation == #vertical) ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2264 |
fullSize := height |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2265 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2266 |
fullSize := width |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2267 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2268 |
|
1283 | 2269 |
absValue < 0 ifTrue:[^ rangeStart]. |
2270 |
absValue > fullSize ifTrue:[^ rangeEnd]. |
|
2271 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2272 |
t := fullSize - thumbFrameSizeDifference - (margin * 2). |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2273 |
t = 0 ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2274 |
"/ in rare cases, this happens ... |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2275 |
val := 0 |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2276 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2277 |
val := absValue / t * (rangeEnd - rangeStart). |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2278 |
]. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2279 |
val := val + rangeStart. |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2280 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
2281 |
rangeStart < rangeEnd ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2282 |
val < rangeStart ifTrue:[^ rangeStart]. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2283 |
val > rangeEnd ifTrue:[^ rangeEnd]. |
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
2284 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2285 |
val > rangeStart ifTrue:[^ rangeStart]. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2286 |
val < rangeEnd ifTrue:[^ rangeEnd]. |
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
2287 |
]. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2288 |
^ val |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2289 |
|
1424
e90680159109
handle rangeStart > rangeEnd;
Claus Gittinger <cg@exept.de>
parents:
1420
diff
changeset
|
2290 |
"Modified: / 21.1.1998 / 19:31:15 / cg" |
1652 | 2291 |
! |
2292 |
||
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2293 |
startMove |
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2294 |
originBeforeMove := self thumbOrigin. |
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2295 |
|
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2296 |
(ghostColor notNil |
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2297 |
or:[ghostFrameColor notNil |
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2298 |
or:[ghostLevel ~~ 0]]) ifTrue:[ |
2010 | 2299 |
thumbFrame isNil ifTrue:[ |
2300 |
self computeThumbFrame. |
|
2301 |
]. |
|
2302 |
frameBeforeMove := thumbFrame insetBy:1@1 |
|
1799
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2303 |
]. |
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2304 |
|
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2305 |
! |
7d3daeab6afe
fixed shift-scroll-motion (scrollOffset)
Claus Gittinger <cg@exept.de>
parents:
1794
diff
changeset
|
2306 |
|
1652 | 2307 |
updateBackground |
2308 |
"make my background grey, whenever either readOnly or disable" |
|
2309 |
||
1731 | 2310 |
|bg| |
2311 |
||
2032
9807d0681551
bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents:
2010
diff
changeset
|
2312 |
enabled ifTrue:[ |
9807d0681551
bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents:
2010
diff
changeset
|
2313 |
bg := DefaultViewBackground. |
9807d0681551
bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents:
2010
diff
changeset
|
2314 |
]. |
9807d0681551
bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents:
2010
diff
changeset
|
2315 |
bg isNil ifTrue:[ |
9807d0681551
bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents:
2010
diff
changeset
|
2316 |
bg := View defaultViewBackgroundColor. |
1652 | 2317 |
]. |
1731 | 2318 |
|
2319 |
bg ~= viewBackground ifTrue:[ |
|
2032
9807d0681551
bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents:
2010
diff
changeset
|
2320 |
self backgroundColor:bg. |
9807d0681551
bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents:
2010
diff
changeset
|
2321 |
self invalidate |
1731 | 2322 |
] |
2032
9807d0681551
bugfix (DefaultBackground is nil in iris style) for updateBackground
ah
parents:
2010
diff
changeset
|
2323 |
|
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2324 |
! ! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2325 |
|
454 | 2326 |
!Scroller methodsFor:'private scrollbar & scrollview interface'! |
2327 |
||
2328 |
setThumbFor:aView |
|
2329 |
"get contents and size info from aView and adjust thumb" |
|
2330 |
||
1962 | 2331 |
|percentSize percentOrigin contentsSize contentsPosition viewsSize t| |
454 | 2332 |
|
1432 | 2333 |
scrolling ifTrue:[self invalidate]. |
2334 |
||
454 | 2335 |
" |
2336 |
get the content's size |
|
2337 |
" |
|
2338 |
aView isNil ifTrue:[ |
|
2010 | 2339 |
contentsSize := 0 |
454 | 2340 |
] ifFalse:[ |
2010 | 2341 |
orientation == #vertical ifTrue:[ |
2342 |
contentsSize := aView heightOfContents. |
|
2343 |
(t := aView transformation) notNil ifTrue:[ |
|
2344 |
contentsSize := t applyScaleY:contentsSize. |
|
2345 |
]. |
|
2346 |
] ifFalse:[ |
|
2347 |
contentsSize := aView widthOfContents. |
|
2348 |
(t := aView transformation) notNil ifTrue:[ |
|
2349 |
contentsSize := t applyScaleX:contentsSize. |
|
2350 |
]. |
|
2351 |
] |
|
454 | 2352 |
]. |
2353 |
||
2354 |
(contentsSize = 0) ifTrue:[ |
|
2010 | 2355 |
percentSize := 100. |
2356 |
percentOrigin := 100 |
|
454 | 2357 |
] ifFalse:[ |
2010 | 2358 |
(orientation == #vertical) ifTrue:[ |
2359 |
viewsSize := aView innerHeight. |
|
2360 |
contentsPosition := aView yOriginOfContents. |
|
2361 |
] ifFalse:[ |
|
2362 |
viewsSize := aView innerWidth. |
|
2363 |
contentsPosition := aView xOriginOfContents |
|
2364 |
]. |
|
2365 |
||
2366 |
percentSize := viewsSize * 100.0 / contentsSize. |
|
2367 |
percentOrigin := contentsPosition * 100.0 / contentsSize. |
|
2368 |
percentOrigin + percentSize > 100.0 ifTrue:[ |
|
2369 |
"actually showing stuff below contents of view" |
|
454 | 2370 |
" |
2010 | 2371 |
contentsSize := contentsPosition + aView innerHeight. |
2372 |
percentSize := viewsSize * 100.0 / contentsSize. |
|
2373 |
percentOrigin := contentsPosition * 100.0 / contentsSize |
|
454 | 2374 |
" |
2010 | 2375 |
] |
454 | 2376 |
]. |
2377 |
(percentSize = thumbHeight) ifTrue:[ |
|
2010 | 2378 |
self thumbOrigin:percentOrigin |
454 | 2379 |
] ifFalse:[ |
2010 | 2380 |
(percentOrigin = thumbOrigin) ifTrue:[ |
2381 |
self thumbHeight:percentSize |
|
2382 |
] ifFalse:[ |
|
2383 |
self thumbOrigin:percentOrigin thumbHeight:percentSize |
|
2384 |
] |
|
454 | 2385 |
] |
2386 |
! |
|
2387 |
||
2388 |
setThumbHeightFor:aView |
|
2389 |
"get contents and size info from aView and adjust thumb height" |
|
2390 |
||
2391 |
|percent total viewsSize| |
|
2392 |
||
1432 | 2393 |
scrolling ifTrue:[self invalidate]. |
2394 |
||
454 | 2395 |
(orientation == #vertical) ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2396 |
total := aView heightOfContents. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2397 |
aView transformation notNil ifTrue:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2398 |
total := aView transformation applyScaleY:total. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2399 |
]. |
454 | 2400 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2401 |
total := aView widthOfContents. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2402 |
aView transformation notNil ifTrue:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2403 |
total := aView transformation applyScaleX:total. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2404 |
]. |
454 | 2405 |
]. |
2406 |
(total = 0) ifTrue:[ |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2407 |
percent := 100 |
454 | 2408 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2409 |
viewsSize := (orientation == #vertical) ifTrue:[aView innerHeight] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2410 |
ifFalse:[aView innerWidth]. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2411 |
percent := viewsSize * 100.0 / total |
454 | 2412 |
]. |
2413 |
self thumbHeight:percent |
|
2414 |
! |
|
2415 |
||
2416 |
setThumbOriginFor:aView |
|
2417 |
"get contents and size info from aView and adjust thumb origin" |
|
2418 |
||
2419 |
|percent total contentsPosition| |
|
2420 |
||
1432 | 2421 |
scrolling ifTrue:[self invalidate]. |
2422 |
||
454 | 2423 |
(orientation == #vertical) ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2424 |
total := aView heightOfContents. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2425 |
aView transformation notNil ifTrue:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2426 |
total := aView transformation applyScaleY:total. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2427 |
]. |
454 | 2428 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2429 |
total := aView widthOfContents. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2430 |
aView transformation notNil ifTrue:[ |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2431 |
total := aView transformation applyScaleX:total. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2432 |
]. |
454 | 2433 |
]. |
2434 |
(total = 0) ifTrue:[ |
|
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2435 |
percent := 100 |
454 | 2436 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2437 |
contentsPosition := (orientation == #vertical) ifTrue:[aView yOriginOfContents] |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2438 |
ifFalse:[aView xOriginOfContents]. |
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2439 |
percent := contentsPosition * 100.0 / total |
454 | 2440 |
]. |
2441 |
self thumbOrigin:percent |
|
2442 |
! ! |
|
2443 |
||
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2444 |
!Scroller methodsFor:'queries'! |
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2445 |
|
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2446 |
preferredExtent |
572 | 2447 |
"return my preferredExtent" |
2448 |
||
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
2449 |
|defExt w h| |
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
2450 |
|
797 | 2451 |
"/ If I have an explicit preferredExtent .. |
2452 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2453 |
preferredExtent notNil ifTrue:[ |
2010 | 2454 |
^ preferredExtent |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2455 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
709
diff
changeset
|
2456 |
|
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
2457 |
defExt := self class defaultExtent. |
452
f255470106c4
oops - last checkin was bogus
Claus Gittinger <cg@exept.de>
parents:
448
diff
changeset
|
2458 |
|
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
2459 |
orientation == #vertical ifTrue:[ |
2010 | 2460 |
h := defExt y. |
2461 |
(w := DefaultVScrollerWidth) isNil ifTrue:[ |
|
2462 |
w := (device horizontalPixelPerMillimeter asFloat * 5) rounded |
|
2463 |
] |
|
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
2464 |
] ifFalse:[ |
2010 | 2465 |
w := defExt x. |
2466 |
(h := DefaultHScrollerHeight) isNil ifTrue:[ |
|
2467 |
h := (device verticalPixelPerMillimeter asFloat * 5) rounded |
|
2468 |
] |
|
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
2469 |
]. |
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
2470 |
|
786
8b301af1cdcc
remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents:
767
diff
changeset
|
2471 |
preferredExtent := w @ h. |
8b301af1cdcc
remember and do not recompute the preferredExtent;
Claus Gittinger <cg@exept.de>
parents:
767
diff
changeset
|
2472 |
^ preferredExtent. |
538
b747ea31b972
use common code for H/V scrollers
Claus Gittinger <cg@exept.de>
parents:
507
diff
changeset
|
2473 |
|
1886 | 2474 |
"Modified: / 28.4.1999 / 18:28:19 / cg" |
1122 | 2475 |
! |
2476 |
||
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2477 |
thumbVisible |
1122 | 2478 |
"return true, if the thumb is usable i.e. its visible & movable. |
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2479 |
Can be used by the scrollBar to decide if it should hide the scroller." |
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2480 |
|
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2481 |
|m2| |
1122 | 2482 |
|
2483 |
(thumbHeight >= 100) ifTrue:[^ false]. |
|
2484 |
self computeThumbFrame. |
|
2485 |
thumbFrame isNil ifTrue:[^ false]. |
|
2486 |
||
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2487 |
m2 := margin * 2. |
1122 | 2488 |
orientation == #vertical ifTrue:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2489 |
thumbFrame height >= (height - m2) ifTrue:[^ false]. |
1122 | 2490 |
] ifFalse:[ |
1657
4ae7bf80d51a
use #onDevice: instead of #on:
Claus Gittinger <cg@exept.de>
parents:
1652
diff
changeset
|
2491 |
thumbFrame width >= (width - m2) ifTrue:[^ false]. |
1122 | 2492 |
]. |
2493 |
^ true |
|
2494 |
||
1518
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2495 |
"Created: / 7.3.1997 / 21:10:23 / cg" |
6d8e1461f119
removed unused: thumbUsable;
Claus Gittinger <cg@exept.de>
parents:
1514
diff
changeset
|
2496 |
"Modified: / 12.5.1998 / 20:21:00 / cg" |
446 | 2497 |
! ! |
2498 |
||
897 | 2499 |
!Scroller class methodsFor:'documentation'! |
105 | 2500 |
|
205 | 2501 |
version |
2321 | 2502 |
^ '$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.151 2000-11-23 13:21:00 cg Exp $' |
105 | 2503 |
! ! |