author | Claus Gittinger <cg@exept.de> |
Wed, 19 Mar 1997 17:26:31 +0100 | |
changeset 1140 | cb2adac34c6c |
parent 1139 | 8114f5fafdf5 |
child 1141 | 1db65b164cd5 |
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 |
||
374 |
for:aViewClass hasHorizontalScrollBar:hasH hasVerticalScrollBar:hasV miniScrollerH:miniH miniScrollerV:miniV origin:org corner:corn in:aView |
|
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:org |
|
392 |
corner:corn |
|
393 |
in:aView |
|
394 |
||
395 |
" |
|
396 |
|top scr| |
|
397 |
||
398 |
top := StandardSystemView extent:200@200. |
|
399 |
scr := NewScrollableView for:nil |
|
400 |
hasHorizontalScrollBar:true |
|
401 |
hasVerticalScrollBar:true |
|
402 |
miniScrollerH:false |
|
403 |
miniScrollerV:false |
|
404 |
origin:0.0@0.0 |
|
405 |
corner:1.0@1.0 |
|
406 |
in:top. |
|
407 |
top open |
|
408 |
" |
|
409 |
||
410 |
"Modified: 6.3.1997 / 18:36:01 / cg" |
|
217 | 411 |
! |
412 |
||
413 |
for:aViewClass in:aView |
|
414 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
415 |
The subview is created here. |
|
416 |
The view will have full scrollbars." |
|
417 |
||
1111 | 418 |
^ self |
419 |
for:aViewClass |
|
420 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
421 |
hasVerticalScrollBar:true |
|
422 |
miniScrollerH:false |
|
423 |
miniScrollerV:false |
|
424 |
origin:nil |
|
425 |
corner:nil |
|
426 |
in:aView |
|
427 |
||
428 |
"Modified: 6.3.1997 / 23:18:41 / cg" |
|
217 | 429 |
! |
430 |
||
431 |
for:aViewClass miniScroller:mini |
|
432 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
433 |
The subview is created here. |
|
434 |
The view will have full scrollbars if mini is false, miniscrollers |
|
435 |
if true." |
|
436 |
||
1111 | 437 |
^ self |
438 |
for:aViewClass |
|
439 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
440 |
hasVerticalScrollBar:true |
|
441 |
miniScrollerH:mini |
|
442 |
miniScrollerV:mini |
|
443 |
origin:nil |
|
444 |
corner:nil |
|
445 |
in:nil |
|
446 |
||
447 |
"Modified: 6.3.1997 / 23:18:45 / cg" |
|
217 | 448 |
! |
449 |
||
450 |
for:aViewClass miniScroller:mini in:aView |
|
451 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
452 |
The subview is created here. |
|
453 |
The view will have full scrollbars if mini is false, miniscrollers |
|
454 |
if true." |
|
455 |
||
1111 | 456 |
^ self |
457 |
for:aViewClass |
|
458 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
459 |
hasVerticalScrollBar:true |
|
460 |
miniScrollerH:mini |
|
461 |
miniScrollerV:mini |
|
462 |
origin:nil |
|
463 |
corner:nil |
|
464 |
in:aView |
|
465 |
||
466 |
"Modified: 6.3.1997 / 23:18:50 / cg" |
|
217 | 467 |
! |
153 | 468 |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
469 |
for:aViewClass miniScroller:mini origin:org corner:corn in:aView |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
470 |
"return a new scrolling view scrolling an instance of aViewClass. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
471 |
The subview is created here. |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
472 |
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
|
473 |
if true." |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
474 |
|
1111 | 475 |
^ self |
476 |
for:aViewClass |
|
477 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
478 |
hasVerticalScrollBar:true |
|
479 |
miniScrollerH:mini |
|
480 |
miniScrollerV:mini |
|
481 |
origin:org |
|
482 |
corner:corn |
|
483 |
in:aView |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
484 |
|
1111 | 485 |
"Modified: 6.3.1997 / 23:18:53 / cg" |
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
486 |
! |
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
487 |
|
217 | 488 |
for:aViewClass miniScrollerH:miniH |
489 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
490 |
The subview is created here. |
|
491 |
The view will have full scrollbars if miniH is false, |
|
492 |
and a horizontal miniscroller if true." |
|
493 |
||
1111 | 494 |
^ self |
495 |
for:aViewClass |
|
496 |
hasHorizontalScrollBar:true |
|
497 |
hasVerticalScrollBar:true |
|
498 |
miniScrollerH:miniH |
|
499 |
miniScrollerV:false |
|
500 |
origin:nil |
|
501 |
corner:nil |
|
502 |
in:nil |
|
503 |
||
504 |
"Modified: 6.3.1997 / 18:30:15 / cg" |
|
217 | 505 |
! |
506 |
||
507 |
for:aViewClass miniScrollerH:miniH in:aView |
|
508 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
509 |
The subview is created here. |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
510 |
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
|
511 |
is false, miniscrollers if true." |
217 | 512 |
|
1111 | 513 |
^ self |
514 |
for:aViewClass |
|
515 |
hasHorizontalScrollBar:true |
|
516 |
hasVerticalScrollBar:true |
|
517 |
miniScrollerH:miniH |
|
518 |
miniScrollerV:false |
|
519 |
origin:nil |
|
520 |
corner:nil |
|
521 |
in:aView |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
522 |
|
1111 | 523 |
"Modified: 6.3.1997 / 18:30:31 / cg" |
217 | 524 |
! |
153 | 525 |
|
217 | 526 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV |
527 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
528 |
The subview is created here. |
|
529 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
530 |
is false, miniscrollers if true." |
|
531 |
||
1111 | 532 |
^ self |
533 |
for:aViewClass |
|
534 |
hasHorizontalScrollBar:true |
|
535 |
hasVerticalScrollBar:true |
|
536 |
miniScrollerH:miniH |
|
537 |
miniScrollerV:miniV |
|
538 |
origin:nil |
|
539 |
corner:nil |
|
540 |
in:nil |
|
541 |
||
542 |
"Modified: 6.3.1997 / 18:30:47 / cg" |
|
217 | 543 |
! |
544 |
||
545 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV in:aView |
|
546 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
547 |
The subview is created here. |
|
548 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
549 |
is false, miniscrollers if true." |
|
550 |
||
1111 | 551 |
^ self |
552 |
for:aViewClass |
|
553 |
hasHorizontalScrollBar:true |
|
554 |
hasVerticalScrollBar:true |
|
555 |
miniScrollerH:miniH |
|
556 |
miniScrollerV:miniV |
|
557 |
origin:nil |
|
558 |
corner:nil |
|
559 |
in:aView |
|
560 |
||
561 |
"Modified: 6.3.1997 / 18:31:02 / cg" |
|
562 |
! |
|
563 |
||
564 |
for:aViewClass miniScrollerH:miniH miniScrollerV:miniV origin:org corner:corn in:aView |
|
565 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
566 |
The subview is created here. |
|
567 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
568 |
is false, miniscrollers if true." |
|
569 |
||
570 |
^ self |
|
571 |
for:aViewClass |
|
572 |
hasHorizontalScrollBar:true |
|
573 |
hasVerticalScrollBar:true |
|
574 |
miniScrollerH:miniH |
|
575 |
miniScrollerV:miniV |
|
576 |
origin:org |
|
577 |
corner:corn |
|
578 |
in:aView |
|
579 |
||
580 |
"Modified: 6.3.1997 / 18:31:17 / cg" |
|
581 |
! |
|
582 |
||
583 |
for:aViewClass miniScrollerH:miniH origin:org corner:corn in:aView |
|
584 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
585 |
The subview is created here. |
|
586 |
The view will have a full horizontal scrollbar if miniH is false, |
|
587 |
a miniscroller if true." |
|
588 |
||
589 |
^ self |
|
590 |
for:aViewClass |
|
591 |
hasHorizontalScrollBar:true |
|
592 |
hasVerticalScrollBar:true |
|
593 |
miniScrollerH:miniH |
|
594 |
miniScrollerV:false |
|
595 |
origin:org |
|
596 |
corner:corn |
|
597 |
in:aView |
|
598 |
||
599 |
"Modified: 6.3.1997 / 18:31:28 / cg" |
|
600 |
! |
|
601 |
||
602 |
for:aViewClass miniScrollerV:miniV origin:org corner:corn in:aView |
|
603 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
604 |
The subview is created here. |
|
605 |
The view will have a full vertical scrollbar if miniV is false, |
|
606 |
a miniscroller if true." |
|
607 |
||
608 |
^ self |
|
609 |
for:aViewClass |
|
610 |
hasHorizontalScrollBar:true |
|
611 |
hasVerticalScrollBar:true |
|
612 |
miniScrollerH:false |
|
613 |
miniScrollerV:miniV |
|
614 |
origin:org |
|
615 |
corner:corn |
|
616 |
in:aView |
|
617 |
||
618 |
"Modified: 6.3.1997 / 18:31:41 / cg" |
|
619 |
! |
|
620 |
||
621 |
for:aViewClass origin:org corner:corner in:aView |
|
622 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
623 |
The subview is created here. |
|
624 |
The view will have full scrollbars." |
|
625 |
||
626 |
^ self |
|
627 |
for:aViewClass |
|
628 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
629 |
hasVerticalScrollBar:true |
|
630 |
miniScrollerH:false |
|
631 |
miniScrollerV:false |
|
632 |
origin:org |
|
633 |
corner:corner |
|
634 |
in:aView |
|
635 |
||
636 |
"Modified: 6.3.1997 / 23:19:05 / cg" |
|
637 |
! |
|
638 |
||
639 |
forView:aView |
|
640 |
"return a new scrolling view scrolling aView. |
|
641 |
The view will have full scrollbars." |
|
642 |
||
643 |
^ self |
|
644 |
forView:aView |
|
645 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
646 |
hasVerticalScrollBar:true |
|
647 |
miniScrollerH:false |
|
648 |
miniScrollerV:false |
|
649 |
origin:nil |
|
650 |
corner:nil |
|
651 |
in:nil |
|
652 |
||
653 |
"Modified: 6.3.1997 / 23:19:08 / cg" |
|
654 |
! |
|
655 |
||
656 |
forView:aScrolledView hasHorizontalScrollBar:hasH hasVerticalScrollBar:hasV miniScrollerH:miniH miniScrollerV:miniV origin:org corner:corn in:aView |
|
657 |
"return a new scrolling view scrolling an instance of aViewClass. |
|
658 |
The subview is created here. |
|
659 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
660 |
is false, miniscrollers if true." |
|
661 |
||
300 | 662 |
|newView dev| |
217 | 663 |
|
664 |
aView notNil ifTrue:[ |
|
703 | 665 |
dev := aView graphicsDevice |
300 | 666 |
] ifFalse:[ |
703 | 667 |
dev := Screen current |
300 | 668 |
]. |
669 |
newView := self basicNew device:dev. |
|
1111 | 670 |
newView initialize. |
671 |
newView setupVertical:hasV mini:miniV horizontal:hasH mini:miniH. |
|
672 |
||
673 |
aScrolledView notNil ifTrue:[ |
|
674 |
newView scrolledView:aScrolledView. |
|
675 |
]. |
|
676 |
||
677 |
org notNil ifTrue:[ |
|
678 |
newView origin:org |
|
679 |
]. |
|
680 |
corn notNil ifTrue:[ |
|
681 |
newView corner:corn |
|
682 |
]. |
|
683 |
||
300 | 684 |
aView notNil ifTrue:[ |
703 | 685 |
aView addSubView:newView |
153 | 686 |
]. |
217 | 687 |
^ newView |
703 | 688 |
|
1111 | 689 |
" |
690 |
|top scr| |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
691 |
|
1111 | 692 |
top := StandardSystemView extent:200@200. |
693 |
scr := NewScrollableView |
|
694 |
forView:(TextView new) |
|
695 |
hasHorizontalScrollBar:true |
|
696 |
hasVerticalScrollBar:true |
|
697 |
miniScrollerH:false |
|
698 |
miniScrollerV:false |
|
699 |
origin:0.0@0.0 |
|
700 |
corner:1.0@1.0 |
|
701 |
in:top. |
|
702 |
top open |
|
703 |
" |
|
546
b643875bda30
more inst creation variations
Claus Gittinger <cg@exept.de>
parents:
492
diff
changeset
|
704 |
|
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
705 |
"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
|
706 |
"Modified: 19.3.1997 / 15:32:51 / stefan" |
217 | 707 |
! |
708 |
||
852 | 709 |
forView:aView in:aSuperView |
710 |
"return a new scrolling view scrolling aView. |
|
711 |
The view will have full scrollbars." |
|
712 |
||
1111 | 713 |
^ self |
714 |
forView:aView |
|
715 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
716 |
hasVerticalScrollBar:true |
|
717 |
miniScrollerH:false |
|
718 |
miniScrollerV:false |
|
719 |
origin:nil |
|
720 |
corner:nil |
|
721 |
in:aSuperView |
|
852 | 722 |
|
1111 | 723 |
"Modified: 6.3.1997 / 23:19:12 / cg" |
852 | 724 |
! |
725 |
||
248 | 726 |
forView:aView miniScrollerH:mini |
727 |
"return a new scrolling view scrolling aView. |
|
728 |
The view will have a full vertical scrollbar and a horizontal |
|
729 |
miniScroller if mini is true." |
|
730 |
||
1111 | 731 |
^ self |
732 |
forView:aView |
|
733 |
hasHorizontalScrollBar:true |
|
734 |
hasVerticalScrollBar:true |
|
735 |
miniScrollerH:mini |
|
736 |
miniScrollerV:false |
|
737 |
origin:nil |
|
738 |
corner:nil |
|
739 |
in:nil |
|
248 | 740 |
|
1111 | 741 |
"Modified: 6.3.1997 / 18:32:58 / cg" |
248 | 742 |
! |
743 |
||
217 | 744 |
forView:scrolledView miniScrollerH:miniH miniScrollerV:miniV in:aView |
745 |
"return a new scrolling view, scrolling aView. |
|
746 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
747 |
is false, miniscrollers if true." |
|
153 | 748 |
|
1111 | 749 |
^ self |
750 |
forView:scrolledView |
|
751 |
hasHorizontalScrollBar:true |
|
752 |
hasVerticalScrollBar:true |
|
753 |
miniScrollerH:miniH |
|
754 |
miniScrollerV:miniV |
|
755 |
origin:nil |
|
756 |
corner:nil |
|
757 |
in:aView |
|
217 | 758 |
|
1111 | 759 |
"Modified: 6.3.1997 / 18:33:20 / cg" |
217 | 760 |
! |
153 | 761 |
|
217 | 762 |
in:aView |
763 |
"return a new scrolling view to be contained in aView. |
|
764 |
There is no slave view now - this has to be set later via |
|
765 |
the scrolledView: method. |
|
766 |
The view will have full scrollbars." |
|
767 |
||
1111 | 768 |
^ self |
769 |
forView:nil |
|
770 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
771 |
hasVerticalScrollBar:true |
|
772 |
miniScrollerH:false |
|
773 |
miniScrollerV:false |
|
774 |
origin:nil |
|
775 |
corner:nil |
|
776 |
in:aView |
|
777 |
||
778 |
"Modified: 6.3.1997 / 23:19:19 / cg" |
|
217 | 779 |
! |
0 | 780 |
|
93 | 781 |
miniScroller:mini |
782 |
"return a new scrolling view. The subview will be created later. |
|
783 |
The view will have full scrollbars if mini is false, |
|
784 |
miniscrollers if true." |
|
785 |
||
1111 | 786 |
^ self |
787 |
forView:nil |
|
788 |
hasHorizontalScrollBar:(self == HVScrollableView) |
|
789 |
hasVerticalScrollBar:true |
|
790 |
miniScrollerH:mini |
|
791 |
miniScrollerV:mini |
|
792 |
origin:nil |
|
793 |
corner:nil |
|
794 |
in:nil |
|
795 |
||
796 |
"Modified: 6.3.1997 / 23:19:21 / cg" |
|
93 | 797 |
! |
798 |
||
113 | 799 |
miniScrollerH:miniH |
800 |
"return a new scrolling view. The subview will be created later. |
|
801 |
The view will have full scrollbars if miniH is false, |
|
802 |
and a horizontal miniscroller if true." |
|
803 |
||
1111 | 804 |
^ self |
805 |
forView:nil |
|
806 |
hasHorizontalScrollBar:true |
|
807 |
hasVerticalScrollBar:true |
|
808 |
miniScrollerH:miniH |
|
809 |
miniScrollerV:false |
|
810 |
origin:nil |
|
811 |
corner:nil |
|
812 |
in:nil |
|
813 |
||
814 |
"Modified: 6.3.1997 / 18:34:06 / cg" |
|
113 | 815 |
! |
816 |
||
93 | 817 |
miniScrollerH:miniH miniScrollerV:miniV |
818 |
"return a new scrolling view. The subview will be created later. |
|
819 |
The view will have full scrollbars if the corresponding miniH/miniV |
|
113 | 820 |
is false, miniscrollers if true." |
93 | 821 |
|
1111 | 822 |
^ self |
823 |
forView:nil |
|
824 |
hasHorizontalScrollBar:true |
|
825 |
hasVerticalScrollBar:true |
|
826 |
miniScrollerH:miniH |
|
827 |
miniScrollerV:miniV |
|
828 |
origin:nil |
|
829 |
corner:nil |
|
830 |
in:nil |
|
831 |
||
832 |
"Modified: 6.3.1997 / 18:34:16 / cg" |
|
217 | 833 |
! ! |
93 | 834 |
|
852 | 835 |
!ScrollableView class methodsFor:'defaults'! |
217 | 836 |
|
837 |
updateStyleCache |
|
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
838 |
"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
|
839 |
|
1111 | 840 |
<resource: #style (#scrolledViewLevel #scrolledViewMargin)> |
841 |
||
842 |
|defLevel defMargin defSpacing| |
|
444
ef26eba8c854
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
300
diff
changeset
|
843 |
|
1111 | 844 |
StyleSheet is3D ifTrue:[ |
845 |
defLevel := -1. |
|
846 |
defMargin := ViewSpacing // 2. |
|
847 |
defSpacing := defMargin. |
|
217 | 848 |
] ifFalse:[ |
1111 | 849 |
defLevel := 0. |
850 |
defMargin := 0. |
|
851 |
defSpacing := 0 |
|
217 | 852 |
]. |
1111 | 853 |
DefaultScrolledViewLevel := StyleSheet at:'scrolledViewLevel' default:defLevel. |
854 |
DefaultScrolledViewBorderWidth := StyleSheet at:'scrolledViewBorderWidth' default:nil. |
|
855 |
DefaultScrolledViewMargin := StyleSheet at:'scrolledViewMargin' default:defMargin. |
|
856 |
DefaultScrollBarSpacing := StyleSheet at:'scrollBarSpacing' default:defSpacing. |
|
857 |
DefaultLevel := StyleSheet at:'scrollableViewLevel' default:nil. |
|
858 |
DefaultScrollBarLevel := StyleSheet at:'scrollBarLevel' default:nil. |
|
859 |
MyDefaultViewBackgroundColor := StyleSheet at:'scrollableViewBackgroundColor' default:DefaultViewBackgroundColor. |
|
0 | 860 |
|
1111 | 861 |
" |
862 |
self updateStyleCache |
|
863 |
" |
|
864 |
||
865 |
"Modified: 7.3.1997 / 15:03:37 / cg" |
|
217 | 866 |
! ! |
867 |
||
1140 | 868 |
!ScrollableView methodsFor:'accessing-behavior'! |
869 |
||
870 |
autoHideScrollBars:aBoolean |
|
871 |
"set/clear the flag which controls if scrollBars should |
|
872 |
be made invisible dynamically, if there is nothing to scroll |
|
873 |
(and shown if there is). |
|
874 |
This flags setting is normally controlled by the styleSheet." |
|
875 |
||
876 |
hideScrollBars := aBoolean. |
|
877 |
||
878 |
"Modified: 19.3.1997 / 16:28:42 / cg" |
|
879 |
"Created: 19.3.1997 / 17:24:39 / cg" |
|
880 |
! ! |
|
881 |
||
1138 | 882 |
!ScrollableView methodsFor:'accessing-components'! |
119 | 883 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
884 |
horizontalScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
885 |
"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
|
886 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
887 |
^ hScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
888 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
889 |
"Modified: 6.3.1997 / 16:59:24 / cg" |
1111 | 890 |
"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
|
891 |
! |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
892 |
|
217 | 893 |
scrollBar |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
894 |
"return the vertical scrollbar (or nil, if there is none)" |
217 | 895 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
896 |
^ vScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
897 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
898 |
"Modified: 6.3.1997 / 16:59:29 / cg" |
1111 | 899 |
"Created: 6.3.1997 / 18:06:23 / cg" |
119 | 900 |
! |
901 |
||
217 | 902 |
scrolledView |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
903 |
"return the scrolled view (or nil, if there is none)" |
38 | 904 |
|
217 | 905 |
^ scrolledView |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
906 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
907 |
"Modified: 6.3.1997 / 16:48:09 / cg" |
1111 | 908 |
"Created: 6.3.1997 / 18:06:23 / cg" |
113 | 909 |
! |
910 |
||
217 | 911 |
scrolledView:aView |
912 |
"set the view to scroll" |
|
913 |
||
914 |
scrolledView notNil ifTrue:[ |
|
982 | 915 |
scrolledView removeDependent:self. |
814 | 916 |
scrolledView destroy. |
917 |
scrolledView := nil. |
|
217 | 918 |
]. |
982 | 919 |
|
217 | 920 |
scrolledView := aView. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
921 |
|
1111 | 922 |
super addSubViewFirst:aView. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
923 |
scrolledView notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
924 |
self setScrollActions. |
217 | 925 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
926 |
realized ifTrue:[ |
1134
f4f1e67f1ff2
setupDimension late in realize
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
927 |
self setupDimensions. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
928 |
self sizeChanged:nil. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
929 |
scrolledView realize |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
930 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
931 |
] |
217 | 932 |
|
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
933 |
"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
|
934 |
"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
|
935 |
! |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
936 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
937 |
verticalScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
938 |
"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
|
939 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
940 |
^ vScrollBar |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
941 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
942 |
"Modified: 6.3.1997 / 16:59:24 / cg" |
1111 | 943 |
"Created: 6.3.1997 / 18:06:23 / cg" |
217 | 944 |
! ! |
945 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
946 |
!ScrollableView methodsFor:'accessing-look'! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
947 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
948 |
horizontalMini:aBoolean |
1138 | 949 |
"control the horizontal scrollBar to be either a miniScroller, |
950 |
or a full scrollBar." |
|
951 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
952 |
horizontalMini ~~ aBoolean ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
953 |
horizontalMini := aBoolean. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
954 |
self setupViews |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
955 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
956 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
957 |
"Created: 7.3.1997 / 21:57:02 / cg" |
1138 | 958 |
"Modified: 19.3.1997 / 16:29:43 / cg" |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
959 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
960 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
961 |
horizontalScrollable:aBoolean |
1138 | 962 |
"enable/disable horizontal scrollability. |
963 |
If disabled, the horizontal scrollBar is made invisible." |
|
964 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
965 |
hasHorizontalScrollBar ~~ aBoolean ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
966 |
hasHorizontalScrollBar := aBoolean. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
967 |
hScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
968 |
self setupViews |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
969 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
970 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
971 |
"Created: 7.3.1997 / 21:56:28 / cg" |
1138 | 972 |
"Modified: 19.3.1997 / 16:30:29 / cg" |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
973 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
974 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
975 |
verticalMini:aBoolean |
1138 | 976 |
"control the vertical scrollBar to be either a miniScroller, |
977 |
or a full scrollBar." |
|
978 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
979 |
verticalMini ~~ aBoolean ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
980 |
verticalMini := aBoolean. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
981 |
self setupViews |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
982 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
983 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
984 |
"Created: 7.3.1997 / 21:56:57 / cg" |
1138 | 985 |
"Modified: 19.3.1997 / 16:29:49 / cg" |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
986 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
987 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
988 |
verticalScrollable:aBoolean |
1138 | 989 |
"enable/disable vertical scrollability. |
990 |
If disabled, the vertical scrollBar is made invisible." |
|
991 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
992 |
hasVerticalScrollBar ~~ aBoolean ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
993 |
hasVerticalScrollBar := aBoolean. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
994 |
vScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
995 |
self setupViews |
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 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
998 |
"Created: 7.3.1997 / 21:56:39 / cg" |
1138 | 999 |
"Modified: 19.3.1997 / 16:30:38 / cg" |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1000 |
! ! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1001 |
|
217 | 1002 |
!ScrollableView methodsFor:'changes '! |
1003 |
||
1004 |
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
|
1005 |
"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
|
1006 |
be updated as well" |
132 | 1007 |
|
217 | 1008 |
changedObject == scrolledView ifTrue:[ |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1009 |
something == #sizeOfContents ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1010 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1011 |
vScrollBar setThumbFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1012 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1013 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1014 |
hScrollBar setThumbFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1015 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1016 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1017 |
something == #originOfContents ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1018 |
lockUpdates ifFalse:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1019 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1020 |
vScrollBar setThumbOriginFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1021 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1022 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1023 |
hScrollBar setThumbOriginFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1024 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1025 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1026 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1027 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1028 |
self updateScrollBarVisibility |
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 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1031 |
"Modified: 7.3.1997 / 22:22:15 / cg" |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1032 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1033 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1034 |
updateScrollBarVisibility |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1035 |
"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
|
1036 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1037 |
|anyChange| |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1038 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1039 |
hideScrollBars ifFalse:[^ self]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1040 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1041 |
anyChange := false. |
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 |
vScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1044 |
vScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1045 |
vScrollBarHidden ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1046 |
vScrollBarHidden := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1047 |
vScrollBar beInvisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1048 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1049 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1050 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1051 |
vScrollBarHidden ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1052 |
vScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1053 |
vScrollBar beVisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1054 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1055 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1056 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1057 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1058 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1059 |
hScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1060 |
hScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1061 |
hScrollBarHidden ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1062 |
hScrollBarHidden := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1063 |
hScrollBar beInvisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1064 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1065 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1066 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1067 |
hScrollBarHidden ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1068 |
hScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1069 |
hScrollBar beVisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1070 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1071 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1072 |
] |
217 | 1073 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1074 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1075 |
anyChange ifTrue:[ |
1134
f4f1e67f1ff2
setupDimension late in realize
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
1076 |
realized ifTrue:[ |
f4f1e67f1ff2
setupDimension late in realize
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
1077 |
self setupDimensions. |
f4f1e67f1ff2
setupDimension late in realize
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
1078 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1079 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1080 |
"/ force him to recompute its dimension ... |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1081 |
scrolledView notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1082 |
vScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1083 |
vScrollBar setThumbFor:scrolledView. |
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 |
hScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1086 |
hScrollBar setThumbFor:scrolledView. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1087 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1088 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1089 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1090 |
"/ stupid - showing one may need the other ... |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1091 |
"/ and vice versa; do it again. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1092 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1093 |
anyChange := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1094 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1095 |
vScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1096 |
vScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1097 |
vScrollBarHidden ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1098 |
vScrollBarHidden := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1099 |
vScrollBar beInvisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1100 |
anyChange := true. |
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 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1103 |
vScrollBarHidden ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1104 |
vScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1105 |
vScrollBar beVisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1106 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1107 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1108 |
] |
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 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1111 |
hScrollBar notNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1112 |
hScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1113 |
hScrollBarHidden ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1114 |
hScrollBarHidden := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1115 |
hScrollBar beInvisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1116 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1117 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1118 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1119 |
hScrollBarHidden ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1120 |
hScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1121 |
hScrollBar beVisible. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1122 |
anyChange := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1123 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1124 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1125 |
]. |
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 |
anyChange ifTrue:[ |
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1128 |
realized ifTrue:[ |
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1129 |
self setupDimensions. |
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1130 |
]. |
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1131 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1132 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1133 |
|
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1134 |
"Modified: 7.3.1997 / 22:58:56 / cg" |
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1135 |
"Modified: 19.3.1997 / 15:33:36 / stefan" |
217 | 1136 |
! ! |
38 | 1137 |
|
217 | 1138 |
!ScrollableView methodsFor:'event processing'! |
1139 |
||
1140 |
keyPress:key x:x y:y |
|
1141 |
"a key was pressed - handle page-keys here" |
|
1142 |
||
1143 |
<resource: #keyboard ( #Prior #Next ) > |
|
1144 |
||
1145 |
(key == #Prior) ifTrue: [^ self pageUp]. |
|
1146 |
(key == #Next) ifTrue: [^ self pageDown]. |
|
1147 |
||
1148 |
super keyPress:key x:x y:y |
|
1111 | 1149 |
|
1150 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
38 | 1151 |
! |
1152 |
||
217 | 1153 |
sizeChanged:how |
1138 | 1154 |
"handle size changes - this may change any scrollBars visibility" |
1155 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1156 |
|orgX orgY scroll| |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1157 |
|
1111 | 1158 |
"/ resize components manually, in an order which is optimal |
1159 |
||
1160 |
how == #smaller ifTrue:[ |
|
1161 |
"/ first resize the horizontalScrollBar, |
|
1162 |
||
1163 |
scrolledView notNil ifTrue:[ |
|
1164 |
scrolledView containerChangedSize |
|
1165 |
]. |
|
1166 |
hScrollBar notNil ifTrue:[ |
|
1167 |
hScrollBar containerChangedSize |
|
1168 |
]. |
|
1169 |
vScrollBar notNil ifTrue:[ |
|
1170 |
vScrollBar containerChangedSize |
|
1171 |
]. |
|
1172 |
] ifFalse:[ |
|
1173 |
hScrollBar notNil ifTrue:[ |
|
1174 |
hScrollBar containerChangedSize |
|
1175 |
]. |
|
1176 |
vScrollBar notNil ifTrue:[ |
|
1177 |
vScrollBar containerChangedSize |
|
1178 |
]. |
|
1179 |
scrolledView notNil ifTrue:[ |
|
1180 |
scrolledView containerChangedSize |
|
1181 |
]. |
|
1182 |
]. |
|
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1183 |
|
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1184 |
"/ The following action will be done in a atomic operation |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1185 |
"/ in HVScrollableView |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1186 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1187 |
scrolledView isNil ifTrue:[^ self]. |
1111 | 1188 |
(hScrollBar isNil and:[vScrollBar isNil]) ifTrue:[^ self]. |
1189 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1190 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1191 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1192 |
vScrollBar setThumbFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1193 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1194 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1195 |
hScrollBar setThumbFor:scrolledView. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1196 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1197 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1198 |
"/ 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
|
1199 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1200 |
hScrollBar isNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1201 |
"/ only care for vertical ... |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1202 |
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
|
1203 |
vScrollBar thumbOrigin:(100 - vScrollBar thumbHeight). |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1204 |
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
|
1205 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1206 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1207 |
vScrollBar isNil ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1208 |
"/ only care for horizontal ... |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1209 |
hScrollBar thumbOrigin + hScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1210 |
hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight). |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1211 |
scrolledView scrollVerticalToPercent:hScrollBar thumbOrigin. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1212 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1213 |
] ifFalse:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1214 |
"/ care for both ... |
113 | 1215 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1216 |
orgY := vScrollBar thumbOrigin. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1217 |
orgX := hScrollBar thumbOrigin. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1218 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1219 |
scroll := false. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1220 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1221 |
orgY + vScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1222 |
vScrollBar thumbOrigin:(100 - vScrollBar thumbHeight). |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1223 |
orgY := vScrollBar thumbOrigin. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1224 |
scroll := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1225 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1226 |
orgX + hScrollBar thumbHeight >= 100 ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1227 |
hScrollBar thumbOrigin:(100 - hScrollBar thumbHeight). |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1228 |
orgX := hScrollBar thumbOrigin. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1229 |
scroll := true. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1230 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1231 |
scroll ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1232 |
scrolledView scrollToPercent:(orgX@orgY). |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1233 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1234 |
] |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1235 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1236 |
self updateScrollBarVisibility. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1237 |
|
1138 | 1238 |
"Modified: 19.3.1997 / 16:31:13 / cg" |
217 | 1239 |
! ! |
1240 |
||
1241 |
!ScrollableView methodsFor:'forced scroll'! |
|
1242 |
||
1243 |
pageDown |
|
1138 | 1244 |
"page down - but only if there is a vertical scrollbar" |
217 | 1245 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1246 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1247 |
vScrollBar pageDown |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1248 |
] |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1249 |
|
1111 | 1250 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1138 | 1251 |
"Modified: 19.3.1997 / 16:32:34 / cg" |
1252 |
! |
|
1253 |
||
1254 |
pageLeft |
|
1255 |
"page left - but only if there is a horizontal scrollbar" |
|
1256 |
||
1257 |
hScrollBar notNil ifTrue:[ |
|
1258 |
hScrollBar pageDown |
|
1259 |
] |
|
1260 |
||
1261 |
"Created: 19.3.1997 / 16:32:14 / cg" |
|
1262 |
"Modified: 19.3.1997 / 16:32:44 / cg" |
|
1263 |
! |
|
1264 |
||
1265 |
pageRight |
|
1266 |
"page right - but only if there is a horizontal scrollbar" |
|
1267 |
||
1268 |
hScrollBar notNil ifTrue:[ |
|
1269 |
hScrollBar pageUp |
|
1270 |
] |
|
1271 |
||
1272 |
"Created: 19.3.1997 / 16:32:22 / cg" |
|
1273 |
"Modified: 19.3.1997 / 16:32:48 / cg" |
|
113 | 1274 |
! |
1275 |
||
217 | 1276 |
pageUp |
1138 | 1277 |
"page up - but only if there is a vertical scrollbar" |
0 | 1278 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1279 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1280 |
vScrollBar pageUp |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1281 |
] |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1282 |
|
1111 | 1283 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1138 | 1284 |
"Modified: 19.3.1997 / 16:32:38 / cg" |
0 | 1285 |
! ! |
1286 |
||
1287 |
!ScrollableView methodsFor:'initialization'! |
|
1288 |
||
217 | 1289 |
initStyle |
958 | 1290 |
"initialize style specifics" |
1291 |
||
1138 | 1292 |
<resource: #style (#scrollBarPosition scrollBarHiding)> |
608 | 1293 |
|
217 | 1294 |
super initStyle. |
1295 |
||
1111 | 1296 |
viewBackground := MyDefaultViewBackgroundColor. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1297 |
scrollBarPosition := styleSheet at:'scrollBarPosition' default:#left. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1298 |
hideScrollBars := styleSheet at:'scrollBarHiding' default:false. |
608 | 1299 |
|
1111 | 1300 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1138 | 1301 |
"Modified: 19.3.1997 / 16:32:59 / cg" |
0 | 1302 |
! |
1303 |
||
1304 |
realize |
|
1305 |
super realize. |
|
38 | 1306 |
|
1134
f4f1e67f1ff2
setupDimension late in realize
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
1307 |
self setupDimensions. |
f4f1e67f1ff2
setupDimension late in realize
Claus Gittinger <cg@exept.de>
parents:
1126
diff
changeset
|
1308 |
|
0 | 1309 |
"since scrolledview may have done something to its contents |
1310 |
during init-time we had no chance yet to catch contents- |
|
1311 |
changes; do it now |
|
1312 |
" |
|
38 | 1313 |
scrolledView notNil ifTrue:[ |
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1314 |
self setupDimensions. |
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 setThumbFor:scrolledView |
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 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1319 |
hScrollBar setThumbFor:scrolledView |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1320 |
]. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1321 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1322 |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1323 |
self updateScrollBarVisibility |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1324 |
|
1135
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1325 |
"Modified: 7.3.1997 / 22:22:33 / cg" |
acdeed6efc13
Fix prev fix from cg. Send setupDimensions only if scrolledView
Stefan Vogel <sv@exept.de>
parents:
1134
diff
changeset
|
1326 |
"Modified: 19.3.1997 / 15:32:20 / stefan" |
1111 | 1327 |
! |
1328 |
||
1329 |
releaseHorizontalScrollBar |
|
1330 |
"destroy any horizontal scrollBar" |
|
1331 |
||
1332 |
hScrollBar notNil ifTrue:[ |
|
1333 |
hScrollBar destroy. |
|
1334 |
hScrollBar := nil |
|
1335 |
]. |
|
1336 |
||
1337 |
"Modified: 6.3.1997 / 17:43:20 / cg" |
|
1338 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
1339 |
! |
|
1340 |
||
1341 |
releaseVerticalScrollBar |
|
1342 |
"destroy any vertical scrollBar" |
|
1343 |
||
1344 |
vScrollBar notNil ifTrue:[ |
|
1345 |
vScrollBar destroy. |
|
1346 |
vScrollBar := nil |
|
1347 |
]. |
|
1348 |
||
1349 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
1097 | 1350 |
! |
7 | 1351 |
|
1352 |
setScrollActions |
|
1353 |
"lock prevents repositioning the scroller to the |
|
1354 |
actual (often rounded) position while scrolling, |
|
1355 |
and keeps it instead at the pointer position. |
|
1356 |
||
1357 |
(this avoids run-away scroller when scrolling |
|
1358 |
textviews, when the text is aligned line-wise). |
|
38 | 1359 |
Consider this as a kludge." |
7 | 1360 |
|
65 | 1361 |
lockUpdates := false. |
7 | 1362 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1363 |
vScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1364 |
vScrollBar scrollAction:[:position | |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1365 |
lockUpdates := true. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1366 |
scrolledView scrollVerticalToPercent:position. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1367 |
lockUpdates := false |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1368 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1369 |
vScrollBar scrollUpAction:[scrolledView scrollUp]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1370 |
vScrollBar scrollDownAction:[scrolledView scrollDown]. |
7 | 1371 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1372 |
hScrollBar notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1373 |
hScrollBar scrollAction:[:position | |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1374 |
lockUpdates := true. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1375 |
scrolledView scrollHorizontalToPercent:position. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1376 |
lockUpdates := false |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1377 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1378 |
hScrollBar scrollUpAction:[scrolledView scrollLeft]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1379 |
hScrollBar scrollDownAction:[scrolledView scrollRight]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1380 |
]. |
7 | 1381 |
|
65 | 1382 |
scrolledView addDependent:self. |
814 | 1383 |
|
1384 |
" |
|
1385 |
pass my keyboard input (and other subviews input) |
|
1386 |
to the scrolled view ... |
|
1387 |
" |
|
1388 |
self delegate:(KeyboardForwarder toView:scrolledView). |
|
1389 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1390 |
"Modified: 6.3.1997 / 17:03:43 / cg" |
1111 | 1391 |
"Created: 6.3.1997 / 18:06:23 / cg" |
1392 |
! |
|
1393 |
||
1394 |
setupDimensions |
|
1138 | 1395 |
"set the components dimensions (i.e. layouts) according to |
1396 |
the scrollability and hidden settings" |
|
1397 |
||
1113 | 1398 |
|scrolledViewMargin scrollBarSpacing |
1111 | 1399 |
scrolledViewLayout hScrollBarLayout vScrollBarLayout |
1400 |
vBd "{ Class: SmallInteger }" |
|
1401 |
hBd "{ Class: SmallInteger }" |
|
1402 |
sBd "{ Class: SmallInteger }" |
|
1403 |
wVScroll "{ Class: SmallInteger }" |
|
1404 |
hHScroll "{ Class: SmallInteger }" |
|
1405 |
hLeftOffs "{ Class: SmallInteger }" |
|
1406 |
hRightOffs "{ Class: SmallInteger }" |
|
1407 |
hTopOffs "{ Class: SmallInteger }" |
|
1408 |
hBottomOffs "{ Class: SmallInteger }" |
|
1409 |
sLeftOffs "{ Class: SmallInteger }" |
|
1410 |
sRightOffs "{ Class: SmallInteger }" |
|
1411 |
sTopOffs "{ Class: SmallInteger }" |
|
1412 |
sBottomOffs "{ Class: SmallInteger }" |
|
1413 |
vLeftOffs "{ Class: SmallInteger }" |
|
1414 |
vRightOffs "{ Class: SmallInteger }" |
|
1415 |
vTopOffs "{ Class: SmallInteger }" |
|
1416 |
vBottomOffs "{ Class: SmallInteger }" |
|
1417 |
addMargin "{ Class: SmallInteger }"| |
|
1418 |
||
1419 |
DefaultLevel notNil ifTrue:[self level:DefaultLevel]. |
|
1420 |
||
1421 |
sBd := 0. |
|
1422 |
DefaultScrolledViewBorderWidth notNil ifTrue:[ |
|
1423 |
sBd := DefaultScrolledViewBorderWidth. |
|
1424 |
scrolledView notNil ifTrue:[ |
|
1425 |
scrolledView borderWidth:DefaultScrolledViewBorderWidth. |
|
1426 |
] |
|
1427 |
] ifFalse:[ |
|
1428 |
scrolledView notNil ifTrue:[ |
|
1429 |
sBd := scrolledView borderWidth |
|
1430 |
] |
|
1431 |
]. |
|
1432 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1433 |
(vScrollBar notNil and:[vScrollBarHidden not]) ifTrue:[ |
1111 | 1434 |
vBd := vScrollBar borderWidth. |
1435 |
wVScroll := vScrollBar widthIncludingBorder. |
|
1436 |
] ifFalse:[ |
|
1437 |
vBd := wVScroll := 0. |
|
1438 |
]. |
|
1439 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1440 |
(hScrollBar notNil and:[hScrollBarHidden not]) ifTrue:[ |
1111 | 1441 |
hBd := hScrollBar borderWidth. |
1442 |
hHScroll := hScrollBar heightIncludingBorder. |
|
1443 |
] ifFalse:[ |
|
1444 |
hBd := hHScroll := 0. |
|
1445 |
]. |
|
1446 |
||
1447 |
"/ the raw layout ... |
|
1448 |
||
1449 |
scrolledViewLayout := ((0.0 @ 0.0) corner:(1.0@1.0)) asLayout. |
|
1450 |
hScrollBarLayout := ((0.0 @ 1.0) corner:(1.0@1.0)) asLayout. |
|
1451 |
||
1452 |
"/ the painful details; mostly complicated for 2D styles, |
|
1453 |
"/ where the positions are setUp to overlay borders ... |
|
1454 |
"/ (well, with 3D styles, a single pixel error will not be noticed; |
|
1455 |
"/ but 2D styles are very sensitive to those; |
|
1456 |
"/ the code below may not work correctly with different borderWidths). |
|
1457 |
||
1458 |
scrolledViewMargin := DefaultScrolledViewMargin. |
|
1459 |
scrollBarSpacing := DefaultScrollBarSpacing. |
|
1460 |
||
1461 |
vTopOffs := 0 - vBd + scrolledViewMargin + margin. |
|
1462 |
scrolledViewMargin == 0 ifTrue:[ |
|
1463 |
vBottomOffs := 0 + vBd - scrolledViewMargin - sBd. |
|
1464 |
] ifFalse:[ |
|
1465 |
vBottomOffs := 0 + vBd - scrolledViewMargin + sBd. |
|
1466 |
]. |
|
1467 |
||
1468 |
hLeftOffs := 0 - hBd + scrolledViewMargin + margin. |
|
1469 |
hRightOffs := 0 + hBd - scrolledViewMargin - sBd. |
|
1470 |
||
1471 |
sLeftOffs := 0 - hBd + scrolledViewMargin + margin. |
|
1472 |
sRightOffs := 0 + hBd - scrolledViewMargin - sBd - sBd - sBd. |
|
1473 |
||
1474 |
scrolledViewMargin == 0 ifTrue:[ |
|
1475 |
sTopOffs := 0 - sBd + margin. |
|
1476 |
sBottomOffs := 0 + sBd - sBd. |
|
1477 |
] ifFalse:[ |
|
1478 |
sTopOffs := 0 + scrolledViewMargin + margin. |
|
1479 |
sBottomOffs := 0 + sBd - scrolledViewMargin - sBd - sBd - sBd. |
|
1480 |
]. |
|
1481 |
||
1482 |
addMargin := 0. |
|
1483 |
"/ DefaultScrollBarLevel == DefaultScrolledViewLevel |
|
1484 |
"/ addMargin := 1. |
|
1485 |
"/ ]. |
|
1486 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1487 |
(vScrollBar notNil and:[vScrollBarHidden not]) ifTrue:[ |
1111 | 1488 |
scrollBarPosition == #right ifTrue:[ |
1489 |
"/ right/bottom |
|
1490 |
vScrollBarLayout := ((1.0 @ 0.0) corner:(1.0@1.0)) asLayout. |
|
1491 |
||
1492 |
vRightOffs := 0 - scrolledViewMargin + margin "???". |
|
1493 |
vLeftOffs := vRightOffs - wVScroll. |
|
1494 |
||
1495 |
sRightOffs := sRightOffs - scrollBarSpacing - wVScroll + sBd. |
|
1496 |
||
1497 |
hRightOffs := hRightOffs - wVScroll - scrollBarSpacing - sBd. |
|
1498 |
||
1499 |
sRightOffs := sRightOffs - addMargin |
|
1500 |
||
1501 |
] ifFalse:[ |
|
1502 |
"/ left/bottom |
|
1503 |
vScrollBarLayout := ((0.0 @ 0.0) corner:(0.0@1.0)) asLayout. |
|
1504 |
||
1505 |
vLeftOffs := 0 - vBd + scrolledViewMargin + margin. |
|
1506 |
vRightOffs := vLeftOffs + wVScroll + margin. |
|
1507 |
||
1508 |
sLeftOffs := wVScroll + scrolledViewMargin + scrollBarSpacing + margin. |
|
1509 |
sRightOffs := 0 - scrolledViewMargin - margin. |
|
1510 |
hLeftOffs := hLeftOffs + wVScroll + vBd + scrollBarSpacing. |
|
1511 |
||
1512 |
sLeftOffs := sLeftOffs + addMargin |
|
1513 |
]. |
|
1514 |
]. |
|
1515 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1516 |
(hScrollBar notNil and:[hScrollBarHidden not]) ifTrue:[ |
1111 | 1517 |
hBottomOffs := 0 - scrolledViewMargin - hBd + margin "???". |
1518 |
hTopOffs := hBottomOffs - hHScroll. |
|
1519 |
scrolledViewMargin == 0 ifTrue:[ |
|
1520 |
hTopOffs := hTopOffs + sBd + sBd |
|
1521 |
]. |
|
1522 |
sBottomOffs := sBottomOffs - scrollBarSpacing - hHScroll. |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1523 |
(vScrollBar notNil and:[vScrollBarHidden not]) ifTrue:[ |
1111 | 1524 |
vBottomOffs := vBottomOffs - scrollBarSpacing - hHScroll. |
1525 |
]. |
|
1526 |
||
1527 |
sBottomOffs := sBottomOffs - addMargin. |
|
1528 |
hRightOffs := hRightOffs - addMargin. |
|
1529 |
]. |
|
1530 |
||
1531 |
scrolledView notNil ifTrue:[ |
|
1532 |
scrolledViewLayout leftOffset:sLeftOffs. |
|
1533 |
scrolledViewLayout rightOffset:sRightOffs. |
|
1534 |
scrolledViewLayout topOffset:sTopOffs. |
|
1535 |
scrolledViewLayout bottomOffset:sBottomOffs. |
|
1536 |
||
1537 |
scrolledView level:DefaultScrolledViewLevel. |
|
1538 |
scrolledView layout:scrolledViewLayout. |
|
1539 |
]. |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1540 |
(hScrollBar notNil and:[hScrollBarHidden not]) ifTrue:[ |
1111 | 1541 |
hScrollBarLayout leftOffset:hLeftOffs. |
1542 |
hScrollBarLayout rightOffset:hRightOffs. |
|
1543 |
hScrollBarLayout topOffset:hTopOffs. |
|
1544 |
hScrollBarLayout bottomOffset:hBottomOffs. |
|
1545 |
||
1546 |
hScrollBar level:DefaultScrollBarLevel. |
|
1547 |
hScrollBar layout:hScrollBarLayout |
|
1548 |
]. |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1549 |
(vScrollBar notNil and:[vScrollBarHidden not]) ifTrue:[ |
1111 | 1550 |
vScrollBarLayout leftOffset:vLeftOffs. |
1551 |
vScrollBarLayout rightOffset:vRightOffs. |
|
1552 |
vScrollBarLayout topOffset:vTopOffs. |
|
1553 |
vScrollBarLayout bottomOffset:vBottomOffs. |
|
1554 |
||
1555 |
vScrollBar level:DefaultScrollBarLevel. |
|
1556 |
vScrollBar layout:vScrollBarLayout |
|
1557 |
]. |
|
1558 |
||
1559 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
1138 | 1560 |
"Modified: 19.3.1997 / 16:33:56 / cg" |
1111 | 1561 |
! |
1562 |
||
1563 |
setupVertical:isVertical mini:miniV horizontal:isHorizontal mini:miniH |
|
1564 |
"setup scrollbars as specified in the arguments" |
|
1565 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1566 |
|noMiniScrollers| |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1567 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1568 |
vScrollBarHidden := hScrollBarHidden := false. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1569 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1570 |
hasVerticalScrollBar := isVertical. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1571 |
hasHorizontalScrollBar := isHorizontal. |
1111 | 1572 |
|
1573 |
noMiniScrollers := styleSheet at:'scrollBarNeverMini' default:false. |
|
1574 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1575 |
verticalMini := miniV. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1576 |
verticalMini ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1577 |
noMiniScrollers ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1578 |
verticalMini := false |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1579 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1580 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1581 |
horizontalMini := miniH. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1582 |
horizontalMini ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1583 |
noMiniScrollers ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1584 |
horizontalMini := false |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1585 |
] |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1586 |
]. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1587 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1588 |
self setupViews. |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1589 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1590 |
"Modified: 7.3.1997 / 22:09:12 / cg" |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1591 |
! |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1592 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1593 |
setupViews |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1594 |
"setup scrollbars as specified in the arguments" |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1595 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1596 |
|cls| |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1597 |
|
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1598 |
hasVerticalScrollBar ifTrue:[ |
1111 | 1599 |
cls := ScrollBar. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1600 |
verticalMini ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1601 |
cls := MiniScroller |
1111 | 1602 |
]. |
1603 |
(vScrollBar notNil |
|
1604 |
and:[vScrollBar class ~~ cls]) ifTrue:[ |
|
1605 |
self releaseVerticalScrollBar |
|
1606 |
]. |
|
1607 |
vScrollBar isNil ifTrue:[ |
|
1608 |
vScrollBar := cls in:self. |
|
1609 |
]. |
|
1610 |
vScrollBar thumbOrigin:0 thumbHeight:100. |
|
1611 |
] ifFalse:[ |
|
1612 |
vScrollBar notNil ifTrue:[ |
|
1613 |
self releaseVerticalScrollBar |
|
1614 |
] |
|
1615 |
]. |
|
1616 |
||
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1617 |
hasHorizontalScrollBar ifTrue:[ |
1111 | 1618 |
cls := HorizontalScrollBar. |
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1619 |
horizontalMini ifTrue:[ |
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1620 |
cls := HorizontalMiniScroller |
1111 | 1621 |
]. |
1622 |
(hScrollBar notNil |
|
1623 |
and:[hScrollBar class ~~ cls]) ifTrue:[ |
|
1624 |
self releaseHorizontalScrollBar |
|
1625 |
]. |
|
1626 |
hScrollBar isNil ifTrue:[ |
|
1627 |
hScrollBar := cls in:self. |
|
1628 |
]. |
|
1629 |
hScrollBar thumbOrigin:0 thumbHeight:100. |
|
1630 |
] ifFalse:[ |
|
1631 |
hScrollBar notNil ifTrue:[ |
|
1632 |
self releaseHorizontalScrollBar |
|
1633 |
] |
|
1634 |
]. |
|
1635 |
||
1636 |
scrolledView notNil ifTrue:[ |
|
1637 |
self setScrollActions. |
|
1638 |
] |
|
1639 |
||
1640 |
"Created: 6.3.1997 / 18:06:23 / cg" |
|
1126
2c698745c81f
added support for automatic scrollBar hiding.
Claus Gittinger <cg@exept.de>
parents:
1125
diff
changeset
|
1641 |
"Modified: 7.3.1997 / 21:54:34 / cg" |
7 | 1642 |
! ! |
1643 |
||
217 | 1644 |
!ScrollableView methodsFor:'queries'! |
38 | 1645 |
|
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1646 |
isHorizontalScrollable |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1647 |
"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
|
1648 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1649 |
^ hScrollBar notNil |
819
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1650 |
|
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1651 |
"Modified: 6.3.1997 / 17:03:49 / cg" |
1111 | 1652 |
"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
|
1653 |
! |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1654 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1655 |
isVerticalScrollable |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1656 |
"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
|
1657 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1658 |
^ vScrollBar notNil |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1659 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1660 |
"Modified: 6.3.1997 / 17:03:52 / cg" |
1111 | 1661 |
"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
|
1662 |
! |
32ac89843fa8
Send only one scroll message for horizontal and vertical scroll
Stefan Vogel <sv@exept.de>
parents:
814
diff
changeset
|
1663 |
|
217 | 1664 |
preferredExtent |
572 | 1665 |
"return my preferredExtent from the scrolledViews prefExtent |
1666 |
plus the size of the scrollBar" |
|
1667 |
||
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1668 |
|slavesPref prefX prefY| |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1669 |
|
799 | 1670 |
"/ If I have an explicit preferredExtent .. |
1671 |
||
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1672 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1673 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1674 |
]. |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
703
diff
changeset
|
1675 |
|
217 | 1676 |
scrolledView notNil ifTrue:[ |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1677 |
slavesPref := scrolledView preferredExtent. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1678 |
prefX := slavesPref x. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1679 |
prefY := slavesPref y. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1680 |
vScrollBar notNil ifTrue:[ |
1111 | 1681 |
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
|
1682 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1683 |
hScrollBar notNil ifTrue:[ |
1111 | 1684 |
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
|
1685 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1686 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1687 |
^ prefX @ prefY. |
0 | 1688 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1689 |
|
217 | 1690 |
^ super preferredExtent. |
572 | 1691 |
|
1111 | 1692 |
"Created: 6.3.1997 / 18:06:24 / cg" |
1693 |
"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
|
1694 |
! |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1695 |
|
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1696 |
preferredExtentForLines:numLines cols:numCols |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1697 |
"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
|
1698 |
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
|
1699 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1700 |
|slavesPref prefX prefY| |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1701 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1702 |
"/ 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
|
1703 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1704 |
preferredExtent notNil ifTrue:[ |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1705 |
^ preferredExtent |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1706 |
]. |
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1707 |
|
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1708 |
scrolledView notNil ifTrue:[ |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1709 |
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
|
1710 |
prefX := slavesPref x. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1711 |
prefY := slavesPref y. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1712 |
vScrollBar notNil ifTrue:[ |
1111 | 1713 |
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
|
1714 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1715 |
hScrollBar notNil ifTrue:[ |
1111 | 1716 |
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
|
1717 |
]. |
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1718 |
|
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1719 |
^ prefX @ prefY. |
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1720 |
]. |
1104
88b80680773e
about to merge V & HV scrollableView into a single
Claus Gittinger <cg@exept.de>
parents:
1097
diff
changeset
|
1721 |
|
678
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1722 |
^ super preferredExtent. |
c1967a46b2c1
added query for lines/cols - prefExt
Claus Gittinger <cg@exept.de>
parents:
608
diff
changeset
|
1723 |
|
1111 | 1724 |
"Created: 6.3.1997 / 18:06:24 / cg" |
1725 |
"Modified: 6.3.1997 / 22:34:30 / cg" |
|
0 | 1726 |
! ! |
1727 |
||
1728 |
!ScrollableView methodsFor:'slave-view messages'! |
|
1729 |
||
1024 | 1730 |
clear |
1138 | 1731 |
"convenient method: forward this to the scrolledView" |
1732 |
||
1073 | 1733 |
scrolledView notNil ifTrue:[scrolledView clear] |
1024 | 1734 |
|
1111 | 1735 |
"Created: 6.3.1997 / 18:06:24 / cg" |
1138 | 1736 |
"Modified: 19.3.1997 / 16:34:19 / cg" |
1024 | 1737 |
! |
1738 |
||
217 | 1739 |
doesNotUnderstand:aMessage |
1740 |
"this is funny: all message we do not understand, are passed |
|
1741 |
on to the scrolledView - so we do not have to care for all |
|
1742 |
possible messages ...(thanks to the Message class)" |
|
1743 |
||
1744 |
scrolledView isNil ifFalse:[ |
|
1111 | 1745 |
^ scrolledView perform:(aMessage selector) |
1746 |
withArguments:(aMessage arguments) |
|
1747 |
]. |
|
1748 |
^ super doesNotUnderstand:aMessage |
|
1749 |
||
1750 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
1751 |
"Modified: 6.3.1997 / 18:38:54 / cg" |
|
217 | 1752 |
! |
1753 |
||
0 | 1754 |
leftButtonMenu |
38 | 1755 |
"return scrolledViews leftbuttonmenu" |
1756 |
||
1757 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 1758 |
^ scrolledView leftButtonMenu |
1111 | 1759 |
|
1760 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1761 |
! |
1762 |
||
1763 |
leftButtonMenu:aMenu |
|
1764 |
"pass on leftbuttonmenu to scrolledView" |
|
1765 |
||
1766 |
scrolledView leftButtonMenu:aMenu |
|
1111 | 1767 |
|
1768 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1769 |
! |
1770 |
||
1771 |
middleButtonMenu |
|
38 | 1772 |
"return scrolledViews middlebuttonmenu" |
1773 |
||
1774 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 1775 |
^ scrolledView middleButtonMenu |
1111 | 1776 |
|
1777 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1778 |
! |
1779 |
||
1780 |
middleButtonMenu:aMenu |
|
1781 |
"pass on middlebuttonmenu to scrolledView" |
|
1782 |
||
1783 |
scrolledView middleButtonMenu:aMenu |
|
1111 | 1784 |
|
1785 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1786 |
! |
1787 |
||
562 | 1788 |
model |
754 | 1789 |
"return my scrolledViews model" |
1790 |
||
1085 | 1791 |
scrolledView isNil ifTrue:[^ nil]. |
562 | 1792 |
^ scrolledView model |
1793 |
||
1085 | 1794 |
"Modified: 1.3.1997 / 01:38:07 / cg" |
1111 | 1795 |
"Created: 6.3.1997 / 18:06:24 / cg" |
562 | 1796 |
! |
1797 |
||
1798 |
model:aModel |
|
754 | 1799 |
"forward model change to my scrolledViews" |
1800 |
||
562 | 1801 |
^ scrolledView model:aModel |
1802 |
||
754 | 1803 |
"Modified: 5.6.1996 / 17:09:50 / cg" |
1111 | 1804 |
"Created: 6.3.1997 / 18:06:24 / cg" |
562 | 1805 |
! |
1806 |
||
0 | 1807 |
rightButtonMenu |
38 | 1808 |
"return scrolledViews rightbuttonmenu" |
1809 |
||
1810 |
scrolledView isNil ifTrue:[^ nil]. |
|
0 | 1811 |
^ scrolledView rightButtonMenu |
1111 | 1812 |
|
1813 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
0 | 1814 |
! |
1815 |
||
1816 |
rightButtonMenu:aMenu |
|
1817 |
"pass on rightbuttonmenu to scrolledView" |
|
1818 |
||
1819 |
scrolledView rightButtonMenu:aMenu |
|
1111 | 1820 |
|
1821 |
"Created: 6.3.1997 / 18:06:24 / cg" |
|
38 | 1822 |
! ! |
1823 |
||
852 | 1824 |
!ScrollableView class methodsFor:'documentation'! |
0 | 1825 |
|
217 | 1826 |
version |
1140 | 1827 |
^ '$Header: /cvs/stx/stx/libwidg/ScrollableView.st,v 1.58 1997-03-19 16:26:31 cg Exp $' |
0 | 1828 |
! ! |