author | Stefan Vogel <sv@exept.de> |
Fri, 09 May 1997 12:19:10 +0200 | |
changeset 1179 | e927f0c09298 |
parent 879 | 8582038d1287 |
child 1592 | 68d7e59d0c06 |
permissions | -rw-r--r-- |
84 | 1 |
" |
2 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
92 | 3 |
All Rights Reserved |
84 | 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 |
InfoBox subclass:#AboutBox |
|
451
35d5ba59ee0e
added access method for background color
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
14 |
instanceVariableNames:'' |
35d5ba59ee0e
added access method for background color
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
15 |
classVariableNames:'CachedIcon' |
35d5ba59ee0e
added access method for background color
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
16 |
poolDictionaries:'' |
35d5ba59ee0e
added access method for background color
Claus Gittinger <cg@exept.de>
parents:
248
diff
changeset
|
17 |
category:'Views-DialogBoxes' |
84 | 18 |
! |
19 |
||
879 | 20 |
!AboutBox class methodsFor:'documentation'! |
84 | 21 |
|
198 | 22 |
copyright |
23 |
" |
|
24 |
COPYRIGHT (c) 1995 by Claus Gittinger |
|
25 |
All Rights Reserved |
|
26 |
||
27 |
This software is furnished under a license and may be used |
|
28 |
only in accordance with the terms of that license and with the |
|
29 |
inclusion of the above copyright notice. This software may not |
|
30 |
be provided or otherwise made available to, or used by, any |
|
31 |
other person. No title to or ownership of the software is |
|
32 |
hereby transferred. |
|
33 |
" |
|
84 | 34 |
! |
35 |
||
36 |
documentation |
|
37 |
" |
|
38 |
A box specialized to show the ST/X about information. |
|
498 | 39 |
As a speciality, this box automatically closes if left |
40 |
alone for a while. |
|
84 | 41 |
|
498 | 42 |
Can be subclasses for your own aboutBoxes; to do so, redefine |
43 |
#defaultIcon and #aboutText. |
|
92 | 44 |
|
498 | 45 |
examples: |
46 |
AboutBox new open |
|
47 |
||
48 |
AboutBox new showAtPointer |
|
84 | 49 |
" |
50 |
! ! |
|
51 |
||
879 | 52 |
!AboutBox class methodsFor:'defaults'! |
84 | 53 |
|
92 | 54 |
aboutText |
498 | 55 |
"return a string to be shown in the box. |
56 |
Can be redefined in custom subclasses." |
|
125 | 57 |
|
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
58 |
|distributor expiration| |
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
59 |
|
693 | 60 |
distributor := Smalltalk distributorString. |
61 |
distributor notEmpty ifTrue:[ |
|
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
62 |
distributor := 'Distributor ...... ', distributor |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
63 |
]. |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
64 |
expiration := Smalltalk expirationTime. |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
65 |
expiration notNil ifTrue:[ |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
66 |
expiration := 'Expires ........... ', expiration printString |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
67 |
] ifFalse:[ |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
68 |
expiration := ''. |
693 | 69 |
]. |
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
70 |
|
92 | 71 |
^ |
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
72 |
'SmallTalk/X |
92 | 73 |
|
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
74 |
Version ......... ', Smalltalk versionString , '.' , Smalltalk releaseNr printString , |
498 | 75 |
' (' , Smalltalk versionDate printString , ') |
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
76 |
', distributor, ' |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
77 |
', expiration , ' |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
78 |
Release ID ...... ', Smalltalk releaseIdentification, ' |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
79 |
Configuration ... ', Smalltalk configuration, ' |
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
80 |
Running on ...... ', OperatingSystem getHostName, ' |
92 | 81 |
|
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
82 |
' , Smalltalk copyrightString , ' |
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
83 |
|
693 | 84 |
' |
179
f464e3c75104
if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents:
165
diff
changeset
|
85 |
|
693 | 86 |
"Modified: 19.8.1996 / 18:09:39 / cg" |
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
87 |
"Modified: 6.9.1996 / 10:11:08 / stefan" |
198 | 88 |
! |
89 |
||
90 |
defaultIcon |
|
498 | 91 |
"return a smalltalk/X icon. |
92 |
Can be redefined in custom subclasses." |
|
198 | 93 |
|
94 |
CachedIcon isNil ifTrue:[ |
|
879 | 95 |
CachedIcon := Image fromFile:'bitmaps/SmalltalkX.xbm' resolution:100. |
198 | 96 |
]. |
97 |
^ CachedIcon |
|
498 | 98 |
|
99 |
"Modified: 23.4.1996 / 17:09:48 / cg" |
|
100 |
! |
|
101 |
||
102 |
defaultLabel |
|
103 |
"return the boxes default window title." |
|
104 |
||
105 |
^ 'About ...' |
|
106 |
||
107 |
"Modified: 23.4.1996 / 17:09:48 / cg" |
|
108 |
"Created: 23.4.1996 / 17:11:46 / cg" |
|
84 | 109 |
! ! |
110 |
||
111 |
!AboutBox methodsFor:'initialization'! |
|
112 |
||
498 | 113 |
initialize |
114 |
"setup the box; change all of my components viewBackground |
|
115 |
to some darkish grey." |
|
116 |
||
107 | 117 |
|dark green lbl| |
84 | 118 |
|
119 |
super initialize. |
|
120 |
||
498 | 121 |
"/ self label:'About ...'. |
84 | 122 |
|
123 |
device hasColors ifTrue:[ |
|
248 | 124 |
green := (Color red:0 green:80 blue:20) "darkened". |
125 |
dark := Color grey:10. |
|
84 | 126 |
] ifFalse:[ |
248 | 127 |
green := Color white. |
128 |
dark := Color black. |
|
84 | 129 |
]. |
130 |
||
452
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
131 |
self withAllSubViewsDo:[:s | s viewBackground:dark]. |
248 | 132 |
|
452
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
133 |
self form:(self class defaultIcon). |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
134 |
(lbl := self formLabel) viewBackground:dark. |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
135 |
lbl foregroundColor:green backgroundColor:dark. |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
136 |
(lbl := self textLabel) viewBackground:dark. |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
137 |
lbl foregroundColor:White backgroundColor:dark. |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
138 |
|
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
139 |
self title:(self class aboutText). |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
140 |
self okText:'close'. |
33ce1b3cd502
oops - the last one was wrong
Claus Gittinger <cg@exept.de>
parents:
451
diff
changeset
|
141 |
|
498 | 142 |
"Modified: 23.4.1996 / 17:11:53 / cg" |
84 | 143 |
! ! |
144 |
||
145 |
!AboutBox methodsFor:'show / hide'! |
|
146 |
||
147 |
show |
|
498 | 148 |
"show the box. |
149 |
Redefined to automatically hide myself after some time" |
|
100 | 150 |
|
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
151 |
self autoHideAfter:15 with:[]. |
84 | 152 |
super showAtCenter. |
153 |
||
154 |
" |
|
155 |
AboutBox new show |
|
156 |
" |
|
498 | 157 |
|
158 |
"Modified: 23.4.1996 / 17:10:03 / cg" |
|
708
f89ff543ea18
Display expiration time, if apropriate.
Stefan Vogel <sv@exept.de>
parents:
693
diff
changeset
|
159 |
"Modified: 6.9.1996 / 09:47:10 / stefan" |
84 | 160 |
! ! |
161 |
||
879 | 162 |
!AboutBox class methodsFor:'documentation'! |
248 | 163 |
|
164 |
version |
|
879 | 165 |
^ '$Header: /cvs/stx/stx/libtool/AboutBox.st,v 1.19 1996-12-20 11:15:13 cg Exp $' |
248 | 166 |
! ! |