AboutBox.st
author Claus Gittinger <cg@exept.de>
Fri, 28 Jun 1996 23:48:59 +0200
changeset 651 b8a14e281c24
parent 498 382ef0b86b30
child 693 29bbbc339107
permissions -rw-r--r--
fixed browse, if there is nothing to browse

"
 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.
    As a speciality, this box automatically closes if left
    alone for a while.

    Can be subclasses for your own aboutBoxes; to do so, redefine
    #defaultIcon and #aboutText.

    examples:
        AboutBox new open

        AboutBox new showAtPointer
"
! !

!AboutBox class methodsFor:'defaults'!

aboutText
    "return a string to be shown in the box.
     Can be redefined in custom subclasses."

    |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: 23.4.1996 / 17:09:42 / cg"
!

defaultIcon
    "return a smalltalk/X icon.
     Can be redefined in custom subclasses."

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

    "Modified: 23.4.1996 / 17:09:48 / cg"
!

defaultLabel
    "return the boxes default window title."

    ^ 'About ...'

    "Modified: 23.4.1996 / 17:09:48 / cg"
    "Created: 23.4.1996 / 17:11:46 / cg"
! !

!AboutBox methodsFor:'initialization'!

initialize
    "setup the box; change all of my components viewBackground
     to some darkish grey."

    |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: 23.4.1996 / 17:11:53 / cg"
! !

!AboutBox methodsFor:'show / hide'!

show
    "show the box.
     Redefined to automatically hide myself after some time"

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

    "
     AboutBox new show
    "

    "Modified: 23.4.1996 / 17:10:03 / cg"
! !

!AboutBox class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libtool/AboutBox.st,v 1.16 1996-04-23 15:19:34 cg Exp $'
! !