--- a/WindowEvent.st Wed Aug 13 22:10:53 1997 +0200
+++ b/WindowEvent.st Wed Aug 13 22:20:02 1997 +0200
@@ -19,7 +19,7 @@
WindowEvent subclass:#InputEvent
instanceVariableNames:'modifierFlags'
- classVariableNames:'F_CTRL F_ALT F_META F_SHIFT'
+ classVariableNames:'F_CTRL F_ALT F_META F_SHIFT F_BUTTON1 F_BUTTON2 F_BUTTON3'
poolDictionaries:''
privateIn:WindowEvent
!
@@ -667,16 +667,40 @@
!WindowEvent::InputEvent class methodsFor:'class initialization'!
initialize
- F_SHIFT := 1.
- F_CTRL := 2.
- F_ALT := 4.
- F_META := 8.
+ F_SHIFT := 16r001.
+ F_CTRL := 16r002.
+ F_ALT := 16r004.
+ F_META := 16r008.
- "Created: 13.8.1997 / 22:01:50 / cg"
+ F_BUTTON1 := 16r100.
+ F_BUTTON2 := 16r200.
+ F_BUTTON3 := 16r400.
+
+ "
+ self initialize
+ "
+
+ "Modified: 13.8.1997 / 22:16:17 / cg"
! !
!WindowEvent::InputEvent methodsFor:'accessing'!
+hasShift:shift ctrl:ctrl alt:alt meta:meta button1:b1 button2:b2 button3:b3
+ |f "{ Class: SmallInteger }"|
+
+ f := 0.
+ shift ifTrue:[f := f bitOr:F_SHIFT].
+ ctrl ifTrue:[f := f bitOr:F_CTRL].
+ alt ifTrue:[f := f bitOr:F_ALT].
+ meta ifTrue:[f := f bitOr:F_META].
+ b1 ifTrue:[f := f bitOr:F_BUTTON1].
+ b2 ifTrue:[f := f bitOr:F_BUTTON2].
+ b3 ifTrue:[f := f bitOr:F_BUTTON3].
+ modifierFlags := f.
+
+ "Created: 13.8.1997 / 22:17:56 / cg"
+!
+
hasShift:shift hasCtrl:ctrl hasAlt:alt hasMeta:meta
|f "{ Class: SmallInteger }"|
@@ -688,6 +712,22 @@
modifierFlags := f.
"Created: 13.8.1997 / 22:02:09 / cg"
+!
+
+hasShift:shift hasCtrl:ctrl hasAlt:alt hasMeta:meta hasButton1:b1 hasButton2:b2 hasButton3:b3
+ |f "{ Class: SmallInteger }"|
+
+ f := 0.
+ shift ifTrue:[f := f bitOr:F_SHIFT].
+ ctrl ifTrue:[f := f bitOr:F_CTRL].
+ alt ifTrue:[f := f bitOr:F_ALT].
+ meta ifTrue:[f := f bitOr:F_META].
+ b1 ifTrue:[f := f bitOr:F_BUTTON1].
+ b2 ifTrue:[f := f bitOr:F_BUTTON2].
+ b3 ifTrue:[f := f bitOr:F_BUTTON3].
+ modifierFlags := f.
+
+ "Created: 13.8.1997 / 22:17:25 / cg"
! !
!WindowEvent::InputEvent methodsFor:'queries'!
@@ -701,6 +741,33 @@
"Modified: 13.8.1997 / 22:02:44 / cg"
!
+hasButton1
+ "return true, if this is an event, with the left mouse button pressed"
+
+ ^ (modifierFlags bitAnd:F_BUTTON1) ~~ 0
+
+ "Modified: 13.8.1997 / 22:02:44 / cg"
+ "Created: 13.8.1997 / 22:16:35 / cg"
+!
+
+hasButton2
+ "return true, if this is an event, with the middle mouse button pressed"
+
+ ^ (modifierFlags bitAnd:F_BUTTON2) ~~ 0
+
+ "Modified: 13.8.1997 / 22:02:44 / cg"
+ "Created: 13.8.1997 / 22:16:43 / cg"
+!
+
+hasButton3
+ "return true, if this is an event, with the right mouse button pressed"
+
+ ^ (modifierFlags bitAnd:F_BUTTON3) ~~ 0
+
+ "Modified: 13.8.1997 / 22:02:44 / cg"
+ "Created: 13.8.1997 / 22:16:49 / cg"
+!
+
hasCtrl
"return true, if this is an event, with CTRL pressed"
@@ -845,5 +912,5 @@
!WindowEvent class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.45 1997-08-13 20:10:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.46 1997-08-13 20:19:42 cg Exp $'
! !