ChckTggle.st
changeset 0 e6a541c1c0eb
child 2 880bbcc50207
equal deleted inserted replaced
-1:000000000000 0:e6a541c1c0eb
       
     1 "
       
     2  COPYRIGHT (c) 1991-92 by Claus Gittinger
       
     3               All Rights Reserved
       
     4 
       
     5  This software is furnished under a license and may be used
       
     6  only in accordance with the terms of that license and with the
       
     7  inclusion of the above copyright notice.   This software may not
       
     8  be provided or otherwise made available to, or used by, any
       
     9  other person.  No title to or ownership of the software is
       
    10  hereby transferred.
       
    11 "
       
    12 
       
    13 Toggle subclass:#CheckToggle
       
    14          instanceVariableNames:'activeLogo'
       
    15          classVariableNames:'defaultCheckForm'
       
    16          poolDictionaries:''
       
    17          category:'Views-Interactors'
       
    18 !
       
    19 
       
    20 CheckToggle comment:'
       
    21 
       
    22 COPYRIGHT (c) 1991-92 by Claus Gittinger
       
    23               All Rights Reserved
       
    24 
       
    25 CheckButtons like Toggles do something when pressed/released;
       
    26 but show an ok-marker if on; nothing if off
       
    27 
       
    28 @(#)ChckTggle.st	3.2 92/09/07
       
    29 
       
    30 written spring 92 by claus
       
    31 '!
       
    32 
       
    33 !CheckToggle class methodsFor:'defaults'!
       
    34 
       
    35 checkFormOn:aDevice
       
    36     "answer the form used when checkToggle is turned on"
       
    37 
       
    38     defaultCheckForm isNil ifTrue:[
       
    39         defaultCheckForm := Form fromFile:'CheckOn.xbm' 
       
    40                                resolution:100
       
    41                                        on:aDevice
       
    42     ].
       
    43     defaultCheckForm isNil ifTrue:[
       
    44         defaultCheckForm :=
       
    45             Form width:16 height:16 fromArray:#(2r00000000 2r00000000
       
    46                                                 2r00000000 2r00000010
       
    47                                                 2r00000000 2r00000010
       
    48                                                 2r00000000 2r00000100
       
    49                                                 2r00000000 2r00000100
       
    50                                                 2r00000000 2r00001000
       
    51                                                 2r00000000 2r00001000
       
    52                                                 2r00000000 2r00010000
       
    53                                                 2r01000000 2r00010000
       
    54                                                 2r00100000 2r00100000
       
    55                                                 2r00010000 2r00100000
       
    56                                                 2r00001000 2r01000000
       
    57                                                 2r00000100 2r01000000
       
    58                                                 2r00000010 2r10000000
       
    59                                                 2r00000001 2r10000000
       
    60                                                 2r00000000 2r00000000)
       
    61                                             on:aDevice
       
    62     ].
       
    63     ^ defaultCheckForm
       
    64 ! !
       
    65 
       
    66 !CheckToggle methodsFor:'initialization'!
       
    67 
       
    68 initialize
       
    69     super initialize.
       
    70 
       
    71     onLevel := offLevel.
       
    72     activeLogo := self class checkFormOn:device.
       
    73     self form:activeLogo
       
    74 ! !
       
    75 
       
    76 !CheckToggle methodsFor:'redrawing'!
       
    77 
       
    78 redraw
       
    79     pressed ifTrue:[
       
    80         logo := activeLogo.
       
    81         super redraw
       
    82     ] ifFalse:[
       
    83         logo := nil.
       
    84         super redraw
       
    85     ]
       
    86 ! !
       
    87