author | Stefan Vogel <sv@exept.de> |
Sun, 26 Oct 2008 21:08:14 +0100 | |
changeset 3750 | 3d4912629acf |
parent 3609 | 3bd1b03b1ffb |
child 3866 | 7628105ef29f |
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 |
" |
|
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
12 |
"{ Package: 'stx:libwidg' }" |
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
13 |
|
77 | 14 |
DialogBox subclass:#InfoBox |
355 | 15 |
instanceVariableNames:'formLabel textLabel' |
16 |
classVariableNames:'InfoBitmap' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'Views-DialogBoxes' |
|
0 | 19 |
! |
20 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
21 |
!InfoBox class methodsFor:'documentation'! |
0 | 22 |
|
197 | 23 |
copyright |
24 |
" |
|
25 |
COPYRIGHT (c) 1989 by Claus Gittinger |
|
26 |
All Rights Reserved |
|
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 |
||
77 | 37 |
! |
8 | 38 |
|
39 |
documentation |
|
40 |
" |
|
355 | 41 |
Historic note: |
42 |
originally, ST/X had separate classes for the various entry methods; |
|
43 |
there were YesNoBox, EnterBox, InfoBox and so on. |
|
44 |
In the meantime, the DialogBox class (and therefore its alias: Dialog) |
|
45 |
is going to duplicate most funcionality found in these classes. |
|
46 |
||
47 |
In the future, those existing subclasses' functionality is going to |
|
48 |
be moved fully into Dialog, and the subclasses will be replaced by dummy |
|
49 |
delegators. (They will be kept for backward compatibility, though). |
|
50 |
||
51 |
||
52 |
||
38 | 53 |
this class implements a pop-up box to show an information message. |
54 |
It has a single ok-Button, which closes the box. |
|
55 |
Also entering return has (by default) the same effect as pressing |
|
56 |
the ok-button. |
|
59 | 57 |
InfoBox is a superclass of some other boxes - see WarningBox, YesNoBox etc. |
58 |
most of them simply redefine the icon shown in the upper left or |
|
59 |
add buttons. |
|
60 |
||
585 | 61 |
[instance variables:] |
59 | 62 |
|
355 | 63 |
formLabel <Label> shows a bitmap (warning, question-mark) |
59 | 64 |
|
355 | 65 |
textLabel <Label> shows the boxes text |
59 | 66 |
|
585 | 67 |
|
68 |
[author:] |
|
69 |
Claus Gittinger |
|
77 | 70 |
" |
59 | 71 |
|
77 | 72 |
! |
38 | 73 |
|
77 | 74 |
examples |
75 |
" |
|
2469 | 76 |
Notice, the preferred use is via the DialogBox class messages, |
77 |
such as |
|
78 |
[exBegin] |
|
79 |
Dialog information:'Time to go home' |
|
80 |
[exEnd] |
|
81 |
these (DialogBox) mesages are compatible with VW and should therefore |
|
82 |
be used for portability. |
|
83 |
||
84 |
Direct use of InfoBox is only required for highly specialized boxes. |
|
85 |
||
86 |
||
87 |
||
59 | 88 |
InfoBoxes are created with: |
89 |
||
370 | 90 |
aBox := InfoBox title:'some title'. |
38 | 91 |
|
92 |
and shown with: |
|
93 |
||
370 | 94 |
aBox showAtPointer |
59 | 95 |
or |
370 | 96 |
aBox open |
38 | 97 |
|
98 |
The default box shows 'yes' in its button; this can be changed with: |
|
99 |
||
370 | 100 |
aBox okText:'some string'. |
38 | 101 |
|
102 |
the boxes bitmap-image can be changed with: |
|
103 |
||
370 | 104 |
aBox image:aForm |
77 | 105 |
|
106 |
||
107 |
Since this type of information is pretty common, a convenient information |
|
108 |
method has been added to Object. |
|
109 |
Thus, you can use: |
|
593 | 110 |
[exBegin] |
370 | 111 |
self information:'hello world' |
593 | 112 |
[exEnd] |
370 | 113 |
|
77 | 114 |
everwhere in your program. |
370 | 115 |
for ST-80 compatibility, you can also use: |
593 | 116 |
[exBegin] |
370 | 117 |
Dialog information:'hello world' |
593 | 118 |
[exEnd] |
370 | 119 |
|
120 |
||
77 | 121 |
|
122 |
standard box: |
|
593 | 123 |
[exBegin] |
370 | 124 |
|box| |
77 | 125 |
|
370 | 126 |
box := InfoBox title:'hello world '. |
127 |
box open |
|
593 | 128 |
[exEnd] |
77 | 129 |
|
130 |
||
131 |
changing the buttons label: |
|
593 | 132 |
[exBegin] |
370 | 133 |
|box| |
77 | 134 |
|
370 | 135 |
box := InfoBox title:'hello world '. |
136 |
box okText:'wow'. |
|
137 |
box open |
|
593 | 138 |
[exEnd] |
77 | 139 |
|
140 |
||
141 |
changing the icon: |
|
142 |
||
593 | 143 |
[exBegin] |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
144 |
|box| |
77 | 145 |
|
370 | 146 |
box := InfoBox title:'hello world '. |
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
147 |
box image:(Image fromFile:'libtool/bitmaps/SBrowser.xbm' inPackage:'stx:libtool'). |
370 | 148 |
box okText:'wow'. |
149 |
box open |
|
593 | 150 |
[exEnd] |
77 | 151 |
|
152 |
or even: |
|
593 | 153 |
[exBegin] |
370 | 154 |
|box| |
77 | 155 |
|
370 | 156 |
box := InfoBox title:'hello garfield '. |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
157 |
box image:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedTo:200@100). |
370 | 158 |
box okText:'wow'. |
159 |
box open |
|
593 | 160 |
[exEnd] |
77 | 161 |
|
162 |
||
163 |
If you plan to use boxes as in the last example, you may want to |
|
164 |
keep the box around for reuse (since the image magnification takes some time). |
|
593 | 165 |
[exBegin] |
370 | 166 |
|box| |
77 | 167 |
|
370 | 168 |
box := InfoBox title:'hello garfield '. |
2362
f6ace7307e4d
examples fixed (bitmaps access)
Claus Gittinger <cg@exept.de>
parents:
2076
diff
changeset
|
169 |
box image:((Image fromFile:'garfield.gif' inPackage:'stx:goodies/bitmaps/gifImages') magnifiedTo:200@100). |
370 | 170 |
box okText:'wow'. |
171 |
box open. |
|
77 | 172 |
|
370 | 173 |
box title:'hello again'. |
174 |
box open |
|
593 | 175 |
[exEnd] |
77 | 176 |
|
63 | 177 |
" |
77 | 178 |
! ! |
179 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
180 |
!InfoBox class methodsFor:'instance creation'! |
38 | 181 |
|
77 | 182 |
title:titleString |
183 |
"create a new infoBox with title, aTitleString" |
|
184 |
||
185 |
^ (self new) title:titleString |
|
38 | 186 |
|
77 | 187 |
" |
188 |
(InfoBox title:'hello') open |
|
189 |
" |
|
190 |
! ! |
|
60 | 191 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
192 |
!InfoBox class methodsFor:'defaults'! |
60 | 193 |
|
574 | 194 |
defaultLabel |
195 |
"return the boxes default window title." |
|
196 |
||
197 |
^ 'Info' |
|
198 |
||
199 |
"Created: 23.4.1996 / 17:12:33 / cg" |
|
200 |
! |
|
201 |
||
77 | 202 |
iconBitmap |
203 |
"return the bitmap shown as icon in my instances. |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
204 |
This is the default image; you can overwrite this in a concrete |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
205 |
instance with the #image: message" |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
206 |
|
1365 | 207 |
<resource: #style (#'infoBox.icon' #'infoBox.iconFile')> |
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
208 |
|
2786 | 209 |
InfoBitmap isNil ifTrue:[ |
210 |
InfoBitmap := self iconBitmapFromStyle:'infoBox.icon' orStyleFile:'infoBox.iconFile' orFilename:'bitmaps/Information.xbm'. |
|
211 |
]. |
|
212 |
^ InfoBitmap |
|
213 |
||
214 |
"Modified: / 26.10.1997 / 17:02:51 / cg" |
|
215 |
! |
|
216 |
||
217 |
iconBitmapFromStyle:styleName orStyleFile:styleFile orFilename:fileName |
|
218 |
"return the bitmap shown as icon in my instances. |
|
219 |
This is the default image; you can overwrite this in a concrete |
|
220 |
instance with the #image: message" |
|
221 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
222 |
|img imgFileName| |
38 | 223 |
|
2786 | 224 |
img := self styleSheet at:styleName. |
225 |
img isNil ifTrue:[ |
|
226 |
imgFileName := StyleSheet at:styleFile default:fileName. |
|
227 |
img := Smalltalk imageFromFileNamed:imgFileName forClass:self. |
|
77 | 228 |
]. |
2786 | 229 |
img notNil ifTrue:[ |
230 |
img := img onDevice:Display |
|
231 |
]. |
|
232 |
^ img |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
233 |
|
1365 | 234 |
"Modified: / 26.10.1997 / 17:02:51 / cg" |
59 | 235 |
! ! |
236 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
237 |
!InfoBox class methodsFor:'styles'! |
59 | 238 |
|
239 |
updateStyleCache |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
240 |
"extract values from the styleSheet and cache them in class variables. |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
241 |
Here, the cached infoBitmap is simply flushed." |
440
2beb33cb0146
added style resource directive
Claus Gittinger <cg@exept.de>
parents:
370
diff
changeset
|
242 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
243 |
InfoBitmap := nil |
38 | 244 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
245 |
"Modified: 1.4.1997 / 14:44:50 / cg" |
59 | 246 |
! ! |
247 |
||
0 | 248 |
!InfoBox methodsFor:'accessing'! |
249 |
||
184 | 250 |
form:aFormOrImage |
251 |
"historical leftover - define a form to be displayed left of the title" |
|
252 |
||
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
253 |
<resource:#obsolete> |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
254 |
|
184 | 255 |
self image:aFormOrImage |
256 |
! |
|
257 |
||
38 | 258 |
formLabel |
259 |
"return the formLabel = can be used to change its appearance" |
|
260 |
||
261 |
^ formLabel |
|
262 |
! |
|
263 |
||
197 | 264 |
image:aForm |
265 |
"define a form to be displayed left of the title |
|
266 |
- usually left as defaulted: |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
267 |
an exclamation-mark here, warn-sign in warningBox, |
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
268 |
others in other subclasses." |
0 | 269 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
270 |
formLabel label:aForm. |
197 | 271 |
formLabel forceResize. |
272 |
shown ifTrue:[self resize] |
|
0 | 273 |
! |
274 |
||
77 | 275 |
textLabel |
276 |
"return the textLabel = can be used to change its appearance" |
|
277 |
||
278 |
^ textLabel |
|
279 |
! |
|
280 |
||
0 | 281 |
title |
8 | 282 |
"return the boxes title string" |
0 | 283 |
|
284 |
^ textLabel label |
|
197 | 285 |
! |
0 | 286 |
|
197 | 287 |
title:aString |
288 |
"set the boxes title string" |
|
60 | 289 |
|
197 | 290 |
aString ~= textLabel label ifTrue:[ |
291 |
textLabel label:aString. |
|
292 |
textLabel forceResize. |
|
293 |
shown ifTrue:[self resize] |
|
294 |
] |
|
0 | 295 |
! ! |
296 |
||
77 | 297 |
!InfoBox methodsFor:'initialization'! |
0 | 298 |
|
2800
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
299 |
addCheckBox:label on:aValueHolder |
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
300 |
|prefHeightBefore box| |
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
301 |
|
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
302 |
box := super addCheckBox:label on:aValueHolder. |
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
303 |
|
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
304 |
box layout:((0.0 @ 1.0 corner:1.0 @ 1.0) asLayout |
3609
3bd1b03b1ffb
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3121
diff
changeset
|
305 |
topOffset:(buttonPanel preferredHeight |
3bd1b03b1ffb
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3121
diff
changeset
|
306 |
+ box preferredHeight |
2800
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
307 |
+ ViewSpacing ) negated; |
3609
3bd1b03b1ffb
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3121
diff
changeset
|
308 |
bottomOffset:(buttonPanel preferredHeight |
2800
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
309 |
+ ViewSpacing ) negated). |
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
310 |
^ box. |
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
311 |
! |
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
312 |
|
77 | 313 |
initFormBitmap |
314 |
"setup the bitmap shown in the upper left - |
|
315 |
extracted into a separate method for easier redefinition |
|
316 |
in subclasses" |
|
0 | 317 |
|
2969
eb87f1aedd6c
Do not use obsolete methods with #form:
Stefan Vogel <sv@exept.de>
parents:
2802
diff
changeset
|
318 |
formLabel label:(self class iconBitmap) |
0 | 319 |
! |
320 |
||
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
321 |
initFormLabel |
570 | 322 |
"setup the icon shown in the infoBox. |
323 |
Can be redefined in subclasses." |
|
324 |
||
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
325 |
|mm| |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
326 |
|
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
327 |
mm := ViewSpacing. |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
328 |
|
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
329 |
formLabel := Label in:self. |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
330 |
formLabel borderWidth:0. |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
331 |
formLabel origin:(mm @ mm). |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
332 |
|
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
333 |
"Created: 16.11.1995 / 18:32:32 / cg" |
570 | 334 |
"Modified: 22.4.1996 / 18:15:37 / cg" |
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
335 |
! |
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
336 |
|
77 | 337 |
initialize |
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
338 |
|mm sep| |
77 | 339 |
|
340 |
super initialize. |
|
341 |
self addOkButton. |
|
0 | 342 |
|
574 | 343 |
"/ label := 'Info'. |
77 | 344 |
|
345 |
mm := ViewSpacing. |
|
346 |
||
180
0eb12501889e
hook to create different labelView in subclasses
Claus Gittinger <cg@exept.de>
parents:
174
diff
changeset
|
347 |
self initFormLabel. |
77 | 348 |
self initFormBitmap. |
0 | 349 |
|
77 | 350 |
textLabel := Label label:'Information' in:self. |
351 |
textLabel borderWidth:0. |
|
367 | 352 |
textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm]. |
0 | 353 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
354 |
(styleSheet at:'infoBoxSeparator' default:false) ifTrue:[ |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
355 |
sep := Separator in:self. |
2800
25f261040a9a
allow adding a (single) checkBox
Claus Gittinger <cg@exept.de>
parents:
2786
diff
changeset
|
356 |
sep origin:[0.0 @ ((formLabel bottom max:textLabel bottom) + mm)]. |
3609
3bd1b03b1ffb
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3121
diff
changeset
|
357 |
sep extent:(1.0 @ sep preferredHeight). |
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
358 |
]. |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
359 |
|
77 | 360 |
" |
361 |
|b| |
|
362 |
||
363 |
b := InfoBox new. |
|
364 |
b title:'hello'. |
|
365 |
b open |
|
366 |
" |
|
367 | 367 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
368 |
"Modified: 1.4.1997 / 14:53:16 / cg" |
0 | 369 |
! ! |
197 | 370 |
|
371 |
!InfoBox methodsFor:'queries'! |
|
372 |
||
3121 | 373 |
beepWhenOpening |
374 |
^ UserPreferences current beepForInfoDialog |
|
375 |
||
376 |
" |
|
377 |
Dialog information:'hello' |
|
378 |
Dialog warn:'hello' |
|
379 |
Dialog error:'hello' |
|
380 |
" |
|
381 |
! |
|
382 |
||
197 | 383 |
preferredExtent |
384 |
"return my preferred extent" |
|
385 |
||
370 | 386 |
|w h mm| |
197 | 387 |
|
3750
3d4912629acf
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3609
diff
changeset
|
388 |
"/ If I have an explicit preferredExtent.. |
3d4912629acf
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3609
diff
changeset
|
389 |
explicitExtent notNil ifTrue:[ |
3d4912629acf
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3609
diff
changeset
|
390 |
^ explicitExtent |
3d4912629acf
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3609
diff
changeset
|
391 |
]. |
797 | 392 |
|
3750
3d4912629acf
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3609
diff
changeset
|
393 |
"/ If I have a cached preferredExtent value.. |
713
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
394 |
preferredExtent notNil ifTrue:[ |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
395 |
^ preferredExtent |
0c38ad51016d
care for preSet preferredExtent
Claus Gittinger <cg@exept.de>
parents:
593
diff
changeset
|
396 |
]. |
197 | 397 |
|
370 | 398 |
mm := ViewSpacing. |
399 |
||
400 |
w := ((margin + mm) * 2) + |
|
401 |
formLabel widthIncludingBorder + |
|
402 |
mm + textLabel width. |
|
403 |
||
3609
3bd1b03b1ffb
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3121
diff
changeset
|
404 |
w := w max:(okButton preferredWidth + (mm * 2)). |
2802
19b141dd52b9
fixed preferredWidth when components were added
Claus Gittinger <cg@exept.de>
parents:
2800
diff
changeset
|
405 |
w := w max:self maxPreferredWidthOfAddedComponents. |
370 | 406 |
|
407 |
h := (mm * 6) |
|
408 |
+ ((formLabel heightIncludingBorder) max:(textLabel height)) |
|
3609
3bd1b03b1ffb
added preferredWidth & preferredHeight
Claus Gittinger <cg@exept.de>
parents:
3121
diff
changeset
|
409 |
+ ((addedComponents ? #()) inject:0 into:[:sum :thisComponent | sum + thisComponent preferredHeight]) |
370 | 410 |
+ okButton heightIncludingBorder. |
197 | 411 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
412 |
(styleSheet at:'infoBoxSeparator' default:false) ifTrue:[ |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
413 |
h := h + (ViewSpacing * 3) |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
414 |
]. |
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
415 |
|
197 | 416 |
^ w @ h |
370 | 417 |
|
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
418 |
"Modified: 1.4.1997 / 14:53:35 / cg" |
197 | 419 |
! ! |
420 |
||
1172
d10e4627b0e3
allow either image or imageFileName to be specified
Claus Gittinger <cg@exept.de>
parents:
797
diff
changeset
|
421 |
!InfoBox class methodsFor:'documentation'! |
243 | 422 |
|
423 |
version |
|
3750
3d4912629acf
changed #preferredExtent - use explicitExtent instvar
Stefan Vogel <sv@exept.de>
parents:
3609
diff
changeset
|
424 |
^ '$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.46 2008-10-26 20:08:14 stefan Exp $' |
243 | 425 |
! ! |