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