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