AboutBox.st
author Claus Gittinger <cg@exept.de>
Sun, 24 Mar 1996 18:59:04 +0100
changeset 451 35d5ba59ee0e
parent 248 3813e693e329
child 452 33ce1b3cd502
permissions -rw-r--r--
added access method for background color
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
84
700f3924df1d Initial revision
claus
parents:
diff changeset
     1
"
700f3924df1d Initial revision
claus
parents:
diff changeset
     2
 COPYRIGHT (c) 1995 by Claus Gittinger
92
claus
parents: 84
diff changeset
     3
	      All Rights Reserved
84
700f3924df1d Initial revision
claus
parents:
diff changeset
     4
700f3924df1d Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
700f3924df1d Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
700f3924df1d Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
700f3924df1d Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
700f3924df1d Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
700f3924df1d Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
700f3924df1d Initial revision
claus
parents:
diff changeset
    11
"
700f3924df1d Initial revision
claus
parents:
diff changeset
    12
700f3924df1d Initial revision
claus
parents:
diff changeset
    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
700f3924df1d Initial revision
claus
parents:
diff changeset
    18
!
700f3924df1d Initial revision
claus
parents:
diff changeset
    19
700f3924df1d Initial revision
claus
parents:
diff changeset
    20
!AboutBox class methodsFor:'documentation'!
700f3924df1d Initial revision
claus
parents:
diff changeset
    21
198
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    22
copyright
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    23
"
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    24
 COPYRIGHT (c) 1995 by Claus Gittinger
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    25
	      All Rights Reserved
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    26
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    27
 This software is furnished under a license and may be used
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    28
 only in accordance with the terms of that license and with the
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    29
 inclusion of the above copyright notice.   This software may not
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    30
 be provided or otherwise made available to, or used by, any
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    31
 other person.  No title to or ownership of the software is
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    32
 hereby transferred.
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    33
"
84
700f3924df1d Initial revision
claus
parents:
diff changeset
    34
!
700f3924df1d Initial revision
claus
parents:
diff changeset
    35
700f3924df1d Initial revision
claus
parents:
diff changeset
    36
documentation
700f3924df1d Initial revision
claus
parents:
diff changeset
    37
"
700f3924df1d Initial revision
claus
parents:
diff changeset
    38
    A box specialized to show the ST/X about information.
92
claus
parents: 84
diff changeset
    39
    Can be subclasses for your own aboutBoxes; to do so, redefine
claus
parents: 84
diff changeset
    40
    defaultIcon and aboutText.
84
700f3924df1d Initial revision
claus
parents:
diff changeset
    41
92
claus
parents: 84
diff changeset
    42
    example:
claus
parents: 84
diff changeset
    43
	AboutBox new open
claus
parents: 84
diff changeset
    44
claus
parents: 84
diff changeset
    45
	AboutBox new showAtPointer
84
700f3924df1d Initial revision
claus
parents:
diff changeset
    46
"
700f3924df1d Initial revision
claus
parents:
diff changeset
    47
! !
700f3924df1d Initial revision
claus
parents:
diff changeset
    48
700f3924df1d Initial revision
claus
parents:
diff changeset
    49
!AboutBox class methodsFor:'defaults'!
700f3924df1d Initial revision
claus
parents:
diff changeset
    50
92
claus
parents: 84
diff changeset
    51
aboutText
125
claus
parents: 111
diff changeset
    52
    "return a string to be shown in the box"
claus
parents: 111
diff changeset
    53
179
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    54
    |distributor|
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    55
186
4980d43818e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    56
    distributor := ''.
4980d43818e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    57
"/    distributor := Smalltalk distributorString.
4980d43818e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    58
"/    distributor notEmpty ifTrue:[
4980d43818e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    59
"/        distributor := 'Distributed by: ' , distributor
4980d43818e5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 179
diff changeset
    60
"/    ].
179
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    61
92
claus
parents: 84
diff changeset
    62
    ^
179
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    63
'SmallTalk/X
92
claus
parents: 84
diff changeset
    64
claus
parents: 84
diff changeset
    65
Version ......... ' , Smalltalk versionString , '.' , Smalltalk releaseNr printString ,
claus
parents: 84
diff changeset
    66
		      ' (' , Smalltalk versionDate printString , ')
claus
parents: 84
diff changeset
    67
Configuration ... ' , Smalltalk configuration , '
claus
parents: 84
diff changeset
    68
Running on ...... ' , OperatingSystem getHostName , '
claus
parents: 84
diff changeset
    69
179
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    70
' , Smalltalk copyrightString , '
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    71
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    72
' , distributor.
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    73
f464e3c75104 if nonEmpty, display distributorString
Claus Gittinger <cg@exept.de>
parents: 165
diff changeset
    74
    "Modified: 16.11.1995 / 18:34:16 / cg"
198
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    75
!
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    76
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    77
defaultIcon
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    78
    "return a smalltalk/X icon"
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    79
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    80
    CachedIcon isNil ifTrue:[
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    81
	CachedIcon := Form fromFile:'SmalltalkX.xbm' resolution:100.
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    82
    ].
2b044adb45a7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 186
diff changeset
    83
    ^ CachedIcon
84
700f3924df1d Initial revision
claus
parents:
diff changeset
    84
! !
700f3924df1d Initial revision
claus
parents:
diff changeset
    85
451
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    86
!AboutBox methodsFor:'accessing'!
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    87
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    88
backgroundColor:aColor
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    89
    |lbl|
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    90
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    91
    self withAllSubViewsDo:[:s | s viewBackground:aColor].
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    92
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    93
    (lbl := self formLabel) viewBackground:aColor.
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    94
    lbl backgroundColor:aColor.
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    95
    (lbl := self textLabel) viewBackground:aColor.
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    96
    lbl backgroundColor:aColor.
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    97
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    98
    "Created: 24.3.1996 / 18:19:35 / cg"
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
    99
! !
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
   100
84
700f3924df1d Initial revision
claus
parents:
diff changeset
   101
!AboutBox methodsFor:'initialization'!
700f3924df1d Initial revision
claus
parents:
diff changeset
   102
700f3924df1d Initial revision
claus
parents:
diff changeset
   103
initialize 
107
claus
parents: 105
diff changeset
   104
    |dark green lbl|
84
700f3924df1d Initial revision
claus
parents:
diff changeset
   105
700f3924df1d Initial revision
claus
parents:
diff changeset
   106
    super initialize.
700f3924df1d Initial revision
claus
parents:
diff changeset
   107
700f3924df1d Initial revision
claus
parents:
diff changeset
   108
    self label:'About ...'.
700f3924df1d Initial revision
claus
parents:
diff changeset
   109
700f3924df1d Initial revision
claus
parents:
diff changeset
   110
    device hasColors ifTrue:[
248
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   111
        green := (Color red:0 green:80 blue:20) "darkened".
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   112
        dark := Color grey:10.
84
700f3924df1d Initial revision
claus
parents:
diff changeset
   113
    ] ifFalse:[
248
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   114
        green := Color white.
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   115
        dark := Color black.
84
700f3924df1d Initial revision
claus
parents:
diff changeset
   116
    ].
700f3924df1d Initial revision
claus
parents:
diff changeset
   117
451
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
   118
    self backgroundColor:dark.
248
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   119
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   120
    "Created: 7.12.1995 / 17:03:09 / cg"
451
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
   121
    "Modified: 24.3.1996 / 18:58:36 / cg"
84
700f3924df1d Initial revision
claus
parents:
diff changeset
   122
! !
700f3924df1d Initial revision
claus
parents:
diff changeset
   123
700f3924df1d Initial revision
claus
parents:
diff changeset
   124
!AboutBox methodsFor:'show / hide'!
700f3924df1d Initial revision
claus
parents:
diff changeset
   125
700f3924df1d Initial revision
claus
parents:
diff changeset
   126
show
100
claus
parents: 92
diff changeset
   127
    "redefined to automatically hide myself after some time"
claus
parents: 92
diff changeset
   128
84
700f3924df1d Initial revision
claus
parents:
diff changeset
   129
    self autoHideAfter:10 with:[].
700f3924df1d Initial revision
claus
parents:
diff changeset
   130
    super showAtCenter.
700f3924df1d Initial revision
claus
parents:
diff changeset
   131
700f3924df1d Initial revision
claus
parents:
diff changeset
   132
    "
700f3924df1d Initial revision
claus
parents:
diff changeset
   133
     AboutBox new show
700f3924df1d Initial revision
claus
parents:
diff changeset
   134
    "
700f3924df1d Initial revision
claus
parents:
diff changeset
   135
! !
700f3924df1d Initial revision
claus
parents:
diff changeset
   136
248
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   137
!AboutBox class methodsFor:'documentation'!
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   138
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   139
version
451
35d5ba59ee0e added access method for background color
Claus Gittinger <cg@exept.de>
parents: 248
diff changeset
   140
    ^ '$Header: /cvs/stx/stx/libtool/AboutBox.st,v 1.14 1996-03-24 17:59:04 cg Exp $'
248
3813e693e329 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 198
diff changeset
   141
! !