AboutBox.st
author Claus Gittinger <cg@exept.de>
Sun, 24 Mar 1996 19:31:02 +0100
changeset 452 33ce1b3cd502
parent 451 35d5ba59ee0e
child 498 382ef0b86b30
permissions -rw-r--r--
oops - the last one was wrong

"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"

InfoBox subclass:#AboutBox
	instanceVariableNames:''
	classVariableNames:'CachedIcon'
	poolDictionaries:''
	category:'Views-DialogBoxes'
!

!AboutBox class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1995 by Claus Gittinger
	      All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

documentation
"
    A box specialized to show the ST/X about information.
    Can be subclasses for your own aboutBoxes; to do so, redefine
    defaultIcon and aboutText.

    example:
	AboutBox new open

	AboutBox new showAtPointer
"
! !

!AboutBox class methodsFor:'defaults'!

aboutText
    "return a string to be shown in the box"

    |distributor|

    distributor := ''.
"/    distributor := Smalltalk distributorString.
"/    distributor notEmpty ifTrue:[
"/        distributor := 'Distributed by: ' , distributor
"/    ].

    ^
'SmallTalk/X

Version ......... ' , Smalltalk versionString , '.' , Smalltalk releaseNr printString ,
		      ' (' , Smalltalk versionDate printString , ')
Configuration ... ' , Smalltalk configuration , '
Running on ...... ' , OperatingSystem getHostName , '

' , Smalltalk copyrightString , '

' , distributor.

    "Modified: 16.11.1995 / 18:34:16 / cg"
!

defaultIcon
    "return a smalltalk/X icon"

    CachedIcon isNil ifTrue:[
	CachedIcon := Form fromFile:'SmalltalkX.xbm' resolution:100.
    ].
    ^ CachedIcon
! !

!AboutBox methodsFor:'initialization'!

initialize 
    |dark green lbl|

    super initialize.

    self label:'About ...'.

    device hasColors ifTrue:[
        green := (Color red:0 green:80 blue:20) "darkened".
        dark := Color grey:10.
    ] ifFalse:[
        green := Color white.
        dark := Color black.
    ].

    self withAllSubViewsDo:[:s | s viewBackground:dark].

    self form:(self class defaultIcon).
    (lbl := self formLabel) viewBackground:dark.
    lbl foregroundColor:green backgroundColor:dark.
    (lbl := self textLabel) viewBackground:dark.
    lbl foregroundColor:White backgroundColor:dark.

    self title:(self class aboutText).
    self okText:'close'.

    "Modified: 24.3.1996 / 19:29:53 / cg"
! !

!AboutBox methodsFor:'show / hide'!

show
    "redefined to automatically hide myself after some time"

    self autoHideAfter:10 with:[].
    super showAtCenter.

    "
     AboutBox new show
    "
! !

!AboutBox class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/AboutBox.st,v 1.15 1996-03-24 18:31:02 cg Exp $'
! !