ResourceRetriever.st
changeset 373 ae526fcf716a
parent 343 8358ce37f8be
child 378 9057ea063eca
equal deleted inserted replaced
372:042713cfe1ed 373:ae526fcf716a
    39 
    39 
    40 !
    40 !
    41 
    41 
    42 documentation
    42 documentation
    43 "
    43 "
    44         This class is used to retrieve resources for a painted interface of
    44     ST80 compatibility class.
    45         some sort. If the className is specified, then the owner of the resource
    45 
    46         is fixed at painting time. If not, then the ApplicationModel which invokes
    46     The class is not completed yet and certainly not bug free.
    47         the painted interface is assumed to be the owner of the resource.
    47     Also, it is not guaranteed that all winSpecs are understood.
    48 
    48 
    49         When the retriever is sent the message #value, it sends the message #valueFor:
    49     Notice: 
    50         to the resource owner, to retrive the resource
    50         this class was implemented using protocol information
       
    51         from alpha testers, literature and by reading public domain code
       
    52         - it may not be complete or compatible to
       
    53         the corresponding ST-80 class. 
       
    54         If you encounter any incompatibilities, please forward a note 
       
    55         describing the incompatibility verbal (i.e. no code) to the ST/X team.
    51 
    56 
    52     [author:]
    57     [author:]
    53         Claus Atzkern
    58         Claus Atzkern
    54 
    59 
    55     [see also:]
    60     [see also:]
    94 
    99 
    95     selector := something.
   100     selector := something.
    96 !
   101 !
    97 
   102 
    98 value
   103 value
    99     "returns value assigned to resource or nil
   104     "returns the value assigned to resource or nil
   100     "
   105     "
   101     |resource|
   106     |resource|
   102 
   107 
   103     (resource := self resource) isNil ifTrue:[
   108     (resource := self resource) isNil ifTrue:[
   104         ^ labelText
   109         ^ labelText
   106 
   111 
   107     (labelText notNil and:[resource isImage]) ifTrue:[
   112     (labelText notNil and:[resource isImage]) ifTrue:[
   108         ^ LabelAndIcon icon:resource string:(Text string:labelText emphasis:#bold)
   113         ^ LabelAndIcon icon:resource string:(Text string:labelText emphasis:#bold)
   109     ].
   114     ].
   110   ^ resource
   115   ^ resource
       
   116 
       
   117     "Modified: / 31.10.1997 / 12:10:05 / cg"
   111 ! !
   118 ! !
   112 
   119 
   113 !ResourceRetriever methodsFor:'accessing resource'!
   120 !ResourceRetriever methodsFor:'accessing resource'!
   114 
   121 
   115 findGuiResourcesIn:aResourceContainer
   122 findGuiResourcesIn:aResourceContainer
   119         resourceOwner := aResourceContainer
   126         resourceOwner := aResourceContainer
   120     ].
   127     ].
   121 !
   128 !
   122 
   129 
   123 resource
   130 resource
   124     "returns form assigned to resource or nil
   131     "returns a form assigned to resource or nil
   125     "
   132     "
   126     |img cls appl|
   133     |img cls appl|
   127 
   134 
   128     selector isNil ifTrue:[
   135     selector isNil ifTrue:[
   129         ^nil
   136         ^nil
   152             ^ cls perform:selector
   159             ^ cls perform:selector
   153         ]
   160         ]
   154     ].
   161     ].
   155     ^ nil
   162     ^ nil
   156 
   163 
       
   164     "Modified: / 31.10.1997 / 12:09:52 / cg"
   157 ! !
   165 ! !
   158 
   166 
   159 !ResourceRetriever methodsFor:'converting'!
   167 !ResourceRetriever methodsFor:'converting'!
   160 
   168 
   161 fromLiteralArrayEncoding:anArray
   169 fromLiteralArrayEncoding:anArray