author | Claus Gittinger <cg@exept.de> |
Sun, 08 Aug 2010 15:23:04 +0200 | |
changeset 3925 | bbcb5ef3a451 |
parent 3641 | e466ec0abd6e |
child 4519 | 4c40ebe99f47 |
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:[ |
|
3925 | 288 |
scrolledView notNil ifTrue:[scrolledView beVisible]. |
3329 | 289 |
self sizeChanged:nil. |
290 |
]. |
|
291 |
self sensor addEventListener:self. |
|
292 |
]. |
|
293 |
model value:scrolledView. |
|
3925 | 294 |
|
295 |
"Modified: / 08-08-2010 / 15:19:38 / cg" |
|
3329 | 296 |
! |
297 |
||
2124 | 298 |
scrolledViews |
299 |
"Returns the collection of all scrolled views including the current scrolled view |
|
2957 | 300 |
and all unmapped scrolled views." |
301 |
||
2124 | 302 |
|subviews| |
303 |
||
3925 | 304 |
frame notNil ifTrue:[ |
2124 | 305 |
subviews := frame subViews. |
3925 | 306 |
subviews notNil ifTrue:[ ^ subviews ] |
2124 | 307 |
]. |
308 |
^ #() |
|
3925 | 309 |
|
310 |
"Modified: / 08-08-2010 / 15:19:46 / cg" |
|
2120 | 311 |
! ! |
312 |
||
313 |
!ViewScroller methodsFor:'accessing-channels'! |
|
314 |
||
315 |
keepViewsChannel |
|
316 |
"boolean holder; if the value is false (the default), the previous scrolled view is |
|
317 |
destroyed, whenever a new scrolled view is set. if true, it is unmapped and kept. |
|
318 |
Set this flag, if the application changes the scrolled view but wants |
|
319 |
them to be kept for fast switching. |
|
320 |
" |
|
321 |
^ keepViewsChannel |
|
322 |
! |
|
323 |
||
324 |
keepViewsChannel:aHolder |
|
325 |
"boolean holder; if the value is false (the default), the previous scrolled view is |
|
326 |
destroyed, whenever a new scrolled view is set. if true, it is unmapped and kept. |
|
327 |
Set this flag, if the application changes the scrolled view but wants |
|
328 |
them to be kept for fast switching. |
|
329 |
" |
|
330 |
|oldValue| |
|
331 |
||
332 |
oldValue := keepViewsChannel value. |
|
333 |
keepViewsChannel removeDependent:self. |
|
334 |
||
3165 | 335 |
(keepViewsChannel := aHolder) isNil ifTrue:[ |
2120 | 336 |
keepViewsChannel := oldValue asValue. |
337 |
]. |
|
338 |
keepViewsChannel addDependent:self. |
|
339 |
self update:nil with:nil from:keepViewsChannel. |
|
340 |
! |
|
341 |
||
342 |
model |
|
343 |
"value holder, which keeps the current scrolledView or nil |
|
344 |
" |
|
345 |
^ model |
|
346 |
! |
|
347 |
||
348 |
model:aHolder |
|
349 |
"value holder, which keeps the current scrolledView or nil |
|
350 |
" |
|
351 |
model removeDependent:self. |
|
352 |
||
353 |
aHolder isNil ifTrue:[ model := nil asValue ] |
|
354 |
ifFalse:[ model := aHolder ]. |
|
355 |
||
356 |
model addDependent:self. |
|
357 |
self update:nil with:nil from:model. |
|
358 |
! ! |
|
359 |
||
360 |
!ViewScroller methodsFor:'accessing-look'! |
|
361 |
||
362 |
horizontalScrollStep:something |
|
363 |
"set the value of the instance variable 'horizontalScrollStep' (automatically generated)" |
|
364 |
||
365 |
horizontalScrollStep := something. |
|
425 | 366 |
! |
367 |
||
368 |
verticalScrollStep:something |
|
369 |
"set the value of the instance variable 'verticalScrollStep' (automatically generated)" |
|
370 |
||
2001
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
371 |
verticalScrollStep := something. |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
372 |
! ! |
186 | 373 |
|
2120 | 374 |
!ViewScroller methodsFor:'change & update'! |
375 |
||
3261
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
376 |
resizeScrolledView |
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
377 |
"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
|
378 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
379 |
|oldExtent newExtent xIsRelative yIsRelative| |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
380 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
381 |
scrolledView isNil ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
382 |
^ self |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
383 |
]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
384 |
oldExtent := scrolledView extent copy. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
385 |
newExtent := scrolledView preferredExtent copy. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
386 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
387 |
xIsRelative := resizeScrolledViewHorizontal. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
388 |
yIsRelative := resizeScrolledViewVertical. |
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 isScrollWrapper ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
391 |
scrolledView isHorizontalScrollable ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
392 |
xIsRelative := true. |
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 |
scrolledView isVerticalScrollable ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
395 |
yIsRelative := true. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
396 |
]. |
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 |
|
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
399 |
resizeScrolledViewHorizontal ifTrue:[ newExtent x:1.0 ]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
400 |
resizeScrolledViewVertical ifTrue:[ newExtent y: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 |
xIsRelative ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
403 |
newExtent x:1.0. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
404 |
oldExtent x: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 |
yIsRelative ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
407 |
newExtent y:1.0. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
408 |
oldExtent y:1.0. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
409 |
]. |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
410 |
oldExtent ~= newExtent ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
411 |
scrolledView extent:newExtent. |
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 |
realized ifTrue:[ |
7f60ff4c779b
resizeScrolledView - canbe called to force a recomputation of the scrolled view
ca
parents:
3249
diff
changeset
|
414 |
self sizeChanged:nil. |
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 |
|
2120 | 419 |
update:something with:aParameter from:changedObject |
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
420 |
changedObject == scrolledView ifTrue:[ |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
421 |
something == #sizeOfView ifTrue:[ |
3493 | 422 |
self repositionScrolledView. |
3481
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
423 |
self changed:#sizeOfContents. "update possible scrollers" |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
424 |
]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
425 |
^ self |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
426 |
]. |
3b75a4fd635a
forward contentsChange messages
Claus Gittinger <cg@exept.de>
parents:
3443
diff
changeset
|
427 |
|
2120 | 428 |
changedObject == model ifTrue:[ |
429 |
self scrolledView:(model value). |
|
2478 | 430 |
^ self |
2120 | 431 |
]. |
432 |
||
433 |
changedObject == keepViewsChannel ifTrue:[ |
|
434 |
self keepViews ifFalse:[ |views| |
|
3355
7cc9b5a40524
Clean up documentation & variable names
Stefan Vogel <sv@exept.de>
parents:
3339
diff
changeset
|
435 |
"destroy all client views other than the actual scrolled view |
2120 | 436 |
" |
437 |
views := frame subViews. |
|
438 |
views size ~~ 0 ifTrue:[ |
|
2478 | 439 |
views copy do:[:v | v ~~ scrolledView ifTrue:[ v destroy ] ]. |
2120 | 440 |
] |
441 |
]. |
|
442 |
^ self |
|
443 |
]. |
|
444 |
||
445 |
super update:something with:aParameter from:changedObject |
|
446 |
! ! |
|
447 |
||
3513
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
448 |
!ViewScroller methodsFor:'delegation'! |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
449 |
|
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
450 |
viewBackground:aColor |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
451 |
super viewBackground:aColor. |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
452 |
frame notNil ifTrue:[ |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
453 |
frame viewBackground:aColor |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
454 |
]. |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
455 |
! ! |
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
456 |
|
186 | 457 |
!ViewScroller methodsFor:'event handling'! |
458 |
||
3498 | 459 |
processEvent:anEvent |
460 |
"return true, if the event was eaten" |
|
461 |
||
3641
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
462 |
|appl evView viewToScroll| |
3339 | 463 |
|
3329 | 464 |
anEvent isMouseWheelEvent ifTrue:[ |
3641
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
465 |
scrolledView isNil ifTrue:[ |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
466 |
^ false |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
467 |
]. |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
468 |
|
3339 | 469 |
appl := self application. |
470 |
appl notNil ifTrue:[ "/ might happen that my application is nil |
|
3409 | 471 |
evView := anEvent view. |
3641
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
472 |
viewToScroll := anEvent targetView. |
3498 | 473 |
|
474 |
"/ because I am catching all scroll events (which is a kludge), |
|
475 |
"/ walk up the hierarchy and see if there is no other scrolled view involved. |
|
476 |
"/ if not, handle the scroll. |
|
477 |
"/ BETTER SOLUTION: |
|
478 |
"/ unhandled mouseWheel events should be forwarded to the container |
|
479 |
||
480 |
[ viewToScroll ~~ scrolledView |
|
481 |
and:[ viewToScroll ~~ self |
|
3641
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
482 |
and:[ viewToScroll notNil |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
483 |
and:[ (viewToScroll isScrollWrapper not |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
484 |
or:[ viewToScroll isVerticalScrollable not ]) |
e466ec0abd6e
No longer scroll the focus view for mouseWheel events.
Stefan Vogel <sv@exept.de>
parents:
3544
diff
changeset
|
485 |
and:[ (viewToScroll handlesMouseWheelMotion:anEvent inView:evView) not ]]]] |
3498 | 486 |
] whileTrue:[ |
487 |
viewToScroll := viewToScroll container. |
|
488 |
]. |
|
489 |
viewToScroll isNil ifTrue:[ |
|
490 |
^ false |
|
491 |
]. |
|
492 |
||
493 |
viewToScroll == scrolledView ifTrue:[ |
|
3409 | 494 |
appl |
495 |
enqueueMessage:#mouseWheelMotion:x:y:amount:deltaTime: |
|
496 |
for:self |
|
497 |
arguments:(anEvent arguments). |
|
3410 | 498 |
^ true |
3409 | 499 |
]. |
3339 | 500 |
]. |
3329 | 501 |
]. |
502 |
^ false |
|
503 |
! |
|
504 |
||
3493 | 505 |
repositionScrolledView |
506 |
"Reposition the scrolledView, if required" |
|
187 | 507 |
|
186 | 508 |
|newOrigin| |
509 |
||
510 |
" |
|
511 |
if we are beyond the end, scroll up a bit |
|
512 |
" |
|
513 |
((self viewOrigin y + self height) > self heightOfContents) ifTrue:[ |
|
514 |
newOrigin := self heightOfContents - self height. |
|
515 |
newOrigin < 0 ifTrue:[ |
|
516 |
newOrigin := 0 |
|
517 |
]. |
|
518 |
self scrollVerticalTo: newOrigin. |
|
519 |
]. |
|
520 |
" |
|
521 |
if we are right of the end, scroll left a bit |
|
522 |
" |
|
523 |
((self viewOrigin x + self width) > self widthOfContents) ifTrue:[ |
|
524 |
newOrigin := self widthOfContents - self width. |
|
525 |
newOrigin < 0 ifTrue:[ |
|
526 |
newOrigin := 0 |
|
527 |
]. |
|
528 |
self scrollHorizontalTo: newOrigin. |
|
529 |
]. |
|
530 |
||
187 | 531 |
"Modified: 24.5.1996 / 17:48:44 / cg" |
3493 | 532 |
! |
533 |
||
534 |
sizeChanged:how |
|
535 |
"my size changed. Reposition the scrolledView, if required" |
|
536 |
||
537 |
super sizeChanged:how. |
|
538 |
self changed:#sizeOfContents. "update possible scrollers" |
|
539 |
||
540 |
self repositionScrolledView. |
|
186 | 541 |
! ! |
542 |
||
3175 | 543 |
!ViewScroller methodsFor:'focus handling'! |
544 |
||
545 |
canTab |
|
546 |
^ false |
|
547 |
! ! |
|
548 |
||
2120 | 549 |
!ViewScroller methodsFor:'initialization & release'! |
550 |
||
551 |
initialize |
|
2738 | 552 |
"initialize all models of the view" |
553 |
||
2120 | 554 |
super initialize. |
555 |
||
3249
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
556 |
resizeScrolledViewVertical := false. |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
557 |
resizeScrolledViewHorizontal := false. |
224b457c40fd
support resizeScrolledViewVertical and resizeScrolledViewHorizontal
ca
parents:
3175
diff
changeset
|
558 |
|
2120 | 559 |
frame := SimpleView origin:0.0@0.0 corner:1.0@1.0 in:self. |
560 |
frame borderWidth:0; level:0. |
|
3513
f74407d012e0
propagate viewBackground to the frame view
Stefan Vogel <sv@exept.de>
parents:
3508
diff
changeset
|
561 |
frame viewBackground:self viewBackground. |
2120 | 562 |
|
563 |
keepViewsChannel := false asValue. |
|
564 |
keepViewsChannel addDependent:self. |
|
565 |
||
566 |
model := nil asValue. |
|
567 |
model addDependent:self. |
|
2156 | 568 |
! |
569 |
||
3326 | 570 |
realize |
571 |
super realize. |
|
572 |
self sensor addEventListener:self. |
|
573 |
||
574 |
! |
|
575 |
||
2156 | 576 |
release |
2738 | 577 |
"release all dependencies" |
578 |
||
2156 | 579 |
keepViewsChannel removeDependent:self. |
580 |
model removeDependent:self. |
|
581 |
||
582 |
super release. |
|
2120 | 583 |
! ! |
584 |
||
29 | 585 |
!ViewScroller methodsFor:'queries-contents'! |
586 |
||
186 | 587 |
heightOfContents |
187 | 588 |
"return my contents' height; this is the scrolledViews height" |
186 | 589 |
|
424 | 590 |
scrolledView isNil ifTrue:[^ super heightOfContents]. |
186 | 591 |
^ scrolledView height |
592 |
||
187 | 593 |
"Modified: 24.5.1996 / 17:34:48 / cg" |
186 | 594 |
! |
595 |
||
29 | 596 |
viewOrigin |
187 | 597 |
"the viewOrigin (for scrollBars) is based upon the scrolledViews origin" |
186 | 598 |
|
424 | 599 |
scrolledView isNil ifTrue:[^ 0@0]. |
29 | 600 |
^ scrolledView origin negated |
186 | 601 |
|
187 | 602 |
"Modified: 24.5.1996 / 17:48:13 / cg" |
29 | 603 |
! |
604 |
||
605 |
widthOfContents |
|
187 | 606 |
"return my contents' width; this is the scrolledViews width" |
29 | 607 |
|
424 | 608 |
scrolledView isNil ifTrue:[^ super widthOfContents]. |
186 | 609 |
^ scrolledView width |
610 |
||
187 | 611 |
"Modified: 24.5.1996 / 17:34:56 / cg" |
29 | 612 |
! ! |
613 |
||
614 |
!ViewScroller methodsFor:'scrolling'! |
|
615 |
||
424 | 616 |
horizontalScrollStep |
617 |
"return the amount by which to step-scroll horizontally" |
|
618 |
||
425 | 619 |
^ horizontalScrollStep ? (self width // 2) |
424 | 620 |
! |
621 |
||
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
622 |
scrollTo:aPoint |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
623 |
"change origin of scrolledView to scroll to aPoint" |
29 | 624 |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
625 |
|wCont hCont "{ Class:SmallInteger }" |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
626 |
iw ih "{ Class:SmallInteger }" |
2001
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
627 |
viewOrigin orgX orgY newX newY dX dY| |
29 | 628 |
|
424 | 629 |
scrolledView isNil ifTrue:[^ self]. |
630 |
||
29 | 631 |
viewOrigin := scrolledView origin. |
632 |
orgX := viewOrigin x negated. |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
633 |
orgY := viewOrigin y negated. |
29 | 634 |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
635 |
newX := aPoint x. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
636 |
newY := aPoint y. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
637 |
wCont := self widthOfContents. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
638 |
hCont := self heightOfContents. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
639 |
iw := self innerWidth. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
640 |
ih := self innerHeight. |
29 | 641 |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
642 |
((newX + iw) > wCont) ifTrue:[ |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
643 |
newX := wCont - iw |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
644 |
]. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
645 |
(newX < 0) ifTrue:[ |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
646 |
newX := 0 |
29 | 647 |
]. |
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
648 |
((newY + ih) > hCont) ifTrue:[ |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
649 |
newY := hCont - ih |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
650 |
]. |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
651 |
(newY < 0) ifTrue:[ |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
652 |
newY := 0 |
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
653 |
]. |
2001
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
654 |
dX := newX-orgX. |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
655 |
dY := newY-orgY. |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
656 |
((dX ~= 0) or:[dY ~= 0]) ifTrue:[ |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
657 |
self originWillChange. |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
658 |
scrolledView origin:(newX negated @ newY negated). |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
659 |
self originChanged:(dX negated @ dY negated). |
4fba7c3b5f53
dont scroll if scroll delta is 0
Claus Gittinger <cg@exept.de>
parents:
1466
diff
changeset
|
660 |
] |
42 | 661 |
|
236
20dba8483ad7
Make #scrollTo: the basic scrolling method.
Stefan Vogel <sv@exept.de>
parents:
187
diff
changeset
|
662 |
"Modified: 21.8.1996 / 09:17:49 / stefan" |
424 | 663 |
! |
664 |
||
665 |
verticalScrollStep |
|
666 |
"return the amount by which to step-scroll vertically" |
|
667 |
||
3498 | 668 |
verticalScrollStep notNil ifTrue:[ ^ verticalScrollStep]. |
669 |
^ (device verticalPixelPerMillimeter * 20) asInteger |
|
670 |
"/ ^ (self height // 3) |
|
42 | 671 |
! ! |
672 |
||
424 | 673 |
!ViewScroller class methodsFor:'documentation'! |
120 | 674 |
|
675 |
version |
|
3925 | 676 |
^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.41 2010-08-08 13:23:04 cg Exp $' |
677 |
! |
|
678 |
||
679 |
version_CVS |
|
680 |
^ '$Header: /cvs/stx/stx/libwidg2/ViewScroller.st,v 1.41 2010-08-08 13:23:04 cg Exp $' |
|
120 | 681 |
! ! |