author | Stefan Vogel <sv@exept.de> |
Mon, 05 Aug 1996 13:49:43 +0200 | |
changeset 819 | 32ac89843fa8 |
parent 814 | 5b80bc44f52b |
child 852 | 3d828d54ebee |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
59 | 3 |
All Rights Reserved |
0 | 4 |
|
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
||
119 | 13 |
SimpleView subclass:#ScrollableView |
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
14 |
instanceVariableNames:'scrolledView scrollBar helpView innerMargin scrollBarPosition |
248 | 15 |
lockUpdates' |
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
16 |
classVariableNames:'DefaultScrolledViewLevel' |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
17 |
poolDictionaries:'' |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
18 |
category:'Views-Basic' |
0 | 19 |
! |
20 |
||
799 | 21 |
!ScrollableView class methodsFor:'documentation'! |
38 | 22 |
|
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
59 | 26 |
All Rights Reserved |
38 | 27 |
|
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
a view containing a scrollbar and some other (slave-)view. |
|
130 | 40 |
This view wraps scrollbar(s) around the view to be scrolled. |
65 | 41 |
The scrollbars are setup to send scrollUp/scrollDown/scrollVerticalTo |
42 |
and scrollLeft/scrollRight/scrollHorizontalTo- messages whenever moved. |
|
130 | 43 |
The view itself has to implement these (there is a default implementation |
65 | 44 |
in the common View class for this. |
45 |
||
46 |
For the scrollbars to know about the full (maximum) size, the view |
|
47 |
must implement #heightOfContents and/or #widthOfContents. |
|
130 | 48 |
The values returned by these methods are used to compute the fraction |
49 |
which is visible (i.e. the scrollers thumb heights). |
|
65 | 50 |
|
38 | 51 |
There are two ways to create a ScrollableView: |
52 |
if the type of the view to be scrolled is known in advance, |
|
53 |
use: |
|
584 | 54 |
v := ScrollableView for:<ViewClass> |
130 | 55 |
or: |
584 | 56 |
v := ScrollableView for:<ViewClass> in:someSuperView |
65 | 57 |
|
38 | 58 |
otherwise, create the scrollableView empty with: |
130 | 59 |
|
584 | 60 |
v := ScrollableView new |
130 | 61 |
or: |
584 | 62 |
v := ScrollableView in:someSuperView |
130 | 63 |
|
65 | 64 |
and define the view later with: |
130 | 65 |
|
584 | 66 |
v scrolledView:aViewToBeScrolled |
65 | 67 |
|
130 | 68 |
Finally, if the view to be scrolled has been already created, |
69 |
use: |
|
70 |
||
584 | 71 |
v := ScrollableView forView:aViewToBeScrolled |
130 | 72 |
or: |
584 | 73 |
v := ScrollableView forView:aViewToBeScrolled in:someSuperView |
65 | 74 |
|
130 | 75 |
It is also possible to change the scrolledView later (even multiple times). |
76 |
This may be useful, if different views are needed to display different types |
|
77 |
of data (see example2) and at creation time, it is not known what type |
|
78 |
of view is required (multimedia applications). |
|
79 |
||
80 |
If you want to scroll views (instead of a views contents), you need a |
|
81 |
companion class (ViewScroller). See the documentation there. |
|
65 | 82 |
|
83 |
If you need horizontal scrolling too, use an instance of HVScrollableView. |
|
113 | 84 |
|
85 |
By default, scrollbars are full size scrollbars - for horizontal scrolling |
|
86 |
(which is less often used), scrollableViews can optionally be created with |
|
87 |
miniscrollers which take up less screen space. |
|
130 | 88 |
|
89 |
TODO: |
|
584 | 90 |
this is pretty old and needs a rewrite. There are quite some |
91 |
historic leftovers found here and things can be done better |
|
92 |
(especially in initializeFor...) |
|
93 |
||
94 |
Also, it should be rewritten into one class which supports both |
|
95 |
Vertical-only, Horizontal-only and HV scrolling. |
|
96 |
Currently, horizontal-only scrolling is not available. |
|
97 |
(you have to write your own class ...) |
|
130 | 98 |
|
584 | 99 |
Finally, some means to hide scrollbars should be added - this would |
100 |
give more screenspace to the view when all is visible |
|
101 |
(and therefore, the scrollbars are not needed, anyway) |
|
102 |
||
103 |
Expect the above things to be fixed in an upcoming version. |
|
130 | 104 |
|
584 | 105 |
[author:] |
106 |
Claus Gittinger |
|
130 | 107 |
|
584 | 108 |
[see also:] |
109 |
ScrollBar Scroller |
|
110 |
HVScrollableView |
|
63 | 111 |
" |
112 |
! |
|
38 | 113 |
|
63 | 114 |
examples |
115 |
" |
|
65 | 116 |
example1 (simple scrolled text): |
591 | 117 |
[exBegin] |
118 |
|top scr txt| |
|
0 | 119 |
|
591 | 120 |
top := StandardSystemView label:'scroll example1'. |
121 |
top extent:200@100. |
|
113 | 122 |
|
591 | 123 |
scr := ScrollableView for:EditTextView in:top. |
124 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
125 |
txt := scr scrolledView. |
|
38 | 126 |
|
591 | 127 |
txt list:#('line1' |
128 |
'line2' |
|
129 |
'line3' |
|
130 |
'line4' |
|
131 |
'line5' |
|
132 |
'line7' |
|
133 |
'line8' |
|
134 |
'line9' |
|
135 |
'line10' |
|
136 |
). |
|
137 |
top open |
|
138 |
[exEnd] |
|
38 | 139 |
|
65 | 140 |
|
141 |
example2 (changing the scrolledView later): |
|
591 | 142 |
[exBegin] |
143 |
|top scr txtView1 txtView2 browserView| |
|
38 | 144 |
|
591 | 145 |
top := StandardSystemView label:'scroll example2'. |
146 |
top extent:300@100. |
|
113 | 147 |
|
591 | 148 |
scr := ScrollableView in:top. |
149 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
113 | 150 |
|
591 | 151 |
top open. |
0 | 152 |
|
591 | 153 |
(Delay forSeconds:5) wait. |
38 | 154 |
|
591 | 155 |
txtView1 := EditTextView new. |
156 |
txtView1 list:#( |
|
157 |
'wait 5 seconds to see the other text' |
|
158 |
'line2' |
|
159 |
'line3' |
|
160 |
'line4' |
|
161 |
'line5' |
|
162 |
'line7' |
|
163 |
'line8' |
|
164 |
'line9' |
|
165 |
'line10' |
|
166 |
). |
|
167 |
scr scrolledView:txtView1. |
|
38 | 168 |
|
591 | 169 |
(Delay forSeconds:5) wait. |
38 | 170 |
|
591 | 171 |
txtView2 := EditTextView new. |
172 |
txtView2 list:#('this is the other views text' |
|
173 |
'alternative line2' |
|
174 |
'alternative line3' |
|
175 |
'alternative line4' |
|
176 |
'alternative line5' |
|
177 |
'alternative line6'). |
|
178 |
scr scrolledView:txtView2. |
|
179 |
[exEnd] |
|
113 | 180 |
|
181 |
||
182 |
||
183 |
||
184 |
example3 (using a miniscroller): |
|
591 | 185 |
[exBegin] |
186 |
|top scr txt| |
|
113 | 187 |
|
591 | 188 |
top := StandardSystemView label:'scroll example3'. |
189 |
top extent:200@100. |
|
113 | 190 |
|
591 | 191 |
scr := ScrollableView for:EditTextView miniScroller:true in:top. |
192 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
193 |
txt := scr scrolledView. |
|
113 | 194 |
|
591 | 195 |
txt list:#('line1' |
196 |
'line2' |
|
197 |
'line3' |
|
198 |
'line4' |
|
199 |
'line5' |
|
200 |
'line7' |
|
201 |
'line8' |
|
202 |
'line9' |
|
203 |
'line10' |
|
204 |
). |
|
205 |
top open |
|
206 |
[exEnd] |
|
113 | 207 |
|
208 |
||
209 |
||
210 |
example4 (scrolling in both directions): |
|
591 | 211 |
[exBegin] |
212 |
|top scr txt| |
|
113 | 213 |
|
591 | 214 |
top := StandardSystemView label:'scroll example4'. |
215 |
top extent:200@100. |
|
113 | 216 |
|
591 | 217 |
scr := HVScrollableView for:EditTextView in:top. |
218 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
219 |
txt := scr scrolledView. |
|
113 | 220 |
|
591 | 221 |
txt list:#('line1' |
222 |
'line2' |
|
223 |
'line3' |
|
224 |
'line4' |
|
225 |
'line5' |
|
226 |
'line7' |
|
227 |
'line8' |
|
228 |
'line9' |
|
229 |
'line10' |
|
230 |
). |
|
231 |
top open |
|
232 |
[exEnd] |
|
113 | 233 |
|
234 |
||
235 |
||
236 |
example5 (using a full scroller vertically, miniscroller horizontally): |
|
591 | 237 |
[exBegin] |
238 |
|top scr txt| |
|
113 | 239 |
|
591 | 240 |
top := StandardSystemView label:'scroll example5'. |
241 |
top extent:200@100. |
|
113 | 242 |
|
591 | 243 |
scr := HVScrollableView for:EditTextView miniScrollerH:true in:top. |
244 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
245 |
txt := scr scrolledView. |
|
113 | 246 |
|
591 | 247 |
txt list:#('line1' |
248 |
'line2' |
|
249 |
'line3' |
|
250 |
'line4' |
|
251 |
'line5' |
|
252 |
'line7' |
|
253 |
'line8' |
|
254 |
'line9' |
|
255 |
'line10' |
|
256 |
). |
|
257 |
top open |
|
258 |
[exEnd] |
|
113 | 259 |
|
260 |
||
261 |
||
262 |
example6 (using miniscrollers for both directions ): |
|
591 | 263 |
[exBegin] |
264 |
|top scr txt| |
|
113 | 265 |
|
591 | 266 |
top := StandardSystemView label:'scroll example6'. |
267 |
top extent:200@100. |
|
113 | 268 |
|
591 | 269 |
scr := HVScrollableView for:EditTextView miniScroller:true in:top. |
270 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
271 |
txt := scr scrolledView. |
|
113 | 272 |
|
591 | 273 |
txt list:#('line1' |
274 |
'line2' |
|
275 |
'line3' |
|
276 |
'line4' |
|
277 |
'line5' |
|
278 |
'line7' |
|
279 |
'line8' |
|
280 |
'line9' |
|
281 |
'line10' |
|
282 |
). |
|
283 |
top open |
|
284 |
[exEnd] |
|
38 | 285 |
" |
286 |
! ! |
|
0 | 287 |
|
799 | 288 |
!ScrollableView class methodsFor:'instance creation'! |
217 | 289 |
|
290 |
for:aViewClass |
|
291 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
292 |
The subview is created here. |
|
293 |
The view will have full scrollbars." |
|
294 |
||
295 |
^ self for:aViewClass miniScrollerH:false miniScrollerV:false in:nil |
|
296 |
! |
|
297 |
||
298 |
for:aViewClass in:aView |
|
299 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
300 |
The subview is created here. |
|
301 |
The view will have full scrollbars." |
|
302 |
||
303 |
^ self for:aViewClass miniScrollerH:false miniScrollerV:false in:aView |
|
304 |
! |
|
305 |
||
306 |
for:aViewClass miniScroller:mini |
|
307 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
308 |
The subview is created here. |
|
309 |
The view will have full scrollbars if mini is false, miniscrollers |
|
310 |
if true." |
|
311 |
||
312 |
^ self for:aViewClass miniScrollerH:mini miniScrollerV:mini in:nil |
|
313 |
! |
|
314 |
||
315 |
for:aViewClass miniScroller:mini in:aView |
|
316 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
317 |
The subview is created here. |
|
318 |
The view will have full scrollbars if mini is false, miniscrollers |
|
319 |
if true." |
|
320 |
||
321 |
^ self for:aViewClass miniScrollerH:mini miniScrollerV:mini in:aView |
|
322 |
! |
|
153 | 323 |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
324 |
for:aViewClass miniScroller:mini origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
325 |
"return a new scrolling view scrolling an instance of aViewClass. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
326 |
The subview is created here. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
327 |
The view will have full scrollbars if mini is false, miniscrollers |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
328 |
if true." |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
329 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
330 |
^ self for:aViewClass miniScrollerH:mini miniScrollerV:mini origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
331 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
332 |
"Created: 18.4.1996 / 14:31:41 / cg" |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
333 |
! |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
334 |
|
217 | 335 |
for:aViewClass miniScrollerH:miniH |
336 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
337 |
The subview is created here. |
|
338 |
The view will have full scrollbars if miniH is false, |
|
339 |
and a horizontal miniscroller if true." |
|
340 |
||
341 |
^ self for:aViewClass miniScrollerH:miniH miniScrollerV:false in:nil |
|
342 |
! |
|
343 |
||
344 |
for:aViewClass miniScrollerH:miniH in:aView |
|
345 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
346 |
The subview is created here. |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
347 |
The view will have full scrollbars if the corresponding miniH/miniV |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
348 |
is false, miniscrollers if true." |
217 | 349 |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
350 |
^ self for:aViewClass miniScrollerH:miniH miniScrollerV:false in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
351 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
352 |
"Modified: 18.4.1996 / 14:29:23 / cg" |
217 | 353 |
! |
153 | 354 |
|
217 | 355 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV |
356 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
357 |
The subview is created here. |
|
358 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
359 |
is false, miniscrollers if true." |
|
360 |
||
361 |
^ self for:aViewClass miniScrollerH:miniH miniScrollerV:miniV in:nil |
|
362 |
! |
|
363 |
||
364 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV in:aView |
|
365 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
366 |
The subview is created here. |
|
367 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
368 |
is false, miniscrollers if true." |
|
369 |
||
300 | 370 |
|newView dev| |
217 | 371 |
|
372 |
aView notNil ifTrue:[ |
|
703 | 373 |
dev := aView graphicsDevice |
300 | 374 |
] ifFalse:[ |
703 | 375 |
dev := Screen current |
300 | 376 |
]. |
377 |
newView := self basicNew device:dev. |
|
378 |
newView initializeFor:aViewClass miniScrollerH:miniH miniScrollerV:miniV. |
|
379 |
aView notNil ifTrue:[ |
|
703 | 380 |
aView addSubView:newView |
153 | 381 |
]. |
217 | 382 |
^ newView |
703 | 383 |
|
384 |
"Modified: 28.5.1996 / 20:23:46 / cg" |
|
217 | 385 |
! |
386 |
||
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
387 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
388 |
"return a new scrolling view scrolling an instance of aViewClass. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
389 |
The subview is created here. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
390 |
The view will have full scrollbars if the corresponding miniH/miniV |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
391 |
is false, miniscrollers if true." |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
392 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
393 |
|newView| |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
394 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
395 |
newView := self for:aViewClass miniScrollerH:miniH miniScrollerV:miniV in:aView. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
396 |
newView origin:org corner:corn. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
397 |
^ newView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
398 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
399 |
"Created: 18.4.1996 / 11:41:05 / cg" |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
400 |
"Modified: 18.4.1996 / 14:27:39 / cg" |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
401 |
! |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
402 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
403 |
for:aViewClass miniScrollerH:miniH origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
404 |
"return a new scrolling view scrolling an instance of aViewClass. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
405 |
The subview is created here. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
406 |
The view will have a full horizontal scrollbar if miniH is false, |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
407 |
a miniscroller if true." |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
408 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
409 |
^ self for:aViewClass miniScrollerH:miniH miniScrollerV:false origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
410 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
411 |
"Modified: 18.4.1996 / 14:32:07 / cg" |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
412 |
! |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
413 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
414 |
for:aViewClass miniScrollerV:miniV origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
415 |
"return a new scrolling view scrolling an instance of aViewClass. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
416 |
The subview is created here. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
417 |
The view will have a full vertical scrollbar if miniV is false, |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
418 |
a miniscroller if true." |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
419 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
420 |
^ self for:aViewClass miniScrollerH:false miniScrollerV:miniV origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
421 |
|
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
422 |
"Created: 18.4.1996 / 14:30:57 / cg" |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
423 |
"Modified: 18.4.1996 / 14:32:21 / cg" |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
424 |
! |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
425 |
|
492 | 426 |
for:aViewClass origin:org corner:corner in:aView |
427 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
428 |
The subview is created here. |
|
429 |
The view will have full scrollbars." |
|
430 |
||
431 |
|v| |
|
432 |
||
433 |
v := self for:aViewClass miniScrollerH:false miniScrollerV:false in:aView. |
|
434 |
v origin:org corner:corner. |
|
435 |
^ v |
|
436 |
||
437 |
"Created: 7.3.1996 / 13:01:08 / cg" |
|
438 |
! |
|
439 |
||
217 | 440 |
forView:aView |
441 |
"return a new scrolling view scrolling aView. |
|
442 |
The view will have full scrollbars." |
|
443 |
||
444 |
^ self forView:aView miniScrollerH:false miniScrollerV:false in:nil |
|
445 |
! |
|
446 |
||
248 | 447 |
forView:aView miniScrollerH:mini |
448 |
"return a new scrolling view scrolling aView. |
|
449 |
The view will have a full vertical scrollbar and a horizontal |
|
450 |
miniScroller if mini is true." |
|
451 |
||
452 |
^ self forView:aView miniScrollerH:mini miniScrollerV:false in:nil |
|
453 |
||
454 |
"Created: 10.12.1995 / 17:26:16 / cg" |
|
455 |
! |
|
456 |
||
217 | 457 |
forView:scrolledView miniScrollerH:miniH miniScrollerV:miniV in:aView |
458 |
"return a new scrolling view, scrolling aView. |
|
459 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
460 |
is false, miniscrollers if true." |
|
153 | 461 |
|
217 | 462 |
|newView| |
463 |
||
464 |
newView := self for:nil miniScrollerH:miniH miniScrollerV:miniV in:aView. |
|
465 |
newView scrolledView:scrolledView. |
|
466 |
^ newView |
|
467 |
! |
|
153 | 468 |
|
217 | 469 |
in:aView |
470 |
"return a new scrolling view to be contained in aView. |
|
471 |
There is no slave view now - this has to be set later via |
|
472 |
the scrolledView: method. |
|
473 |
The view will have full scrollbars." |
|
474 |
||
475 |
^ self for:nil miniScrollerH:false miniScrollerV:false in:aView |
|
476 |
! |
|
0 | 477 |
|
93 | 478 |
miniScroller:mini |
479 |
"return a new scrolling view. The subview will be created later. |
|
480 |
The view will have full scrollbars if mini is false, |
|
481 |
miniscrollers if true." |
|
482 |
||
483 |
^ self for:nil miniScrollerH:mini miniScrollerV:mini |
|
484 |
! |
|
485 |
||
113 | 486 |
miniScrollerH:miniH |
487 |
"return a new scrolling view. The subview will be created later. |
|
488 |
The view will have full scrollbars if miniH is false, |
|
489 |
and a horizontal miniscroller if true." |
|
490 |
||
491 |
^ self for:nil miniScrollerH:miniH miniScrollerV:false in:nil |
|
492 |
! |
|
493 |
||
93 | 494 |
miniScrollerH:miniH miniScrollerV:miniV |
495 |
"return a new scrolling view. The subview will be created later. |
|
496 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
113 | 497 |
is false, miniscrollers if true." |
93 | 498 |
|
499 |
^ self for:nil miniScrollerH:miniH miniScrollerV:miniV in:nil |
|
217 | 500 |
! ! |
93 | 501 |
|
799 | 502 |
!ScrollableView class methodsFor:'defaults'! |
217 | 503 |
|
504 |
updateStyleCache |
|
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
505 |
"extract values from the styleSheet and cache them in class variables" |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
506 |
|
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
507 |
<resource: #style (#scrolledViewLevel)> |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
508 |
|
217 | 509 |
|d| |
38 | 510 |
|
217 | 511 |
StyleSheet name == #st80 ifTrue:[ |
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
512 |
d := 1 |
217 | 513 |
] ifFalse:[ |
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
514 |
StyleSheet is3D ifTrue:[ |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
515 |
d := -1 |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
516 |
] ifFalse:[ |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
517 |
d := 0 |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
518 |
] |
217 | 519 |
]. |
520 |
DefaultScrolledViewLevel := StyleSheet at:'scrolledViewLevel' default:d. |
|
0 | 521 |
|
217 | 522 |
"Modified: 31.8.1995 / 04:05:55 / claus" |
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
523 |
"Modified: 1.3.1996 / 13:46:39 / cg" |
217 | 524 |
! ! |
525 |
||
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
526 |
!ScrollableView methodsFor:'accessing - components'! |
119 | 527 |
|
217 | 528 |
scrollBar |
529 |
"return the scrollbar" |
|
530 |
||
531 |
^ scrollBar |
|
119 | 532 |
! |
533 |
||
217 | 534 |
scrolledView |
535 |
"return the scrolled view" |
|
38 | 536 |
|
217 | 537 |
^ scrolledView |
113 | 538 |
! |
539 |
||
217 | 540 |
scrolledView:aView |
541 |
"set the view to scroll" |
|
542 |
||
543 |
|halfMargin twoMargins isOpenwin| |
|
544 |
||
545 |
scrolledView notNil ifTrue:[ |
|
814 | 546 |
scrolledView destroy. |
547 |
scrolledView := nil. |
|
217 | 548 |
]. |
549 |
scrolledView := aView. |
|
77 | 550 |
|
217 | 551 |
"/ ((style ~~ #normal) and:[style ~~ #mswindows]) ifTrue:[ |
552 |
styleSheet is3D ifTrue:[ |
|
814 | 553 |
"3D look" |
217 | 554 |
|
814 | 555 |
isOpenwin := styleSheet name = #openwin. |
217 | 556 |
|
814 | 557 |
twoMargins := innerMargin * 2. |
558 |
halfMargin := innerMargin // 2. |
|
217 | 559 |
|
814 | 560 |
isOpenwin ifTrue:[ |
561 |
scrolledView level:0. |
|
562 |
scrolledView borderWidth:1 |
|
563 |
] ifFalse:[ |
|
564 |
scrolledView level:DefaultScrolledViewLevel. |
|
217 | 565 |
"/ scrolledView level:-1 |
814 | 566 |
]. |
77 | 567 |
|
814 | 568 |
(scrollBarPosition == #right) ifTrue:[ |
569 |
scrolledView |
|
570 |
origin:halfMargin asPoint |
|
571 |
extent:[(width - |
|
572 |
scrollBar width - |
|
573 |
twoMargins) |
|
574 |
@ |
|
575 |
(height - innerMargin) |
|
576 |
]. |
|
577 |
] ifFalse:[ |
|
578 |
scrolledView |
|
579 |
origin:((scrollBar origin x |
|
580 |
+ scrollBar width |
|
581 |
+ innerMargin) |
|
582 |
@ |
|
583 |
halfMargin) |
|
584 |
extent:[(width |
|
585 |
- scrollBar width |
|
586 |
- twoMargins) |
|
587 |
@ |
|
588 |
(height - innerMargin) |
|
589 |
]. |
|
590 |
] |
|
217 | 591 |
] ifFalse:[ |
814 | 592 |
"non 3D look" |
593 |
(scrollBarPosition == #right) ifTrue:[ |
|
594 |
scrolledView |
|
595 |
origin:scrolledView borderWidth negated asPoint |
|
596 |
] ifFalse:[ |
|
597 |
scrolledView |
|
598 |
origin:((scrollBar width |
|
599 |
+ scrollBar borderWidth |
|
600 |
- scrolledView borderWidth) |
|
601 |
@ |
|
602 |
scrolledView borderWidth negated) |
|
603 |
]. |
|
604 |
scrolledView |
|
605 |
extent:[ |
|
606 |
(width |
|
607 |
- scrollBar width |
|
608 |
- scrolledView borderWidth) |
|
609 |
@ |
|
610 |
(height + (scrollBar borderWidth)) |
|
611 |
] |
|
217 | 612 |
]. |
132 | 613 |
|
217 | 614 |
super addSubView:scrolledView. |
615 |
self setScrollActions. |
|
616 |
||
814 | 617 |
realized ifTrue:[ |
618 |
self sizeChanged:nil. |
|
619 |
scrolledView realize |
|
620 |
]. |
|
217 | 621 |
|
814 | 622 |
"Modified: 1.8.1996 / 12:44:27 / cg" |
217 | 623 |
! ! |
624 |
||
625 |
!ScrollableView methodsFor:'changes '! |
|
626 |
||
627 |
update:something with:argument from:changedObject |
|
628 |
"whenever the scrolledView changes its contents, the scroller must |
|
629 |
be updated" |
|
132 | 630 |
|
217 | 631 |
changedObject == scrolledView ifTrue:[ |
632 |
something == #sizeOfContents ifTrue:[ |
|
633 |
scrollBar setThumbFor:scrolledView. |
|
634 |
^ self |
|
635 |
]. |
|
636 |
something == #originOfContents ifTrue:[ |
|
637 |
lockUpdates ifFalse:[ |
|
638 |
scrollBar setThumbOriginFor:scrolledView. |
|
639 |
]. |
|
640 |
^ self |
|
641 |
]. |
|
642 |
]. |
|
643 |
! ! |
|
38 | 644 |
|
217 | 645 |
!ScrollableView methodsFor:'event processing'! |
646 |
||
647 |
keyPress:key x:x y:y |
|
648 |
"a key was pressed - handle page-keys here" |
|
649 |
||
650 |
<resource: #keyboard ( #Prior #Next ) > |
|
651 |
||
652 |
(key == #Prior) ifTrue: [^ self pageUp]. |
|
653 |
(key == #Next) ifTrue: [^ self pageDown]. |
|
654 |
||
655 |
super keyPress:key x:x y:y |
|
38 | 656 |
! |
657 |
||
217 | 658 |
sizeChanged:how |
659 |
super sizeChanged:how. |
|
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
660 |
|
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
661 |
"/ The following action will be done in a atomic operation |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
662 |
"/ in HVScrollableView |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
663 |
|
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
664 |
(scrolledView notNil and:[self isHorizontalScrollable not]) ifTrue:[ |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
665 |
scrollBar setThumbFor:scrolledView. |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
666 |
scrollBar thumbOrigin + scrollBar thumbHeight >= 100 ifTrue:[ |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
667 |
scrollBar thumbOrigin:(100 - scrollBar thumbHeight). |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
668 |
scrolledView scrollVerticalToPercent:scrollBar thumbOrigin. |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
669 |
]. |
217 | 670 |
]. |
113 | 671 |
|
217 | 672 |
"Modified: 8.9.1995 / 12:46:36 / claus" |
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
673 |
"Modified: 5.8.1996 / 12:31:34 / stefan" |
217 | 674 |
! ! |
675 |
||
676 |
!ScrollableView methodsFor:'forced scroll'! |
|
677 |
||
678 |
pageDown |
|
679 |
"page down" |
|
680 |
||
681 |
scrollBar pageDown |
|
113 | 682 |
! |
683 |
||
217 | 684 |
pageUp |
685 |
"page up" |
|
0 | 686 |
|
217 | 687 |
scrollBar pageUp |
0 | 688 |
! ! |
689 |
||
690 |
!ScrollableView methodsFor:'initialization'! |
|
691 |
||
217 | 692 |
initStyle |
608 | 693 |
<resource: #style (#scrollBarPosition)> |
694 |
||
217 | 695 |
super initStyle. |
696 |
||
697 |
scrollBarPosition := styleSheet at:'scrollBarPosition' default:#left |
|
608 | 698 |
|
699 |
"Modified: 30.4.1996 / 17:01:53 / cg" |
|
217 | 700 |
! |
701 |
||
0 | 702 |
initialize |
38 | 703 |
"default setup: full scrollers" |
704 |
||
705 |
^ self initializeFor:nil miniScrollerH:false miniScrollerV:false |
|
0 | 706 |
! |
707 |
||
38 | 708 |
initializeFor:aViewClass miniScrollerH:miniH miniScrollerV:miniV |
130 | 709 |
|negativeOffset twoMargins halfMargin cls isST80 isOpenWin is3D lvl extra| |
0 | 710 |
|
711 |
super initialize. |
|
712 |
||
65 | 713 |
lockUpdates := false. |
714 |
||
110 | 715 |
" |
716 |
mhmh - these must go into the stylesheet as well... |
|
717 |
" |
|
130 | 718 |
isST80 := styleSheet name = #st80. |
719 |
isOpenWin := styleSheet name = #openwin. |
|
59 | 720 |
|
110 | 721 |
isOpenWin ifTrue:[self level:0]. |
130 | 722 |
is3D := styleSheet is3D. |
59 | 723 |
|
724 |
isST80 ifTrue:[ |
|
814 | 725 |
innerMargin := 0 |
38 | 726 |
] ifFalse:[ |
814 | 727 |
is3D ifTrue:[ |
728 |
innerMargin := ViewSpacing. |
|
729 |
] ifFalse:[ |
|
730 |
innerMargin := 0 |
|
731 |
] |
|
38 | 732 |
]. |
0 | 733 |
negativeOffset := borderWidth negated. |
734 |
||
735 |
"create the scrollbar" |
|
736 |
||
59 | 737 |
isST80 ifTrue:[ |
814 | 738 |
cls := ScrollBar |
59 | 739 |
] ifFalse:[ |
814 | 740 |
cls := miniV ifTrue:[MiniScroller] ifFalse:[ScrollBar]. |
59 | 741 |
]. |
38 | 742 |
|
743 |
scrollBar := cls in:self. |
|
0 | 744 |
scrollBar thumbOrigin:0 thumbHeight:100. |
745 |
||
130 | 746 |
extra := 0. |
747 |
||
0 | 748 |
"create the subview" |
59 | 749 |
is3D ifTrue:[ |
814 | 750 |
twoMargins := innerMargin * 2. |
751 |
halfMargin := innerMargin // 2. |
|
0 | 752 |
|
814 | 753 |
aViewClass notNil ifTrue:[ |
754 |
scrolledView := aViewClass in:self. |
|
755 |
isOpenWin ifTrue:[ |
|
756 |
lvl := 0. |
|
757 |
"/ scrolledView level:0. |
|
758 |
scrolledView borderWidth:1. |
|
759 |
] ifFalse:[ |
|
760 |
lvl := DefaultScrolledViewLevel. |
|
153 | 761 |
"/ isST80 ifTrue:[ |
762 |
"/ "/ scrolledView level:1. |
|
763 |
"/ lvl := 1. |
|
764 |
"/ ] ifFalse:[ |
|
765 |
"/ "/ scrolledView level:-1 |
|
766 |
"/ lvl := -1 |
|
767 |
"/ ] |
|
814 | 768 |
]. |
769 |
scrolledView level:lvl. |
|
770 |
extra := scrolledView borderWidth * 2. |
|
771 |
]. |
|
130 | 772 |
|
814 | 773 |
scrollBar extent:[scrollBar extent x |
774 |
@ |
|
775 |
(height - innerMargin "new:" + extra)]. |
|
776 |
scrolledView notNil ifTrue:[ |
|
777 |
scrolledView |
|
778 |
extent:[(width |
|
779 |
- scrollBar width |
|
780 |
- twoMargins) |
|
781 |
@ |
|
782 |
(height - innerMargin)]. |
|
783 |
]. |
|
130 | 784 |
|
814 | 785 |
(scrollBarPosition == #right) ifTrue:[ |
786 |
scrollBar origin:[width - scrollBar extent x |
|
787 |
- (scrollBar borderWidth * 2) |
|
788 |
- halfMargin |
|
789 |
@ |
|
790 |
halfMargin]. |
|
38 | 791 |
|
814 | 792 |
scrolledView notNil ifTrue:[ |
793 |
scrolledView origin:halfMargin asPoint |
|
794 |
] |
|
795 |
] ifFalse:[ |
|
796 |
scrollBar origin:halfMargin asPoint. |
|
38 | 797 |
|
814 | 798 |
scrolledView notNil ifTrue:[ |
799 |
scrolledView origin:((scrollBar origin x + scrollBar width + innerMargin) |
|
800 |
@ |
|
801 |
halfMargin) |
|
802 |
] |
|
803 |
]. |
|
0 | 804 |
] ifFalse:[ |
814 | 805 |
(scrollBarPosition == #right) ifTrue:[ |
806 |
scrollBar origin:[width - scrollBar extent x |
|
807 |
- scrollBar borderWidth |
|
808 |
@ |
|
809 |
negativeOffset] |
|
810 |
] ifFalse:[ |
|
811 |
scrollBar origin:negativeOffset asPoint |
|
812 |
]. |
|
813 |
scrollBar extent:[scrollBar extent x |
|
814 |
@ |
|
815 |
(height "+ (scrollBar borderWidth * 1)")]. |
|
0 | 816 |
|
814 | 817 |
aViewClass notNil ifTrue:[ |
818 |
scrolledView := aViewClass in:self. |
|
819 |
(scrollBarPosition == #right) ifTrue:[ |
|
820 |
scrolledView origin:scrolledView borderWidth negated asPoint |
|
821 |
] ifFalse:[ |
|
822 |
scrolledView origin:((scrollBar width + |
|
823 |
scrollBar borderWidth - |
|
824 |
scrolledView borderWidth) |
|
825 |
@ |
|
826 |
scrolledView borderWidth negated) |
|
827 |
]. |
|
828 |
scrolledView extent:[(width - scrollBar width - scrolledView borderWidth) |
|
829 |
@ |
|
830 |
(height + (scrollBar borderWidth)) |
|
831 |
] |
|
832 |
]. |
|
0 | 833 |
]. |
834 |
scrolledView notNil ifTrue:[ |
|
814 | 835 |
self setScrollActions. |
0 | 836 |
] |
814 | 837 |
|
838 |
"Modified: 1.8.1996 / 12:44:32 / cg" |
|
0 | 839 |
! |
840 |
||
841 |
realize |
|
842 |
super realize. |
|
38 | 843 |
|
0 | 844 |
"since scrolledview may have done something to its contents |
845 |
during init-time we had no chance yet to catch contents- |
|
846 |
changes; do it now |
|
847 |
" |
|
38 | 848 |
scrolledView notNil ifTrue:[ |
59 | 849 |
scrollBar setThumbFor:scrolledView |
38 | 850 |
] |
0 | 851 |
! ! |
852 |
||
7 | 853 |
!ScrollableView methodsFor:'private'! |
854 |
||
855 |
setScrollActions |
|
856 |
"lock prevents repositioning the scroller to the |
|
857 |
actual (often rounded) position while scrolling, |
|
858 |
and keeps it instead at the pointer position. |
|
859 |
||
860 |
(this avoids run-away scroller when scrolling |
|
861 |
textviews, when the text is aligned line-wise). |
|
38 | 862 |
Consider this as a kludge." |
7 | 863 |
|
65 | 864 |
lockUpdates := false. |
7 | 865 |
|
866 |
scrollBar scrollAction:[:position | |
|
814 | 867 |
lockUpdates := true. |
868 |
scrolledView scrollVerticalToPercent:position. |
|
869 |
lockUpdates := false |
|
7 | 870 |
]. |
871 |
scrollBar scrollUpAction:[scrolledView scrollUp]. |
|
872 |
scrollBar scrollDownAction:[scrolledView scrollDown]. |
|
873 |
||
65 | 874 |
scrolledView addDependent:self. |
814 | 875 |
|
876 |
" |
|
877 |
pass my keyboard input (and other subviews input) |
|
878 |
to the scrolled view ... |
|
879 |
" |
|
880 |
self delegate:(KeyboardForwarder toView:scrolledView). |
|
881 |
||
882 |
"Modified: 1.8.1996 / 12:44:21 / cg" |
|
7 | 883 |
! ! |
884 |
||
217 | 885 |
!ScrollableView methodsFor:'queries'! |
38 | 886 |
|
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
887 |
isHorizontalScrollable |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
888 |
"return false, because I am not horizontal scrollable" |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
889 |
|
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
890 |
^ false |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
891 |
|
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
892 |
"Created: 5.8.1996 / 12:28:05 / stefan" |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
893 |
! |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
894 |
|
217 | 895 |
preferredExtent |
572 | 896 |
"return my preferredExtent from the scrolledViews prefExtent |
897 |
plus the size of the scrollBar" |
|
898 |
||
799 | 899 |
"/ If I have an explicit preferredExtent .. |
900 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
901 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
902 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
903 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
904 |
|
217 | 905 |
scrolledView notNil ifTrue:[ |
906 |
| pref | |
|
907 |
pref := scrolledView preferredExtent. |
|
908 |
^ (pref x + scrollBar width + (innerMargin * 2)) @ pref y. |
|
0 | 909 |
]. |
217 | 910 |
^ super preferredExtent. |
572 | 911 |
|
799 | 912 |
"Modified: 19.7.1996 / 20:45:30 / cg" |
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
913 |
! |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
914 |
|
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
915 |
preferredExtentForLines:numLines cols:numCols |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
916 |
"return my preferredExtent for given number of lines and cols." |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
917 |
|
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
918 |
scrolledView notNil ifTrue:[ |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
919 |
| pref | |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
920 |
pref := scrolledView preferredExtentForLines:numLines cols:numCols. |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
921 |
^ (pref x + scrollBar width + (innerMargin * 2)) @ pref y. |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
922 |
]. |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
923 |
^ super preferredExtent. |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
924 |
|
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
925 |
"Created: 24.5.1996 / 17:13:26 / cg" |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
926 |
"Modified: 24.5.1996 / 17:15:50 / cg" |
0 | 927 |
! ! |
928 |
||
929 |
!ScrollableView methodsFor:'slave-view messages'! |
|
930 |
||
217 | 931 |
doesNotUnderstand:aMessage |
932 |
"this is funny: all message we do not understand, are passed |
|
933 |
on to the scrolledView - so we do not have to care for all |
|
934 |
possible messages ...(thanks to the Message class)" |
|
935 |
||
936 |
scrolledView isNil ifFalse:[ |
|
937 |
^ scrolledView perform:(aMessage selector) |
|
938 |
withArguments:(aMessage arguments) |
|
939 |
] |
|
940 |
! |
|
941 |
||
0 | 942 |
leftButtonMenu |
38 | 943 |
"return scrolledViews leftbuttonmenu" |
944 |
||
945 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 946 |
^ scrolledView leftButtonMenu |
947 |
! |
|
948 |
||
949 |
leftButtonMenu:aMenu |
|
950 |
"pass on leftbuttonmenu to scrolledView" |
|
951 |
||
952 |
scrolledView leftButtonMenu:aMenu |
|
953 |
! |
|
954 |
||
955 |
middleButtonMenu |
|
38 | 956 |
"return scrolledViews middlebuttonmenu" |
957 |
||
958 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 959 |
^ scrolledView middleButtonMenu |
960 |
! |
|
961 |
||
962 |
middleButtonMenu:aMenu |
|
963 |
"pass on middlebuttonmenu to scrolledView" |
|
964 |
||
965 |
scrolledView middleButtonMenu:aMenu |
|
966 |
! |
|
967 |
||
562 | 968 |
model |
754 | 969 |
"return my scrolledViews model" |
970 |
||
562 | 971 |
^ scrolledView model |
972 |
||
973 |
"Created: 20.4.1996 / 13:27:25 / cg" |
|
754 | 974 |
"Modified: 5.6.1996 / 14:17:04 / cg" |
562 | 975 |
! |
976 |
||
977 |
model:aModel |
|
754 | 978 |
"forward model change to my scrolledViews" |
979 |
||
562 | 980 |
^ scrolledView model:aModel |
981 |
||
982 |
"Created: 20.4.1996 / 13:27:33 / cg" |
|
754 | 983 |
"Modified: 5.6.1996 / 17:09:50 / cg" |
562 | 984 |
! |
985 |
||
0 | 986 |
rightButtonMenu |
38 | 987 |
"return scrolledViews rightbuttonmenu" |
988 |
||
989 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 990 |
^ scrolledView rightButtonMenu |
991 |
! |
|
992 |
||
993 |
rightButtonMenu:aMenu |
|
994 |
"pass on rightbuttonmenu to scrolledView" |
|
995 |
||
996 |
scrolledView rightButtonMenu:aMenu |
|
38 | 997 |
! ! |
998 |
||
799 | 999 |
!ScrollableView class methodsFor:'documentation'! |
0 | 1000 |
|
217 | 1001 |
version |
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1002 |
^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.39 1996-08-05 11:49:43 stefan Exp $' |
0 | 1003 |
! ! |