author | Claus Gittinger <cg@exept.de> |
Wed, 22 Aug 2018 15:37:08 +0200 | |
changeset 18348 | b3cdcd31f2cf |
parent 18109 | 3238e993a075 |
permissions | -rw-r--r-- |
18109 | 1 |
"{ Encoding: utf8 }" |
2 |
||
84 | 3 |
" |
4 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
92 | 5 |
All Rights Reserved |
84 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
2700 | 14 |
"{ Package: 'stx:libtool' }" |
15 |
||
16026 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
84 | 18 |
InfoBox subclass:#AboutBox |
451
35d5ba59ee0e
added access method for background color
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
19 |
instanceVariableNames:'' |
9801 | 20 |
classVariableNames:'DefaultGreen' |
451
35d5ba59ee0e
added access method for background color
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
21 |
poolDictionaries:'' |
35d5ba59ee0e
added access method for background color
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
22 |
category:'Views-DialogBoxes' |
84 | 23 |
! |
24 |
||
879 | 25 |
!AboutBox class methodsFor:'documentation'! |
84 | 26 |
|
198 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
84 | 39 |
! |
40 |
||
41 |
documentation |
|
42 |
" |
|
2700 | 43 |
A box specialized to show the ST/X about-information (also usable for Applications). |
498 | 44 |
As a speciality, this box automatically closes if left |
45 |
alone for a while. |
|
84 | 46 |
|
498 | 47 |
Can be subclasses for your own aboutBoxes; to do so, redefine |
48 |
#defaultIcon and #aboutText. |
|
92 | 49 |
|
498 | 50 |
examples: |
51 |
AboutBox new open |
|
52 |
||
53 |
AboutBox new showAtPointer |
|
84 | 54 |
" |
2700 | 55 |
! |
56 |
||
57 |
examples |
|
58 |
" |
|
59 |
[exBegin] |
|
60 |
|box| |
|
61 |
||
62 |
box := AboutBox new. |
|
63 |
box autoHideAfter:10 with:[]. |
|
64 |
box showAtCenter |
|
65 |
[exEnd] |
|
66 |
||
67 |
[exBegin] |
|
68 |
|box| |
|
69 |
||
70 |
box := AboutBox title:'About me'. |
|
5333 | 71 |
box image:((Smalltalk |
72 |
bitmapFromFileNamed:'gifImages/claus.gif' |
|
73 |
inPackage:'stx:goodies') |
|
74 |
magnifiedTo:100@100). |
|
2700 | 75 |
box label:'Example'. |
76 |
box autoHideAfter:10 with:[]. |
|
77 |
box showAtPointer. |
|
78 |
[exEnd] |
|
79 |
" |
|
84 | 80 |
! ! |
81 |
||
879 | 82 |
!AboutBox class methodsFor:'defaults'! |
84 | 83 |
|
92 | 84 |
aboutText |
498 | 85 |
"return a string to be shown in the box. |
86 |
Can be redefined in custom subclasses." |
|
125 | 87 |
|
8701 | 88 |
|paddedLabelWith distributor expiration machine info resources| |
7795 | 89 |
|
90 |
resources := self classResources. |
|
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
91 |
|
8701 | 92 |
paddedLabelWith := |
93 |
[:label :value | |
|
94 |
(((resources string:label) , ' ') paddedTo:20 with:$.) , ' ' , value |
|
95 |
]. |
|
96 |
||
693 | 97 |
distributor := Smalltalk distributorString. |
98 |
distributor notEmpty ifTrue:[ |
|
8701 | 99 |
distributor := paddedLabelWith value:'Distributor' value:distributor |
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
100 |
]. |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
101 |
expiration := Smalltalk expirationTime. |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
102 |
expiration notNil ifTrue:[ |
8701 | 103 |
expiration := paddedLabelWith value:'Expires' value:expiration |
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
104 |
] ifFalse:[ |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
105 |
expiration := ''. |
693 | 106 |
]. |
1797 | 107 |
machine := OperatingSystem getHostName. |
108 |
info := OperatingSystem getSystemInfo. |
|
109 |
(info includesKey:#machine) ifTrue:[ |
|
110 |
machine := machine , ' (' , (info at:#machine) , ')' |
|
111 |
]. |
|
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
112 |
|
92 | 113 |
^ |
7721 | 114 |
'Smalltalk/X |
92 | 115 |
|
16233 | 116 |
' , (paddedLabelWith value:'Version' value:Smalltalk versionString) , |
498 | 117 |
' (' , Smalltalk versionDate printString , ') |
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
118 |
', distributor, ' |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
119 |
', expiration , ' |
8701 | 120 |
' , (paddedLabelWith value:'Release ID' value:Smalltalk releaseIdentification) , ' |
18109 | 121 |
' , (paddedLabelWith value:'Configuration' value:Smalltalk configuration) , ' (' , (ExternalBytes sizeofPointer * 8) printString,'bit) |
8701 | 122 |
' , (paddedLabelWith value:'Running on' value:machine) , ' |
123 |
' , (paddedLabelWith value:'Started at' value:Smalltalk imageStartTime printString) , ' |
|
92 | 124 |
|
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
125 |
' , Smalltalk copyrightString , ' |
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
126 |
|
693 | 127 |
' |
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
128 |
|
7721 | 129 |
"Modified: / 06-09-1996 / 10:11:08 / stefan" |
7795 | 130 |
"Modified: / 16-04-2007 / 16:17:34 / cg" |
198 | 131 |
! |
132 |
||
2727 | 133 |
defaultGreen |
134 |
"return the boxes default green color (eXept green)." |
|
135 |
||
136 |
DefaultGreen notNil ifTrue:[^ DefaultGreen]. |
|
137 |
^ Color red:0 green:80 blue:20 |
|
138 |
! |
|
139 |
||
198 | 140 |
defaultIcon |
16942 | 141 |
"return a Smalltalk/X icon. |
498 | 142 |
Can be redefined in custom subclasses." |
198 | 143 |
|
9801 | 144 |
<resource: #programImage> |
498 | 145 |
|
9801 | 146 |
^ Icon stxIconTransparent3. |
498 | 147 |
! |
148 |
||
149 |
defaultLabel |
|
150 |
"return the boxes default window title." |
|
151 |
||
6625 | 152 |
^ 'About...' |
498 | 153 |
|
154 |
"Modified: 23.4.1996 / 17:09:48 / cg" |
|
155 |
"Created: 23.4.1996 / 17:11:46 / cg" |
|
84 | 156 |
! ! |
157 |
||
8988 | 158 |
!AboutBox class methodsFor:'image specs'! |
159 |
||
160 |
stxIconTemplate |
|
161 |
"This resource specification was automatically generated |
|
162 |
by the ImageEditor of ST/X." |
|
163 |
||
164 |
"Do not manually edit this!! If it is corrupted, |
|
165 |
the ImageEditor may not be able to read the specification." |
|
166 |
||
167 |
" |
|
168 |
self stxIconTemplate inspect |
|
169 |
ImageEditor openOnClass:self andSelector:#stxIconTemplate |
|
170 |
Icon flushCachedIcons |
|
171 |
" |
|
172 |
||
173 |
<resource: #image> |
|
174 |
||
175 |
^Icon |
|
176 |
constantNamed:'AboutBox class stxIconTemplate' |
|
16552 | 177 |
ifAbsentPut:[(Depth1Image width:48 height:48) bits:(ByteArray fromPackedString:' |
8988 | 178 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
179 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
180 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
|
16552 | 181 |
@@@@@@@@@@@@@@@@@@@@@@@@') |
182 |
colorMapFromArray:#[0 0 0] |
|
183 |
mask:((ImageMask width:48 height:48) bits:(ByteArray fromPackedString:' |
|
8988 | 184 |
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@G@@@A @@O @@C@@@O @@F@@@O @@L@@@O0@@\@@@O0@@8@@@G0@A0@@@G8@C @@@C8@G@@@@C<@N@@ |
185 |
@@A<@\@@@@A>@8@@@@@>A0@@@@@_C @@@@@_G @@@@@O/@@@@@@O>@@@@@@G<@@@@@@G8@@@@@@C8@@@@@@G8@@@@@@O<@@@@@@_<@@@@@@>^@@@@@A<N@@@ |
|
186 |
@@C8O@@@@@O0G @@@@_ C @@@@?@A0@@@A>@A0@@@C<@@8@@@O8@@\@@@_0@@L@@@? @@N@@@? @@F@@@?@@@C@@@^@@@A@@@@@@@@ @@@@@@@@@@@@@@@@@ |
|
16552 | 187 |
@@@@@@@@@@@@@@@@@@@@@@@@'); yourself); yourself] |
8988 | 188 |
! ! |
189 |
||
84 | 190 |
!AboutBox methodsFor:'initialization'! |
191 |
||
498 | 192 |
initialize |
2727 | 193 |
"setup the box; change all of my components viewBackground to some darkish grey." |
498 | 194 |
|
16245 | 195 |
|dark green lbl| |
84 | 196 |
|
197 |
super initialize. |
|
198 |
||
498 | 199 |
"/ self label:'About ...'. |
84 | 200 |
|
2727 | 201 |
green := self class defaultGreen. |
7961
f5545f9cf057
aboutToObenBoxNotification for aboutBox
Claus Gittinger <cg@exept.de>
parents:
7839
diff
changeset
|
202 |
dark := Color grey:20. |
16245 | 203 |
device hasColors ifFalse:[ |
204 |
device hasGrayscales ifTrue:[ |
|
2727 | 205 |
green := Color brightness:(green brightness). |
206 |
dark := Color brightness:(dark brightness). |
|
207 |
] ifFalse:[ |
|
13958 | 208 |
green := self whiteColor. |
209 |
dark := self blackColor. |
|
2727 | 210 |
] |
84 | 211 |
]. |
212 |
||
452
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
213 |
self withAllSubViewsDo:[:s | s viewBackground:dark]. |
248 | 214 |
|
5834
2a6457a7d2d7
Use #image: instead of obsolete #form:
Stefan Vogel <sv@exept.de>
parents:
5554
diff
changeset
|
215 |
self image:(self class defaultIcon). |
452
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
216 |
(lbl := self formLabel) viewBackground:dark. |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
217 |
lbl foregroundColor:green backgroundColor:dark. |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
218 |
(lbl := self textLabel) viewBackground:dark. |
16746 | 219 |
lbl foregroundColor:self whiteColor backgroundColor:dark. |
452
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
220 |
|
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
221 |
self title:(self class aboutText). |
6625 | 222 |
self okText:(resources string:'Close'). |
452
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
223 |
|
1592 | 224 |
"Modified: / 12.6.1998 / 11:48:23 / cg" |
84 | 225 |
! ! |
226 |
||
4864 | 227 |
!AboutBox methodsFor:'show & hide'! |
84 | 228 |
|
229 |
show |
|
498 | 230 |
"show the box. |
231 |
Redefined to automatically hide myself after some time" |
|
100 | 232 |
|
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
233 |
self autoHideAfter:15 with:[]. |
84 | 234 |
super showAtCenter. |
235 |
||
236 |
" |
|
237 |
AboutBox new show |
|
238 |
" |
|
498 | 239 |
|
240 |
"Modified: 23.4.1996 / 17:10:03 / cg" |
|
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
241 |
"Modified: 6.9.1996 / 09:47:10 / stefan" |
84 | 242 |
! ! |
243 |
||
879 | 244 |
!AboutBox class methodsFor:'documentation'! |
248 | 245 |
|
246 |
version |
|
16026 | 247 |
^ '$Header$' |
8988 | 248 |
! |
249 |
||
250 |
version_CVS |
|
16026 | 251 |
^ '$Header$' |
248 | 252 |
! ! |
12559 | 253 |