--- a/ButtonC.st Sun Dec 17 17:35:38 1995 +0100
+++ b/ButtonC.st Sun Dec 17 17:49:09 1995 +0100
@@ -195,28 +195,6 @@
releaseActionBlock := aBlock
!
-toggle
- "toggle and perform the action"
-
- enableChannel value ifTrue:[
- self toggleNoAction.
- self performAction.
- view changed:#toggle with:pressed
- ]
-!
-
-toggleNoAction
- "toggle, but do NOT perform any action"
-
- pressed ifTrue:[
- view turnOff.
- pressed := false.
- ] ifFalse:[
- view turnOn.
- pressed := true.
- ].
-!
-
triggerOnDown:aBoolean
"set/clear the flag which controls if the action block is to be evaluated
on press or on release.
@@ -309,6 +287,28 @@
pressed := aBoolean.
"Created: 14.11.1995 / 21:37:08 / cg"
+!
+
+toggle
+ "toggle and perform the action"
+
+ enableChannel value ifTrue:[
+ self toggleNoAction.
+ self performAction.
+ view changed:#toggle with:pressed
+ ]
+!
+
+toggleNoAction
+ "toggle, but do NOT perform any action"
+
+ pressed ifTrue:[
+ view turnOff.
+ pressed := false.
+ ] ifFalse:[
+ view turnOn.
+ pressed := true.
+ ].
! !
!ButtonController methodsFor:'event handling'!
@@ -319,33 +319,33 @@
buttonPress:button x:x y:y
(button == 1 or:[button == #select]) ifFalse:[
- ^ super buttonPress:button x:x y:y
+ ^ super buttonPress:button x:x y:y
].
enableChannel value ifTrue:[
- isToggle ifTrue:[
- self toggle.
- ^ self
- ].
+ isToggle ifTrue:[
+ self toggle.
+ ^ self
+ ].
- pressed ifFalse:[
- pressed := true.
- view showActive.
+ pressed ifFalse:[
+ pressed := true.
+ view showActive.
- (pressActionBlock notNil or:[model notNil]) ifTrue:[
- "
- force output - so that button is drawn correctly in case
- of any long-computation (at high priority)
- "
- view flush.
- ].
+ (pressActionBlock notNil or:[model notNil]) ifTrue:[
+ "
+ force output - so that button is drawn correctly in case
+ of any long-computation (at high priority)
+ "
+ view flush.
+ ].
- self performAction.
+ self performAction.
- autoRepeat ifTrue:[
- Processor addTimedBlock:repeatBlock afterSeconds:initialDelay
- ]
- ]
+ autoRepeat ifTrue:[
+ Processor addTimedBlock:repeatBlock afterSeconds:initialDelay
+ ]
+ ]
]
"Modified: 16.12.1995 / 17:31:55 / cg"
@@ -355,39 +355,39 @@
"button was released - if enabled, perform releaseaction"
(button == 1 or:[button == #select]) ifFalse:[
- ^ super buttonRelease:button x:x y:y
+ ^ super buttonRelease:button x:x y:y
].
isToggle ifTrue:[
- ^ self
+ ^ self
].
pressed ifTrue:[
- autoRepeat ifTrue:[
- Processor removeTimedBlock:repeatBlock
- ].
- pressed := false.
- view showPassive.
+ autoRepeat ifTrue:[
+ Processor removeTimedBlock:repeatBlock
+ ].
+ pressed := false.
+ view showPassive.
- enableChannel value ifTrue:[
- "
- only perform action if released within myself
- "
- ((x >= 0)
- and:[x <= view width
- and:[y >= 0
- and:[y <= view height]]]) ifTrue:[
- (releaseActionBlock notNil or:[model notNil]) ifTrue:[
- "
- force output - so that button is drawn correctly in case
- of any long-computation (at high priority)
- "
- view flush.
- ].
+ enableChannel value ifTrue:[
+ "
+ only perform action if released within myself
+ "
+ ((x >= 0)
+ and:[x <= view width
+ and:[y >= 0
+ and:[y <= view height]]]) ifTrue:[
+ (releaseActionBlock notNil or:[model notNil]) ifTrue:[
+ "
+ force output - so that button is drawn correctly in case
+ of any long-computation (at high priority)
+ "
+ view flush.
+ ].
- self performAction.
- ]
- ]
+ self performAction.
+ ]
+ ]
]
"Modified: 16.12.1995 / 17:32:09 / cg"
@@ -546,7 +546,8 @@
initialize
super initialize.
- self enableChannel:(true asValue).
+ enableChannel := true asValue.
+ enableChannel onChangeSend:#enableStateChange to:self.
active := false.
pressed := false.
@@ -561,5 +562,5 @@
!ButtonController class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/Attic/ButtonC.st,v 1.26 1995-12-16 16:37:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/Attic/ButtonC.st,v 1.27 1995-12-17 16:49:09 cg Exp $'
! !
--- a/ButtonController.st Sun Dec 17 17:35:38 1995 +0100
+++ b/ButtonController.st Sun Dec 17 17:49:09 1995 +0100
@@ -195,28 +195,6 @@
releaseActionBlock := aBlock
!
-toggle
- "toggle and perform the action"
-
- enableChannel value ifTrue:[
- self toggleNoAction.
- self performAction.
- view changed:#toggle with:pressed
- ]
-!
-
-toggleNoAction
- "toggle, but do NOT perform any action"
-
- pressed ifTrue:[
- view turnOff.
- pressed := false.
- ] ifFalse:[
- view turnOn.
- pressed := true.
- ].
-!
-
triggerOnDown:aBoolean
"set/clear the flag which controls if the action block is to be evaluated
on press or on release.
@@ -309,6 +287,28 @@
pressed := aBoolean.
"Created: 14.11.1995 / 21:37:08 / cg"
+!
+
+toggle
+ "toggle and perform the action"
+
+ enableChannel value ifTrue:[
+ self toggleNoAction.
+ self performAction.
+ view changed:#toggle with:pressed
+ ]
+!
+
+toggleNoAction
+ "toggle, but do NOT perform any action"
+
+ pressed ifTrue:[
+ view turnOff.
+ pressed := false.
+ ] ifFalse:[
+ view turnOn.
+ pressed := true.
+ ].
! !
!ButtonController methodsFor:'event handling'!
@@ -319,33 +319,33 @@
buttonPress:button x:x y:y
(button == 1 or:[button == #select]) ifFalse:[
- ^ super buttonPress:button x:x y:y
+ ^ super buttonPress:button x:x y:y
].
enableChannel value ifTrue:[
- isToggle ifTrue:[
- self toggle.
- ^ self
- ].
+ isToggle ifTrue:[
+ self toggle.
+ ^ self
+ ].
- pressed ifFalse:[
- pressed := true.
- view showActive.
+ pressed ifFalse:[
+ pressed := true.
+ view showActive.
- (pressActionBlock notNil or:[model notNil]) ifTrue:[
- "
- force output - so that button is drawn correctly in case
- of any long-computation (at high priority)
- "
- view flush.
- ].
+ (pressActionBlock notNil or:[model notNil]) ifTrue:[
+ "
+ force output - so that button is drawn correctly in case
+ of any long-computation (at high priority)
+ "
+ view flush.
+ ].
- self performAction.
+ self performAction.
- autoRepeat ifTrue:[
- Processor addTimedBlock:repeatBlock afterSeconds:initialDelay
- ]
- ]
+ autoRepeat ifTrue:[
+ Processor addTimedBlock:repeatBlock afterSeconds:initialDelay
+ ]
+ ]
]
"Modified: 16.12.1995 / 17:31:55 / cg"
@@ -355,39 +355,39 @@
"button was released - if enabled, perform releaseaction"
(button == 1 or:[button == #select]) ifFalse:[
- ^ super buttonRelease:button x:x y:y
+ ^ super buttonRelease:button x:x y:y
].
isToggle ifTrue:[
- ^ self
+ ^ self
].
pressed ifTrue:[
- autoRepeat ifTrue:[
- Processor removeTimedBlock:repeatBlock
- ].
- pressed := false.
- view showPassive.
+ autoRepeat ifTrue:[
+ Processor removeTimedBlock:repeatBlock
+ ].
+ pressed := false.
+ view showPassive.
- enableChannel value ifTrue:[
- "
- only perform action if released within myself
- "
- ((x >= 0)
- and:[x <= view width
- and:[y >= 0
- and:[y <= view height]]]) ifTrue:[
- (releaseActionBlock notNil or:[model notNil]) ifTrue:[
- "
- force output - so that button is drawn correctly in case
- of any long-computation (at high priority)
- "
- view flush.
- ].
+ enableChannel value ifTrue:[
+ "
+ only perform action if released within myself
+ "
+ ((x >= 0)
+ and:[x <= view width
+ and:[y >= 0
+ and:[y <= view height]]]) ifTrue:[
+ (releaseActionBlock notNil or:[model notNil]) ifTrue:[
+ "
+ force output - so that button is drawn correctly in case
+ of any long-computation (at high priority)
+ "
+ view flush.
+ ].
- self performAction.
- ]
- ]
+ self performAction.
+ ]
+ ]
]
"Modified: 16.12.1995 / 17:32:09 / cg"
@@ -546,7 +546,8 @@
initialize
super initialize.
- self enableChannel:(true asValue).
+ enableChannel := true asValue.
+ enableChannel onChangeSend:#enableStateChange to:self.
active := false.
pressed := false.
@@ -561,5 +562,5 @@
!ButtonController class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.26 1995-12-16 16:37:04 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libwidg/ButtonController.st,v 1.27 1995-12-17 16:49:09 cg Exp $'
! !