# HG changeset patch # User tz # Date 889824313 -3600 # Node ID 238d796c5da0dd93ddf5e1acf7d5eda4c80f9a58 # Parent 12f157d5e0175627d7eab25af9ff6d3c83c66b5e own #iconOn: method implememted diff -r 12f157d5e017 -r 238d796c5da0 ResourceSelectionBrowser.st --- a/ResourceSelectionBrowser.st Thu Mar 12 23:05:33 1998 +0100 +++ b/ResourceSelectionBrowser.st Fri Mar 13 22:25:13 1998 +0100 @@ -123,6 +123,32 @@ ! ! +!ResourceSelectionBrowser class methodsFor:'image specs'! + +iconClass + "Generated by the Image Editor" + " + ImageEditor openOnClass:self andSelector:#iconClass + " + + + + ^Icon + constantNamed:#'ResourceSelectionBrowser iconClass' + ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@UUUUUAQ****(@F**** @Z****@A****(@F**** @Z****@A****(LF**** TZ****@A****(@F**** @Z****@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 255 0 0]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@') ; yourself); yourself]! + +iconPrivateClass + "Generated by the Image Editor" + " + ImageEditor openOnClass:self andSelector:#iconPrivateClass + " + + + + ^Icon + constantNamed:#'ResourceSelectionBrowser iconPrivateClass' + ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@PUUUUU@A****(@F*??* @Z+??*@A*/*>(OF*>+: @Z+??*@A*/?:(DF*>** @Z+:**@A*/**(@F*>** @Z****C0@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 255 0 0]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@') ; yourself); yourself]! ! + !ResourceSelectionBrowser class methodsFor:'interface specs'! windowSpec @@ -311,33 +337,6 @@ )) ! ! -!ResourceSelectionBrowser class methodsFor:'resources'! - -iconClass - "Generated by the Image Editor" - " - ImageEditor openOnClass:self andSelector:#iconClass - " - - - - ^Icon - constantNamed:#'ResourceSelectionBrowser iconClass' - ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@@UUUUUAQ****(@F**** @Z****@A****(@F**** @Z****@A****(LF**** TZ****@A****(@F**** @Z****@@@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 255 0 0]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@') ; yourself); yourself] -! - -iconPrivateClass - "Generated by the Image Editor" - " - ImageEditor openOnClass:self andSelector:#iconPrivateClass - " - - - - ^Icon - constantNamed:#'ResourceSelectionBrowser iconPrivateClass' - ifAbsentPut:[(Depth2Image new) width: 18; height: 16; photometric:(#palette); bitsPerSample:(#(2 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'@@@@@@PUUUUU@A****(@F*??* @Z+??*@A*/*>(OF*>+: @Z+??*@A*/?:(DF*>** @Z+:**@A*/**(@F*>** @Z****C0@@@@@@@@@@@@@b') ; colorMapFromArray:#[0 0 0 255 255 255 170 170 170 255 0 0]; mask:((Depth1Image new) width: 18; height: 16; photometric:(#blackIs0); bitsPerSample:(#(1 )); samplesPerPixel:(1); bits:(ByteArray fromPackedString:'_?>@???@???@???@???@???@???@???@???@???@???@???@???@???@???@_?>@') ; yourself); yourself]! ! - !ResourceSelectionBrowser methodsFor:'accessing - views'! classNameInputField @@ -432,7 +431,7 @@ !ResourceSelectionBrowser methodsFor:'callbacks - user'! classSelected: anIndex - + self selectionOfClass value isNil ifTrue: [^nil]. self withWaitCursorDo: [ @@ -479,9 +478,9 @@ superClsCandidate := (Dialog request: 'Enter name of superclass of private class.' initialAnswer: 'Object') asSymbol. - (superClsCandidate := Smalltalk at: superClsCandidate) isNil ifTrue: [^nil]. + (Smalltalk at: superClsCandidate) isNil ifTrue: [^self warn: 'Class ', superClsCandidate asBoldText, ' does not exist!!']. - (superClsCandidate isClass and: [superClsCandidate isPrivate not]) + ((superClsCandidate := Smalltalk at: superClsCandidate) isClass and: [superClsCandidate isPrivate not]) ifFalse: [^self warn: 'May not create private class with superclass ', superClsCandidate asBoldText, '!!']. superClsCandidate subclass: clsCandidat instanceVariableNames:'' @@ -611,10 +610,39 @@ !ResourceSelectionBrowser::Row methodsFor:'accessing'! iconOn:aGC + "register and answer an icon indicating the resource type." - icon isNil ifTrue: [icon := method iconOn: aGC]. + self resourceType isNil ifTrue: [^nil]. + icon isNil + ifTrue: + [ + |cls sel image imageKey| + ((self resourceType = #image) or: [resourceType = #fileImage]) + ifTrue: + [ + cls := method who methodClass soleInstance. + sel := method who methodSelector. + ] + ifFalse: + [ + cls := BrowserView. + sel := (resourceType, 'Icon') asSymbol. + ]. + imageKey := (cls name, sel) asSymbol. + (icon := aGC registeredImageAt: imageKey) isNil + ifTrue: + [ + image := cls perform: sel. + image extent y > 18 + ifTrue: + [ + image := image magnifiedBy: 18/image extent y + ]. + aGC registerImage: image key: imageKey. + icon := aGC registeredImageAt: imageKey. + ]. + ]. ^icon - ! method: aMethod