26
|
1 |
"
|
|
2 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
3 |
All Rights Reserved
|
|
4 |
|
|
5 |
This software is furnished under a license and may be used
|
|
6 |
only in accordance with the terms of that license and with the
|
|
7 |
inclusion of the above copyright notice. This software may not
|
|
8 |
be provided or otherwise made available to, or used by, any
|
|
9 |
other person. No title to or ownership of the software is
|
|
10 |
hereby transferred.
|
|
11 |
"
|
11
|
12 |
|
|
13 |
Object subclass:#WindowEvent
|
|
14 |
instanceVariableNames:'view type arguments'
|
|
15 |
classVariableNames:''
|
|
16 |
poolDictionaries:''
|
|
17 |
category:'Interface-Support'
|
|
18 |
!
|
|
19 |
|
|
20 |
!WindowEvent class methodsFor:'instance creation'!
|
|
21 |
|
|
22 |
for:aView type:aSymbol arguments:argArray
|
|
23 |
"create and return a new windowEvent for sending
|
|
24 |
aSymbol-message with arguments to aView"
|
|
25 |
|
|
26 |
^ self new for:aView type:aSymbol arguments:argArray
|
|
27 |
! !
|
|
28 |
|
28
|
29 |
!WindowEvent methodsFor:'accessing'!
|
|
30 |
|
|
31 |
view
|
|
32 |
"return the view, for which the event is for"
|
|
33 |
|
|
34 |
^ view
|
|
35 |
!
|
|
36 |
|
|
37 |
type
|
|
38 |
"return the type of the event"
|
|
39 |
|
|
40 |
^ type
|
|
41 |
!
|
|
42 |
|
|
43 |
arguments
|
|
44 |
"return the arguments of the event"
|
|
45 |
|
|
46 |
^ arguments
|
|
47 |
!
|
|
48 |
|
|
49 |
arguments:anArray
|
|
50 |
"set the arguments"
|
|
51 |
|
|
52 |
arguments := anArray
|
|
53 |
! !
|
|
54 |
|
11
|
55 |
!WindowEvent methodsFor:'sending'!
|
|
56 |
|
|
57 |
sendEvent
|
|
58 |
"forward the event represented by the receiver to the view
|
|
59 |
or delegate"
|
|
60 |
|
|
61 |
|delegate selector|
|
|
62 |
|
|
63 |
type == #keyPress:x:y: ifTrue:[
|
|
64 |
view device sendKeyPress:(arguments at:1)
|
|
65 |
x:(arguments at:2)
|
|
66 |
y:(arguments at:3)
|
|
67 |
to:view
|
|
68 |
] ifFalse:[
|
|
69 |
delegate := view delegate.
|
|
70 |
delegate notNil ifTrue:[
|
|
71 |
"what a kludge - sending to delegate needs another
|
|
72 |
selector and an additional argument.
|
|
73 |
have to edit the selector ..."
|
|
74 |
|
|
75 |
(type endsWith:':') ifTrue:[
|
|
76 |
selector := (type , 'view:') asSymbol.
|
|
77 |
] ifFalse:[
|
|
78 |
selector := (type , 'View:') asSymbol.
|
|
79 |
].
|
|
80 |
arguments isNil ifTrue:[
|
23
|
81 |
delegate perform:selector with:view
|
11
|
82 |
] ifFalse:[
|
23
|
83 |
delegate perform:selector withArguments:(arguments copyWith:view)
|
11
|
84 |
]
|
|
85 |
] ifFalse:[
|
|
86 |
view perform:type withArguments:arguments
|
|
87 |
]
|
|
88 |
]
|
|
89 |
! !
|
|
90 |
|
|
91 |
!WindowEvent methodsFor:'private accessing'!
|
|
92 |
|
|
93 |
for:aView type:aSymbol arguments:argArray
|
|
94 |
"set the instances of the window event"
|
|
95 |
|
|
96 |
view := aView.
|
|
97 |
type := aSymbol.
|
|
98 |
arguments := argArray
|
|
99 |
! !
|