author | Claus Gittinger <cg@exept.de> |
Thu, 28 Mar 2019 09:13:28 +0100 | |
changeset 6037 | d446c3eccc41 |
parent 5811 | c8e7ae5e07e4 |
permissions | -rw-r--r-- |
5811 | 1 |
"{ Encoding: utf8 }" |
2 |
||
36 | 3 |
" |
4 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
2001
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
14 |
"{ Package: 'stx:libwidg2' }" |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
15 |
|
4762 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
49 | 18 |
SimpleView subclass:#ViewScroller |
2120 | 19 |
instanceVariableNames:'frame scrolledView keepViewsChannel model verticalScrollStep |
3249
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
20 |
horizontalScrollStep resizeScrolledViewVertical |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
21 |
resizeScrolledViewHorizontal' |
186 | 22 |
classVariableNames:'' |
23 |
poolDictionaries:'' |
|
24 |
category:'Views-Basic' |
|
29 | 25 |
! |
26 |
||
424 | 27 |
!ViewScroller class methodsFor:'documentation'! |
29 | 28 |
|
36 | 29 |
copyright |
30 |
" |
|
31 |
COPYRIGHT (c) 1994 by Claus Gittinger |
|
32 |
All Rights Reserved |
|
33 |
||
34 |
This software is furnished under a license and may be used |
|
35 |
only in accordance with the terms of that license and with the |
|
36 |
inclusion of the above copyright notice. This software may not |
|
37 |
be provided or otherwise made available to, or used by, any |
|
38 |
other person. No title to or ownership of the software is |
|
39 |
hereby transferred. |
|
40 |
" |
|
41 |
! |
|
42 |
||
43 |
documentation |
|
44 |
" |
|
187 | 45 |
This wrapper view allows scrolling of views (in contrast to scrolling |
46 |
of contents which can be done by any view). |
|
186 | 47 |
|
187 | 48 |
Normally, scrolling is done by putting a view into a ScrollableView (which |
49 |
simply wraps the scrollbars around) and have the scrollbars send scrollUp:/ |
|
50 |
scrollDown: etc. send to the scrolledView. |
|
51 |
The default implementation of scrolling (in View) modifies the transformation, |
|
52 |
and does a bit-copy of the contents with redraw of the exposed area. |
|
36 | 53 |
|
187 | 54 |
However, there are situations, where you want to scroll a view itself. |
55 |
For example, if you need many buttons in a panel, which do not fit. |
|
36 | 56 |
|
187 | 57 |
This class provides the basic mechanism to implement this. |
58 |
It is a wrapper, which implements scrolling by modifying the origin of its |
|
59 |
single subview when asked to scroll. Thus, it can be put into a ScrollableView |
|
60 |
like any other, but will move its subview when asked to scroll instead. |
|
61 |
(i.e. reimplement all scroll messages by manipulating its subviews origin |
|
62 |
instead of its contents' transformation offset) |
|
36 | 63 |
|
187 | 64 |
The subview should have a constant extent, which will be taken for the |
65 |
scrollbar position/height computation. |
|
66 |
Since the subview is represented directly by the underlying window systems view |
|
67 |
implementation, there may be a limit on the maximum size of that view. For |
|
68 |
example, in X, dimensions may not be larger than 32767 pixels. |
|
69 |
||
2120 | 70 |
[Instance variables:] |
71 |
model <ValueHolder> the model which keeps the current scrolledView. |
|
72 |
||
73 |
keepViewsChannel <ValueHolder> boolean holder; if the value is false (the default), |
|
74 |
the previous scrolled view is destroyed, whenever a |
|
75 |
new scrolled view is set. If true, it is unmapped and |
|
76 |
kept. |
|
77 |
Set this flag, if the application changes the scrolled |
|
78 |
view but wants them to be kept for fast switching. |
|
79 |
||
80 |
horizontalScrollStep <SmallInteger> amount to scroll when stepping left/right in pixels |
|
81 |
verticalScrollStep <SmallInteger> amount to scroll when stepping up/down in pixels |
|
82 |
||
83 |
frame <SimpleView> the one and only container of the visible scrolledView |
|
4807 | 84 |
and all invisible scrolledViews if existent. |
2120 | 85 |
|
86 |
scrolledView <SimpleView | nil> the current scrolled view or nil |
|
87 |
||
187 | 88 |
[see also:] |
89 |
ScrollableView HVScrollableView |
|
90 |
||
91 |
[author:] |
|
92 |
Claus Gittinger |
|
36 | 93 |
" |
94 |
! |
|
95 |
||
29 | 96 |
examples |
97 |
" |
|
98 |
scroll a panel of buttons: |
|
186 | 99 |
[exBegin] |
29 | 100 |
|top frame vscroller v panel| |
101 |
||
102 |
top := StandardSystemView new. |
|
103 |
top extent:100@400. |
|
104 |
||
105 |
frame := ScrollableView for:ViewScroller in:top. |
|
106 |
frame origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
107 |
||
108 |
vscroller := frame scrolledView. |
|
109 |
panel := VerticalPanelView new. |
|
110 |
panel horizontalLayout:#fit. |
|
111 |
1 to:100 do:[:i | |
|
186 | 112 |
Button label:(i printString) in:panel |
29 | 113 |
]. |
114 |
vscroller scrolledView:panel. |
|
115 |
top open. |
|
186 | 116 |
[exEnd] |
29 | 117 |
|
425 | 118 |
same, defining what a scroll step is: |
119 |
[exBegin] |
|
120 |
|top frame vscroller v panel| |
|
121 |
||
122 |
top := StandardSystemView new. |
|
123 |
top extent:100@400. |
|
124 |
||
125 |
frame := ScrollableView for:ViewScroller in:top. |
|
126 |
frame origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
127 |
||
128 |
vscroller := frame scrolledView. |
|
129 |
vscroller verticalScrollStep:20. |
|
130 |
panel := VerticalPanelView new. |
|
131 |
panel horizontalLayout:#fit. |
|
132 |
1 to:100 do:[:i | |
|
133 |
Button label:(i printString) in:panel |
|
134 |
]. |
|
135 |
vscroller scrolledView:panel. |
|
136 |
top open. |
|
137 |
[exEnd] |
|
138 |
||
187 | 139 |
|
29 | 140 |
same, horizontally. Also change layout in panel for nicer look |
141 |
and make panel adjust its height: |
|
36 | 142 |
(since the buttons are defined to fill vertically, the vertical |
143 |
scrollbar is useless here - its here as example; not for its function) |
|
186 | 144 |
[exBegin] |
29 | 145 |
|top frame vscroller v panel| |
146 |
||
147 |
top := StandardSystemView new. |
|
148 |
top extent:300@100. |
|
149 |
||
150 |
frame := HVScrollableView for:ViewScroller in:top. |
|
151 |
frame origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
152 |
||
153 |
vscroller := frame scrolledView. |
|
154 |
panel := HorizontalPanelView new. |
|
155 |
panel verticalLayout:#fit. |
|
156 |
panel horizontalLayout:#fit. |
|
157 |
1 to:100 do:[:i | |
|
186 | 158 |
Button label:(i printString) in:panel |
29 | 159 |
]. |
160 |
vscroller scrolledView:panel. |
|
161 |
panel height:1.0. |
|
162 |
top open. |
|
186 | 163 |
[exEnd] |
29 | 164 |
|
165 |
||
166 |
scroll a panel of buttons and other views: |
|
167 |
(not good looking, but a demo that it can be done ...) |
|
186 | 168 |
[exBegin] |
29 | 169 |
|top frame vscroller v panel textView1 textView2| |
170 |
||
171 |
top := StandardSystemView new. |
|
172 |
||
173 |
frame := HVScrollableView for:ViewScroller in:top. |
|
174 |
frame origin:0.0 @ 0.0 corner:1.0 @ 1.0. |
|
175 |
||
176 |
vscroller := frame scrolledView. |
|
177 |
||
178 |
panel := VerticalPanelView new. |
|
179 |
panel horizontalLayout:#leftSpace. |
|
3544 | 180 |
panel extent:1.0@1.0. |
29 | 181 |
|
182 |
textView1 := ScrollableView for:EditTextView in:panel. |
|
3544 | 183 |
textView1 extent:1.0 @ 300. |
184 |
textView1 scrolledView contents:('keyboard.rc' asFilename readStream contents). |
|
29 | 185 |
|
186 |
textView2 := ScrollableView for:EditTextView in:panel. |
|
187 | 187 |
textView2 extent:500 @ 300. |
29 | 188 |
textView2 scrolledView contents:('Make.proto' asFilename readStream contents). |
189 |
||
190 |
1 to:100 do:[:i | |
|
186 | 191 |
Button label:(i printString) in:panel |
29 | 192 |
]. |
3544 | 193 |
vscroller resizeScrolledViewHorizontal:true. |
29 | 194 |
vscroller scrolledView:panel. |
3544 | 195 |
|
29 | 196 |
top open. |
186 | 197 |
[exEnd] |
29 | 198 |
" |
199 |
! ! |
|
200 |
||
186 | 201 |
!ViewScroller methodsFor:'accessing'! |
202 |
||
2120 | 203 |
destroyAllClientViews |
2957 | 204 |
"destroy all client views" |
205 |
||
2120 | 206 |
frame destroySubViews. |
207 |
||
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
208 |
scrolledView notNil ifTrue:[ |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
209 |
scrolledView removeDependent:self. |
2120 | 210 |
scrolledView := nil. |
211 |
self sizeChanged:nil. |
|
212 |
]. |
|
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
213 |
model value:nil. |
2120 | 214 |
! |
425 | 215 |
|
2120 | 216 |
keepViews |
217 |
"returns the value of the boolean channel: keepViewsChannel. |
|
2957 | 218 |
for more information see: #keepViewsChannel" |
219 |
||
2120 | 220 |
^ keepViewsChannel value ? false |
221 |
! |
|
222 |
||
223 |
keepViews:aBool |
|
224 |
"set the value of the boolean channel: keepViewsChannel. |
|
225 |
for more information see: #keepViewsChannel: |
|
226 |
" |
|
227 |
keepViewsChannel value:aBool |
|
2001
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
228 |
! |
425 | 229 |
|
3249
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
230 |
resizeScrolledViewHorizontal |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
231 |
^ resizeScrolledViewHorizontal |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
232 |
! |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
233 |
|
4580 | 234 |
resizeScrolledViewHorizontal:aBoolean |
235 |
"if true, the scrolled view is actually NOT scrolled horizontally, |
|
236 |
but instead always resized to fit. |
|
237 |
Set this, if only vertical scrollability is wanted (i.e. the view |
|
238 |
itself does adjust its size horizontally (for example, in a settings dialog, |
|
239 |
the subcanvas to be enbedded has a horizontal panel, taking all of the space)" |
|
240 |
||
241 |
resizeScrolledViewHorizontal := aBoolean. |
|
3249
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
242 |
! |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
243 |
|
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
244 |
resizeScrolledViewVertical |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
245 |
^ resizeScrolledViewVertical |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
246 |
! |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
247 |
|
4580 | 248 |
resizeScrolledViewVertical:aBoolean |
249 |
"if true, the scrolled view is actually NOT scrolled vertically, |
|
250 |
but instead always resized to fit. |
|
251 |
Set this, if only horizontal scrollability is wanted (i.e. the view |
|
252 |
itself does adjust its size vertically (for example, in a settings dialog, |
|
253 |
the subcanvas to be enbedded has a vertical panel, taking all of the space)" |
|
254 |
||
255 |
resizeScrolledViewVertical := aBoolean. |
|
256 |
scrolledView notNil ifTrue:[ |
|
257 |
self resizeScrolledView |
|
258 |
]. |
|
3249
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
259 |
! |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
260 |
|
424 | 261 |
scrolledView |
262 |
"return the view which is scrolled" |
|
263 |
||
264 |
^ scrolledView |
|
265 |
! |
|
266 |
||
3329 | 267 |
scrolledView:aView |
268 |
"set a new scolled view; dependent on the #keepViewsChannel |
|
269 |
the old scolled view will be destroyed or unmapped." |
|
270 |
||
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
271 |
|extent| |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
272 |
|
3329 | 273 |
scrolledView ~~ aView ifTrue:[ |
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
274 |
scrolledView notNil ifTrue:[ |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
275 |
scrolledView removeDependent:self. |
3329 | 276 |
self keepViews ifTrue:[ scrolledView beInvisible ] |
277 |
ifFalse:[ scrolledView destroy ]. |
|
278 |
]. |
|
279 |
scrolledView := aView. |
|
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
280 |
scrolledView notNil ifTrue:[ |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
281 |
scrolledView addDependent:self. |
3329 | 282 |
|
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
283 |
"test whether new scrolled view not nil and |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
284 |
not already added to my subViews. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
285 |
" |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
286 |
(scrolledView superView ~~ frame) ifTrue:[ |
3329 | 287 |
|
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
288 |
scrolledView borderWidth:0; level:0. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
289 |
extent := scrolledView preferredExtent. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
290 |
frame addSubView:scrolledView. |
3329 | 291 |
|
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
292 |
"/ test whether the new view is a scrollWrapper. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
293 |
"/ in this case scrolling can be done by this view |
3329 | 294 |
|
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
295 |
scrolledView isScrollWrapper ifTrue:[ |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
296 |
scrolledView isHorizontalScrollable ifTrue:[ extent x:1.0 ]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
297 |
scrolledView isVerticalScrollable ifTrue:[ extent y:1.0 ]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
298 |
]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
299 |
|
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
300 |
resizeScrolledViewHorizontal ifTrue:[ extent x:1.0 ]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
301 |
resizeScrolledViewVertical ifTrue:[ extent y:1.0 ]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
302 |
|
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
303 |
scrolledView extent:extent. |
3329 | 304 |
]. |
305 |
]. |
|
306 |
realized ifTrue:[ |
|
3925 | 307 |
scrolledView notNil ifTrue:[scrolledView beVisible]. |
3329 | 308 |
self sizeChanged:nil. |
309 |
]. |
|
310 |
self sensor addEventListener:self. |
|
311 |
]. |
|
312 |
model value:scrolledView. |
|
3925 | 313 |
|
314 |
"Modified: / 08-08-2010 / 15:19:38 / cg" |
|
3329 | 315 |
! |
316 |
||
2124 | 317 |
scrolledViews |
318 |
"Returns the collection of all scrolled views including the current scrolled view |
|
2957 | 319 |
and all unmapped scrolled views." |
320 |
||
2124 | 321 |
|subviews| |
322 |
||
3925 | 323 |
frame notNil ifTrue:[ |
2124 | 324 |
subviews := frame subViews. |
3925 | 325 |
subviews notNil ifTrue:[ ^ subviews ] |
2124 | 326 |
]. |
327 |
^ #() |
|
3925 | 328 |
|
329 |
"Modified: / 08-08-2010 / 15:19:46 / cg" |
|
2120 | 330 |
! ! |
331 |
||
332 |
!ViewScroller methodsFor:'accessing-channels'! |
|
333 |
||
334 |
keepViewsChannel |
|
335 |
"boolean holder; if the value is false (the default), the previous scrolled view is |
|
336 |
destroyed, whenever a new scrolled view is set. if true, it is unmapped and kept. |
|
337 |
Set this flag, if the application changes the scrolled view but wants |
|
338 |
them to be kept for fast switching. |
|
339 |
" |
|
340 |
^ keepViewsChannel |
|
341 |
! |
|
342 |
||
343 |
keepViewsChannel:aHolder |
|
344 |
"boolean holder; if the value is false (the default), the previous scrolled view is |
|
345 |
destroyed, whenever a new scrolled view is set. if true, it is unmapped and kept. |
|
346 |
Set this flag, if the application changes the scrolled view but wants |
|
347 |
them to be kept for fast switching. |
|
348 |
" |
|
349 |
|oldValue| |
|
350 |
||
351 |
oldValue := keepViewsChannel value. |
|
352 |
keepViewsChannel removeDependent:self. |
|
353 |
||
3165 | 354 |
(keepViewsChannel := aHolder) isNil ifTrue:[ |
2120 | 355 |
keepViewsChannel := oldValue asValue. |
356 |
]. |
|
357 |
keepViewsChannel addDependent:self. |
|
358 |
self update:nil with:nil from:keepViewsChannel. |
|
359 |
! |
|
360 |
||
361 |
model |
|
362 |
"value holder, which keeps the current scrolledView or nil |
|
363 |
" |
|
364 |
^ model |
|
365 |
! |
|
366 |
||
367 |
model:aHolder |
|
368 |
"value holder, which keeps the current scrolledView or nil |
|
369 |
" |
|
370 |
model removeDependent:self. |
|
371 |
||
372 |
aHolder isNil ifTrue:[ model := nil asValue ] |
|
373 |
ifFalse:[ model := aHolder ]. |
|
374 |
||
375 |
model addDependent:self. |
|
376 |
self update:nil with:nil from:model. |
|
377 |
! ! |
|
378 |
||
379 |
!ViewScroller methodsFor:'accessing-look'! |
|
380 |
||
381 |
horizontalScrollStep:something |
|
382 |
"set the value of the instance variable 'horizontalScrollStep' (automatically generated)" |
|
383 |
||
384 |
horizontalScrollStep := something. |
|
425 | 385 |
! |
386 |
||
387 |
verticalScrollStep:something |
|
388 |
"set the value of the instance variable 'verticalScrollStep' (automatically generated)" |
|
389 |
||
2001
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
390 |
verticalScrollStep := something. |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
391 |
! ! |
186 | 392 |
|
2120 | 393 |
!ViewScroller methodsFor:'change & update'! |
394 |
||
3261
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
395 |
resizeScrolledView |
4580 | 396 |
"forces a recomputation of the scrolled view's size" |
3261
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
397 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
398 |
|oldExtent newExtent xIsRelative yIsRelative| |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
399 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
400 |
scrolledView isNil ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
401 |
^ self |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
402 |
]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
403 |
oldExtent := scrolledView extent copy. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
404 |
newExtent := scrolledView preferredExtent copy. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
405 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
406 |
xIsRelative := resizeScrolledViewHorizontal. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
407 |
yIsRelative := resizeScrolledViewVertical. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
408 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
409 |
scrolledView isScrollWrapper ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
410 |
scrolledView isHorizontalScrollable ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
411 |
xIsRelative := true. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
412 |
]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
413 |
scrolledView isVerticalScrollable ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
414 |
yIsRelative := true. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
415 |
]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
416 |
]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
417 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
418 |
resizeScrolledViewHorizontal ifTrue:[ newExtent x:1.0 ]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
419 |
resizeScrolledViewVertical ifTrue:[ newExtent y:1.0 ]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
420 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
421 |
xIsRelative ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
422 |
newExtent x:1.0. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
423 |
oldExtent x:1.0. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
424 |
]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
425 |
yIsRelative ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
426 |
newExtent y:1.0. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
427 |
oldExtent y:1.0. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
428 |
]. |
4580 | 429 |
true "oldExtent ~= newExtent" ifTrue:[ |
3261
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
430 |
scrolledView extent:newExtent. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
431 |
|
4580 | 432 |
"/ realized ifTrue:[ |
433 |
"/ self sizeChanged:nil. |
|
434 |
"/ ]. |
|
3261
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
435 |
]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
436 |
! |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
437 |
|
2120 | 438 |
update:something with:aParameter from:changedObject |
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
439 |
changedObject == scrolledView ifTrue:[ |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
440 |
something == #sizeOfView ifTrue:[ |
4581 | 441 |
(resizeScrolledViewHorizontal not or:[ resizeScrolledViewVertical not ]) ifTrue:[ |
442 |
self repositionScrolledView. |
|
443 |
self changed:#sizeOfContents. "update possible scrollers" |
|
444 |
]. |
|
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
445 |
]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
446 |
^ self |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
447 |
]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
448 |
|
2120 | 449 |
changedObject == model ifTrue:[ |
450 |
self scrolledView:(model value). |
|
2478 | 451 |
^ self |
2120 | 452 |
]. |
453 |
||
454 |
changedObject == keepViewsChannel ifTrue:[ |
|
455 |
self keepViews ifFalse:[ |views| |
|
3355
7cc9b5a40524
Clean up documentation & variable names
Stefan Vogel <sv@exept.de>
parents:
3339
diff
changeset
|
456 |
"destroy all client views other than the actual scrolled view |
2120 | 457 |
" |
458 |
views := frame subViews. |
|
459 |
views size ~~ 0 ifTrue:[ |
|
2478 | 460 |
views copy do:[:v | v ~~ scrolledView ifTrue:[ v destroy ] ]. |
2120 | 461 |
] |
462 |
]. |
|
463 |
^ self |
|
464 |
]. |
|
465 |
||
466 |
super update:something with:aParameter from:changedObject |
|
467 |
! ! |
|
468 |
||
3513
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
469 |
!ViewScroller methodsFor:'delegation'! |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
470 |
|
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
471 |
viewBackground:aColor |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
472 |
super viewBackground:aColor. |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
473 |
frame notNil ifTrue:[ |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
474 |
frame viewBackground:aColor |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
475 |
]. |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
476 |
! ! |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
477 |
|
186 | 478 |
!ViewScroller methodsFor:'event handling'! |
479 |
||
3498 | 480 |
processEvent:anEvent |
481 |
"return true, if the event was eaten" |
|
482 |
||
3641
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
483 |
|appl evView viewToScroll| |
3339 | 484 |
|
3329 | 485 |
anEvent isMouseWheelEvent ifTrue:[ |
3641
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
486 |
scrolledView isNil ifTrue:[ |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
487 |
^ false |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
488 |
]. |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
489 |
|
3339 | 490 |
appl := self application. |
491 |
appl notNil ifTrue:[ "/ might happen that my application is nil |
|
3409 | 492 |
evView := anEvent view. |
3641
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
493 |
viewToScroll := anEvent targetView. |
3498 | 494 |
|
495 |
"/ because I am catching all scroll events (which is a kludge), |
|
496 |
"/ walk up the hierarchy and see if there is no other scrolled view involved. |
|
497 |
"/ if not, handle the scroll. |
|
498 |
"/ BETTER SOLUTION: |
|
499 |
"/ unhandled mouseWheel events should be forwarded to the container |
|
500 |
||
501 |
[ viewToScroll ~~ scrolledView |
|
502 |
and:[ viewToScroll ~~ self |
|
3641
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
503 |
and:[ viewToScroll notNil |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
504 |
and:[ (viewToScroll isScrollWrapper not |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
505 |
or:[ viewToScroll isVerticalScrollable not ]) |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
506 |
and:[ (viewToScroll handlesMouseWheelMotion:anEvent inView:evView) not ]]]] |
3498 | 507 |
] whileTrue:[ |
508 |
viewToScroll := viewToScroll container. |
|
509 |
]. |
|
510 |
viewToScroll isNil ifTrue:[ |
|
511 |
^ false |
|
512 |
]. |
|
513 |
||
514 |
viewToScroll == scrolledView ifTrue:[ |
|
3409 | 515 |
appl |
516 |
enqueueMessage:#mouseWheelMotion:x:y:amount:deltaTime: |
|
517 |
for:self |
|
518 |
arguments:(anEvent arguments). |
|
3410 | 519 |
^ true |
3409 | 520 |
]. |
3339 | 521 |
]. |
3329 | 522 |
]. |
523 |
^ false |
|
524 |
! |
|
525 |
||
3493 | 526 |
repositionScrolledView |
527 |
"Reposition the scrolledView, if required" |
|
187 | 528 |
|
186 | 529 |
|newOrigin| |
530 |
||
4580 | 531 |
"/ self resizeScrolledView. |
532 |
||
186 | 533 |
" |
534 |
if we are beyond the end, scroll up a bit |
|
535 |
" |
|
536 |
((self viewOrigin y + self height) > self heightOfContents) ifTrue:[ |
|
4762 | 537 |
newOrigin := (self heightOfContents - self height) max:0. |
186 | 538 |
self scrollVerticalTo: newOrigin. |
539 |
]. |
|
540 |
" |
|
541 |
if we are right of the end, scroll left a bit |
|
542 |
" |
|
543 |
((self viewOrigin x + self width) > self widthOfContents) ifTrue:[ |
|
4762 | 544 |
newOrigin := (self widthOfContents - self width) max:0. |
186 | 545 |
self scrollHorizontalTo: newOrigin. |
546 |
]. |
|
547 |
||
187 | 548 |
"Modified: 24.5.1996 / 17:48:44 / cg" |
3493 | 549 |
! |
550 |
||
551 |
sizeChanged:how |
|
552 |
"my size changed. Reposition the scrolledView, if required" |
|
553 |
||
5731 | 554 |
thisContext isRecursive ifTrue:[^self]. |
3493 | 555 |
super sizeChanged:how. |
556 |
self changed:#sizeOfContents. "update possible scrollers" |
|
557 |
||
558 |
self repositionScrolledView. |
|
4580 | 559 |
self resizeScrolledView |
186 | 560 |
! ! |
561 |
||
3175 | 562 |
!ViewScroller methodsFor:'focus handling'! |
563 |
||
564 |
canTab |
|
565 |
^ false |
|
566 |
! ! |
|
567 |
||
2120 | 568 |
!ViewScroller methodsFor:'initialization & release'! |
569 |
||
570 |
initialize |
|
2738 | 571 |
"initialize all models of the view" |
572 |
||
2120 | 573 |
super initialize. |
574 |
||
3249
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
575 |
resizeScrolledViewVertical := false. |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
576 |
resizeScrolledViewHorizontal := false. |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
577 |
|
2120 | 578 |
frame := SimpleView origin:0.0@0.0 corner:1.0@1.0 in:self. |
579 |
frame borderWidth:0; level:0. |
|
3513
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
580 |
frame viewBackground:self viewBackground. |
2120 | 581 |
|
582 |
keepViewsChannel := false asValue. |
|
583 |
keepViewsChannel addDependent:self. |
|
584 |
||
585 |
model := nil asValue. |
|
586 |
model addDependent:self. |
|
2156 | 587 |
! |
588 |
||
3326 | 589 |
realize |
590 |
super realize. |
|
591 |
self sensor addEventListener:self. |
|
592 |
||
593 |
! |
|
594 |
||
2156 | 595 |
release |
2738 | 596 |
"release all dependencies" |
597 |
||
2156 | 598 |
keepViewsChannel removeDependent:self. |
599 |
model removeDependent:self. |
|
600 |
||
601 |
super release. |
|
2120 | 602 |
! ! |
603 |
||
29 | 604 |
!ViewScroller methodsFor:'queries-contents'! |
605 |
||
186 | 606 |
heightOfContents |
187 | 607 |
"return my contents' height; this is the scrolledViews height" |
186 | 608 |
|
424 | 609 |
scrolledView isNil ifTrue:[^ super heightOfContents]. |
186 | 610 |
^ scrolledView height |
611 |
||
187 | 612 |
"Modified: 24.5.1996 / 17:34:48 / cg" |
186 | 613 |
! |
614 |
||
29 | 615 |
viewOrigin |
5811 | 616 |
"the viewOrigin (for scrollBars) is based upon the scrolledView's origin" |
186 | 617 |
|
424 | 618 |
scrolledView isNil ifTrue:[^ 0@0]. |
29 | 619 |
^ scrolledView origin negated |
186 | 620 |
|
5811 | 621 |
"Modified: / 24-05-1996 / 17:48:13 / cg" |
622 |
"Modified (comment): / 14-06-2018 / 10:17:20 / Claus Gittinger" |
|
29 | 623 |
! |
624 |
||
625 |
widthOfContents |
|
187 | 626 |
"return my contents' width; this is the scrolledViews width" |
29 | 627 |
|
424 | 628 |
scrolledView isNil ifTrue:[^ super widthOfContents]. |
186 | 629 |
^ scrolledView width |
630 |
||
187 | 631 |
"Modified: 24.5.1996 / 17:34:56 / cg" |
29 | 632 |
! ! |
633 |
||
634 |
!ViewScroller methodsFor:'scrolling'! |
|
635 |
||
424 | 636 |
horizontalScrollStep |
637 |
"return the amount by which to step-scroll horizontally" |
|
638 |
||
425 | 639 |
^ horizontalScrollStep ? (self width // 2) |
424 | 640 |
! |
641 |
||
4551 | 642 |
scrollTo:aPoint redraw:doRedraw |
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
643 |
"change origin of scrolledView to scroll to aPoint" |
29 | 644 |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
645 |
|wCont hCont "{ Class:SmallInteger }" |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
646 |
iw ih "{ Class:SmallInteger }" |
2001
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
647 |
viewOrigin orgX orgY newX newY dX dY| |
29 | 648 |
|
424 | 649 |
scrolledView isNil ifTrue:[^ self]. |
650 |
||
29 | 651 |
viewOrigin := scrolledView origin. |
652 |
orgX := viewOrigin x negated. |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
653 |
orgY := viewOrigin y negated. |
29 | 654 |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
655 |
newX := aPoint x. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
656 |
newY := aPoint y. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
657 |
wCont := self widthOfContents. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
658 |
hCont := self heightOfContents. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
659 |
iw := self innerWidth. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
660 |
ih := self innerHeight. |
29 | 661 |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
662 |
((newX + iw) > wCont) ifTrue:[ |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
663 |
newX := wCont - iw |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
664 |
]. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
665 |
(newX < 0) ifTrue:[ |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
666 |
newX := 0 |
29 | 667 |
]. |
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
668 |
((newY + ih) > hCont) ifTrue:[ |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
669 |
newY := hCont - ih |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
670 |
]. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
671 |
(newY < 0) ifTrue:[ |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
672 |
newY := 0 |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
673 |
]. |
2001
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
674 |
dX := newX-orgX. |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
675 |
dY := newY-orgY. |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
676 |
((dX ~= 0) or:[dY ~= 0]) ifTrue:[ |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
677 |
self originWillChange. |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
678 |
scrolledView origin:(newX negated @ newY negated). |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
679 |
self originChanged:(dX negated @ dY negated). |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
680 |
] |
42 | 681 |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
682 |
"Modified: 21.8.1996 / 09:17:49 / stefan" |
424 | 683 |
! |
684 |
||
685 |
verticalScrollStep |
|
686 |
"return the amount by which to step-scroll vertically" |
|
687 |
||
3498 | 688 |
verticalScrollStep notNil ifTrue:[ ^ verticalScrollStep]. |
4989 | 689 |
^ (device verticalPixelPerMillimeter * 20) asInteger |
3498 | 690 |
"/ ^ (self height // 3) |
42 | 691 |
! ! |
692 |
||
424 | 693 |
!ViewScroller class methodsFor:'documentation'! |
120 | 694 |
|
695 |
version |
|
4807 | 696 |
^ '$Header$' |
3925 | 697 |
! |
698 |
||
699 |
version_CVS |
|
4807 | 700 |
^ '$Header$' |
120 | 701 |
! ! |
4519 | 702 |