--- a/ButtonController.st Thu Sep 22 14:57:21 2016 +0200
+++ b/ButtonController.st Thu Sep 22 15:00:31 2016 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 1995 by Claus Gittinger
All Rights Reserved
@@ -16,7 +18,8 @@
Controller subclass:#ButtonController
instanceVariableNames:'enableChannel pressChannel releaseChannel pressed active entered
isTriggerOnDown autoRepeat repeatBlock initialDelay repeatDelay
- pressActionBlock releaseActionBlock isToggle isRadio buttonDown'
+ pressActionBlock releaseActionBlock isToggle isRadio buttonDown
+ doubleClickActionBlock'
classVariableNames:''
poolDictionaries:''
category:'Interface-Support-Controllers'
@@ -161,7 +164,7 @@
!
beButton
- "make the receiver act like a button; thats the default, anyway"
+ "make the receiver act like a button; that's the default, anyway"
"/ because I will be a trigger-on-up button
(isTriggerOnDown
@@ -235,6 +238,20 @@
"Modified: / 30.3.1999 / 14:50:12 / stefan"
!
+doubleClickAction
+ "return the doubleClickAction; that's the block which gets evaluated
+ when the button is double-clicked (if non-nil).
+ Seldom used with buttons"
+
+ ^ doubleClickActionBlock
+!
+
+doubleClickAction:aBlock
+ "define the action to be performed on double click"
+
+ doubleClickActionBlock := aBlock.
+!
+
enable
"alternative invokation; redirected to basic mechanism"
@@ -262,7 +279,7 @@
!
pressAction
- "return the pressAction; thats the block which gets evaluated
+ "return the pressAction; that's the block which gets evaluated
when the button is pressed (if non-nil)"
^ pressActionBlock
@@ -275,8 +292,8 @@
!
releaseAction
- "return the releaseAction; thats the block which gets evaluated
- when the button is relreased (if non-nil)"
+ "return the releaseAction; that's the block which gets evaluated
+ when the button is released (if non-nil)"
^ releaseActionBlock
!
@@ -435,6 +452,10 @@
!
buttonMultiPress:button x:x y:y
+ doubleClickActionBlock notNil ifTrue:[
+ doubleClickActionBlock valueWithOptionalArgument:view.
+ ^ self.
+ ].
^ self buttonPress:button x:x y:y
!