77
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
|
12 |
|
|
13 |
'From Smalltalk/X, Version:2.10.5 on 14-apr-1995 at 11:13:06 am'!
|
|
14 |
|
|
15 |
Object subclass:#Icon
|
|
16 |
instanceVariableNames:'image mask'
|
|
17 |
classVariableNames:'KnownIcons'
|
|
18 |
poolDictionaries:''
|
|
19 |
category:'Graphics-Support'
|
|
20 |
!
|
|
21 |
|
|
22 |
!Icon class methodsFor:'documentation'!
|
|
23 |
|
|
24 |
version
|
|
25 |
"
|
105
|
26 |
$Header: /cvs/stx/stx/libview2/Icon.st,v 1.3 1995-09-23 11:30:33 claus Exp $
|
77
|
27 |
"
|
|
28 |
!
|
|
29 |
|
|
30 |
documentation
|
|
31 |
"
|
|
32 |
Compatibility mimicri for Icon.
|
|
33 |
Implements the #constantNamed: message which is used by some PD
|
|
34 |
classes and returns corresponding ST/X icons.
|
|
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
|
|
37 |
name symbol (i.e. for Icon constantNamed:#foo, a 'foo.xbm' file is required).
|
105
|
38 |
Caveat:
|
|
39 |
masks are not yet implemented
|
77
|
40 |
"
|
|
41 |
!
|
|
42 |
|
|
43 |
copyright
|
|
44 |
"
|
|
45 |
COPYRIGHT (c) 1995 by Claus Gittinger
|
|
46 |
All Rights Reserved
|
|
47 |
|
|
48 |
This software is furnished under a license and may be used
|
|
49 |
only in accordance with the terms of that license and with the
|
|
50 |
inclusion of the above copyright notice. This software may not
|
|
51 |
be provided or otherwise made available to, or used by, any
|
|
52 |
other person. No title to or ownership of the software is
|
|
53 |
hereby transferred.
|
|
54 |
"
|
|
55 |
! !
|
|
56 |
|
|
57 |
!Icon class methodsFor:'initialization'!
|
|
58 |
|
|
59 |
replacementNames
|
105
|
60 |
"return an ST-80 constant name to ST/X file name translation."
|
77
|
61 |
|
|
62 |
^ #(
|
|
63 |
#(file FBrowser)
|
|
64 |
#(debugger Debugger)
|
|
65 |
#(systembrowser SBrowser)
|
|
66 |
#(classbrowser SBrowser)
|
|
67 |
#(categoryBrowser SBrowser)
|
|
68 |
#(hierarchyBrowser SBrowser)
|
|
69 |
#(methodBrowser SBrowser)
|
|
70 |
#(launcher SmalltalkX)
|
|
71 |
#(workspace SmalltalkX)
|
|
72 |
#(transcript SmalltalkX)
|
|
73 |
#(inspector Inspector)
|
|
74 |
#(default SmalltalkX)
|
|
75 |
)
|
|
76 |
!
|
|
77 |
|
|
78 |
replacementNameFor:aName
|
|
79 |
"return a replacement ST/X name for an ST80 icon name."
|
|
80 |
|
|
81 |
self replacementNames do:[:aPair |
|
|
82 |
(aPair at:1) == aName ifTrue:[^ aPair at:2].
|
|
83 |
].
|
|
84 |
^ nil
|
|
85 |
!
|
|
86 |
|
|
87 |
initialize
|
|
88 |
KnownIcons := IdentityDictionary new
|
|
89 |
|
|
90 |
"
|
|
91 |
Icon initialize
|
|
92 |
"
|
|
93 |
! !
|
|
94 |
|
|
95 |
!Icon class methodsFor:'instance creation'!
|
|
96 |
|
|
97 |
constantNamed:aName put:anIcon
|
105
|
98 |
KnownIcons at:aName put:anIcon
|
77
|
99 |
!
|
|
100 |
|
|
101 |
constantNamed:aName
|
|
102 |
|icon nm|
|
|
103 |
|
|
104 |
icon := KnownIcons at:aName ifAbsent:[].
|
|
105 |
icon isNil ifTrue:[
|
|
106 |
nm := self replacementNameFor:aName.
|
|
107 |
nm notNil ifTrue:[
|
|
108 |
icon := Image fromFile:('bitmaps/' , nm , '.xbm').
|
|
109 |
].
|
|
110 |
icon isNil ifTrue:[
|
84
|
111 |
icon := Image fromFile:('bitmaps/' , aName , '.xbm').
|
77
|
112 |
icon isNil ifTrue:[
|
|
113 |
('ICON: no icon named ' , aName) errorPrintNL.
|
|
114 |
^ nil
|
|
115 |
].
|
105
|
116 |
icon := icon on:Screen default.
|
77
|
117 |
].
|
|
118 |
KnownIcons at:aName put:icon.
|
|
119 |
].
|
|
120 |
^ icon
|
|
121 |
|
|
122 |
"
|
|
123 |
Icon constantNamed:#file
|
|
124 |
Icon constantNamed:#debugger
|
|
125 |
Icon constantNamed:#systembrowser
|
84
|
126 |
Icon constantNamed:#SBrowser
|
105
|
127 |
Icon constantNamed:#SBrowser
|
77
|
128 |
"
|
|
129 |
! !
|
|
130 |
|
|
131 |
Icon initialize!
|