WarnBox.st
author claus
Wed, 10 May 1995 04:30:46 +0200
changeset 126 40228f4fd66b
parent 109 0f014b33eba2
child 174 d80a6cc3f9b2
permissions -rw-r--r--
.

"
 COPYRIGHT (c) 1993 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:#WarningBox
       instanceVariableNames:''
       classVariableNames:'WarnBitmap'
       poolDictionaries:''
       category:'Views-DialogBoxes'
!

WarningBox comment:'
COPYRIGHT (c) 1993 by Claus Gittinger
	      All Rights Reserved

$Header: /cvs/stx/stx/libwidg/Attic/WarnBox.st,v 1.9 1995-03-20 11:52:01 claus Exp $
'!

!WarningBox class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1993 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.
"
!

version
"
$Header: /cvs/stx/stx/libwidg/Attic/WarnBox.st,v 1.9 1995-03-20 11:52:01 claus Exp $
"
!

documentation
"
    this class implements a pop-up box to show an information message. 
    WarningBoxes are basically InfoBoxes with a different bitmap-image.
    (also, they add a beep when popping up)

    They are created with:

	aBox := WarningBox title:'some title'.

    and shown with:

	aBox showAtPointer

    The default box shows 'yes' in its button; this can be changed with:

	aBox okText:'some string'.

    Since showing warnings is a common action, a convenient method has been
    added to Object; thus you can use:

	self warn:'oops - headcrash'

    everywhere in your code.
"
!

examples
"
    Examples:

	|aBox|

	aBox := WarningBox title:'Press ''OK'' to continue'.
	aBox okText:'OK'.
	aBox showAtPointer.

    since warnboxes are much like infoBoxes, all of look can be changed
    like described there:

	|aBox|

	aBox := WarningBox title:'Press ''OK'' to continue'.
	aBox okText:'yes, continue'.
	aBox form:(Image fromFile:'bitmaps/SmalltalkX.xbm').
	aBox showAtPointer.
"
! !

!WarningBox class methodsFor:'styles'!

updateStyleCache
    |img|

    img := StyleSheet at:'warningBoxIcon'.
    img notNil ifTrue:[WarnBitmap := img on:Display].
! !

!WarningBox class methodsFor:'icon bitmap'!

iconBitmap
    "return the bitmap shown as icon in my instances"

    WarnBitmap isNil ifTrue:[
	WarnBitmap := Image fromFile:'bitmaps/Warning.xbm'.
	WarnBitmap notNil ifTrue:[
	    WarnBitmap := WarnBitmap on:Display
	]
    ].
    ^ WarnBitmap
! !

!WarningBox methodsFor:'initialization'!

initialize
    super initialize.
    label := 'Warning'
! !

!WarningBox methodsFor:'realization'!

show
    "added bell to wake up user"

    device beep.
    super show
! 

showAtPointer
    "added bell to wake up user"

    device beep.
    super showAtPointer
! !