*** empty log message ***
authorclaus
Thu, 16 Feb 1995 04:13:03 +0100
changeset 86 df2687090a7f
parent 85 c229bb31d758
child 87 2c6ab478466a
*** empty log message ***
RButtGrp.st
RButton.st
RadioButton.st
RadioButtonGroup.st
Scroller.st
Toggle.st
--- a/RButtGrp.st	Wed Feb 15 11:37:50 1995 +0100
+++ b/RButtGrp.st	Thu Feb 16 04:13:03 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.7 1994-11-17 14:38:30 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.8 1995-02-16 03:12:56 claus Exp $
 '!
 
 !RadioButtonGroup class methodsFor:'documentation '!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.7 1994-11-17 14:38:30 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.8 1995-02-16 03:12:56 claus Exp $
 "
 !
 
@@ -69,7 +69,8 @@
 
 add:aRadioButton
     super add:aRadioButton.
-    aRadioButton addDependent:self
+    aRadioButton addDependent:self.
+    aRadioButton group:self
 ! !
 
 !RadioButtonGroup methodsFor:'update'!
--- a/RButton.st	Wed Feb 15 11:37:50 1995 +0100
+++ b/RButton.st	Thu Feb 16 04:13:03 1995 +0100
@@ -11,7 +11,7 @@
 "
 
 Toggle subclass:#RadioButton
-       instanceVariableNames:''
+       instanceVariableNames:'group'
        classVariableNames:''
        poolDictionaries:''
        category:'Views-Interactors'
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/Attic/RButton.st,v 1.6 1995-02-06 00:53:09 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/RButton.st,v 1.7 1995-02-16 03:12:59 claus Exp $
 '!
 
 !RadioButton class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/Attic/RButton.st,v 1.6 1995-02-06 00:53:09 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Attic/RButton.st,v 1.7 1995-02-16 03:12:59 claus Exp $
 "
 !
 
@@ -53,6 +53,33 @@
 
     written fall 91 by claus
 "
+!
+
+examples 
+"
+    |top panel b group|
+
+    top := StandardSystemView new.
+    top extent:200@200.
+
+    panel := HorizontalPanelView
+		origin:0.0@0.0
+		corner:1.0@1.0
+		    in:top.
+
+    group := RadioButtonGroup new.
+
+    b := RadioButton label:'am' in:panel.
+    group add:b.
+
+    b := RadioButton label:'fm' in:panel.
+    group add:b.
+
+    b := RadioButton label:'off' in:panel.
+    group add:b.
+
+    top open
+"
 ! !
 
 !RadioButton methodsFor:'destroying'!
@@ -62,17 +89,18 @@
     super destroy
 ! !
 
-!RadioButton methodsFor:'changing state'!
+!RadioButton methodsFor:'accessing '!
 
-XXtoggle
-    "in addition to toggling, notify RadioButtonGroup"
+group
+    "return the radioButtonGroup in which I am"
 
-    controller enabled ifTrue:[
-	super toggle.
-	controller pressed ifTrue:[
-	    self changed
-	]
-    ]
+    ^ group
+!
+
+group:aButtonGroup
+    "set the radioButtonGroup in which I am"
+
+    group := aButtonGroup
 ! !
 
 !RadioButton methodsFor:'events'!
--- a/RadioButton.st	Wed Feb 15 11:37:50 1995 +0100
+++ b/RadioButton.st	Thu Feb 16 04:13:03 1995 +0100
@@ -11,7 +11,7 @@
 "
 
 Toggle subclass:#RadioButton
-       instanceVariableNames:''
+       instanceVariableNames:'group'
        classVariableNames:''
        poolDictionaries:''
        category:'Views-Interactors'
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/RadioButton.st,v 1.6 1995-02-06 00:53:09 claus Exp $
+$Header: /cvs/stx/stx/libwidg/RadioButton.st,v 1.7 1995-02-16 03:12:59 claus Exp $
 '!
 
 !RadioButton class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/RadioButton.st,v 1.6 1995-02-06 00:53:09 claus Exp $
+$Header: /cvs/stx/stx/libwidg/RadioButton.st,v 1.7 1995-02-16 03:12:59 claus Exp $
 "
 !
 
@@ -53,6 +53,33 @@
 
     written fall 91 by claus
 "
+!
+
+examples 
+"
+    |top panel b group|
+
+    top := StandardSystemView new.
+    top extent:200@200.
+
+    panel := HorizontalPanelView
+		origin:0.0@0.0
+		corner:1.0@1.0
+		    in:top.
+
+    group := RadioButtonGroup new.
+
+    b := RadioButton label:'am' in:panel.
+    group add:b.
+
+    b := RadioButton label:'fm' in:panel.
+    group add:b.
+
+    b := RadioButton label:'off' in:panel.
+    group add:b.
+
+    top open
+"
 ! !
 
 !RadioButton methodsFor:'destroying'!
@@ -62,17 +89,18 @@
     super destroy
 ! !
 
-!RadioButton methodsFor:'changing state'!
+!RadioButton methodsFor:'accessing '!
 
-XXtoggle
-    "in addition to toggling, notify RadioButtonGroup"
+group
+    "return the radioButtonGroup in which I am"
 
-    controller enabled ifTrue:[
-	super toggle.
-	controller pressed ifTrue:[
-	    self changed
-	]
-    ]
+    ^ group
+!
+
+group:aButtonGroup
+    "set the radioButtonGroup in which I am"
+
+    group := aButtonGroup
 ! !
 
 !RadioButton methodsFor:'events'!
--- a/RadioButtonGroup.st	Wed Feb 15 11:37:50 1995 +0100
+++ b/RadioButtonGroup.st	Thu Feb 16 04:13:03 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1991 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.7 1994-11-17 14:38:30 claus Exp $
+$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.8 1995-02-16 03:12:56 claus Exp $
 '!
 
 !RadioButtonGroup class methodsFor:'documentation '!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.7 1994-11-17 14:38:30 claus Exp $
+$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.8 1995-02-16 03:12:56 claus Exp $
 "
 !
 
@@ -69,7 +69,8 @@
 
 add:aRadioButton
     super add:aRadioButton.
-    aRadioButton addDependent:self
+    aRadioButton addDependent:self.
+    aRadioButton group:self
 ! !
 
 !RadioButtonGroup methodsFor:'update'!
--- a/Scroller.st	Wed Feb 15 11:37:50 1995 +0100
+++ b/Scroller.st	Thu Feb 16 04:13:03 1995 +0100
@@ -43,7 +43,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.13 1995-02-06 00:53:15 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.14 1995-02-16 03:13:00 claus Exp $
 '!
 
 !Scroller class methodsFor:'documentation'!
@@ -64,7 +64,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.13 1995-02-06 00:53:15 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Scroller.st,v 1.14 1995-02-16 03:13:00 claus Exp $
 "
 !
 
@@ -1046,18 +1046,32 @@
     "page up/left"
 
     self thumbOrigin:(thumbOrigin - thumbHeight).
-    scrollAction notNil ifTrue:[
-	scrollAction value:thumbOrigin
-    ]
+    self tellOthers
 !
 
 pageDown
     "page down/right"
 
     self thumbOrigin:(thumbOrigin + thumbHeight).
+    self tellOthers
+! !
+
+!Scroller methodsFor:'forwarding changed origin'!
+
+tellOthers
+    "
+     the ST/X way of notifying scrolls
+    "
     scrollAction notNil ifTrue:[
 	scrollAction value:thumbOrigin
-    ]
+    ].
+    "
+     the ST-80 way of notifying scrolls
+    "
+    (model notNil and:[changeSymbol notNil]) ifTrue:[
+	model perform:changeSymbol with:thumbOrigin
+    ].
+    self changed:#scrollerPosition.
 ! !
 
 !Scroller methodsFor:'event handling'!
@@ -1155,21 +1169,7 @@
     ].
 
     self thumbOrigin:(self percentFromAbs:pos).
-    "
-     the ST/X way of notifying scrolls
-    "
-    scrollAction notNil ifTrue:[
-	scrollAction value:thumbOrigin
-    ].
-    "
-     the ST-80 way of notifying scrolls
-    "
-    (model notNil
-    and:[changeSymbol notNil])
-    ifTrue:[
-	model perform:changeSymbol
-    ].
-    self changed:#scrollerPosition.
+    self tellOthers.
 
     pressOffset := curr - org.
     scrolling := true
@@ -1211,21 +1211,7 @@
     self thumbOrigin:(self percentFromAbs:(pos - pressOffset)).
 
     synchronousOperation ifTrue: [
-	"
-	 the ST/X way of notifying scrolls
-	"
-	scrollAction notNil ifTrue:[
-	    scrollAction value:thumbOrigin
-	].
-	"
-	 the ST-80 way of notifying scrolls
-	"
-	(model notNil
-	and:[changeSymbol notNil])
-	ifTrue:[
-	    model perform:changeSymbol
-	].
-	self changed:#scrollerPosition.
+	self tellOthers.
     ]
 !
 
@@ -1250,21 +1236,7 @@
 
 	scrolling := false.
 	synchronousOperation ifFalse: [
-	    "
-	     the ST/X way of notifying scrolls
-	    "
-	    scrollAction notNil ifTrue:[
-		scrollAction value:thumbOrigin
-	    ].
-	    "
-	     the ST-80 way of notifying scrolls
-	    "
-	    (model notNil
-	    and:[changeSymbol notNil])
-	    ifTrue:[
-		model perform:changeSymbol
-	    ].
-	    self changed:#scrollerPosition.
+	    self tellOthers.
 	]
     ]
 ! !
--- a/Toggle.st	Wed Feb 15 11:37:50 1995 +0100
+++ b/Toggle.st	Thu Feb 16 04:13:03 1995 +0100
@@ -21,7 +21,7 @@
 COPYRIGHT (c) 1989 by Claus Gittinger
 	      All Rights Reserved
 
-$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.11 1995-02-06 00:53:28 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.12 1995-02-16 03:13:03 claus Exp $
 '!
 
 !Toggle class methodsFor:'documentation'!
@@ -42,7 +42,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.11 1995-02-06 00:53:28 claus Exp $
+$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.12 1995-02-16 03:13:03 claus Exp $
 "
 !
 
@@ -311,15 +311,12 @@
     shown ifTrue:[
 	self redraw
     ].
-    model notNil ifTrue:[
-	model value:pressed
-    ]
 !
 
 toggle
     "toggle and perform the action"
 
-    |action pressed|
+    |action pressed sym|
 
     controller enabled ifTrue:[
 	self toggleNoAction.
@@ -330,8 +327,9 @@
 	].
 	action notNil ifTrue:[action value].
 	model notNil ifTrue:[
-	    model value:pressed.
-	    model changed
+	    (sym := changeSymbol) notNil ifTrue:[
+		model perform:sym with:pressed
+	    ].
 	].
 	self changed
     ]