turnOn/ turnOff changed back - now added turnOn/OffWithAction (sorry stefan)
authorClaus Gittinger <cg@exept.de>
Wed, 15 Nov 1995 17:20:37 +0100
changeset 178 5c28593c2a3b
parent 177 c06d27f8525f
child 179 f17806f9d8ed
turnOn/ turnOff changed back - now added turnOn/OffWithAction (sorry stefan)
Button.st
RButtGrp.st
RadioButtonGroup.st
Toggle.st
--- a/Button.st	Tue Nov 14 22:44:34 1995 +0100
+++ b/Button.st	Wed Nov 15 17:20:37 1995 +0100
@@ -52,7 +52,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.35 1995-11-14 21:44:19 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Button.st,v 1.36 1995-11-15 16:20:26 cg Exp $'
 !
 
 documentation
@@ -1428,8 +1428,39 @@
 
 !Button methodsFor:'changing state'!
 
-turnOffNoAction
-    "turn the button off (if not already off)"
+turnOffWithAction
+    "turn the button off (if not already off) and perform any action/change notification"
+
+    controller pressed ifTrue:[
+	offLevel ~~ level ifTrue:[
+	    self level:offLevel.
+	].
+	(passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[
+	    self logo:passiveLogo
+	].
+	self turnOffWithoutRedraw.
+	self redraw
+    ]
+
+    "Created: 15.11.1995 / 16:55:37 / cg"
+!
+
+turnOffWithoutRedraw
+    "turn the button off - no redraw but perform any action/change notification"
+
+    controller pressed:false.
+    controller active:false.
+
+    "do not use super level:offLevel
+     - because that one does redraw the edges.
+     Sure, this is no good coding style"
+
+    level := offLevel.
+    margin := level abs
+!
+
+turnOff
+    "turn the button off (if not already off) do NOT perform actions/change notifications"
 
     controller pressed ifTrue:[
 	offLevel ~~ level ifTrue:[
@@ -1444,41 +1475,27 @@
 	margin := level abs.
 	self redraw
     ]
-
-    "Created: 14.11.1995 / 22:00:09 / cg"
-    "Modified: 14.11.1995 / 22:00:37 / cg"
-!
-
-turnOffWithoutRedraw
-    "turn the button off - no redraw"
-
-    controller pressed:false.
-    controller active:false.
-
-    "do not use super level:offLevel
-     - because that one does redraw the edges.
-     Sure, this is no good coding style"
-    level := offLevel.
-    margin := level abs
 !
 
-turnOff
-    "turn the button off (if not already off)"
+turnOnWithAction
+    "turn the button on (if not already on) and perform any change actions/notifications"
 
-    controller pressed ifTrue:[
-	offLevel ~~ level ifTrue:[
-	    self level:offLevel.
+    controller pressed ifFalse:[
+	onLevel ~~ level ifTrue:[
+	    self level:onLevel.
 	].
-	(passiveLogo notNil and:[passiveLogo ~~ logo]) ifTrue:[
-	    self logo:passiveLogo
+	(activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
+	    self logo:activeLogo
 	].
-	self turnOffWithoutRedraw.
+	self turnOnWithoutRedraw.
 	self redraw
     ]
+
+    "Created: 15.11.1995 / 16:55:56 / cg"
 !
 
-turnOnNoAction
-    "turn the button on (if not already on)"
+turnOn
+    "turn the button on (if not already on) - do NOT perform any action/notification"
 
     controller pressed ifFalse:[
 	onLevel ~~ level ifTrue:[
@@ -1499,32 +1516,18 @@
 !
 
 turnOnWithoutRedraw
-    "turn the button on - no redraw"
+    "turn the button on - no redraw but perform any change actions/notifications"
 
     controller pressed:true.
 
     "do not use super level:offLevel
      - because that one does redraw the edges.
      Sure, this is no good coding style"
+
     level := onLevel.
     margin := level abs
 !
 
-turnOn
-    "turn the button on (if not already on)"
-
-    controller pressed ifFalse:[
-	onLevel ~~ level ifTrue:[
-	    self level:onLevel.
-	].
-	(activeLogo notNil and:[activeLogo ~~ logo]) ifTrue:[
-	    self logo:activeLogo
-	].
-	self turnOnWithoutRedraw.
-	self redraw
-    ]
-!
-
 toggleNoAction
     "toggle, but do NOT perform any action - can be used to change a toggle
      under program control (i.e. turn one toggle off from another one)"
--- a/RButtGrp.st	Tue Nov 14 22:44:34 1995 +0100
+++ b/RButtGrp.st	Wed Nov 15 17:20:37 1995 +0100
@@ -36,7 +36,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.17 1995-11-14 21:44:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Attic/RButtGrp.st,v 1.18 1995-11-15 16:20:34 cg Exp $'
 !
 
 documentation
@@ -74,87 +74,88 @@
 "
     example (using Toggles for 'at most one-on behavior'):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := Toggle label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := Toggle label:'two' in:panel.
-	g add:b.
+	group add:b.
 	b := Toggle label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
 
 
     example (using RadioButtons for 'one-on behavior'):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := RadioButton label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := RadioButton label:'two' in:panel.
-	g add:b.
+	group add:b.
 	b := RadioButton label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
 
 
     example (using Buttons for 'none-on behavior'; but the groups value remembers the last button):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := Button label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := Button label:'two' in:panel.
-	g add:b.
+	group add:b.
 	b := Button label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
-	g valueChannel inspect
+	group valueChannel inspect
 
 
     example (same, with button 'two' initially on):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := RadioButton label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := RadioButton label:'two' in:panel.
-	g add:b.
-	b turnOn.
+	group add:b.
+	group value:2.
 	b := RadioButton label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
 
+
     using checkBoxes (these have a label included):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
 	panel horizontalLayout:#left.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := CheckBox label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := CheckBox label:'two' in:panel.
-	g add:b.
+	group add:b.
 	b := CheckBox label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
 
@@ -178,6 +179,8 @@
 	    Transcript showCr:'aborted'
 	]
 "
+
+    "Created: 15.11.1995 / 17:14:53 / cg"
 ! !
 
 !RadioButtonGroup methodsFor:'accessing'!
@@ -196,6 +199,14 @@
 
 !RadioButtonGroup methodsFor:'accessing-mvc'!
 
+value
+    ^ valueChannel value
+!
+
+value:anIndex
+    valueChannel value:anIndex
+!
+
 valueChannel
     ^ valueChannel
 !
@@ -206,7 +217,7 @@
     valueChannel notNil ifTrue:[oldValue := valueChannel value].
     valueChannel := aValueHolder.
     (newValue := valueChannel value) ~~ oldValue ifTrue:[
-	(self at:newValue) turnOn
+	(self at:newValue) turnOnWithAction
     ]
 ! !
 
--- a/RadioButtonGroup.st	Tue Nov 14 22:44:34 1995 +0100
+++ b/RadioButtonGroup.st	Wed Nov 15 17:20:37 1995 +0100
@@ -36,7 +36,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.17 1995-11-14 21:44:31 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/RadioButtonGroup.st,v 1.18 1995-11-15 16:20:34 cg Exp $'
 !
 
 documentation
@@ -74,87 +74,88 @@
 "
     example (using Toggles for 'at most one-on behavior'):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := Toggle label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := Toggle label:'two' in:panel.
-	g add:b.
+	group add:b.
 	b := Toggle label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
 
 
     example (using RadioButtons for 'one-on behavior'):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := RadioButton label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := RadioButton label:'two' in:panel.
-	g add:b.
+	group add:b.
 	b := RadioButton label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
 
 
     example (using Buttons for 'none-on behavior'; but the groups value remembers the last button):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := Button label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := Button label:'two' in:panel.
-	g add:b.
+	group add:b.
 	b := Button label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
-	g valueChannel inspect
+	group valueChannel inspect
 
 
     example (same, with button 'two' initially on):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := HorizontalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := RadioButton label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := RadioButton label:'two' in:panel.
-	g add:b.
-	b turnOn.
+	group add:b.
+	group value:2.
 	b := RadioButton label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
 
+
     using checkBoxes (these have a label included):
 
-	|top panel toggle b g|
+	|top panel toggle b group|
 
 	top := StandardSystemView new.
 	panel := VerticalPanelView origin:0.0@0.0 corner:1.0@1.0 in:top.
 	panel horizontalLayout:#left.
-	g := RadioButtonGroup new.
+	group := RadioButtonGroup new.
 	b := CheckBox label:'one' in:panel.
-	g add:b.
+	group add:b.
 	b := CheckBox label:'two' in:panel.
-	g add:b.
+	group add:b.
 	b := CheckBox label:'three' in:panel.
-	g add:b.
+	group add:b.
 	top extent:(panel preferredExtent).
 	top open.
 
@@ -178,6 +179,8 @@
 	    Transcript showCr:'aborted'
 	]
 "
+
+    "Created: 15.11.1995 / 17:14:53 / cg"
 ! !
 
 !RadioButtonGroup methodsFor:'accessing'!
@@ -196,6 +199,14 @@
 
 !RadioButtonGroup methodsFor:'accessing-mvc'!
 
+value
+    ^ valueChannel value
+!
+
+value:anIndex
+    valueChannel value:anIndex
+!
+
 valueChannel
     ^ valueChannel
 !
@@ -206,7 +217,7 @@
     valueChannel notNil ifTrue:[oldValue := valueChannel value].
     valueChannel := aValueHolder.
     (newValue := valueChannel value) ~~ oldValue ifTrue:[
-	(self at:newValue) turnOn
+	(self at:newValue) turnOnWithAction
     ]
 ! !
 
--- a/Toggle.st	Tue Nov 14 22:44:34 1995 +0100
+++ b/Toggle.st	Wed Nov 15 17:20:37 1995 +0100
@@ -36,7 +36,7 @@
 !
 
 version
-    ^ '$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.21 1995-11-14 21:44:34 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libwidg/Toggle.st,v 1.22 1995-11-15 16:20:37 cg Exp $'
 !
 
 documentation
@@ -391,9 +391,9 @@
 	    val := model perform:aspectMsg with:self
 	].
 	val ifTrue:[
-	    self turnOnNoAction
+	    self turnOn
 	] ifFalse:[
-	    self turnOffNoAction
+	    self turnOff
 	].
     ].