ChckTggle.st
author claus
Wed, 13 Oct 1993 03:46:58 +0100
changeset 4 88eb91574867
parent 2 880bbcc50207
child 18 66bf62e27141
permissions -rw-r--r--
*** empty log message ***

"
 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:'activeLogo'
         classVariableNames:'defaultCheckForm'
         poolDictionaries:''
         category:'Views-Interactors'
!

CheckToggle comment:'

COPYRIGHT (c) 1991 by Claus Gittinger
              All Rights Reserved

CheckButtons like Toggles do something when pressed/released;
but show an ok-marker if on; nothing if off

$Header: /cvs/stx/stx/libwidg/Attic/ChckTggle.st,v 1.3 1993-10-13 02:46:38 claus Exp $

written spring 92 by claus
'!

!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.
    self form:activeLogo
! !

!CheckToggle methodsFor:'redrawing'!

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