Icon.st
changeset 777 03e6a1108f80
parent 358 6b9671f01908
child 780 ce6214bd3f68
--- a/Icon.st	Tue Jan 27 14:31:52 1998 +0100
+++ b/Icon.st	Tue Jan 27 17:20:33 1998 +0100
@@ -161,6 +161,22 @@
     "Modified: 10.1.1997 / 17:52:06 / cg"
 !
 
+constantNamed:aName ifAbsentPut: aBlock
+    "if an image for aName is registered, return it;
+    otherwise, register the result from evaluating aBlock
+    (which also could be a value holder) and return it."
+
+    |image|
+
+    (image := self constantNamed: aName) isNil
+    ifTrue:
+    [
+        self constantNamed: aName put: (image := aBlock value)
+    ].
+    ^image
+
+!
+
 constantNamed:aName put:anImage
     "register anImage under aName."
 
@@ -172,6 +188,6 @@
 !Icon class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/Icon.st,v 1.14 1997-01-10 17:59:45 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/Icon.st,v 1.15 1998-01-27 16:20:33 tz Exp $'
 ! !
 Icon initialize!