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