--- a/Icon.st Sat Jun 02 16:02:55 2001 +0200
+++ b/Icon.st Fri Jun 08 18:14:54 2001 +0200
@@ -126,14 +126,60 @@
constantNamed:aName
"return the image registered under aName."
+ ^ self constantNamed:aName searchForFile:true
+
+ "
+ Icon constantNamed:#file
+ Icon constantNamed:#debugger
+ Icon constantNamed:#systembrowser
+ Icon constantNamed:#SBrowser
+ Icon constantNamed:#SBrowser
+ "
+
+ "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 searchForFile:false) isNil
+ ifTrue:[
+ self constantNamed:aName put:(image := aBlock value)
+ ].
+ ^image
+!
+
+constantNamed:aName ifAbsentPutImageFromFile:aFileName
+ "if an image for aName is registered, return it;
+ otherwise, load the image from aFileName (searched in bitmaps directories),
+ register the result and return it."
+
+ ^ self
+ constantNamed:aName
+ ifAbsentPut:[Smalltalk imageFromFileNamed:aFileName forClass:self]
+
+!
+
+constantNamed:aName put:anImage
+ "register anImage under aName."
+
+ KnownIcons at:aName put:anImage
+
+ "Modified: 23.4.1996 / 11:40:51 / cg"
+!
+
+constantNamed:aName searchForFile:doSearchForFile
+ "return the image registered under aName."
+
|icon nm|
icon := KnownIcons at:aName ifAbsent:[].
- icon isNil ifTrue:[
- (aName indexOfSeparatorStartingAt:1) ~~ 0 ifTrue:[
- ^ nil
- ].
+ (icon isNil and:[doSearchForFile]) ifTrue:[
nm := self replacementNameFor:aName.
nm notNil ifTrue:[
icon := Smalltalk imageFromFileNamed:nm forClass:self.
@@ -165,41 +211,6 @@
"
"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 ifAbsentPutImageFromFile:aFileName
- "if an image for aName is registered, return it;
- otherwise, load the image from aFileName (searched in bitmaps directories),
- register the result and return it."
-
- ^ self
- constantNamed:aName
- ifAbsentPut:[Smalltalk imageFromFileNamed:aFileName forClass:self]
-
-!
-
-constantNamed:aName put:anImage
- "register anImage under aName."
-
- KnownIcons at:aName put:anImage
-
- "Modified: 23.4.1996 / 11:40:51 / cg"
! !
!Icon class methodsFor:'image specs'!
@@ -610,6 +621,6 @@
!Icon class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview2/Icon.st,v 1.29 2001-06-02 14:02:55 ca Exp $'
+ ^ '$Header: /cvs/stx/stx/libview2/Icon.st,v 1.30 2001-06-08 16:14:54 cg Exp $'
! !
Icon initialize!