11
|
1 |
'From Smalltalk/X, Version:2.8.2 on 29-nov-1993 at 15:23:00'!
|
|
2 |
|
|
3 |
Object subclass:#WindowEvent
|
|
4 |
instanceVariableNames:'view type arguments'
|
|
5 |
classVariableNames:''
|
|
6 |
poolDictionaries:''
|
|
7 |
category:'Interface-Support'
|
|
8 |
!
|
|
9 |
|
|
10 |
!WindowEvent class methodsFor:'instance creation'!
|
|
11 |
|
|
12 |
for:aView type:aSymbol arguments:argArray
|
|
13 |
"create and return a new windowEvent for sending
|
|
14 |
aSymbol-message with arguments to aView"
|
|
15 |
|
|
16 |
^ self new for:aView type:aSymbol arguments:argArray
|
|
17 |
! !
|
|
18 |
|
|
19 |
!WindowEvent methodsFor:'sending'!
|
|
20 |
|
|
21 |
sendEvent
|
|
22 |
"forward the event represented by the receiver to the view
|
|
23 |
or delegate"
|
|
24 |
|
|
25 |
|delegate selector|
|
|
26 |
|
|
27 |
type == #keyPress:x:y: ifTrue:[
|
|
28 |
view device sendKeyPress:(arguments at:1)
|
|
29 |
x:(arguments at:2)
|
|
30 |
y:(arguments at:3)
|
|
31 |
to:view
|
|
32 |
] ifFalse:[
|
|
33 |
delegate := view delegate.
|
|
34 |
delegate notNil ifTrue:[
|
|
35 |
"what a kludge - sending to delegate needs another
|
|
36 |
selector and an additional argument.
|
|
37 |
have to edit the selector ..."
|
|
38 |
|
|
39 |
(type endsWith:':') ifTrue:[
|
|
40 |
selector := (type , 'view:') asSymbol.
|
|
41 |
] ifFalse:[
|
|
42 |
selector := (type , 'View:') asSymbol.
|
|
43 |
].
|
|
44 |
arguments isNil ifTrue:[
|
23
|
45 |
delegate perform:selector with:view
|
11
|
46 |
] ifFalse:[
|
23
|
47 |
delegate perform:selector withArguments:(arguments copyWith:view)
|
11
|
48 |
]
|
|
49 |
] ifFalse:[
|
|
50 |
view perform:type withArguments:arguments
|
|
51 |
]
|
|
52 |
]
|
|
53 |
! !
|
|
54 |
|
|
55 |
!WindowEvent methodsFor:'private accessing'!
|
|
56 |
|
|
57 |
for:aView type:aSymbol arguments:argArray
|
|
58 |
"set the instances of the window event"
|
|
59 |
|
|
60 |
view := aView.
|
|
61 |
type := aSymbol.
|
|
62 |
arguments := argArray
|
|
63 |
! !
|