author | Claus Gittinger <cg@exept.de> |
Mon, 28 Jul 1997 12:32:51 +0200 | |
changeset 1286 | 42740ebf473a |
parent 1253 | 385bb80488f5 |
child 1344 | 0912e7165023 |
permissions | -rw-r--r-- |
0 | 1 |
" |
5 | 2 |
COPYRIGHT (c) 1989 by Claus Gittinger |
1111 | 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 |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
14 |
instanceVariableNames:'scrolledView vScrollBar hScrollBar scrollBarPosition lockUpdates |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
15 |
hideScrollBars hasHorizontalScrollBar hasVerticalScrollBar |
1138 | 16 |
horizontalMini verticalMini vScrollBarHidden hScrollBarHidden |
17 |
vScrollBarVisible hScrollBarVisible' |
|
1111 | 18 |
classVariableNames:'DefaultScrolledViewLevel DefaultScrolledViewMargin |
19 |
DefaultScrollBarSpacing DefaultScrolledViewBorderWidth |
|
20 |
DefaultLevel DefaultScrollBarLevel MyDefaultViewBackgroundColor' |
|
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
21 |
poolDictionaries:'' |
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
22 |
category:'Views-Basic' |
0 | 23 |
! |
24 |
||
852 | 25 |
!ScrollableView class methodsFor:'documentation'! |
38 | 26 |
|
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
1111 | 30 |
All Rights Reserved |
38 | 31 |
|
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
43 |
a view containing a scrollbar and some other (slave-)view. |
|
130 | 44 |
This view wraps scrollbar(s) around the view to be scrolled. |
65 | 45 |
The scrollbars are setup to send scrollUp/scrollDown/scrollVerticalTo |
46 |
and scrollLeft/scrollRight/scrollHorizontalTo- messages whenever moved. |
|
130 | 47 |
The view itself has to implement these (there is a default implementation |
65 | 48 |
in the common View class for this. |
49 |
||
50 |
For the scrollbars to know about the full (maximum) size, the view |
|
51 |
must implement #heightOfContents and/or #widthOfContents. |
|
130 | 52 |
The values returned by these methods are used to compute the fraction |
53 |
which is visible (i.e. the scrollers thumb heights). |
|
65 | 54 |
|
38 | 55 |
There are two ways to create a ScrollableView: |
56 |
if the type of the view to be scrolled is known in advance, |
|
57 |
use: |
|
584 | 58 |
v := ScrollableView for:<ViewClass> |
130 | 59 |
or: |
584 | 60 |
v := ScrollableView for:<ViewClass> in:someSuperView |
65 | 61 |
|
38 | 62 |
otherwise, create the scrollableView empty with: |
130 | 63 |
|
584 | 64 |
v := ScrollableView new |
130 | 65 |
or: |
584 | 66 |
v := ScrollableView in:someSuperView |
130 | 67 |
|
65 | 68 |
and define the view later with: |
130 | 69 |
|
584 | 70 |
v scrolledView:aViewToBeScrolled |
65 | 71 |
|
130 | 72 |
Finally, if the view to be scrolled has been already created, |
73 |
use: |
|
74 |
||
584 | 75 |
v := ScrollableView forView:aViewToBeScrolled |
130 | 76 |
or: |
584 | 77 |
v := ScrollableView forView:aViewToBeScrolled in:someSuperView |
65 | 78 |
|
130 | 79 |
It is also possible to change the scrolledView later (even multiple times). |
80 |
This may be useful, if different views are needed to display different types |
|
81 |
of data (see example2) and at creation time, it is not known what type |
|
82 |
of view is required (multimedia applications). |
|
83 |
||
84 |
If you want to scroll views (instead of a views contents), you need a |
|
85 |
companion class (ViewScroller). See the documentation there. |
|
65 | 86 |
|
87 |
If you need horizontal scrolling too, use an instance of HVScrollableView. |
|
113 | 88 |
|
89 |
By default, scrollbars are full size scrollbars - for horizontal scrolling |
|
90 |
(which is less often used), scrollableViews can optionally be created with |
|
91 |
miniscrollers which take up less screen space. |
|
130 | 92 |
|
93 |
TODO: |
|
584 | 94 |
this is pretty old and needs a rewrite. There are quite some |
95 |
historic leftovers found here and things can be done better |
|
96 |
(especially in initializeFor...) |
|
97 |
||
98 |
Also, it should be rewritten into one class which supports both |
|
99 |
Vertical-only, Horizontal-only and HV scrolling. |
|
100 |
Currently, horizontal-only scrolling is not available. |
|
101 |
(you have to write your own class ...) |
|
130 | 102 |
|
584 | 103 |
Finally, some means to hide scrollbars should be added - this would |
104 |
give more screenspace to the view when all is visible |
|
105 |
(and therefore, the scrollbars are not needed, anyway) |
|
106 |
||
107 |
Expect the above things to be fixed in an upcoming version. |
|
130 | 108 |
|
584 | 109 |
[author:] |
110 |
Claus Gittinger |
|
130 | 111 |
|
584 | 112 |
[see also:] |
113 |
ScrollBar Scroller |
|
114 |
HVScrollableView |
|
63 | 115 |
" |
116 |
! |
|
38 | 117 |
|
63 | 118 |
examples |
119 |
" |
|
1138 | 120 |
simple scrolled text: |
591 | 121 |
[exBegin] |
122 |
|top scr txt| |
|
0 | 123 |
|
591 | 124 |
top := StandardSystemView label:'scroll example1'. |
125 |
top extent:200@100. |
|
113 | 126 |
|
1138 | 127 |
scr := ScrollableView for:EditTextView in:top. |
591 | 128 |
scr origin:0.0@0.0 corner:1.0@1.0. |
129 |
txt := scr scrolledView. |
|
38 | 130 |
|
591 | 131 |
txt list:#('line1' |
132 |
'line2' |
|
133 |
'line3' |
|
134 |
'line4' |
|
135 |
'line5' |
|
136 |
'line7' |
|
137 |
'line8' |
|
138 |
'line9' |
|
139 |
'line10' |
|
140 |
). |
|
141 |
top open |
|
142 |
[exEnd] |
|
38 | 143 |
|
65 | 144 |
|
1138 | 145 |
changing the scrolledView later: |
591 | 146 |
[exBegin] |
147 |
|top scr txtView1 txtView2 browserView| |
|
38 | 148 |
|
591 | 149 |
top := StandardSystemView label:'scroll example2'. |
150 |
top extent:300@100. |
|
113 | 151 |
|
591 | 152 |
scr := ScrollableView in:top. |
153 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
113 | 154 |
|
591 | 155 |
top open. |
0 | 156 |
|
591 | 157 |
(Delay forSeconds:5) wait. |
38 | 158 |
|
591 | 159 |
txtView1 := EditTextView new. |
160 |
txtView1 list:#( |
|
161 |
'wait 5 seconds to see the other text' |
|
162 |
'line2' |
|
163 |
'line3' |
|
164 |
'line4' |
|
165 |
'line5' |
|
166 |
'line7' |
|
167 |
'line8' |
|
168 |
'line9' |
|
169 |
'line10' |
|
170 |
). |
|
171 |
scr scrolledView:txtView1. |
|
38 | 172 |
|
591 | 173 |
(Delay forSeconds:5) wait. |
38 | 174 |
|
591 | 175 |
txtView2 := EditTextView new. |
176 |
txtView2 list:#('this is the other views text' |
|
177 |
'alternative line2' |
|
178 |
'alternative line3' |
|
179 |
'alternative line4' |
|
180 |
'alternative line5' |
|
181 |
'alternative line6'). |
|
182 |
scr scrolledView:txtView2. |
|
183 |
[exEnd] |
|
113 | 184 |
|
185 |
||
186 |
||
187 |
||
1138 | 188 |
using a miniscroller: |
591 | 189 |
[exBegin] |
190 |
|top scr txt| |
|
113 | 191 |
|
591 | 192 |
top := StandardSystemView label:'scroll example3'. |
193 |
top extent:200@100. |
|
113 | 194 |
|
591 | 195 |
scr := ScrollableView for:EditTextView miniScroller:true in:top. |
196 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
197 |
txt := scr scrolledView. |
|
113 | 198 |
|
591 | 199 |
txt list:#('line1' |
200 |
'line2' |
|
201 |
'line3' |
|
202 |
'line4' |
|
203 |
'line5' |
|
204 |
'line7' |
|
205 |
'line8' |
|
206 |
'line9' |
|
207 |
'line10' |
|
208 |
). |
|
209 |
top open |
|
210 |
[exEnd] |
|
113 | 211 |
|
212 |
||
213 |
||
1138 | 214 |
scrolling in both directions: |
215 |
Notice: HVScrollableView remains existent for backward compatibility; |
|
216 |
scrollability can now be controlled in both directions at any |
|
217 |
time (see examples below). |
|
591 | 218 |
[exBegin] |
219 |
|top scr txt| |
|
113 | 220 |
|
591 | 221 |
top := StandardSystemView label:'scroll example4'. |
222 |
top extent:200@100. |
|
113 | 223 |
|
591 | 224 |
scr := HVScrollableView for:EditTextView in:top. |
225 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
226 |
txt := scr scrolledView. |
|
113 | 227 |
|
591 | 228 |
txt list:#('line1' |
229 |
'line2' |
|
230 |
'line3' |
|
231 |
'line4' |
|
232 |
'line5' |
|
233 |
'line7' |
|
234 |
'line8' |
|
235 |
'line9' |
|
236 |
'line10' |
|
237 |
). |
|
238 |
top open |
|
239 |
[exEnd] |
|
113 | 240 |
|
241 |
||
242 |
||
1138 | 243 |
using a full scroller vertically, miniscroller horizontally: |
244 |
Notice: HVScrollableView remains existent for backward compatibility; |
|
245 |
scrollability can now be controlled in both directions at any |
|
246 |
time (see examples below). |
|
591 | 247 |
[exBegin] |
248 |
|top scr txt| |
|
113 | 249 |
|
591 | 250 |
top := StandardSystemView label:'scroll example5'. |
251 |
top extent:200@100. |
|
113 | 252 |
|
591 | 253 |
scr := HVScrollableView for:EditTextView miniScrollerH:true in:top. |
254 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
255 |
txt := scr scrolledView. |
|
113 | 256 |
|
591 | 257 |
txt list:#('line1' |
258 |
'line2' |
|
259 |
'line3' |
|
260 |
'line4' |
|
261 |
'line5' |
|
262 |
'line7' |
|
263 |
'line8' |
|
264 |
'line9' |
|
265 |
'line10' |
|
266 |
). |
|
267 |
top open |
|
268 |
[exEnd] |
|
113 | 269 |
|
270 |
||
271 |
||
1138 | 272 |
using miniscrollers for both directions: |
273 |
Notice: HVScrollableView remains existent for backward compatibility; |
|
274 |
scrollability can now be controlled in both directions at any |
|
275 |
time (see examples below). |
|
591 | 276 |
[exBegin] |
277 |
|top scr txt| |
|
113 | 278 |
|
591 | 279 |
top := StandardSystemView label:'scroll example6'. |
280 |
top extent:200@100. |
|
113 | 281 |
|
591 | 282 |
scr := HVScrollableView for:EditTextView miniScroller:true in:top. |
283 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
284 |
txt := scr scrolledView. |
|
113 | 285 |
|
591 | 286 |
txt list:#('line1' |
287 |
'line2' |
|
288 |
'line3' |
|
289 |
'line4' |
|
290 |
'line5' |
|
291 |
'line7' |
|
292 |
'line8' |
|
293 |
'line9' |
|
294 |
'line10' |
|
295 |
). |
|
296 |
top open |
|
297 |
[exEnd] |
|
1138 | 298 |
controlling scrollability: |
299 |
[exBegin] |
|
300 |
|top scr txt| |
|
301 |
||
302 |
top := StandardSystemView label:'scroll example6'. |
|
303 |
top extent:200@100. |
|
304 |
||
305 |
txt := EditTextView new. |
|
306 |
||
307 |
scr := ScrollableView forView:txt in:top. |
|
308 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
309 |
scr horizontalScrollable:true. |
|
310 |
scr verticalScrollable:false. |
|
311 |
||
312 |
txt list:#('line1' |
|
313 |
'line2' |
|
314 |
'line3' |
|
315 |
'line4' |
|
316 |
'line5' |
|
317 |
'line7' |
|
318 |
'line8' |
|
319 |
'line9' |
|
320 |
'line10' |
|
321 |
). |
|
322 |
top open |
|
323 |
[exEnd] |
|
324 |
controlling scrollability and miniScroller: |
|
325 |
[exBegin] |
|
326 |
|top scr txt| |
|
327 |
||
328 |
top := StandardSystemView label:'scroll example6'. |
|
329 |
top extent:200@100. |
|
330 |
||
331 |
txt := EditTextView new. |
|
332 |
||
333 |
scr := ScrollableView forView:txt in:top. |
|
334 |
scr origin:0.0@0.0 corner:1.0@1.0. |
|
1139 | 335 |
scr horizontalScrollable:true; horizontalMini:false. |
336 |
scr verticalScrollable:true; verticalMini:true. |
|
1138 | 337 |
|
338 |
txt list:#('line1' |
|
339 |
'line2' |
|
340 |
'line3' |
|
341 |
'line4' |
|
342 |
'line5' |
|
343 |
'line7' |
|
344 |
'line8' |
|
345 |
'line9' |
|
346 |
'line10' |
|
347 |
). |
|
348 |
top open |
|
349 |
[exEnd] |
|
38 | 350 |
" |
351 |
! ! |
|
0 | 352 |
|
852 | 353 |
!ScrollableView class methodsFor:'instance creation'! |
217 | 354 |
|
355 |
for:aViewClass |
|
356 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
357 |
The subview is created here. |
|
358 |
The view will have full scrollbars." |
|
359 |
||
1111 | 360 |
^ self |
361 |
for:aViewClass |
|
362 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
363 |
hasVerticalScrollBar:true |
|
364 |
miniScrollerH:false |
|
365 |
miniScrollerV:false |
|
366 |
origin:nil |
|
367 |
corner:nil |
|
368 |
in:nil |
|
369 |
||
370 |
"Created: 6.3.1997 / 18:06:22 / cg" |
|
371 |
"Modified: 6.3.1997 / 23:18:32 / cg" |
|
372 |
! |
|
373 |
||
1183 | 374 |
for:aViewClass hasHorizontalScrollBar:hasH hasVerticalScrollBar:hasV miniScrollerH:miniH miniScrollerV:miniV |
375 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
376 |
The subview is created here. |
|
377 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
378 |
is false, miniscrollers if true." |
|
379 |
||
380 |
|newView| |
|
381 |
||
382 |
aViewClass notNil ifTrue:[ |
|
383 |
newView := aViewClass new. |
|
384 |
]. |
|
385 |
^ self |
|
386 |
forView:newView |
|
387 |
hasHorizontalScrollBar:hasH |
|
388 |
hasVerticalScrollBar:hasV |
|
389 |
miniScrollerH:miniH |
|
390 |
miniScrollerV:miniV |
|
391 |
origin:nil |
|
392 |
corner:nil |
|
393 |
in:nil |
|
394 |
||
395 |
"Created: 7.4.1997 / 19:00:14 / cg" |
|
396 |
! |
|
397 |
||
1111 | 398 |
for:aViewClass hasHorizontalScrollBar:hasH hasVerticalScrollBar:hasV miniScrollerH:miniH miniScrollerV:miniV origin:org corner:corn in:aView |
399 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
400 |
The subview is created here. |
|
401 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
402 |
is false, miniscrollers if true." |
|
403 |
||
404 |
|newView| |
|
405 |
||
406 |
aViewClass notNil ifTrue:[ |
|
407 |
newView := aViewClass new. |
|
408 |
]. |
|
409 |
^ self |
|
410 |
forView:newView |
|
411 |
hasHorizontalScrollBar:hasH |
|
412 |
hasVerticalScrollBar:hasV |
|
413 |
miniScrollerH:miniH |
|
414 |
miniScrollerV:miniV |
|
415 |
origin:org |
|
416 |
corner:corn |
|
417 |
in:aView |
|
418 |
||
419 |
" |
|
420 |
|top scr| |
|
421 |
||
422 |
top := StandardSystemView extent:200@200. |
|
423 |
scr := NewScrollableView for:nil |
|
424 |
hasHorizontalScrollBar:true |
|
425 |
hasVerticalScrollBar:true |
|
426 |
miniScrollerH:false |
|
427 |
miniScrollerV:false |
|
428 |
origin:0.0@0.0 |
|
429 |
corner:1.0@1.0 |
|
430 |
in:top. |
|
431 |
top open |
|
432 |
" |
|
433 |
||
434 |
"Modified: 6.3.1997 / 18:36:01 / cg" |
|
217 | 435 |
! |
436 |
||
437 |
for:aViewClass in:aView |
|
438 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
439 |
The subview is created here. |
|
440 |
The view will have full scrollbars." |
|
441 |
||
1111 | 442 |
^ self |
443 |
for:aViewClass |
|
444 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
445 |
hasVerticalScrollBar:true |
|
446 |
miniScrollerH:false |
|
447 |
miniScrollerV:false |
|
448 |
origin:nil |
|
449 |
corner:nil |
|
450 |
in:aView |
|
451 |
||
452 |
"Modified: 6.3.1997 / 23:18:41 / cg" |
|
217 | 453 |
! |
454 |
||
455 |
for:aViewClass miniScroller:mini |
|
456 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
457 |
The subview is created here. |
|
458 |
The view will have full scrollbars if mini is false, miniscrollers |
|
459 |
if true." |
|
460 |
||
1111 | 461 |
^ self |
462 |
for:aViewClass |
|
463 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
464 |
hasVerticalScrollBar:true |
|
465 |
miniScrollerH:mini |
|
466 |
miniScrollerV:mini |
|
467 |
origin:nil |
|
468 |
corner:nil |
|
469 |
in:nil |
|
470 |
||
471 |
"Modified: 6.3.1997 / 23:18:45 / cg" |
|
217 | 472 |
! |
473 |
||
474 |
for:aViewClass miniScroller:mini in:aView |
|
475 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
476 |
The subview is created here. |
|
477 |
The view will have full scrollbars if mini is false, miniscrollers |
|
478 |
if true." |
|
479 |
||
1111 | 480 |
^ self |
481 |
for:aViewClass |
|
482 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
483 |
hasVerticalScrollBar:true |
|
484 |
miniScrollerH:mini |
|
485 |
miniScrollerV:mini |
|
486 |
origin:nil |
|
487 |
corner:nil |
|
488 |
in:aView |
|
489 |
||
490 |
"Modified: 6.3.1997 / 23:18:50 / cg" |
|
217 | 491 |
! |
153 | 492 |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
493 |
for:aViewClass miniScroller:mini origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
494 |
"return a new scrolling view scrolling an instance of aViewClass. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
495 |
The subview is created here. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
496 |
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
|
497 |
if true." |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
498 |
|
1111 | 499 |
^ self |
500 |
for:aViewClass |
|
501 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
502 |
hasVerticalScrollBar:true |
|
503 |
miniScrollerH:mini |
|
504 |
miniScrollerV:mini |
|
505 |
origin:org |
|
506 |
corner:corn |
|
507 |
in:aView |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
508 |
|
1111 | 509 |
"Modified: 6.3.1997 / 23:18:53 / cg" |
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
510 |
! |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
511 |
|
217 | 512 |
for:aViewClass miniScrollerH:miniH |
513 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
514 |
The subview is created here. |
|
515 |
The view will have full scrollbars if miniH is false, |
|
516 |
and a horizontal miniscroller if true." |
|
517 |
||
1111 | 518 |
^ self |
519 |
for:aViewClass |
|
520 |
hasHorizontalScrollBar:true |
|
521 |
hasVerticalScrollBar:true |
|
522 |
miniScrollerH:miniH |
|
523 |
miniScrollerV:false |
|
524 |
origin:nil |
|
525 |
corner:nil |
|
526 |
in:nil |
|
527 |
||
528 |
"Modified: 6.3.1997 / 18:30:15 / cg" |
|
217 | 529 |
! |
530 |
||
531 |
for:aViewClass miniScrollerH:miniH in:aView |
|
532 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
533 |
The subview is created here. |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
534 |
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
|
535 |
is false, miniscrollers if true." |
217 | 536 |
|
1111 | 537 |
^ self |
538 |
for:aViewClass |
|
539 |
hasHorizontalScrollBar:true |
|
540 |
hasVerticalScrollBar:true |
|
541 |
miniScrollerH:miniH |
|
542 |
miniScrollerV:false |
|
543 |
origin:nil |
|
544 |
corner:nil |
|
545 |
in:aView |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
546 |
|
1111 | 547 |
"Modified: 6.3.1997 / 18:30:31 / cg" |
217 | 548 |
! |
153 | 549 |
|
217 | 550 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV |
551 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
552 |
The subview is created here. |
|
553 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
554 |
is false, miniscrollers if true." |
|
555 |
||
1111 | 556 |
^ self |
557 |
for:aViewClass |
|
558 |
hasHorizontalScrollBar:true |
|
559 |
hasVerticalScrollBar:true |
|
560 |
miniScrollerH:miniH |
|
561 |
miniScrollerV:miniV |
|
562 |
origin:nil |
|
563 |
corner:nil |
|
564 |
in:nil |
|
565 |
||
566 |
"Modified: 6.3.1997 / 18:30:47 / cg" |
|
217 | 567 |
! |
568 |
||
569 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV in:aView |
|
570 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
571 |
The subview is created here. |
|
572 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
573 |
is false, miniscrollers if true." |
|
574 |
||
1111 | 575 |
^ self |
576 |
for:aViewClass |
|
577 |
hasHorizontalScrollBar:true |
|
578 |
hasVerticalScrollBar:true |
|
579 |
miniScrollerH:miniH |
|
580 |
miniScrollerV:miniV |
|
581 |
origin:nil |
|
582 |
corner:nil |
|
583 |
in:aView |
|
584 |
||
585 |
"Modified: 6.3.1997 / 18:31:02 / cg" |
|
586 |
! |
|
587 |
||
588 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV origin:org corner:corn in:aView |
|
589 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
590 |
The subview is created here. |
|
591 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
592 |
is false, miniscrollers if true." |
|
593 |
||
594 |
^ self |
|
595 |
for:aViewClass |
|
596 |
hasHorizontalScrollBar:true |
|
597 |
hasVerticalScrollBar:true |
|
598 |
miniScrollerH:miniH |
|
599 |
miniScrollerV:miniV |
|
600 |
origin:org |
|
601 |
corner:corn |
|
602 |
in:aView |
|
603 |
||
604 |
"Modified: 6.3.1997 / 18:31:17 / cg" |
|
605 |
! |
|
606 |
||
607 |
for:aViewClass miniScrollerH:miniH origin:org corner:corn in:aView |
|
608 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
609 |
The subview is created here. |
|
610 |
The view will have a full horizontal scrollbar if miniH is false, |
|
611 |
a miniscroller if true." |
|
612 |
||
613 |
^ self |
|
614 |
for:aViewClass |
|
615 |
hasHorizontalScrollBar:true |
|
616 |
hasVerticalScrollBar:true |
|
617 |
miniScrollerH:miniH |
|
618 |
miniScrollerV:false |
|
619 |
origin:org |
|
620 |
corner:corn |
|
621 |
in:aView |
|
622 |
||
623 |
"Modified: 6.3.1997 / 18:31:28 / cg" |
|
624 |
! |
|
625 |
||
626 |
for:aViewClass miniScrollerV:miniV origin:org corner:corn in:aView |
|
627 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
628 |
The subview is created here. |
|
629 |
The view will have a full vertical scrollbar if miniV is false, |
|
630 |
a miniscroller if true." |
|
631 |
||
632 |
^ self |
|
633 |
for:aViewClass |
|
634 |
hasHorizontalScrollBar:true |
|
635 |
hasVerticalScrollBar:true |
|
636 |
miniScrollerH:false |
|
637 |
miniScrollerV:miniV |
|
638 |
origin:org |
|
639 |
corner:corn |
|
640 |
in:aView |
|
641 |
||
642 |
"Modified: 6.3.1997 / 18:31:41 / cg" |
|
643 |
! |
|
644 |
||
645 |
for:aViewClass origin:org corner:corner in:aView |
|
646 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
647 |
The subview is created here. |
|
648 |
The view will have full scrollbars." |
|
649 |
||
650 |
^ self |
|
651 |
for:aViewClass |
|
652 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
653 |
hasVerticalScrollBar:true |
|
654 |
miniScrollerH:false |
|
655 |
miniScrollerV:false |
|
656 |
origin:org |
|
657 |
corner:corner |
|
658 |
in:aView |
|
659 |
||
660 |
"Modified: 6.3.1997 / 23:19:05 / cg" |
|
661 |
! |
|
662 |
||
663 |
forView:aView |
|
664 |
"return a new scrolling view scrolling aView. |
|
665 |
The view will have full scrollbars." |
|
666 |
||
667 |
^ self |
|
668 |
forView:aView |
|
669 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
670 |
hasVerticalScrollBar:true |
|
671 |
miniScrollerH:false |
|
672 |
miniScrollerV:false |
|
673 |
origin:nil |
|
674 |
corner:nil |
|
675 |
in:nil |
|
676 |
||
677 |
"Modified: 6.3.1997 / 23:19:08 / cg" |
|
678 |
! |
|
679 |
||
680 |
forView:aScrolledView hasHorizontalScrollBar:hasH hasVerticalScrollBar:hasV miniScrollerH:miniH miniScrollerV:miniV origin:org corner:corn in:aView |
|
681 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
682 |
The subview is created here. |
|
683 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
684 |
is false, miniscrollers if true." |
|
685 |
||
300 | 686 |
|newView dev| |
217 | 687 |
|
688 |
aView notNil ifTrue:[ |
|
703 | 689 |
dev := aView graphicsDevice |
300 | 690 |
] ifFalse:[ |
703 | 691 |
dev := Screen current |
300 | 692 |
]. |
693 |
newView := self basicNew device:dev. |
|
1111 | 694 |
newView initialize. |
695 |
newView setupVertical:hasV mini:miniV horizontal:hasH mini:miniH. |
|
696 |
||
697 |
aScrolledView notNil ifTrue:[ |
|
698 |
newView scrolledView:aScrolledView. |
|
699 |
]. |
|
700 |
||
701 |
org notNil ifTrue:[ |
|
702 |
newView origin:org |
|
703 |
]. |
|
704 |
corn notNil ifTrue:[ |
|
705 |
newView corner:corn |
|
706 |
]. |
|
707 |
||
300 | 708 |
aView notNil ifTrue:[ |
703 | 709 |
aView addSubView:newView |
153 | 710 |
]. |
217 | 711 |
^ newView |
703 | 712 |
|
1111 | 713 |
" |
714 |
|top scr| |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
715 |
|
1111 | 716 |
top := StandardSystemView extent:200@200. |
717 |
scr := NewScrollableView |
|
718 |
forView:(TextView new) |
|
719 |
hasHorizontalScrollBar:true |
|
720 |
hasVerticalScrollBar:true |
|
721 |
miniScrollerH:false |
|
722 |
miniScrollerV:false |
|
723 |
origin:0.0@0.0 |
|
724 |
corner:1.0@1.0 |
|
725 |
in:top. |
|
726 |
top open |
|
727 |
" |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
728 |
|
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
729 |
"Modified: 6.3.1997 / 18:42:40 / cg" |
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
730 |
"Modified: 19.3.1997 / 15:32:51 / stefan" |
217 | 731 |
! |
732 |
||
852 | 733 |
forView:aView in:aSuperView |
734 |
"return a new scrolling view scrolling aView. |
|
735 |
The view will have full scrollbars." |
|
736 |
||
1111 | 737 |
^ self |
738 |
forView:aView |
|
739 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
740 |
hasVerticalScrollBar:true |
|
741 |
miniScrollerH:false |
|
742 |
miniScrollerV:false |
|
743 |
origin:nil |
|
744 |
corner:nil |
|
745 |
in:aSuperView |
|
852 | 746 |
|
1111 | 747 |
"Modified: 6.3.1997 / 23:19:12 / cg" |
852 | 748 |
! |
749 |
||
248 | 750 |
forView:aView miniScrollerH:mini |
751 |
"return a new scrolling view scrolling aView. |
|
752 |
The view will have a full vertical scrollbar and a horizontal |
|
753 |
miniScroller if mini is true." |
|
754 |
||
1111 | 755 |
^ self |
756 |
forView:aView |
|
757 |
hasHorizontalScrollBar:true |
|
758 |
hasVerticalScrollBar:true |
|
759 |
miniScrollerH:mini |
|
760 |
miniScrollerV:false |
|
761 |
origin:nil |
|
762 |
corner:nil |
|
763 |
in:nil |
|
248 | 764 |
|
1111 | 765 |
"Modified: 6.3.1997 / 18:32:58 / cg" |
248 | 766 |
! |
767 |
||
217 | 768 |
forView:scrolledView miniScrollerH:miniH miniScrollerV:miniV in:aView |
769 |
"return a new scrolling view, scrolling aView. |
|
770 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
771 |
is false, miniscrollers if true." |
|
153 | 772 |
|
1111 | 773 |
^ self |
774 |
forView:scrolledView |
|
775 |
hasHorizontalScrollBar:true |
|
776 |
hasVerticalScrollBar:true |
|
777 |
miniScrollerH:miniH |
|
778 |
miniScrollerV:miniV |
|
779 |
origin:nil |
|
780 |
corner:nil |
|
781 |
in:aView |
|
217 | 782 |
|
1111 | 783 |
"Modified: 6.3.1997 / 18:33:20 / cg" |
217 | 784 |
! |
153 | 785 |
|
217 | 786 |
in:aView |
787 |
"return a new scrolling view to be contained in aView. |
|
788 |
There is no slave view now - this has to be set later via |
|
789 |
the scrolledView: method. |
|
790 |
The view will have full scrollbars." |
|
791 |
||
1111 | 792 |
^ self |
793 |
forView:nil |
|
794 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
795 |
hasVerticalScrollBar:true |
|
796 |
miniScrollerH:false |
|
797 |
miniScrollerV:false |
|
798 |
origin:nil |
|
799 |
corner:nil |
|
800 |
in:aView |
|
801 |
||
802 |
"Modified: 6.3.1997 / 23:19:19 / cg" |
|
217 | 803 |
! |
0 | 804 |
|
93 | 805 |
miniScroller:mini |
806 |
"return a new scrolling view. The subview will be created later. |
|
807 |
The view will have full scrollbars if mini is false, |
|
808 |
miniscrollers if true." |
|
809 |
||
1111 | 810 |
^ self |
811 |
forView:nil |
|
812 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
813 |
hasVerticalScrollBar:true |
|
814 |
miniScrollerH:mini |
|
815 |
miniScrollerV:mini |
|
816 |
origin:nil |
|
817 |
corner:nil |
|
818 |
in:nil |
|
819 |
||
820 |
"Modified: 6.3.1997 / 23:19:21 / cg" |
|
93 | 821 |
! |
822 |
||
113 | 823 |
miniScrollerH:miniH |
824 |
"return a new scrolling view. The subview will be created later. |
|
825 |
The view will have full scrollbars if miniH is false, |
|
826 |
and a horizontal miniscroller if true." |
|
827 |
||
1111 | 828 |
^ self |
829 |
forView:nil |
|
830 |
hasHorizontalScrollBar:true |
|
831 |
hasVerticalScrollBar:true |
|
832 |
miniScrollerH:miniH |
|
833 |
miniScrollerV:false |
|
834 |
origin:nil |
|
835 |
corner:nil |
|
836 |
in:nil |
|
837 |
||
838 |
"Modified: 6.3.1997 / 18:34:06 / cg" |
|
113 | 839 |
! |
840 |
||
93 | 841 |
miniScrollerH:miniH miniScrollerV:miniV |
842 |
"return a new scrolling view. The subview will be created later. |
|
843 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
113 | 844 |
is false, miniscrollers if true." |
93 | 845 |
|
1111 | 846 |
^ self |
847 |
forView:nil |
|
848 |
hasHorizontalScrollBar:true |
|
849 |
hasVerticalScrollBar:true |
|
850 |
miniScrollerH:miniH |
|
851 |
miniScrollerV:miniV |
|
852 |
origin:nil |
|
853 |
corner:nil |
|
854 |
in:nil |
|
855 |
||
856 |
"Modified: 6.3.1997 / 18:34:16 / cg" |
|
217 | 857 |
! ! |
93 | 858 |
|
852 | 859 |
!ScrollableView class methodsFor:'defaults'! |
217 | 860 |
|
861 |
updateStyleCache |
|
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
862 |
"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
|
863 |
|
1111 | 864 |
<resource: #style (#scrolledViewLevel #scrolledViewMargin)> |
865 |
||
866 |
|defLevel defMargin defSpacing| |
|
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
867 |
|
1111 | 868 |
StyleSheet is3D ifTrue:[ |
869 |
defLevel := -1. |
|
870 |
defMargin := ViewSpacing // 2. |
|
871 |
defSpacing := defMargin. |
|
217 | 872 |
] ifFalse:[ |
1111 | 873 |
defLevel := 0. |
874 |
defMargin := 0. |
|
875 |
defSpacing := 0 |
|
217 | 876 |
]. |
1111 | 877 |
DefaultScrolledViewLevel := StyleSheet at:'scrolledViewLevel' default:defLevel. |
878 |
DefaultScrolledViewBorderWidth := StyleSheet at:'scrolledViewBorderWidth' default:nil. |
|
879 |
DefaultScrolledViewMargin := StyleSheet at:'scrolledViewMargin' default:defMargin. |
|
880 |
DefaultScrollBarSpacing := StyleSheet at:'scrollBarSpacing' default:defSpacing. |
|
881 |
DefaultLevel := StyleSheet at:'scrollableViewLevel' default:nil. |
|
882 |
DefaultScrollBarLevel := StyleSheet at:'scrollBarLevel' default:nil. |
|
883 |
MyDefaultViewBackgroundColor := StyleSheet at:'scrollableViewBackgroundColor' default:DefaultViewBackgroundColor. |
|
0 | 884 |
|
1111 | 885 |
" |
886 |
self updateStyleCache |
|
887 |
" |
|
888 |
||
889 |
"Modified: 7.3.1997 / 15:03:37 / cg" |
|
217 | 890 |
! ! |
891 |
||
1140 | 892 |
!ScrollableView methodsFor:'accessing-behavior'! |
893 |
||
894 |
autoHideScrollBars:aBoolean |
|
895 |
"set/clear the flag which controls if scrollBars should |
|
896 |
be made invisible dynamically, if there is nothing to scroll |
|
897 |
(and shown if there is). |
|
898 |
This flags setting is normally controlled by the styleSheet." |
|
899 |
||
900 |
hideScrollBars := aBoolean. |
|
901 |
||
902 |
"Modified: 19.3.1997 / 16:28:42 / cg" |
|
903 |
"Created: 19.3.1997 / 17:24:39 / cg" |
|
904 |
! ! |
|
905 |
||
1138 | 906 |
!ScrollableView methodsFor:'accessing-components'! |
119 | 907 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
908 |
horizontalScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
909 |
"return the horizontal scrollbar (or nil, if there is none)" |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
910 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
911 |
^ hScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
912 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
913 |
"Modified: 6.3.1997 / 16:59:24 / cg" |
1111 | 914 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
915 |
! |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
916 |
|
217 | 917 |
scrollBar |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
918 |
"return the vertical scrollbar (or nil, if there is none)" |
217 | 919 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
920 |
^ vScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
921 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
922 |
"Modified: 6.3.1997 / 16:59:29 / cg" |
1111 | 923 |
"Created: 6.3.1997 / 18:06:23 / cg" |
119 | 924 |
! |
925 |
||
217 | 926 |
scrolledView |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
927 |
"return the scrolled view (or nil, if there is none)" |
38 | 928 |
|
217 | 929 |
^ scrolledView |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
930 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
931 |
"Modified: 6.3.1997 / 16:48:09 / cg" |
1111 | 932 |
"Created: 6.3.1997 / 18:06:23 / cg" |
113 | 933 |
! |
934 |
||
217 | 935 |
scrolledView:aView |
936 |
"set the view to scroll" |
|
937 |
||
938 |
scrolledView notNil ifTrue:[ |
|
982 | 939 |
scrolledView removeDependent:self. |
814 | 940 |
scrolledView destroy. |
941 |
scrolledView := nil. |
|
217 | 942 |
]. |
982 | 943 |
|
217 | 944 |
scrolledView := aView. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
945 |
|
1111 | 946 |
super addSubViewFirst:aView. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
947 |
scrolledView notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
948 |
self setScrollActions. |
217 | 949 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
950 |
realized ifTrue:[ |
1134
f4f1e67f1ff2
setupDimension late in realize
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
951 |
self setupDimensions. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
952 |
self sizeChanged:nil. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
953 |
scrolledView realize |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
954 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
955 |
] |
217 | 956 |
|
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
957 |
"Modified: 7.3.1997 / 22:24:43 / cg" |
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
958 |
"Modified: 19.3.1997 / 15:32:37 / stefan" |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
959 |
! |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
960 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
961 |
verticalScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
962 |
"return the vertical scrollbar (or nil, if there is none)" |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
963 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
964 |
^ vScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
965 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
966 |
"Modified: 6.3.1997 / 16:59:24 / cg" |
1111 | 967 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1253 | 968 |
! |
969 |
||
970 |
widget |
|
971 |
"for ST80 compatibility (where a wrapper returns its wrapped |
|
972 |
widget), return the scrolledView here" |
|
973 |
||
974 |
^ scrolledView |
|
975 |
||
976 |
"Created: 20.6.1997 / 14:45:16 / cg" |
|
217 | 977 |
! ! |
978 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
979 |
!ScrollableView methodsFor:'accessing-look'! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
980 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
981 |
horizontalMini:aBoolean |
1138 | 982 |
"control the horizontal scrollBar to be either a miniScroller, |
983 |
or a full scrollBar." |
|
984 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
985 |
horizontalMini ~~ aBoolean ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
986 |
horizontalMini := aBoolean. |
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
987 |
self setupViews. |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
988 |
shown ifTrue:[ |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
989 |
self setupDimensions. |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
990 |
] |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
991 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
992 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
993 |
"Created: 7.3.1997 / 21:57:02 / cg" |
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
994 |
"Modified: 8.4.1997 / 00:45:03 / cg" |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
995 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
996 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
997 |
horizontalScrollable:aBoolean |
1138 | 998 |
"enable/disable horizontal scrollability. |
999 |
If disabled, the horizontal scrollBar is made invisible." |
|
1000 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1001 |
hasHorizontalScrollBar ~~ aBoolean ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1002 |
hasHorizontalScrollBar := aBoolean. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1003 |
hScrollBarHidden := false. |
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1004 |
self setupViews. |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1005 |
shown ifTrue:[ |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1006 |
self setupDimensions. |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1007 |
] |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1008 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1009 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1010 |
"Created: 7.3.1997 / 21:56:28 / cg" |
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1011 |
"Modified: 8.4.1997 / 00:45:00 / cg" |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1012 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1013 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1014 |
verticalMini:aBoolean |
1138 | 1015 |
"control the vertical scrollBar to be either a miniScroller, |
1016 |
or a full scrollBar." |
|
1017 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1018 |
verticalMini ~~ aBoolean ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1019 |
verticalMini := aBoolean. |
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1020 |
self setupViews. |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1021 |
shown ifTrue:[ |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1022 |
self setupDimensions. |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1023 |
] |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1024 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1025 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1026 |
"Created: 7.3.1997 / 21:56:57 / cg" |
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1027 |
"Modified: 8.4.1997 / 00:44:57 / cg" |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1028 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1029 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1030 |
verticalScrollable:aBoolean |
1138 | 1031 |
"enable/disable vertical scrollability. |
1032 |
If disabled, the vertical scrollBar is made invisible." |
|
1033 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1034 |
hasVerticalScrollBar ~~ aBoolean ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1035 |
hasVerticalScrollBar := aBoolean. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1036 |
vScrollBarHidden := false. |
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1037 |
self setupViews. |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1038 |
shown ifTrue:[ |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1039 |
self setupDimensions. |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1040 |
] |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1041 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1042 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1043 |
"Created: 7.3.1997 / 21:56:39 / cg" |
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1044 |
"Modified: 8.4.1997 / 00:44:53 / cg" |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1045 |
! ! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1046 |
|
217 | 1047 |
!ScrollableView methodsFor:'changes '! |
1048 |
||
1049 |
update:something with:argument from:changedObject |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1050 |
"whenever the scrolledView changes its contents, the scroller(s) must |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1051 |
be updated as well" |
132 | 1052 |
|
217 | 1053 |
changedObject == scrolledView ifTrue:[ |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1054 |
something == #sizeOfContents ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1055 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1056 |
vScrollBar setThumbFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1057 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1058 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1059 |
hScrollBar setThumbFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1060 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1061 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1062 |
something == #originOfContents ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1063 |
lockUpdates ifFalse:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1064 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1065 |
vScrollBar setThumbOriginFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1066 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1067 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1068 |
hScrollBar setThumbOriginFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1069 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1070 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1071 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1072 |
|
1231 | 1073 |
self updateScrollBarVisibility |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1074 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1075 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1076 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1077 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1078 |
updateScrollBarVisibility |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1079 |
"check if any scrollbar needs to be hidden or shown" |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1080 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1081 |
|anyChange| |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1082 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1083 |
hideScrollBars ifFalse:[^ self]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1084 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1085 |
anyChange := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1086 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1087 |
vScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1088 |
vScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1089 |
vScrollBarHidden ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1090 |
vScrollBarHidden := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1091 |
vScrollBar beInvisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1092 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1093 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1094 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1095 |
vScrollBarHidden ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1096 |
vScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1097 |
vScrollBar beVisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1098 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1099 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1100 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1101 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1102 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1103 |
hScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1104 |
hScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1105 |
hScrollBarHidden ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1106 |
hScrollBarHidden := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1107 |
hScrollBar beInvisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1108 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1109 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1110 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1111 |
hScrollBarHidden ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1112 |
hScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1113 |
hScrollBar beVisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1114 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1115 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1116 |
] |
217 | 1117 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1118 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1119 |
anyChange ifTrue:[ |
1161
5142fbafeb92
must set dimensions in updateScrollBarVisibility
Claus Gittinger <cg@exept.de>
parents:
1160
diff
changeset
|
1120 |
self setupDimensions. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1121 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1122 |
"/ force him to recompute its dimension ... |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1123 |
scrolledView notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1124 |
vScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1125 |
vScrollBar setThumbFor:scrolledView. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1126 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1127 |
hScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1128 |
hScrollBar setThumbFor:scrolledView. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1129 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1130 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1131 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1132 |
"/ stupid - showing one may need the other ... |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1133 |
"/ and vice versa; do it again. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1134 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1135 |
anyChange := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1136 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1137 |
vScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1138 |
vScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1139 |
vScrollBarHidden ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1140 |
vScrollBarHidden := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1141 |
vScrollBar beInvisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1142 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1143 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1144 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1145 |
vScrollBarHidden ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1146 |
vScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1147 |
vScrollBar beVisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1148 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1149 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1150 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1151 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1152 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1153 |
hScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1154 |
hScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1155 |
hScrollBarHidden ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1156 |
hScrollBarHidden := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1157 |
hScrollBar beInvisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1158 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1159 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1160 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1161 |
hScrollBarHidden ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1162 |
hScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1163 |
hScrollBar beVisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1164 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1165 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1166 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1167 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1168 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1169 |
anyChange ifTrue:[ |
1161
5142fbafeb92
must set dimensions in updateScrollBarVisibility
Claus Gittinger <cg@exept.de>
parents:
1160
diff
changeset
|
1170 |
self setupDimensions. |
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1171 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1172 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1173 |
|
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1174 |
"Modified: 19.3.1997 / 15:33:36 / stefan" |
1161
5142fbafeb92
must set dimensions in updateScrollBarVisibility
Claus Gittinger <cg@exept.de>
parents:
1160
diff
changeset
|
1175 |
"Modified: 28.3.1997 / 17:32:09 / cg" |
217 | 1176 |
! ! |
38 | 1177 |
|
217 | 1178 |
!ScrollableView methodsFor:'event processing'! |
1179 |
||
1180 |
keyPress:key x:x y:y |
|
1181 |
"a key was pressed - handle page-keys here" |
|
1182 |
||
1183 |
<resource: #keyboard ( #Prior #Next ) > |
|
1184 |
||
1185 |
(key == #Prior) ifTrue: [^ self pageUp]. |
|
1186 |
(key == #Next) ifTrue: [^ self pageDown]. |
|
1187 |
||
1188 |
super keyPress:key x:x y:y |
|
1111 | 1189 |
|
1190 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
38 | 1191 |
! |
1192 |
||
217 | 1193 |
sizeChanged:how |
1138 | 1194 |
"handle size changes - this may change any scrollBars visibility" |
1195 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1196 |
|orgX orgY scroll| |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1197 |
|
1111 | 1198 |
"/ resize components manually, in an order which is optimal |
1199 |
||
1200 |
how == #smaller ifTrue:[ |
|
1201 |
"/ first resize the horizontalScrollBar, |
|
1202 |
||
1203 |
scrolledView notNil ifTrue:[ |
|
1204 |
scrolledView containerChangedSize |
|
1205 |
]. |
|
1206 |
hScrollBar notNil ifTrue:[ |
|
1207 |
hScrollBar containerChangedSize |
|
1208 |
]. |
|
1209 |
vScrollBar notNil ifTrue:[ |
|
1210 |
vScrollBar containerChangedSize |
|
1211 |
]. |
|
1212 |
] ifFalse:[ |
|
1213 |
hScrollBar notNil ifTrue:[ |
|
1214 |
hScrollBar containerChangedSize |
|
1215 |
]. |
|
1216 |
vScrollBar notNil ifTrue:[ |
|
1217 |
vScrollBar containerChangedSize |
|
1218 |
]. |
|
1219 |
scrolledView notNil ifTrue:[ |
|
1220 |
scrolledView containerChangedSize |
|
1221 |
]. |
|
1222 |
]. |
|
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1223 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1224 |
scrolledView isNil ifTrue:[^ self]. |
1111 | 1225 |
(hScrollBar isNil and:[vScrollBar isNil]) ifTrue:[^ self]. |
1226 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1227 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1228 |
vScrollBar setThumbFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1229 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1230 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1231 |
hScrollBar setThumbFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1232 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1233 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1234 |
"/ splitted, since there are optimized scrollProcedures for each case ... |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1235 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1236 |
hScrollBar isNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1237 |
"/ only care for vertical ... |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1238 |
vScrollBar thumbOrigin + vScrollBar thumbHeight >= 100 ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1239 |
vScrollBar thumbOrigin:(100 - vScrollBar thumbHeight). |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1240 |
scrolledView scrollVerticalToPercent:vScrollBar thumbOrigin. |
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1241 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1242 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1243 |
vScrollBar isNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1244 |
"/ only care for horizontal ... |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1245 |
hScrollBar thumbOrigin + hScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1246 |
hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight). |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1247 |
scrolledView scrollVerticalToPercent:hScrollBar thumbOrigin. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1248 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1249 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1250 |
"/ care for both ... |
113 | 1251 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1252 |
orgY := vScrollBar thumbOrigin. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1253 |
orgX := hScrollBar thumbOrigin. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1254 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1255 |
scroll := false. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1256 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1257 |
orgY + vScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1258 |
vScrollBar thumbOrigin:(100 - vScrollBar thumbHeight). |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1259 |
orgY := vScrollBar thumbOrigin. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1260 |
scroll := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1261 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1262 |
orgX + hScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1263 |
hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight). |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1264 |
orgX := hScrollBar thumbOrigin. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1265 |
scroll := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1266 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1267 |
scroll ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1268 |
scrolledView scrollToPercent:(orgX@orgY). |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1269 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1270 |
] |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1271 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1272 |
self updateScrollBarVisibility. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1273 |
|
1160
f3204cabcce8
must update scrollBarVisibility in realize
Claus Gittinger <cg@exept.de>
parents:
1152
diff
changeset
|
1274 |
"Modified: 28.3.1997 / 17:25:38 / cg" |
217 | 1275 |
! ! |
1276 |
||
1277 |
!ScrollableView methodsFor:'forced scroll'! |
|
1278 |
||
1279 |
pageDown |
|
1138 | 1280 |
"page down - but only if there is a vertical scrollbar" |
217 | 1281 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1282 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1283 |
vScrollBar pageDown |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1284 |
] |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1285 |
|
1111 | 1286 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1138 | 1287 |
"Modified: 19.3.1997 / 16:32:34 / cg" |
1288 |
! |
|
1289 |
||
1290 |
pageLeft |
|
1291 |
"page left - but only if there is a horizontal scrollbar" |
|
1292 |
||
1293 |
hScrollBar notNil ifTrue:[ |
|
1294 |
hScrollBar pageDown |
|
1295 |
] |
|
1296 |
||
1297 |
"Created: 19.3.1997 / 16:32:14 / cg" |
|
1298 |
"Modified: 19.3.1997 / 16:32:44 / cg" |
|
1299 |
! |
|
1300 |
||
1301 |
pageRight |
|
1302 |
"page right - but only if there is a horizontal scrollbar" |
|
1303 |
||
1304 |
hScrollBar notNil ifTrue:[ |
|
1305 |
hScrollBar pageUp |
|
1306 |
] |
|
1307 |
||
1308 |
"Created: 19.3.1997 / 16:32:22 / cg" |
|
1309 |
"Modified: 19.3.1997 / 16:32:48 / cg" |
|
113 | 1310 |
! |
1311 |
||
217 | 1312 |
pageUp |
1138 | 1313 |
"page up - but only if there is a vertical scrollbar" |
0 | 1314 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1315 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1316 |
vScrollBar pageUp |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1317 |
] |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1318 |
|
1111 | 1319 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1138 | 1320 |
"Modified: 19.3.1997 / 16:32:38 / cg" |
0 | 1321 |
! ! |
1322 |
||
1323 |
!ScrollableView methodsFor:'initialization'! |
|
1324 |
||
217 | 1325 |
initStyle |
958 | 1326 |
"initialize style specifics" |
1327 |
||
1141 | 1328 |
<resource: #style (#scrollBarPosition #scrollBarHiding)> |
608 | 1329 |
|
217 | 1330 |
super initStyle. |
1331 |
||
1111 | 1332 |
viewBackground := MyDefaultViewBackgroundColor. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1333 |
scrollBarPosition := styleSheet at:'scrollBarPosition' default:#left. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1334 |
hideScrollBars := styleSheet at:'scrollBarHiding' default:false. |
608 | 1335 |
|
1111 | 1336 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1138 | 1337 |
"Modified: 19.3.1997 / 16:32:59 / cg" |
0 | 1338 |
! |
1339 |
||
1247 | 1340 |
initialize |
1341 |
"setup some default" |
|
1342 |
||
1343 |
verticalMini := horizontalMini := false. |
|
1344 |
hasVerticalScrollBar := hasHorizontalScrollBar := false. |
|
1345 |
super initialize. |
|
1346 |
! |
|
1347 |
||
0 | 1348 |
realize |
1161
5142fbafeb92
must set dimensions in updateScrollBarVisibility
Claus Gittinger <cg@exept.de>
parents:
1160
diff
changeset
|
1349 |
"realize (i.e. make me visible). |
5142fbafeb92
must set dimensions in updateScrollBarVisibility
Claus Gittinger <cg@exept.de>
parents:
1160
diff
changeset
|
1350 |
Since scrolledView may have done something to its contents |
0 | 1351 |
during init-time we had no chance yet to catch contents- |
1161
5142fbafeb92
must set dimensions in updateScrollBarVisibility
Claus Gittinger <cg@exept.de>
parents:
1160
diff
changeset
|
1352 |
changes; do it now" |
1160
f3204cabcce8
must update scrollBarVisibility in realize
Claus Gittinger <cg@exept.de>
parents:
1152
diff
changeset
|
1353 |
|
1161
5142fbafeb92
must set dimensions in updateScrollBarVisibility
Claus Gittinger <cg@exept.de>
parents:
1160
diff
changeset
|
1354 |
self setupDimensions. |
1176
29d0a646cbdf
must realize before setting scroller values
Claus Gittinger <cg@exept.de>
parents:
1161
diff
changeset
|
1355 |
super realize. |
1201
e7f1cf0180ca
must updateScrollBarVisibility in realize
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1356 |
|
38 | 1357 |
scrolledView notNil ifTrue:[ |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1358 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1359 |
vScrollBar setThumbFor:scrolledView |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1360 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1361 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1362 |
hScrollBar setThumbFor:scrolledView |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1363 |
]. |
1201
e7f1cf0180ca
must updateScrollBarVisibility in realize
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1364 |
self updateScrollBarVisibility. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1365 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1366 |
|
1201
e7f1cf0180ca
must updateScrollBarVisibility in realize
Claus Gittinger <cg@exept.de>
parents:
1184
diff
changeset
|
1367 |
"Modified: 23.4.1997 / 13:59:59 / cg" |
1111 | 1368 |
! |
1369 |
||
1370 |
releaseHorizontalScrollBar |
|
1371 |
"destroy any horizontal scrollBar" |
|
1372 |
||
1373 |
hScrollBar notNil ifTrue:[ |
|
1374 |
hScrollBar destroy. |
|
1375 |
hScrollBar := nil |
|
1376 |
]. |
|
1377 |
||
1378 |
"Modified: 6.3.1997 / 17:43:20 / cg" |
|
1379 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
1380 |
! |
|
1381 |
||
1382 |
releaseVerticalScrollBar |
|
1383 |
"destroy any vertical scrollBar" |
|
1384 |
||
1385 |
vScrollBar notNil ifTrue:[ |
|
1386 |
vScrollBar destroy. |
|
1387 |
vScrollBar := nil |
|
1388 |
]. |
|
1389 |
||
1390 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
1097 | 1391 |
! |
7 | 1392 |
|
1393 |
setScrollActions |
|
1394 |
"lock prevents repositioning the scroller to the |
|
1395 |
actual (often rounded) position while scrolling, |
|
1396 |
and keeps it instead at the pointer position. |
|
1397 |
||
1398 |
(this avoids run-away scroller when scrolling |
|
1399 |
textviews, when the text is aligned line-wise). |
|
38 | 1400 |
Consider this as a kludge." |
7 | 1401 |
|
65 | 1402 |
lockUpdates := false. |
7 | 1403 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1404 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1405 |
vScrollBar scrollAction:[:position | |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1406 |
lockUpdates := true. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1407 |
scrolledView scrollVerticalToPercent:position. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1408 |
lockUpdates := false |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1409 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1410 |
vScrollBar scrollUpAction:[scrolledView scrollUp]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1411 |
vScrollBar scrollDownAction:[scrolledView scrollDown]. |
7 | 1412 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1413 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1414 |
hScrollBar scrollAction:[:position | |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1415 |
lockUpdates := true. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1416 |
scrolledView scrollHorizontalToPercent:position. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1417 |
lockUpdates := false |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1418 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1419 |
hScrollBar scrollUpAction:[scrolledView scrollLeft]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1420 |
hScrollBar scrollDownAction:[scrolledView scrollRight]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1421 |
]. |
7 | 1422 |
|
65 | 1423 |
scrolledView addDependent:self. |
814 | 1424 |
|
1425 |
" |
|
1426 |
pass my keyboard input (and other subviews input) |
|
1427 |
to the scrolled view ... |
|
1428 |
" |
|
1429 |
self delegate:(KeyboardForwarder toView:scrolledView). |
|
1430 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1431 |
"Modified: 6.3.1997 / 17:03:43 / cg" |
1111 | 1432 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1433 |
! |
|
1434 |
||
1435 |
setupDimensions |
|
1138 | 1436 |
"set the components dimensions (i.e. layouts) according to |
1437 |
the scrollability and hidden settings" |
|
1438 |
||
1113 | 1439 |
|scrolledViewMargin scrollBarSpacing |
1111 | 1440 |
scrolledViewLayout hScrollBarLayout vScrollBarLayout |
1441 |
vBd "{ Class: SmallInteger }" |
|
1442 |
hBd "{ Class: SmallInteger }" |
|
1443 |
sBd "{ Class: SmallInteger }" |
|
1444 |
wVScroll "{ Class: SmallInteger }" |
|
1445 |
hHScroll "{ Class: SmallInteger }" |
|
1446 |
hLeftOffs "{ Class: SmallInteger }" |
|
1447 |
hRightOffs "{ Class: SmallInteger }" |
|
1448 |
hTopOffs "{ Class: SmallInteger }" |
|
1449 |
hBottomOffs "{ Class: SmallInteger }" |
|
1450 |
sLeftOffs "{ Class: SmallInteger }" |
|
1451 |
sRightOffs "{ Class: SmallInteger }" |
|
1452 |
sTopOffs "{ Class: SmallInteger }" |
|
1453 |
sBottomOffs "{ Class: SmallInteger }" |
|
1454 |
vLeftOffs "{ Class: SmallInteger }" |
|
1455 |
vRightOffs "{ Class: SmallInteger }" |
|
1456 |
vTopOffs "{ Class: SmallInteger }" |
|
1457 |
vBottomOffs "{ Class: SmallInteger }" |
|
1458 |
addMargin "{ Class: SmallInteger }"| |
|
1459 |
||
1460 |
DefaultLevel notNil ifTrue:[self level:DefaultLevel]. |
|
1461 |
||
1462 |
sBd := 0. |
|
1463 |
DefaultScrolledViewBorderWidth notNil ifTrue:[ |
|
1464 |
sBd := DefaultScrolledViewBorderWidth. |
|
1465 |
scrolledView notNil ifTrue:[ |
|
1466 |
scrolledView borderWidth:DefaultScrolledViewBorderWidth. |
|
1467 |
] |
|
1468 |
] ifFalse:[ |
|
1469 |
scrolledView notNil ifTrue:[ |
|
1470 |
sBd := scrolledView borderWidth |
|
1471 |
] |
|
1472 |
]. |
|
1473 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1474 |
(vScrollBar notNil and:[vScrollBarHidden not]) ifTrue:[ |
1111 | 1475 |
vBd := vScrollBar borderWidth. |
1476 |
wVScroll := vScrollBar widthIncludingBorder. |
|
1477 |
] ifFalse:[ |
|
1478 |
vBd := wVScroll := 0. |
|
1479 |
]. |
|
1480 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1481 |
(hScrollBar notNil and:[hScrollBarHidden not]) ifTrue:[ |
1111 | 1482 |
hBd := hScrollBar borderWidth. |
1483 |
hHScroll := hScrollBar heightIncludingBorder. |
|
1484 |
] ifFalse:[ |
|
1485 |
hBd := hHScroll := 0. |
|
1486 |
]. |
|
1487 |
||
1488 |
"/ the raw layout ... |
|
1489 |
||
1490 |
scrolledViewLayout := ((0.0 @ 0.0) corner:(1.0@1.0)) asLayout. |
|
1491 |
hScrollBarLayout := ((0.0 @ 1.0) corner:(1.0@1.0)) asLayout. |
|
1492 |
||
1493 |
"/ the painful details; mostly complicated for 2D styles, |
|
1494 |
"/ where the positions are setUp to overlay borders ... |
|
1495 |
"/ (well, with 3D styles, a single pixel error will not be noticed; |
|
1496 |
"/ but 2D styles are very sensitive to those; |
|
1497 |
"/ the code below may not work correctly with different borderWidths). |
|
1498 |
||
1499 |
scrolledViewMargin := DefaultScrolledViewMargin. |
|
1500 |
scrollBarSpacing := DefaultScrollBarSpacing. |
|
1501 |
||
1502 |
vTopOffs := 0 - vBd + scrolledViewMargin + margin. |
|
1503 |
scrolledViewMargin == 0 ifTrue:[ |
|
1286 | 1504 |
vBottomOffs := vBd - scrolledViewMargin - sBd. |
1111 | 1505 |
] ifFalse:[ |
1286 | 1506 |
vBottomOffs := vBd - scrolledViewMargin + sBd. |
1111 | 1507 |
]. |
1508 |
||
1509 |
hLeftOffs := 0 - hBd + scrolledViewMargin + margin. |
|
1286 | 1510 |
hRightOffs := hBd - scrolledViewMargin - sBd. |
1111 | 1511 |
|
1512 |
sLeftOffs := 0 - hBd + scrolledViewMargin + margin. |
|
1286 | 1513 |
sRightOffs := hBd - scrolledViewMargin - sBd - sBd - sBd. |
1111 | 1514 |
|
1515 |
scrolledViewMargin == 0 ifTrue:[ |
|
1516 |
sTopOffs := 0 - sBd + margin. |
|
1286 | 1517 |
sBottomOffs := sBd - sBd. |
1111 | 1518 |
] ifFalse:[ |
1519 |
sTopOffs := 0 + scrolledViewMargin + margin. |
|
1286 | 1520 |
sBottomOffs := sBd - scrolledViewMargin - sBd - sBd - sBd. |
1111 | 1521 |
]. |
1522 |
||
1523 |
addMargin := 0. |
|
1524 |
"/ DefaultScrollBarLevel == DefaultScrolledViewLevel |
|
1525 |
"/ addMargin := 1. |
|
1526 |
"/ ]. |
|
1527 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1528 |
(vScrollBar notNil and:[vScrollBarHidden not]) ifTrue:[ |
1111 | 1529 |
scrollBarPosition == #right ifTrue:[ |
1530 |
"/ right/bottom |
|
1531 |
vScrollBarLayout := ((1.0 @ 0.0) corner:(1.0@1.0)) asLayout. |
|
1532 |
||
1533 |
vRightOffs := 0 - scrolledViewMargin + margin "???". |
|
1534 |
vLeftOffs := vRightOffs - wVScroll. |
|
1535 |
||
1536 |
sRightOffs := sRightOffs - scrollBarSpacing - wVScroll + sBd. |
|
1537 |
||
1538 |
hRightOffs := hRightOffs - wVScroll - scrollBarSpacing - sBd. |
|
1539 |
||
1540 |
sRightOffs := sRightOffs - addMargin |
|
1541 |
] ifFalse:[ |
|
1542 |
"/ left/bottom |
|
1543 |
vScrollBarLayout := ((0.0 @ 0.0) corner:(0.0@1.0)) asLayout. |
|
1544 |
||
1545 |
vLeftOffs := 0 - vBd + scrolledViewMargin + margin. |
|
1546 |
vRightOffs := vLeftOffs + wVScroll + margin. |
|
1547 |
||
1548 |
sLeftOffs := wVScroll + scrolledViewMargin + scrollBarSpacing + margin. |
|
1549 |
sRightOffs := 0 - scrolledViewMargin - margin. |
|
1550 |
hLeftOffs := hLeftOffs + wVScroll + vBd + scrollBarSpacing. |
|
1551 |
||
1552 |
sLeftOffs := sLeftOffs + addMargin |
|
1553 |
]. |
|
1554 |
]. |
|
1555 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1556 |
(hScrollBar notNil and:[hScrollBarHidden not]) ifTrue:[ |
1111 | 1557 |
hBottomOffs := 0 - scrolledViewMargin - hBd + margin "???". |
1558 |
hTopOffs := hBottomOffs - hHScroll. |
|
1559 |
scrolledViewMargin == 0 ifTrue:[ |
|
1560 |
hTopOffs := hTopOffs + sBd + sBd |
|
1561 |
]. |
|
1562 |
sBottomOffs := sBottomOffs - scrollBarSpacing - hHScroll. |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1563 |
(vScrollBar notNil and:[vScrollBarHidden not]) ifTrue:[ |
1111 | 1564 |
vBottomOffs := vBottomOffs - scrollBarSpacing - hHScroll. |
1565 |
]. |
|
1566 |
||
1567 |
sBottomOffs := sBottomOffs - addMargin. |
|
1568 |
hRightOffs := hRightOffs - addMargin. |
|
1569 |
]. |
|
1570 |
||
1571 |
scrolledView notNil ifTrue:[ |
|
1572 |
scrolledViewLayout leftOffset:sLeftOffs. |
|
1573 |
scrolledViewLayout rightOffset:sRightOffs. |
|
1574 |
scrolledViewLayout topOffset:sTopOffs. |
|
1575 |
scrolledViewLayout bottomOffset:sBottomOffs. |
|
1576 |
||
1243
064852ff0ef7
set scrolledViews level to 0 if there are no scrollBars
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
1577 |
((hScrollBar isNil or:[hScrollBarHidden]) |
064852ff0ef7
set scrolledViews level to 0 if there are no scrollBars
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
1578 |
and:[(vScrollBar isNil or:[vScrollBarHidden])]) ifTrue:[ |
064852ff0ef7
set scrolledViews level to 0 if there are no scrollBars
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
1579 |
scrolledView level:0 |
064852ff0ef7
set scrolledViews level to 0 if there are no scrollBars
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
1580 |
] ifFalse:[ |
064852ff0ef7
set scrolledViews level to 0 if there are no scrollBars
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
1581 |
scrolledView level:DefaultScrolledViewLevel. |
064852ff0ef7
set scrolledViews level to 0 if there are no scrollBars
Claus Gittinger <cg@exept.de>
parents:
1231
diff
changeset
|
1582 |
]. |
1111 | 1583 |
scrolledView layout:scrolledViewLayout. |
1584 |
]. |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1585 |
(hScrollBar notNil and:[hScrollBarHidden not]) ifTrue:[ |
1111 | 1586 |
hScrollBarLayout leftOffset:hLeftOffs. |
1587 |
hScrollBarLayout rightOffset:hRightOffs. |
|
1588 |
hScrollBarLayout topOffset:hTopOffs. |
|
1589 |
hScrollBarLayout bottomOffset:hBottomOffs. |
|
1590 |
||
1591 |
hScrollBar level:DefaultScrollBarLevel. |
|
1592 |
hScrollBar layout:hScrollBarLayout |
|
1593 |
]. |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1594 |
(vScrollBar notNil and:[vScrollBarHidden not]) ifTrue:[ |
1111 | 1595 |
vScrollBarLayout leftOffset:vLeftOffs. |
1596 |
vScrollBarLayout rightOffset:vRightOffs. |
|
1597 |
vScrollBarLayout topOffset:vTopOffs. |
|
1598 |
vScrollBarLayout bottomOffset:vBottomOffs. |
|
1599 |
||
1600 |
vScrollBar level:DefaultScrollBarLevel. |
|
1601 |
vScrollBar layout:vScrollBarLayout |
|
1602 |
]. |
|
1603 |
||
1604 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
1138 | 1605 |
"Modified: 19.3.1997 / 16:33:56 / cg" |
1111 | 1606 |
! |
1607 |
||
1608 |
setupVertical:isVertical mini:miniV horizontal:isHorizontal mini:miniH |
|
1609 |
"setup scrollbars as specified in the arguments" |
|
1610 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1611 |
|noMiniScrollers| |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1612 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1613 |
vScrollBarHidden := hScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1614 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1615 |
hasVerticalScrollBar := isVertical. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1616 |
hasHorizontalScrollBar := isHorizontal. |
1111 | 1617 |
|
1618 |
noMiniScrollers := styleSheet at:'scrollBarNeverMini' default:false. |
|
1619 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1620 |
verticalMini := miniV. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1621 |
verticalMini ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1622 |
noMiniScrollers ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1623 |
verticalMini := false |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1624 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1625 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1626 |
horizontalMini := miniH. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1627 |
horizontalMini ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1628 |
noMiniScrollers ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1629 |
horizontalMini := false |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1630 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1631 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1632 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1633 |
self setupViews. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1634 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1635 |
"Modified: 7.3.1997 / 22:09:12 / cg" |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1636 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1637 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1638 |
setupViews |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1639 |
"setup scrollbars as specified in the arguments" |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1640 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1641 |
|cls| |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1642 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1643 |
hasVerticalScrollBar ifTrue:[ |
1111 | 1644 |
cls := ScrollBar. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1645 |
verticalMini ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1646 |
cls := MiniScroller |
1111 | 1647 |
]. |
1648 |
(vScrollBar notNil |
|
1649 |
and:[vScrollBar class ~~ cls]) ifTrue:[ |
|
1650 |
self releaseVerticalScrollBar |
|
1651 |
]. |
|
1652 |
vScrollBar isNil ifTrue:[ |
|
1653 |
vScrollBar := cls in:self. |
|
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1654 |
realized ifTrue:[ |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1655 |
vScrollBar realize |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1656 |
] |
1111 | 1657 |
]. |
1658 |
vScrollBar thumbOrigin:0 thumbHeight:100. |
|
1659 |
] ifFalse:[ |
|
1660 |
vScrollBar notNil ifTrue:[ |
|
1661 |
self releaseVerticalScrollBar |
|
1662 |
] |
|
1663 |
]. |
|
1664 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1665 |
hasHorizontalScrollBar ifTrue:[ |
1111 | 1666 |
cls := HorizontalScrollBar. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1667 |
horizontalMini ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1668 |
cls := HorizontalMiniScroller |
1111 | 1669 |
]. |
1670 |
(hScrollBar notNil |
|
1671 |
and:[hScrollBar class ~~ cls]) ifTrue:[ |
|
1672 |
self releaseHorizontalScrollBar |
|
1673 |
]. |
|
1674 |
hScrollBar isNil ifTrue:[ |
|
1675 |
hScrollBar := cls in:self. |
|
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1676 |
realized ifTrue:[ |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1677 |
hScrollBar realize |
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1678 |
] |
1111 | 1679 |
]. |
1680 |
hScrollBar thumbOrigin:0 thumbHeight:100. |
|
1681 |
] ifFalse:[ |
|
1682 |
hScrollBar notNil ifTrue:[ |
|
1683 |
self releaseHorizontalScrollBar |
|
1684 |
] |
|
1685 |
]. |
|
1686 |
||
1687 |
scrolledView notNil ifTrue:[ |
|
1688 |
self setScrollActions. |
|
1689 |
] |
|
1690 |
||
1691 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
1184
733373c4f445
dont forget to set dimensions and realize
Claus Gittinger <cg@exept.de>
parents:
1183
diff
changeset
|
1692 |
"Modified: 8.4.1997 / 00:44:33 / cg" |
7 | 1693 |
! ! |
1694 |
||
217 | 1695 |
!ScrollableView methodsFor:'queries'! |
38 | 1696 |
|
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1697 |
isHorizontalScrollable |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1698 |
"return true if I am horizontally scrollable" |
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1699 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1700 |
^ hScrollBar notNil |
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1701 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1702 |
"Modified: 6.3.1997 / 17:03:49 / cg" |
1111 | 1703 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1704 |
! |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1705 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1706 |
isVerticalScrollable |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1707 |
"return true if I am vertically scrollable" |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1708 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1709 |
^ vScrollBar notNil |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1710 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1711 |
"Modified: 6.3.1997 / 17:03:52 / cg" |
1111 | 1712 |
"Created: 6.3.1997 / 18:06:23 / cg" |
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1713 |
! |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1714 |
|
217 | 1715 |
preferredExtent |
572 | 1716 |
"return my preferredExtent from the scrolledViews prefExtent |
1717 |
plus the size of the scrollBar" |
|
1718 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1719 |
|slavesPref prefX prefY| |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1720 |
|
799 | 1721 |
"/ If I have an explicit preferredExtent .. |
1722 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1723 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1724 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1725 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1726 |
|
217 | 1727 |
scrolledView notNil ifTrue:[ |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1728 |
slavesPref := scrolledView preferredExtent. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1729 |
prefX := slavesPref x. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1730 |
prefY := slavesPref y. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1731 |
vScrollBar notNil ifTrue:[ |
1111 | 1732 |
prefX := prefX + vScrollBar width + (DefaultScrolledViewMargin * 2) + DefaultScrollBarSpacing. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1733 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1734 |
hScrollBar notNil ifTrue:[ |
1111 | 1735 |
prefY := prefY + hScrollBar height + (DefaultScrolledViewMargin * 2) + DefaultScrollBarSpacing. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1736 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1737 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1738 |
^ prefX @ prefY. |
0 | 1739 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1740 |
|
217 | 1741 |
^ super preferredExtent. |
572 | 1742 |
|
1111 | 1743 |
"Created: 6.3.1997 / 18:06:24 / cg" |
1744 |
"Modified: 6.3.1997 / 22:34:09 / cg" |
|
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1745 |
! |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1746 |
|
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1747 |
preferredExtentForLines:numLines cols:numCols |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1748 |
"return my preferredExtent from the scrolledViews prefExtent |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1749 |
plus the size of the scrollBar" |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1750 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1751 |
|slavesPref prefX prefY| |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1752 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1753 |
"/ If I have an explicit preferredExtent .. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1754 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1755 |
preferredExtent notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1756 |
^ preferredExtent |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1757 |
]. |
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1758 |
|
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1759 |
scrolledView notNil ifTrue:[ |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1760 |
slavesPref := scrolledView preferredExtentForLines:numLines cols:numCols. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1761 |
prefX := slavesPref x. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1762 |
prefY := slavesPref y. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1763 |
vScrollBar notNil ifTrue:[ |
1111 | 1764 |
prefX := prefX + vScrollBar width + (DefaultScrolledViewMargin * 2) + DefaultScrollBarSpacing. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1765 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1766 |
hScrollBar notNil ifTrue:[ |
1111 | 1767 |
prefY := prefY + hScrollBar height + (DefaultScrolledViewMargin * 2) + DefaultScrollBarSpacing. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1768 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1769 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1770 |
^ prefX @ prefY. |
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1771 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1772 |
|
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1773 |
^ super preferredExtent. |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1774 |
|
1111 | 1775 |
"Created: 6.3.1997 / 18:06:24 / cg" |
1776 |
"Modified: 6.3.1997 / 22:34:30 / cg" |
|
1231 | 1777 |
! |
1778 |
||
1779 |
specClass |
|
1780 |
^ ScrollableViewSpec |
|
1781 |
||
1782 |
||
0 | 1783 |
! ! |
1784 |
||
1785 |
!ScrollableView methodsFor:'slave-view messages'! |
|
1786 |
||
1024 | 1787 |
clear |
1138 | 1788 |
"convenient method: forward this to the scrolledView" |
1789 |
||
1073 | 1790 |
scrolledView notNil ifTrue:[scrolledView clear] |
1024 | 1791 |
|
1111 | 1792 |
"Created: 6.3.1997 / 18:06:24 / cg" |
1138 | 1793 |
"Modified: 19.3.1997 / 16:34:19 / cg" |
1024 | 1794 |
! |
1795 |
||
217 | 1796 |
doesNotUnderstand:aMessage |
1797 |
"this is funny: all message we do not understand, are passed |
|
1798 |
on to the scrolledView - so we do not have to care for all |
|
1799 |
possible messages ...(thanks to the Message class)" |
|
1800 |
||
1801 |
scrolledView isNil ifFalse:[ |
|
1111 | 1802 |
^ scrolledView perform:(aMessage selector) |
1803 |
withArguments:(aMessage arguments) |
|
1804 |
]. |
|
1805 |
^ super doesNotUnderstand:aMessage |
|
1806 |
||
1807 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
1808 |
"Modified: 6.3.1997 / 18:38:54 / cg" |
|
217 | 1809 |
! |
1810 |
||
0 | 1811 |
leftButtonMenu |
38 | 1812 |
"return scrolledViews leftbuttonmenu" |
1813 |
||
1814 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 1815 |
^ scrolledView leftButtonMenu |
1111 | 1816 |
|
1817 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1818 |
! |
1819 |
||
1820 |
leftButtonMenu:aMenu |
|
1821 |
"pass on leftbuttonmenu to scrolledView" |
|
1822 |
||
1823 |
scrolledView leftButtonMenu:aMenu |
|
1111 | 1824 |
|
1825 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1826 |
! |
1827 |
||
1828 |
middleButtonMenu |
|
38 | 1829 |
"return scrolledViews middlebuttonmenu" |
1830 |
||
1831 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 1832 |
^ scrolledView middleButtonMenu |
1111 | 1833 |
|
1834 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1835 |
! |
1836 |
||
1837 |
middleButtonMenu:aMenu |
|
1838 |
"pass on middlebuttonmenu to scrolledView" |
|
1839 |
||
1840 |
scrolledView middleButtonMenu:aMenu |
|
1111 | 1841 |
|
1842 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1843 |
! |
1844 |
||
562 | 1845 |
model |
754 | 1846 |
"return my scrolledViews model" |
1847 |
||
1085 | 1848 |
scrolledView isNil ifTrue:[^ nil]. |
562 | 1849 |
^ scrolledView model |
1850 |
||
1085 | 1851 |
"Modified: 1.3.1997 / 01:38:07 / cg" |
1111 | 1852 |
"Created: 6.3.1997 / 18:06:24 / cg" |
562 | 1853 |
! |
1854 |
||
1855 |
model:aModel |
|
754 | 1856 |
"forward model change to my scrolledViews" |
1857 |
||
562 | 1858 |
^ scrolledView model:aModel |
1859 |
||
754 | 1860 |
"Modified: 5.6.1996 / 17:09:50 / cg" |
1111 | 1861 |
"Created: 6.3.1997 / 18:06:24 / cg" |
562 | 1862 |
! |
1863 |
||
0 | 1864 |
rightButtonMenu |
38 | 1865 |
"return scrolledViews rightbuttonmenu" |
1866 |
||
1867 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 1868 |
^ scrolledView rightButtonMenu |
1111 | 1869 |
|
1870 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1871 |
! |
1872 |
||
1873 |
rightButtonMenu:aMenu |
|
1874 |
"pass on rightbuttonmenu to scrolledView" |
|
1875 |
||
1876 |
scrolledView rightButtonMenu:aMenu |
|
1111 | 1877 |
|
1878 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
38 | 1879 |
! ! |
1880 |
||
852 | 1881 |
!ScrollableView class methodsFor:'documentation'! |
0 | 1882 |
|
217 | 1883 |
version |
1286 | 1884 |
^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.71 1997-07-28 10:32:51 cg Exp $' |
0 | 1885 |
! ! |