ResourceSelectionBrowser.st
changeset 1524 4efbd088b787
parent 1493 844c2ed1208d
child 1605 8aab97d1f5fe
equal deleted inserted replaced
1523:a8fe5e15220b 1524:4efbd088b787
   927 !ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'!
   927 !ResourceSelectionBrowser::ResourceMethod methodsFor:'accessing'!
   928 
   928 
   929 iconOn:aGC
   929 iconOn:aGC
   930     "registers and returns an icon indicating the resource type"
   930     "registers and returns an icon indicating the resource type"
   931 
   931 
       
   932     |cls sel image imageKey|
       
   933 
   932     self resourceType isNil ifTrue: [^nil].
   934     self resourceType isNil ifTrue: [^nil].
   933     icon isNil 
   935 
   934     ifTrue: 
   936     icon isNil ifTrue:[
   935     [
       
   936         |cls sel image imageKey|
       
   937         ((self resourceType = #image) or: [resourceType = #fileImage])
   937         ((self resourceType = #image) or: [resourceType = #fileImage])
   938         ifTrue: 
   938         ifTrue:[  
   939         [  
   939             cls := method mclass theNonMetaclass.
   940             cls := method who methodClass soleInstance.
   940             sel := method selector.
   941             sel := method who methodSelector.
   941         ] ifFalse: [
   942         ]
       
   943         ifFalse:
       
   944         [
       
   945             cls := SystemBrowser.
   942             cls := SystemBrowser.
   946             sel := (resourceType, 'Icon') asSymbol.
   943             sel := (resourceType, 'Icon') asSymbol.
   947         ].
   944         ].
   948         imageKey := (cls name, sel) asSymbol.
   945         imageKey := (cls name, sel) asSymbol.
   949         (icon := aGC registeredImageAt: imageKey) isNil
   946         (icon := aGC registeredImageAt: imageKey) isNil
   950         ifTrue:
   947         ifTrue: [       
   951         [       
       
   952             image := cls perform: sel.
   948             image := cls perform: sel.
   953             image extent y > 18
   949             (image extent y > 18) ifTrue: [         
   954             ifTrue:
       
   955             [         
       
   956                 image := image magnifiedBy: 18/image extent y
   950                 image := image magnifiedBy: 18/image extent y
   957             ].
   951             ].
   958             aGC registerImage: image key: imageKey.
   952             aGC registerImage: image key: imageKey.
   959             icon := aGC registeredImageAt: imageKey.
   953             icon := aGC registeredImageAt: imageKey.
   960         ].
   954         ].
   961     ].
   955     ].
   962     ^icon
   956     ^icon
       
   957 
       
   958     "Modified: / 5.11.2001 / 16:48:35 / cg"
   963 !
   959 !
   964 
   960 
   965 method: aMethod
   961 method: aMethod
   966     "sets aMethod"
   962     "sets aMethod"
   967 
   963