allow either image or imageFileName to be specified
in styleSheet; optional separator between label and buttonPanel.
--- a/InfoBox.st Tue Apr 01 13:36:24 1997 +0200
+++ b/InfoBox.st Tue Apr 01 14:54:08 1997 +0200
@@ -19,7 +19,7 @@
category:'Views-DialogBoxes'
!
-!InfoBox class methodsFor:'documentation'!
+!InfoBox class methodsFor:'documentation'!
copyright
"
@@ -166,7 +166,7 @@
"
! !
-!InfoBox class methodsFor:'instance creation'!
+!InfoBox class methodsFor:'instance creation'!
title:titleString
"create a new infoBox with title, aTitleString"
@@ -178,7 +178,7 @@
"
! !
-!InfoBox class methodsFor:'defaults'!
+!InfoBox class methodsFor:'defaults'!
defaultLabel
"return the boxes default window title."
@@ -190,30 +190,39 @@
iconBitmap
"return the bitmap shown as icon in my instances.
- The form is cached and reused, for faster opening."
+ This is the default image; you can overwrite this in a concrete
+ instance with the #image: message"
+
+ <resource: #style (#infoBoxIcon #infoBoxIconFile)>
+
+ |img imgFileName|
InfoBitmap isNil ifTrue:[
- InfoBitmap := Image fromFile:'bitmaps/Information.xbm'.
- InfoBitmap notNil ifTrue:[
- InfoBitmap := InfoBitmap on:Display
- ]
+ img := StyleSheet at:'infoBoxIcon'.
+ img notNil ifTrue:[
+ InfoBitmap := img
+ ] ifFalse:[
+ imgFileName := StyleSheet at:'infoBoxIconFile' default:'bitmaps/Information.xbm'.
+ InfoBitmap := Image fromFile:imgFileName.
+ ].
+ InfoBitmap notNil ifTrue:[
+ InfoBitmap := InfoBitmap on:Display
+ ]
].
^ InfoBitmap
+
+ "Modified: 1.4.1997 / 14:44:12 / cg"
! !
-!InfoBox class methodsFor:'styles'!
+!InfoBox class methodsFor:'styles'!
updateStyleCache
- "extract values from the styleSheet and cache them in class variables"
-
- <resource: #style (#informationBoxIcon)>
+ "extract values from the styleSheet and cache them in class variables.
+ Here, the cached infoBitmap is simply flushed."
- |img|
+ InfoBitmap := nil
- img := StyleSheet at:'informationBoxIcon'.
- img notNil ifTrue:[InfoBitmap := img on:Display].
-
- "Modified: 1.3.1996 / 13:45:38 / cg"
+ "Modified: 1.4.1997 / 14:44:50 / cg"
! !
!InfoBox methodsFor:'accessing'!
@@ -290,7 +299,7 @@
!
initialize
- |mm|
+ |mm sep|
super initialize.
self addOkButton.
@@ -306,6 +315,12 @@
textLabel borderWidth:0.
textLabel origin:[(mm + formLabel widthIncludingBorder + mm) @ mm].
+ (styleSheet at:'infoBoxSeparator' default:false) ifTrue:[
+ sep := Separator in:self.
+ sep origin:[0.0 @ ((formLabel bottom max:textLabel bottom) + ViewSpacing)].
+ sep extent:(1.0 @ sep preferredExtent y).
+ ].
+
"
|b|
@@ -314,7 +329,7 @@
b open
"
- "Modified: 23.4.1996 / 17:12:39 / cg"
+ "Modified: 1.4.1997 / 14:53:16 / cg"
! !
!InfoBox methodsFor:'queries'!
@@ -342,13 +357,17 @@
+ ((formLabel heightIncludingBorder) max:(textLabel height))
+ okButton heightIncludingBorder.
+ (styleSheet at:'infoBoxSeparator' default:false) ifTrue:[
+ h := h + (ViewSpacing * 3)
+ ].
+
^ w @ h
- "Modified: 19.7.1996 / 20:44:35 / cg"
+ "Modified: 1.4.1997 / 14:53:35 / cg"
! !
-!InfoBox class methodsFor:'documentation'!
+!InfoBox class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.31 1996-07-19 18:49:51 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/InfoBox.st,v 1.32 1997-04-01 12:54:08 cg Exp $'
! !