Icon.st
changeset 105 2e1c39cafe2e
parent 84 31752ae049fa
child 111 23f66f18a3cb
equal deleted inserted replaced
104:aee902af74e0 105:2e1c39cafe2e
    21 
    21 
    22 !Icon class methodsFor:'documentation'!
    22 !Icon class methodsFor:'documentation'!
    23 
    23 
    24 version
    24 version
    25 "
    25 "
    26 $Header: /cvs/stx/stx/libview2/Icon.st,v 1.2 1995-07-03 02:47:44 claus Exp $
    26 $Header: /cvs/stx/stx/libview2/Icon.st,v 1.3 1995-09-23 11:30:33 claus Exp $
    27 "
    27 "
    28 !
    28 !
    29 
    29 
    30 documentation
    30 documentation
    31 "
    31 "
    33     Implements the #constantNamed: message which is used by some PD
    33     Implements the #constantNamed: message which is used by some PD
    34     classes and returns corresponding ST/X icons.
    34     classes and returns corresponding ST/X icons.
    35     If you like the original icons, install the xbm files in the bitmap
    35     If you like the original icons, install the xbm files in the bitmap
    36     directory under a name foo.xbm, where foo corresponds to the icons
    36     directory under a name foo.xbm, where foo corresponds to the icons
    37     name symbol (i.e. for Icon constantNamed:#foo, a 'foo.xbm' file is required).
    37     name symbol (i.e. for Icon constantNamed:#foo, a 'foo.xbm' file is required).
       
    38     Caveat:
       
    39 	masks are not yet implemented
    38 "
    40 "
    39 !
    41 !
    40 
    42 
    41 copyright
    43 copyright
    42 "
    44 "
    53 ! !
    55 ! !
    54 
    56 
    55 !Icon class methodsFor:'initialization'!
    57 !Icon class methodsFor:'initialization'!
    56 
    58 
    57 replacementNames
    59 replacementNames
    58     "return a constant name to ST/X name translation."
    60     "return an ST-80 constant name to ST/X file name translation."
    59 
    61 
    60     ^ #( 
    62     ^ #( 
    61 	#(file             FBrowser)
    63 	#(file             FBrowser)
    62 	#(debugger         Debugger)
    64 	#(debugger         Debugger)
    63 	#(systembrowser    SBrowser)
    65 	#(systembrowser    SBrowser)
    91 ! !
    93 ! !
    92 
    94 
    93 !Icon class methodsFor:'instance creation'!
    95 !Icon class methodsFor:'instance creation'!
    94 
    96 
    95 constantNamed:aName put:anIcon
    97 constantNamed:aName put:anIcon
    96     KnownIcons at:aName put:icon
    98     KnownIcons at:aName put:anIcon
    97 !
    99 !
    98 
   100 
    99 constantNamed:aName
   101 constantNamed:aName
   100     |icon nm|
   102     |icon nm|
   101 
   103 
   109 	    icon := Image fromFile:('bitmaps/' , aName , '.xbm').
   111 	    icon := Image fromFile:('bitmaps/' , aName , '.xbm').
   110 	    icon isNil ifTrue:[
   112 	    icon isNil ifTrue:[
   111 		('ICON: no icon named ' , aName) errorPrintNL.
   113 		('ICON: no icon named ' , aName) errorPrintNL.
   112 		^ nil
   114 		^ nil
   113 	    ].
   115 	    ].
       
   116 	    icon := icon on:Screen default.
   114 	].
   117 	].
   115 	KnownIcons at:aName put:icon.
   118 	KnownIcons at:aName put:icon.
   116     ].
   119     ].
   117     ^ icon
   120     ^ icon
   118 
   121 
   119     "
   122     "
   120      Icon constantNamed:#file     
   123      Icon constantNamed:#file     
   121      Icon constantNamed:#debugger     
   124      Icon constantNamed:#debugger     
   122      Icon constantNamed:#systembrowser     
   125      Icon constantNamed:#systembrowser     
   123      Icon constantNamed:#SBrowser     
   126      Icon constantNamed:#SBrowser     
       
   127      Icon constantNamed:#SBrowser     
   124     "
   128     "
   125 ! !
   129 ! !
   126 
   130 
   127 Icon initialize!
   131 Icon initialize!