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