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