RadioButtonGroup.st
author claus
Sun, 07 Aug 1994 15:23:42 +0200
changeset 38 4b9b70b2cc87
parent 7 15a9291b9bd0
child 59 450ce95a72a4
permissions -rw-r--r--
2.10.3 pre-final version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     1
"
5
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1991 by Claus Gittinger
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     3
              All Rights Reserved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     4
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    11
"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    12
7
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    13
OrderedCollection subclass:#RadioButtonGroup
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    14
         instanceVariableNames:''
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    15
         classVariableNames:''
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    16
         poolDictionaries:''
15a9291b9bd0 *** empty log message ***
claus
parents: 5
diff changeset
    17
         category:'Views-Support'
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    18
!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    19
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    20
RadioButtonGroup comment:'
5
claus
parents: 3
diff changeset
    21
COPYRIGHT (c) 1991 by Claus Gittinger
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    22
              All Rights Reserved
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    23
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    24
$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.5 1994-08-07 13:23:13 claus Exp $
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    25
'!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    26
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    27
!RadioButtonGroup class methodsFor:'documentation '!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    28
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    29
copyright
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    30
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    31
 COPYRIGHT (c) 1991 by Claus Gittinger
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    32
              All Rights Reserved
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    33
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    34
 This software is furnished under a license and may be used
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    35
 only in accordance with the terms of that license and with the
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    36
 inclusion of the above copyright notice.   This software may not
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    37
 be provided or otherwise made available to, or used by, any
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    38
 other person.  No title to or ownership of the software is
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    39
 hereby transferred.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    40
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    41
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    42
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    43
version
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    44
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    45
$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.5 1994-08-07 13:23:13 claus Exp $
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    46
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    47
!
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    48
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    49
documentation
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    50
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    51
    RadioButtonGroups control the interaction between RadioButtons
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    52
    turning off other button(s) when one of the group is pressed.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    53
"
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    54
! !
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    55
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    56
!RadioButtonGroup methodsFor:'adding / removing'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    57
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    58
add:aRadioButton
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    59
    super add:aRadioButton.
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    60
    aRadioButton addDependent:self
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    61
! !
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    62
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    63
!RadioButtonGroup methodsFor:'update'!
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    64
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    65
update:changedButton
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    66
    "a RadioButton in this group has changed - notify the others"
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    67
38
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    68
    "in case we have a toggle in the group, 
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    69
     and it has been turned off - turn it on again
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    70
    "
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    71
    changedButton isOn ifFalse:[
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    72
        changedButton toggleNoAction.
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    73
        ^ self
4b9b70b2cc87 2.10.3 pre-final version
claus
parents: 7
diff changeset
    74
    ].
0
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    75
    self do:[:aButton |
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    76
        (aButton == changedButton) ifFalse:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    77
            aButton isOn ifTrue:[
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    78
                aButton turnOff
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    79
            ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    80
        ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    81
    ]
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    82
e6a541c1c0eb Initial revision
claus
parents:
diff changeset
    83
! !