WindowEvent.st
changeset 11 bc3949e465a0
child 23 4a7e02de7b72
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WindowEvent.st	Sat Dec 11 02:34:56 1993 +0100
@@ -0,0 +1,63 @@
+'From Smalltalk/X, Version:2.8.2 on 29-nov-1993 at 15:23:00'!
+
+Object subclass:#WindowEvent
+         instanceVariableNames:'view type arguments'
+         classVariableNames:''
+         poolDictionaries:''
+         category:'Interface-Support'
+!
+
+!WindowEvent class methodsFor:'instance creation'!
+
+for:aView type:aSymbol arguments:argArray
+    "create and return a new windowEvent for sending
+     aSymbol-message with arguments to aView"
+
+    ^ self new for:aView type:aSymbol arguments:argArray
+! !
+
+!WindowEvent methodsFor:'sending'!
+
+sendEvent
+    "forward the event represented by the receiver to the view
+     or delegate"
+
+    |delegate selector|
+
+    type == #keyPress:x:y: ifTrue:[
+        view device sendKeyPress:(arguments at:1)
+                               x:(arguments at:2)
+                               y:(arguments at:3)
+                              to:view 
+    ] ifFalse:[
+        delegate := view delegate.
+        delegate notNil ifTrue:[
+            "what a kludge - sending to delegate needs another
+             selector and an additional argument.
+             have to edit the selector ..."
+
+            (type endsWith:':') ifTrue:[
+                selector := (type , 'view:') asSymbol.
+            ] ifFalse:[
+                selector := (type , 'View:') asSymbol.
+            ].
+            arguments isNil ifTrue:[
+                view perform:selector with:view
+            ] ifFalse:[
+                view perform:selector withArguments:(arguments , view)
+            ]
+        ] ifFalse:[
+            view perform:type withArguments:arguments
+        ]
+    ]
+! !
+
+!WindowEvent methodsFor:'private accessing'!
+
+for:aView type:aSymbol arguments:argArray
+    "set the instances of the window event"
+
+    view := aView.
+    type := aSymbol.
+    arguments := argArray
+! !