124 !Icon class methodsFor:'accessing'! |
124 !Icon class methodsFor:'accessing'! |
125 |
125 |
126 constantNamed:aName |
126 constantNamed:aName |
127 "return the image registered under aName." |
127 "return the image registered under aName." |
128 |
128 |
|
129 ^ self constantNamed:aName searchForFile:true |
|
130 |
|
131 " |
|
132 Icon constantNamed:#file |
|
133 Icon constantNamed:#debugger |
|
134 Icon constantNamed:#systembrowser |
|
135 Icon constantNamed:#SBrowser |
|
136 Icon constantNamed:#SBrowser |
|
137 " |
|
138 |
|
139 "Modified: 10.1.1997 / 17:52:06 / cg" |
|
140 ! |
|
141 |
|
142 constantNamed:aName ifAbsentPut:aBlock |
|
143 "if an image for aName is registered, return it; |
|
144 otherwise, register the result from evaluating aBlock |
|
145 (which also could be a value holder) and return it." |
|
146 |
|
147 |image| |
|
148 |
|
149 (image := self constantNamed:aName searchForFile:false) isNil |
|
150 ifTrue:[ |
|
151 self constantNamed:aName put:(image := aBlock value) |
|
152 ]. |
|
153 ^image |
|
154 ! |
|
155 |
|
156 constantNamed:aName ifAbsentPutImageFromFile:aFileName |
|
157 "if an image for aName is registered, return it; |
|
158 otherwise, load the image from aFileName (searched in bitmaps directories), |
|
159 register the result and return it." |
|
160 |
|
161 ^ self |
|
162 constantNamed:aName |
|
163 ifAbsentPut:[Smalltalk imageFromFileNamed:aFileName forClass:self] |
|
164 |
|
165 ! |
|
166 |
|
167 constantNamed:aName put:anImage |
|
168 "register anImage under aName." |
|
169 |
|
170 KnownIcons at:aName put:anImage |
|
171 |
|
172 "Modified: 23.4.1996 / 11:40:51 / cg" |
|
173 ! |
|
174 |
|
175 constantNamed:aName searchForFile:doSearchForFile |
|
176 "return the image registered under aName." |
|
177 |
129 |icon nm| |
178 |icon nm| |
130 |
179 |
131 icon := KnownIcons at:aName ifAbsent:[]. |
180 icon := KnownIcons at:aName ifAbsent:[]. |
132 |
181 |
133 icon isNil ifTrue:[ |
182 (icon isNil and:[doSearchForFile]) ifTrue:[ |
134 (aName indexOfSeparatorStartingAt:1) ~~ 0 ifTrue:[ |
|
135 ^ nil |
|
136 ]. |
|
137 nm := self replacementNameFor:aName. |
183 nm := self replacementNameFor:aName. |
138 nm notNil ifTrue:[ |
184 nm notNil ifTrue:[ |
139 icon := Smalltalk imageFromFileNamed:nm forClass:self. |
185 icon := Smalltalk imageFromFileNamed:nm forClass:self. |
140 icon isNil ifTrue:[ |
186 icon isNil ifTrue:[ |
141 icon := Smalltalk imageFromFileNamed:(nm , '.xbm') forClass:self. |
187 icon := Smalltalk imageFromFileNamed:(nm , '.xbm') forClass:self. |
163 Icon constantNamed:#SBrowser |
209 Icon constantNamed:#SBrowser |
164 Icon constantNamed:#SBrowser |
210 Icon constantNamed:#SBrowser |
165 " |
211 " |
166 |
212 |
167 "Modified: 10.1.1997 / 17:52:06 / cg" |
213 "Modified: 10.1.1997 / 17:52:06 / cg" |
168 ! |
|
169 |
|
170 constantNamed:aName ifAbsentPut: aBlock |
|
171 "if an image for aName is registered, return it; |
|
172 otherwise, register the result from evaluating aBlock |
|
173 (which also could be a value holder) and return it." |
|
174 |
|
175 |image| |
|
176 |
|
177 (image := self constantNamed: aName) isNil |
|
178 ifTrue: |
|
179 [ |
|
180 self constantNamed: aName put: (image := aBlock value) |
|
181 ]. |
|
182 ^image |
|
183 |
|
184 ! |
|
185 |
|
186 constantNamed:aName ifAbsentPutImageFromFile:aFileName |
|
187 "if an image for aName is registered, return it; |
|
188 otherwise, load the image from aFileName (searched in bitmaps directories), |
|
189 register the result and return it." |
|
190 |
|
191 ^ self |
|
192 constantNamed:aName |
|
193 ifAbsentPut:[Smalltalk imageFromFileNamed:aFileName forClass:self] |
|
194 |
|
195 ! |
|
196 |
|
197 constantNamed:aName put:anImage |
|
198 "register anImage under aName." |
|
199 |
|
200 KnownIcons at:aName put:anImage |
|
201 |
|
202 "Modified: 23.4.1996 / 11:40:51 / cg" |
|
203 ! ! |
214 ! ! |
204 |
215 |
205 !Icon class methodsFor:'image specs'! |
216 !Icon class methodsFor:'image specs'! |
206 |
217 |
207 backwardIcon |
218 backwardIcon |