WindowEvent.st
changeset 1841 3773debcc078
parent 1730 484d0d28f4c7
child 1861 1b1e49147380
--- a/WindowEvent.st	Thu Jul 31 23:14:00 1997 +0200
+++ b/WindowEvent.st	Fri Aug 01 15:40:20 1997 +0200
@@ -17,9 +17,9 @@
 	category:'Interface-Support'
 !
 
-WindowEvent subclass:#KeyboardEvent
-	instanceVariableNames:'rawKey modifierFlags'
-	classVariableNames:'F_CTRL F_ALT F_META F_SHIFT'
+WindowEvent subclass:#ButtonEvent
+	instanceVariableNames:''
+	classVariableNames:''
 	poolDictionaries:''
 	privateIn:WindowEvent
 !
@@ -31,9 +31,9 @@
 	privateIn:WindowEvent
 !
 
-WindowEvent subclass:#ButtonEvent
-	instanceVariableNames:''
-	classVariableNames:''
+WindowEvent subclass:#KeyboardEvent
+	instanceVariableNames:'rawKey modifierFlags'
+	classVariableNames:'F_CTRL F_ALT F_META F_SHIFT'
 	poolDictionaries:''
 	privateIn:WindowEvent
 !
@@ -439,13 +439,12 @@
 !
 
 key
-    "return the key of the key-event. For non key-events, nil is returned."
+    "return the key - nil is returned here.
+     This is redefined in KeyboardEvent."
 
-    ((type == #keyPress:x:y:)
-    or:[type == #keyRelease:x:y:]) ifTrue:[
-	^ arguments at:1
-    ].
     ^ nil
+
+    "Created: 1.8.1997 / 13:56:21 / cg"
 !
 
 rectangle
@@ -658,6 +657,70 @@
 	delegate:true
 ! !
 
+!WindowEvent::ButtonEvent methodsFor:'accessing'!
+
+x
+    "return the x coordinate of the button-event
+     (mouse position at the time of the event)."
+
+    ^ arguments at:2
+
+    "Created: 1.8.1997 / 13:58:15 / cg"
+!
+
+y
+    "return the y coordinate of the button-event
+     (mouse position at the time of the event)."
+
+    ^ arguments at:3
+
+    "Created: 1.8.1997 / 13:58:07 / cg"
+! !
+
+!WindowEvent::ButtonEvent methodsFor:'queries'!
+
+isButtonEvent
+    "return true, if this event is a button event"
+
+    ^ true
+
+    "Created: 4.4.1997 / 13:44:11 / cg"
+!
+
+isButtonMotionEvent
+    "return true, if this event is a buttonMotion event"
+
+    ^ (type == #buttonMotion:x:y:)
+
+    "Created: 4.4.1997 / 13:44:22 / cg"
+!
+
+isButtonPressEvent
+    "return true, if this event is a buttonPress event"
+
+    ^ (type == #buttonPress:x:y:)
+
+    "Created: 4.4.1997 / 13:44:22 / cg"
+! !
+
+!WindowEvent::ClientEvent methodsFor:'accessing'!
+
+eventData
+    "return the value of the instance variable 'eventData' (automatically generated)"
+
+    ^ eventData
+
+    "Created: 4.4.1997 / 17:41:50 / cg"
+!
+
+eventData:something
+    "set the value of the instance variable 'eventData' (automatically generated)"
+
+    eventData := something.
+
+    "Created: 4.4.1997 / 17:41:57 / cg"
+! !
+
 !WindowEvent::KeyboardEvent class methodsFor:'class initialization'!
 
 initialize
@@ -684,6 +747,14 @@
     "Modified: 12.4.1997 / 11:10:38 / cg"
 !
 
+key
+    "return the key of the key-event."
+
+    ^ arguments at:1
+
+    "Created: 1.8.1997 / 13:55:19 / cg"
+!
+
 rawKey
     ^ rawKey
 
@@ -694,6 +765,25 @@
     rawKey := aKey
 
     "Created: 4.4.1997 / 13:47:10 / cg"
+!
+
+x
+    "return the x coordinate of the key-event
+     (mouse position at the time of the key-event)."
+
+    ^ arguments at:2
+
+    "Created: 1.8.1997 / 13:57:27 / cg"
+!
+
+y
+    "return the y coordinate of the key-event
+     (mouse position at the time of the key-event)."
+
+    ^ arguments at:3
+
+    "Created: 1.8.1997 / 13:55:19 / cg"
+    "Modified: 1.8.1997 / 13:57:42 / cg"
 ! !
 
 !WindowEvent::KeyboardEvent methodsFor:'queries'!
@@ -741,52 +831,8 @@
     "Created: 4.4.1997 / 13:39:59 / cg"
 ! !
 
-!WindowEvent::ClientEvent methodsFor:'accessing'!
-
-eventData
-    "return the value of the instance variable 'eventData' (automatically generated)"
-
-    ^ eventData
-
-    "Created: 4.4.1997 / 17:41:50 / cg"
-!
-
-eventData:something
-    "set the value of the instance variable 'eventData' (automatically generated)"
-
-    eventData := something.
-
-    "Created: 4.4.1997 / 17:41:57 / cg"
-! !
-
-!WindowEvent::ButtonEvent methodsFor:'queries'!
-
-isButtonEvent
-    "return true, if this event is a button event"
-
-    ^ true
-
-    "Created: 4.4.1997 / 13:44:11 / cg"
-!
-
-isButtonMotionEvent
-    "return true, if this event is a buttonMotion event"
-
-    ^ (type == #buttonMotion:x:y:)
-
-    "Created: 4.4.1997 / 13:44:22 / cg"
-!
-
-isButtonPressEvent
-    "return true, if this event is a buttonPress event"
-
-    ^ (type == #buttonPress:x:y:)
-
-    "Created: 4.4.1997 / 13:44:22 / cg"
-! !
-
 !WindowEvent class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.43 1997-05-20 07:01:12 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.44 1997-08-01 13:40:20 cg Exp $'
 ! !