188 "Created: 23.4.1996 / 17:12:33 / cg" |
188 "Created: 23.4.1996 / 17:12:33 / cg" |
189 ! |
189 ! |
190 |
190 |
191 iconBitmap |
191 iconBitmap |
192 "return the bitmap shown as icon in my instances. |
192 "return the bitmap shown as icon in my instances. |
193 The form is cached and reused, for faster opening." |
193 This is the default image; you can overwrite this in a concrete |
|
194 instance with the #image: message" |
|
195 |
|
196 <resource: #style (#infoBoxIcon #infoBoxIconFile)> |
|
197 |
|
198 |img imgFileName| |
194 |
199 |
195 InfoBitmap isNil ifTrue:[ |
200 InfoBitmap isNil ifTrue:[ |
196 InfoBitmap := Image fromFile:'bitmaps/Information.xbm'. |
201 img := StyleSheet at:'infoBoxIcon'. |
197 InfoBitmap notNil ifTrue:[ |
202 img notNil ifTrue:[ |
198 InfoBitmap := InfoBitmap on:Display |
203 InfoBitmap := img |
199 ] |
204 ] ifFalse:[ |
|
205 imgFileName := StyleSheet at:'infoBoxIconFile' default:'bitmaps/Information.xbm'. |
|
206 InfoBitmap := Image fromFile:imgFileName. |
|
207 ]. |
|
208 InfoBitmap notNil ifTrue:[ |
|
209 InfoBitmap := InfoBitmap on:Display |
|
210 ] |
200 ]. |
211 ]. |
201 ^ InfoBitmap |
212 ^ InfoBitmap |
202 ! ! |
213 |
203 |
214 "Modified: 1.4.1997 / 14:44:12 / cg" |
204 !InfoBox class methodsFor:'styles'! |
215 ! ! |
|
216 |
|
217 !InfoBox class methodsFor:'styles'! |
205 |
218 |
206 updateStyleCache |
219 updateStyleCache |
207 "extract values from the styleSheet and cache them in class variables" |
220 "extract values from the styleSheet and cache them in class variables. |
208 |
221 Here, the cached infoBitmap is simply flushed." |
209 <resource: #style (#informationBoxIcon)> |
222 |
210 |
223 InfoBitmap := nil |
211 |img| |
224 |
212 |
225 "Modified: 1.4.1997 / 14:44:50 / cg" |
213 img := StyleSheet at:'informationBoxIcon'. |
|
214 img notNil ifTrue:[InfoBitmap := img on:Display]. |
|
215 |
|
216 "Modified: 1.3.1996 / 13:45:38 / cg" |
|
217 ! ! |
226 ! ! |
218 |
227 |
219 !InfoBox methodsFor:'accessing'! |
228 !InfoBox methodsFor:'accessing'! |
220 |
229 |
221 form:aFormOrImage |
230 form:aFormOrImage |
303 self initFormBitmap. |
312 self initFormBitmap. |
304 |
313 |
305 textLabel := Label label:'Information' in:self. |
314 textLabel := Label label:'Information' in:self. |
306 textLabel borderWidth:0. |
315 textLabel borderWidth:0. |
307 textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm]. |
316 textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm]. |
|
317 |
|
318 (styleSheet at:'infoBoxSeparator' default:false) ifTrue:[ |
|
319 sep := Separator in:self. |
|
320 sep origin:[0.0 @ ((formLabel bottom max:textLabel bottom) + ViewSpacing)]. |
|
321 sep extent:(1.0 @ sep preferredExtent y). |
|
322 ]. |
308 |
323 |
309 " |
324 " |
310 |b| |
325 |b| |
311 |
326 |
312 b := InfoBox new. |
327 b := InfoBox new. |
313 b title:'hello'. |
328 b title:'hello'. |
314 b open |
329 b open |
315 " |
330 " |
316 |
331 |
317 "Modified: 23.4.1996 / 17:12:39 / cg" |
332 "Modified: 1.4.1997 / 14:53:16 / cg" |
318 ! ! |
333 ! ! |
319 |
334 |
320 !InfoBox methodsFor:'queries'! |
335 !InfoBox methodsFor:'queries'! |
321 |
336 |
322 preferredExtent |
337 preferredExtent |
340 |
355 |
341 h := (mm * 6) |
356 h := (mm * 6) |
342 + ((formLabel heightIncludingBorder) max:(textLabel height)) |
357 + ((formLabel heightIncludingBorder) max:(textLabel height)) |
343 + okButton heightIncludingBorder. |
358 + okButton heightIncludingBorder. |
344 |
359 |
|
360 (styleSheet at:'infoBoxSeparator' default:false) ifTrue:[ |
|
361 h := h + (ViewSpacing * 3) |
|
362 ]. |
|
363 |
345 ^ w @ h |
364 ^ w @ h |
346 |
365 |
347 "Modified: 19.7.1996 / 20:44:35 / cg" |
366 "Modified: 1.4.1997 / 14:53:35 / cg" |
348 ! ! |
367 ! ! |
349 |
368 |
350 !InfoBox class methodsFor:'documentation'! |
369 !InfoBox class methodsFor:'documentation'! |
351 |
370 |
352 version |
371 version |
353 ^ '$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.31 1996-07-19 18:49:51 cg Exp $' |
372 ^ '$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.32 1997-04-01 12:54:08 cg Exp $' |
354 ! ! |
373 ! ! |