author | Claus Gittinger <cg@exept.de> |
Tue, 10 Dec 2002 11:46:23 +0100 | |
changeset 2402 | 4425948481b4 |
parent 2375 | e0c7852263e4 |
child 2404 | 2b7591c982ac |
permissions | -rw-r--r-- |
1 | 1 |
" |
2 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
24 | 3 |
All Rights Reserved |
1 | 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 |
||
1763
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1694
diff
changeset
|
13 |
"{ Package: 'stx:libwidg2' }" |
7d6d64622ee4
change & updates fixed (monochrome bitmaps)
Claus Gittinger <cg@exept.de>
parents:
1694
diff
changeset
|
14 |
|
296 | 15 |
View subclass:#ImageView |
2158 | 16 |
instanceVariableNames:'image magnifiedImage adjust imageChannel tileMode tileOffset' |
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
17 |
classVariableNames:'DoNotMagnifyQuery' |
161 | 18 |
poolDictionaries:'' |
19 |
category:'Views-Misc' |
|
1 | 20 |
! |
21 |
||
257 | 22 |
!ImageView class methodsFor:'documentation'! |
26 | 23 |
|
24 |
copyright |
|
25 |
" |
|
26 |
COPYRIGHT (c) 1993 by Claus Gittinger |
|
27 |
All Rights Reserved |
|
28 |
||
29 |
This software is furnished under a license and may be used |
|
30 |
only in accordance with the terms of that license and with the |
|
31 |
inclusion of the above copyright notice. This software may not |
|
32 |
be provided or otherwise made available to, or used by, any |
|
33 |
other person. No title to or ownership of the software is |
|
34 |
hereby transferred. |
|
35 |
" |
|
36 |
! |
|
37 |
||
38 |
documentation |
|
39 |
" |
|
40 |
This View knows how to display an image (or form). |
|
41 |
||
42 |
You can display an image with: |
|
43 |
||
296 | 44 |
ImageView openOn:anImageFileName |
26 | 45 |
or: |
296 | 46 |
ImageView openOnImage:anImage |
47 | 47 |
or: |
296 | 48 |
ImageView new image:anImage |
26 | 49 |
|
50 |
i.e. |
|
51 |
||
353 | 52 |
ImageView openOn:'bitmaps/gifImages/garfield.gif' |
296 | 53 |
ImageView openOn:'bitmaps/SBrowser.xbm' |
54 |
||
353 | 55 |
ImageView openOnImage:(Image fromFile:'bitmaps/gifImages/garfield.gif') |
296 | 56 |
ImageView openOnImage:(Image fromFile:'bitmaps/SBrowser.xbm') |
26 | 57 |
|
2158 | 58 |
adjust: |
59 |
controls how images are displayed; |
|
60 |
can be one of: |
|
2375 | 61 |
#topLeft - image is displayed as usual |
2158 | 62 |
#center - image is shown centered |
63 |
#fitBig - big images are shrunk to make it fit the view |
|
64 |
#fitSmall - small images are magnified to make it fit the view, |
|
65 |
#fit - all images are magnified to fit the view |
|
66 |
||
296 | 67 |
[author:] |
68 |
Claus Gittinger |
|
69 |
||
70 |
[see also:] |
|
71 |
Image Form |
|
26 | 72 |
" |
73 |
! ! |
|
74 |
||
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
75 |
!ImageView class methodsFor:'initialization'! |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
76 |
|
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
77 |
initialize |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
78 |
DoNotMagnifyQuery := QuerySignal new defaultAnswer:false. |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
79 |
! ! |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
80 |
|
1694 | 81 |
!ImageView class methodsFor:'queries - plugin'! |
82 |
||
83 |
aspectSelectors |
|
84 |
^ #( imageChannel ) |
|
85 |
||
86 |
"Created: / 11.2.2000 / 00:37:33 / cg" |
|
87 |
! ! |
|
88 |
||
257 | 89 |
!ImageView class methodsFor:'startup'! |
1 | 90 |
|
11 | 91 |
openOn:aFileName |
47 | 92 |
"startup an image viewer on an image read from a file" |
93 |
||
1970 | 94 |
|fn imageView img e| |
95 |
||
96 |
fn := aFileName asFilename. |
|
47 | 97 |
|
1970 | 98 |
img := Image fromFile:fn. |
47 | 99 |
img isNil ifTrue:[ |
1970 | 100 |
fn exists ifTrue:[ |
348 | 101 |
e := 'unknown/unsupported image format' |
102 |
] ifFalse:[ |
|
103 |
e := 'no such image'. |
|
104 |
]. |
|
105 |
self warn:e. |
|
106 |
^ nil |
|
47 | 107 |
]. |
353 | 108 |
imageView := self openOnImage:img. |
47 | 109 |
|
1970 | 110 |
imageView topView label:fn pathName iconLabel:(fn baseName). |
47 | 111 |
|
353 | 112 |
^ imageView |
1 | 113 |
|
47 | 114 |
" |
353 | 115 |
ImageView openOn:'bitmaps/gifImages/garfield.gif' |
116 |
ImageView openOn:'bitmaps/xpmBitmaps/BOOK.xpm' |
|
47 | 117 |
" |
348 | 118 |
|
599 | 119 |
"Modified: / 31.10.1997 / 16:17:52 / cg" |
47 | 120 |
! |
121 |
||
122 |
openOnImage:anImage |
|
123 |
"startup an image viewer on an image" |
|
1 | 124 |
|
635 | 125 |
|top v imageView icnW icnH iconView magX magY mag lbl imgWidth imgHeight| |
47 | 126 |
|
127 |
anImage isImage ifTrue:[ |
|
353 | 128 |
lbl := 'an Image' |
47 | 129 |
] ifFalse:[ |
353 | 130 |
lbl := 'a Form' |
47 | 131 |
]. |
132 |
top := StandardSystemView label:lbl. |
|
1 | 133 |
|
134 |
v := HVScrollableView for:self in:top. |
|
135 |
v origin:0@0 extent:1.0@1.0. |
|
136 |
imageView := v scrolledView. |
|
137 |
||
47 | 138 |
anImage notNil ifTrue:[ |
353 | 139 |
imageView image:anImage. |
7 | 140 |
|
353 | 141 |
"define an icon view showing a little version of image. |
142 |
Since some window managers cannot handle this correctly (twm), |
|
143 |
this is only done when running on an IRIS" |
|
7 | 144 |
|
353 | 145 |
(true "(OperatingSystem getSystemType = 'iris')" |
146 |
and:[StyleSheet name == #iris]) ifTrue:[ |
|
599 | 147 |
iconView := ImageView new. |
7 | 148 |
|
353 | 149 |
"for now; should somehow get access to preferred iconview extent ..." |
150 |
icnW := 86. |
|
599 | 151 |
icnH := 68. |
7 | 152 |
|
635 | 153 |
imgWidth := anImage width. |
154 |
imgHeight := anImage height. |
|
155 |
||
156 |
((imgWidth <= icnW) and:[imgHeight <= icnH]) ifTrue:[ |
|
157 |
iconView extent:(imgWidth @ imgHeight). |
|
353 | 158 |
mag := 1 @ 1 |
159 |
] ifFalse:[ |
|
635 | 160 |
magX := icnW / imgWidth. |
161 |
magY := icnH / imgHeight. |
|
7 | 162 |
|
353 | 163 |
"scale image" |
7 | 164 |
" |
353 | 165 |
mag := magX @ magY. |
7 | 166 |
" |
353 | 167 |
"preserve ratio" |
7 | 168 |
" |
353 | 169 |
mag := (magX min:magY) asPoint. |
7 | 170 |
" |
171 |
" " |
|
353 | 172 |
mag := (magX max:magY) asPoint. |
7 | 173 |
" " |
174 |
||
353 | 175 |
iconView extent:((anImage width @ anImage height) * mag) rounded. |
176 |
]. |
|
7 | 177 |
|
353 | 178 |
top iconView:iconView. |
179 |
]. |
|
7 | 180 |
]. |
181 |
||
182 |
top open. |
|
183 |
||
26 | 184 |
iconView notNil ifTrue:[ |
353 | 185 |
top windowGroup addView:iconView. |
186 |
[ |
|
2099 | 187 |
iconView image:(anImage magnifiedBy:mag). |
353 | 188 |
] forkAt:4 |
7 | 189 |
]. |
353 | 190 |
^ imageView |
1 | 191 |
|
26 | 192 |
" |
353 | 193 |
ImageView openOnImage:(Image fromFile:'bitmaps/gifImages/garfield.gif') |
47 | 194 |
ImageView openOnImage:(Image fromFile:'bitmaps/SBrowser.xbm') |
26 | 195 |
" |
353 | 196 |
|
635 | 197 |
"Modified: / 18.12.1997 / 11:46:19 / cg" |
1 | 198 |
! ! |
199 |
||
161 | 200 |
!ImageView methodsFor:'accessing'! |
201 |
||
202 |
adjust:layoutSymbol |
|
203 |
"set the adjust (how the image is displayed); |
|
2375 | 204 |
currently, only support #topLeft, #center, #fitBig, #fitSmall and #fit: |
205 |
#topLeft - image is displayed as usual |
|
206 |
#center - image is shown centered |
|
207 |
#fitBig - big images are shrunk to make it fit the view |
|
208 |
#fitSmall - small images are magnified to make it fit the view, |
|
209 |
#fit - all images are magnified to fit the view |
|
210 |
" |
|
2158 | 211 |
|
2164 | 212 |
adjust ~= layoutSymbol ifTrue:[ |
213 |
adjust := layoutSymbol. |
|
161 | 214 |
|
2164 | 215 |
magnifiedImage := nil. |
216 |
self shown ifTrue:[ |
|
217 |
image notNil ifTrue:[ |
|
218 |
self generateMagnifiedImage. |
|
219 |
self clear. |
|
220 |
self scrollToTopLeft. |
|
221 |
self invalidate. |
|
222 |
self contentsChanged. |
|
223 |
] |
|
224 |
]. |
|
2158 | 225 |
]. |
161 | 226 |
! |
227 |
||
228 |
image |
|
229 |
"return the image" |
|
230 |
||
231 |
^ image |
|
232 |
! |
|
233 |
||
234 |
image:anImage |
|
235 |
"set the image - show a wait cursor, since image dithering may take a while" |
|
1 | 236 |
|
1993 | 237 |
"/ image ~= anImage ifTrue:[ |
2089 | 238 |
self setImage:anImage |
1993 | 239 |
"/ ] |
240 |
! |
|
241 |
||
242 |
setImage:anImage |
|
243 |
"set the image - show a wait cursor, since image dithering may take a while" |
|
244 |
||
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
245 |
|oldSize newSize| |
1993 | 246 |
|
247 |
oldSize := image ifNil:[0@0] ifNotNil:[image extent]. |
|
248 |
||
249 |
image := anImage. |
|
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
250 |
magnifiedImage := nil. |
2158 | 251 |
self generateMagnifiedImage. |
1993 | 252 |
|
2158 | 253 |
newSize := image ifNil:[0@0] ifNotNil:[(magnifiedImage ? image) extent]. |
2164 | 254 |
self scrollToTopLeft. |
255 |
||
1993 | 256 |
oldSize ~= newSize ifTrue:[ |
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
257 |
"/ avoid endless loop in case of a resize happening due |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
258 |
"/ to scrollBar visibility changes. |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
259 |
"/ that QuerySignal suppresses another magnification in sizeChanged: |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
260 |
DoNotMagnifyQuery answer:true |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
261 |
do:[ |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
262 |
self contentsChanged. |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
263 |
] |
1993 | 264 |
]. |
265 |
||
266 |
shown ifTrue:[ |
|
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
267 |
self clear. |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
268 |
self invalidate |
1993 | 269 |
]. |
270 |
self changed:#image. |
|
1694 | 271 |
|
272 |
"Modified: / 10.2.2000 / 23:25:51 / cg" |
|
2089 | 273 |
! |
274 |
||
275 |
tileMode:aBoolean tileOffset:aPoint |
|
276 |
||
277 |
tileMode := aBoolean. |
|
278 |
tileOffset := aPoint |
|
1694 | 279 |
! ! |
280 |
||
2402 | 281 |
!ImageView methodsFor:'accessing - channels'! |
1510
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
282 |
|
1694 | 283 |
imageChannel |
284 |
imageChannel isNil ifTrue:[ |
|
285 |
imageChannel := ValueHolder new. |
|
286 |
imageChannel addDependent:self. |
|
287 |
]. |
|
288 |
^ imageChannel |
|
289 |
||
290 |
"Created: / 11.2.2000 / 00:34:44 / cg" |
|
291 |
! |
|
292 |
||
293 |
imageChannel:aValueHolder |
|
294 |
imageChannel notNil ifTrue:[ |
|
295 |
imageChannel removeDependent:self. |
|
161 | 296 |
]. |
1694 | 297 |
imageChannel := aValueHolder. |
298 |
imageChannel notNil ifTrue:[ |
|
299 |
imageChannel addDependent:self. |
|
300 |
]. |
|
301 |
||
302 |
"Created: / 11.2.2000 / 00:34:33 / cg" |
|
303 |
! ! |
|
1135
75101bf02c5b
send contentsChanged notifications before, to avoid
Claus Gittinger <cg@exept.de>
parents:
1071
diff
changeset
|
304 |
|
1694 | 305 |
!ImageView methodsFor:'change & update'! |
306 |
||
307 |
update:something with:aParameter from:changedObject |
|
308 |
something == imageChannel ifTrue:[ |
|
309 |
self image:(imageChannel value). |
|
310 |
^ self |
|
311 |
]. |
|
312 |
super update:something with:aParameter from:changedObject |
|
313 |
||
314 |
"Created: / 11.2.2000 / 00:37:02 / cg" |
|
1 | 315 |
! ! |
316 |
||
317 |
!ImageView methodsFor:'drawing'! |
|
318 |
||
2158 | 319 |
generateMagnifiedImage |
320 |
|doFit innerWidth innerHeight imgWidth imgHeight| |
|
321 |
||
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
322 |
magnifiedImage notNil ifTrue:[ |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
323 |
^ self |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
324 |
]. |
2358 | 325 |
image isNil ifTrue:[ |
326 |
^ self |
|
327 |
]. |
|
328 |
||
2158 | 329 |
doFit := false. |
330 |
||
331 |
innerWidth := self innerWidth. |
|
332 |
innerHeight := self innerHeight. |
|
333 |
||
334 |
imgWidth := image width. |
|
335 |
imgHeight := image height. |
|
336 |
||
337 |
tileMode ~~ true ifTrue:[ |
|
338 |
((imgWidth > innerWidth) |
|
339 |
or:[imgHeight > innerHeight]) ifTrue:[ |
|
340 |
((adjust == #fit) or:[adjust == #fitBig]) ifTrue:[ |
|
341 |
doFit := true |
|
342 |
]. |
|
343 |
] ifFalse:[ |
|
344 |
((imgWidth < innerWidth) |
|
345 |
or:[imgHeight < innerHeight]) ifTrue:[ |
|
346 |
((adjust == #fit) or:[adjust == #fitSmall]) ifTrue:[ |
|
347 |
doFit := true |
|
348 |
]. |
|
349 |
] |
|
350 |
]. |
|
351 |
]. |
|
352 |
doFit ifTrue:[ |
|
353 |
magnifiedImage := image magnifiedPreservingRatioTo:(innerWidth @ innerHeight). |
|
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
354 |
"/ self contentsChanged. |
2164 | 355 |
] ifFalse:[ |
356 |
magnifiedImage := image |
|
2158 | 357 |
]. |
358 |
! |
|
359 |
||
210
1a3b06d71a03
faster redraw; care for margins
Claus Gittinger <cg@exept.de>
parents:
207
diff
changeset
|
360 |
redrawX:x y:y width:w height:h |
2158 | 361 |
|xI yI depth shownImage imgWidth imgHeight right bott| |
11 | 362 |
|
1 | 363 |
image notNil ifTrue:[ |
2158 | 364 |
self generateMagnifiedImage. |
365 |
||
366 |
shownImage := magnifiedImage ? image. |
|
367 |
imgWidth := shownImage width. |
|
368 |
imgHeight := shownImage height. |
|
635 | 369 |
|
414 | 370 |
adjust == #center ifTrue:[ |
635 | 371 |
xI := (width - (margin * 2) - imgWidth) // 2. |
372 |
yI := (height - (margin * 2) - imgHeight) // 2. |
|
414 | 373 |
] ifFalse:[ |
374 |
xI := yI := margin |
|
375 |
]. |
|
376 |
||
2158 | 377 |
((depth := shownImage depth) == 1) ifTrue:[ |
378 |
self paint:(shownImage colorFromValue:1) |
|
379 |
on:(shownImage colorFromValue:0). |
|
1510
fd0cd6065dc6
catch image conversion errors.
Claus Gittinger <cg@exept.de>
parents:
1327
diff
changeset
|
380 |
]. |
1071
981c97fe54de
generate device image before clearing in redraw
Claus Gittinger <cg@exept.de>
parents:
677
diff
changeset
|
381 |
|
2089 | 382 |
tileMode == true ifTrue:[ |
383 |
(depth == 1 |
|
384 |
and:[image mask isNil]) ifFalse:[ |
|
385 |
self clearRectangleX:x y:y width:w height:h. |
|
386 |
0 to:y+h by:tileOffset y do:[:oY | |
|
387 |
0 to:x+w by:tileOffset x do:[:oX | |
|
388 |
self displayForm:image x:oX y:oY |
|
389 |
] |
|
390 |
]. |
|
391 |
] ifTrue:[ |
|
392 |
0 to:y+h by:tileOffset y do:[:oY | |
|
393 |
0 to:x+w by:tileOffset x do:[:oX | |
|
394 |
self displayOpaqueForm:image x:oX y:oY |
|
395 |
] |
|
396 |
]. |
|
397 |
]. |
|
398 |
] ifFalse:[ |
|
399 |
(depth == 1 |
|
2158 | 400 |
and:[shownImage mask isNil]) ifFalse:[ |
2089 | 401 |
self clearRectangleX:x y:y width:w height:h. |
2158 | 402 |
self displayForm:shownImage x:xI y:yI |
2089 | 403 |
] ifTrue:[ |
2158 | 404 |
self displayOpaqueForm:shownImage x:xI y:yI |
2089 | 405 |
]. |
430 | 406 |
|
2089 | 407 |
"/ right of image ? |
408 |
right := x + w - 1. |
|
409 |
right > (xI + imgWidth) ifTrue:[ |
|
410 |
self clearRectangleX:(xI + imgWidth) |
|
411 |
y:y |
|
412 |
width:(right - imgWidth - xI) |
|
413 |
height:h |
|
414 |
]. |
|
415 |
"/ below of image ? |
|
416 |
bott := y + h - 1. |
|
417 |
bott > (yI + imgHeight) ifTrue:[ |
|
418 |
self clearRectangleX:margin |
|
419 |
y:(yI + imgHeight) |
|
420 |
width:w |
|
421 |
height:(bott - imgHeight - yI) |
|
422 |
]. |
|
430 | 423 |
]. |
1 | 424 |
] |
89 | 425 |
|
635 | 426 |
"Created: / 11.7.1996 / 21:02:12 / cg" |
1071
981c97fe54de
generate device image before clearing in redraw
Claus Gittinger <cg@exept.de>
parents:
677
diff
changeset
|
427 |
"Modified: / 12.8.1998 / 14:02:28 / cg" |
1 | 428 |
! ! |
429 |
||
2158 | 430 |
!ImageView methodsFor:'event handling'! |
431 |
||
432 |
sizeChanged:how |
|
433 |
magnifiedImage notNil ifTrue:[ |
|
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
434 |
DoNotMagnifyQuery query ifFalse:[ |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
435 |
magnifiedImage := nil. |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
436 |
self generateMagnifiedImage. |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
437 |
self clear. |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
438 |
self invalidate. |
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
439 |
] |
2158 | 440 |
]. |
441 |
super sizeChanged:how |
|
442 |
! ! |
|
443 |
||
1327 | 444 |
!ImageView methodsFor:'initialize / release'! |
445 |
||
446 |
destroy |
|
447 |
image := nil. |
|
448 |
super destroy. |
|
449 |
! ! |
|
450 |
||
161 | 451 |
!ImageView methodsFor:'queries'! |
24 | 452 |
|
161 | 453 |
heightOfContents |
454 |
"return the images height - scrollbar needs this info" |
|
1 | 455 |
|
161 | 456 |
image isNil ifTrue:[^ 0]. |
2158 | 457 |
^ (magnifiedImage ? image) height |
89 | 458 |
! |
459 |
||
1 | 460 |
widthOfContents |
461 |
"return the images width - scrollbar needs this info" |
|
462 |
||
463 |
image isNil ifTrue:[^ 0]. |
|
2158 | 464 |
^ (magnifiedImage ? image) width |
161 | 465 |
! ! |
466 |
||
257 | 467 |
!ImageView class methodsFor:'documentation'! |
161 | 468 |
|
469 |
version |
|
2402 | 470 |
^ '$Header: /cvs/stx/stx/libwidg2/ImageView.st,v 1.53 2002-12-10 10:46:23 cg Exp $' |
1 | 471 |
! ! |
2358 | 472 |
|
2160
4c15f05f8bc6
somewhat complicated: under win32 style, a magnify leads to scrollbars
Claus Gittinger <cg@exept.de>
parents:
2158
diff
changeset
|
473 |
ImageView initialize! |