--- a/ToggleController.st Wed May 03 02:30:14 1995 +0200
+++ b/ToggleController.st Wed May 03 02:39:07 1995 +0200
@@ -11,7 +11,7 @@
"
ButtonController subclass:#ToggleController
- instanceVariableNames:''
+ instanceVariableNames:'action'
classVariableNames:''
poolDictionaries:''
category:'Interface-Support'
@@ -35,7 +35,7 @@
version
"
-$Header: /cvs/stx/stx/libwidg/ToggleController.st,v 1.2 1995-02-17 13:23:13 claus Exp $
+$Header: /cvs/stx/stx/libwidg/ToggleController.st,v 1.3 1995-05-03 00:38:31 claus Exp $
"
!
@@ -47,27 +47,26 @@
"
! !
-!ToggleController methodsFor:'initialization '!
+!ToggleController methodsFor:'initialization'!
initialize
super initialize.
- triggerOnDown := true
+ self beToggle
+! !
+
+!ToggleController methodsFor:'events'!
+
+performAction
+ action notNil ifTrue:[action value:pressed].
+ super performAction
! !
-!ToggleController methodsFor:'event handling'!
+!ToggleController methodsFor:'accessing'!
-buttonRelease:button x:x y:y
- ((button == 1) or:[button == #select]) ifFalse:[
- ^ super buttonRelease:button x:x y:y
- ].
- "ignore"
-!
+action:aBlock
+ "set the action to be performed. This is called
+ with the toggles state as argument."
-buttonPress:button x:x y:y
- ((button == 1) or:[button == #select]) ifTrue:[
- view toggle
- ] ifFalse:[
- ^ super buttonPress:button x:x y:y
- ].
+ action := aBlock
! !