CheckToggle.st
author claus
Sat, 18 Mar 1995 06:16:33 +0100
changeset 104 ca75c90df7a9
parent 77 565b052f5277
child 118 3ee5ea99d0e2
permissions -rw-r--r--
Initial revision

"
 COPYRIGHT (c) 1991 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.
"

Toggle subclass:#CheckToggle
	 instanceVariableNames:''
	 classVariableNames:'DefaultCheckForm'
	 poolDictionaries:''
	 category:'Views-Interactors'
!

CheckToggle comment:'
COPYRIGHT (c) 1991 by Claus Gittinger
	      All Rights Reserved

$Header: /cvs/stx/stx/libwidg/CheckToggle.st,v 1.7 1995-02-06 00:51:59 claus Exp $
'!

!CheckToggle class methodsFor:'documentation'!

copyright
"
 COPYRIGHT (c) 1991 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/CheckToggle.st,v 1.7 1995-02-06 00:51:59 claus Exp $
"
!

documentation
"
    CheckButtons are like Toggles in toggling their state when pressed.
    However, they show an ok-marker if on; nothing if off.
"
! !

!CheckToggle class methodsFor:'defaults'!

checkFormOn:aDevice
    "answer the form used when checkToggle is turned on"

    DefaultCheckForm isNil ifTrue:[
	DefaultCheckForm := Form fromFile:'CheckOn.xbm' 
			       resolution:100
				       on:aDevice
    ].
    DefaultCheckForm isNil ifTrue:[
	DefaultCheckForm :=
	    Form width:16 height:16 fromArray:#[2r00000000 2r00000000
						2r00000000 2r00000010
						2r00000000 2r00000010
						2r00000000 2r00000100
						2r00000000 2r00000100
						2r00000000 2r00001000
						2r00000000 2r00001000
						2r00000000 2r00010000
						2r01000000 2r00010000
						2r00100000 2r00100000
						2r00010000 2r00100000
						2r00001000 2r01000000
						2r00000100 2r01000000
						2r00000010 2r10000000
						2r00000001 2r10000000
						2r00000000 2r00000000]
					    on:aDevice
    ].
    ^ DefaultCheckForm
! !

!CheckToggle methodsFor:'initialization'!

initialize
    super initialize.

    onLevel := offLevel.
    activeLogo := self class checkFormOn:device.
    passiveLogo := nil.
    self form:activeLogo
!

initStyle
    super initStyle.

    self activeForegroundColor:(StyleSheet at:'checkToggleCheckColor' default:activeFgColor).
    showLamp := false
! !

!CheckToggle methodsFor:'redrawing'!

redraw
    controller pressed ifTrue:[
	logo := activeLogo.
	super redraw
    ] ifFalse:[
	logo := nil.
	super redraw
    ]
! !