CheckToggle.st
author claus
Sun, 07 Aug 1994 15:23:42 +0200
changeset 38 4b9b70b2cc87
parent 18 66bf62e27141
child 59 450ce95a72a4
permissions -rw-r--r--
2.10.3 pre-final version

"
 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

$Header: /cvs/stx/stx/libwidg/CheckToggle.st,v 1.5 1994-08-07 13:21:08 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.5 1994-08-07 13:21:08 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.
    self form:activeLogo
!

initStyle
    super initStyle.

    style == #iris ifTrue:[
        self activeForegroundColor:Color red.
        showLamp := false
    ]
! !

!CheckToggle methodsFor:'redrawing'!

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