--- a/ButtonController.st Wed Aug 23 20:06:29 1995 +0200
+++ b/ButtonController.st Thu Aug 24 05:02:53 1995 +0200
@@ -13,7 +13,8 @@
'From Smalltalk/X, Version:2.10.5 on 4-may-1995 at 6:17:35 am'!
Controller subclass:#ButtonController
- instanceVariableNames:'enableChannel pressed active entered isTriggerOnDown autoRepeat
+ instanceVariableNames:'enableChannel pressChannel releaseChannel
+ pressed active entered isTriggerOnDown autoRepeat
repeatBlock initialDelay repeatDelay pressActionBlock
releaseActionBlock isToggle'
classVariableNames:''
@@ -39,7 +40,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.13 1995-07-23 03:01:00 claus Exp $
+$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.14 1995-08-24 03:02:02 claus Exp $
"
!
@@ -141,6 +142,36 @@
pressed := aBoolean
! !
+!ButtonController methodsFor:'accessing-channels'!
+
+enableChannel
+ "return the valueHolder which holdes the enable
+ boolean value"
+
+ ^ enableChannel
+!
+
+enableChannel:aValueHolder
+ "set the valueHolder, which holds the enable boolean value"
+
+ enableChannel notNil ifTrue:[
+ enableChannel retractInterrestFor:self.
+ ].
+ enableChannel := aValueHolder.
+ aValueHolder onChangeSend:#enableStateChange to:self.
+ view notNil ifTrue:[
+ view redraw
+ ]
+!
+
+pressChannel:aChannel
+ pressChannel := aChannel
+!
+
+releaseChannel:aChannel
+ releaseChannel := aChannel
+! !
+
!ButtonController methodsFor:'accessing-behavior'!
beTriggerOnDown
@@ -262,26 +293,6 @@
enableChannel value:false.
"/ view redraw - not needed; button listenes to enableChannel
]
-!
-
-enableChannel
- "return the valueHolder which holdes the enable
- boolean value"
-
- ^ enableChannel
-!
-
-enableChannel:aValueHolder
- "set the valueHolder, which holds the enable boolean value"
-
- enableChannel notNil ifTrue:[
- enableChannel retractInterrestFor:self.
- ].
- enableChannel := aValueHolder.
- aValueHolder onChangeSend:#enableStateChange to:self.
- view notNil ifTrue:[
- view redraw
- ]
! !
!ButtonController methodsFor:'event handling'!
@@ -407,7 +418,7 @@
!
performAction
- |action value|
+ |action value channel|
isToggle ifTrue:[
value := pressed
@@ -416,12 +427,14 @@
].
"
- ST/X style actionBlock evaluation ...
+ ST/X style actionBlock evaluation & channel notification ...
"
pressed ifTrue:[
- action := pressActionBlock
+ action := pressActionBlock.
+ channel := pressChannel.
] ifFalse:[
- action := releaseActionBlock
+ action := releaseActionBlock.
+ channel := releaseChannel.
].
action notNil ifTrue:[
active := true.
@@ -432,6 +445,9 @@
].
active := false.
].
+ channel notNil ifTrue:[
+ channel value:true
+ ].
"
ST-80 style model notification ...