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