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 |
|
46
|
20 |
!WindowEvent class methodsFor:'documentation'!
|
|
21 |
|
|
22 |
copyright
|
|
23 |
"
|
|
24 |
COPYRIGHT (c) 1993 by Claus Gittinger
|
|
25 |
All Rights Reserved
|
|
26 |
|
|
27 |
This software is furnished under a license and may be used
|
|
28 |
only in accordance with the terms of that license and with the
|
|
29 |
inclusion of the above copyright notice. This software may not
|
|
30 |
be provided or otherwise made available to, or used by, any
|
|
31 |
other person. No title to or ownership of the software is
|
|
32 |
hereby transferred.
|
|
33 |
"
|
|
34 |
!
|
|
35 |
|
|
36 |
version
|
|
37 |
"
|
|
38 |
$Header: /cvs/stx/stx/libview/WindowEvent.st,v 1.5 1994-06-03 00:54:00 claus Exp $
|
|
39 |
"
|
|
40 |
!
|
|
41 |
|
|
42 |
documentation
|
|
43 |
"
|
|
44 |
Instances of WindowEvent are created for every event coming from
|
|
45 |
the graphics device, to be handled by a windowGroup. Usually, they
|
|
46 |
are queued by a sensor, and processed in some ebent loop in the window group.
|
|
47 |
"
|
|
48 |
! !
|
|
49 |
|
11
|
50 |
!WindowEvent class methodsFor:'instance creation'!
|
|
51 |
|
|
52 |
for:aView type:aSymbol arguments:argArray
|
|
53 |
"create and return a new windowEvent for sending
|
|
54 |
aSymbol-message with arguments to aView"
|
|
55 |
|
46
|
56 |
^ (self new) for:aView type:aSymbol arguments:argArray
|
|
57 |
!
|
|
58 |
|
|
59 |
damageFor:aView rectangle:aRectangle
|
|
60 |
"create and return a new damage Event for aRectangle
|
|
61 |
in aView"
|
|
62 |
|
|
63 |
^ (self new) for:aView type:#damage arguments:aRectangle
|
|
64 |
|
11
|
65 |
! !
|
|
66 |
|
28
|
67 |
!WindowEvent methodsFor:'accessing'!
|
|
68 |
|
|
69 |
view
|
|
70 |
"return the view, for which the event is for"
|
|
71 |
|
|
72 |
^ view
|
|
73 |
!
|
|
74 |
|
|
75 |
type
|
|
76 |
"return the type of the event"
|
|
77 |
|
|
78 |
^ type
|
|
79 |
!
|
|
80 |
|
|
81 |
arguments
|
|
82 |
"return the arguments of the event"
|
|
83 |
|
|
84 |
^ arguments
|
|
85 |
!
|
|
86 |
|
|
87 |
arguments:anArray
|
|
88 |
"set the arguments"
|
|
89 |
|
|
90 |
arguments := anArray
|
46
|
91 |
!
|
|
92 |
|
|
93 |
rectangle
|
|
94 |
"return the damage rectangle"
|
|
95 |
|
|
96 |
^ arguments "consider this a kludge"
|
28
|
97 |
! !
|
|
98 |
|
11
|
99 |
!WindowEvent methodsFor:'sending'!
|
|
100 |
|
|
101 |
sendEvent
|
|
102 |
"forward the event represented by the receiver to the view
|
|
103 |
or delegate"
|
|
104 |
|
|
105 |
|delegate selector|
|
|
106 |
|
|
107 |
type == #keyPress:x:y: ifTrue:[
|
|
108 |
view device sendKeyPress:(arguments at:1)
|
|
109 |
x:(arguments at:2)
|
|
110 |
y:(arguments at:3)
|
|
111 |
to:view
|
|
112 |
] ifFalse:[
|
|
113 |
delegate := view delegate.
|
|
114 |
delegate notNil ifTrue:[
|
|
115 |
"what a kludge - sending to delegate needs another
|
|
116 |
selector and an additional argument.
|
|
117 |
have to edit the selector ..."
|
|
118 |
|
|
119 |
(type endsWith:':') ifTrue:[
|
|
120 |
selector := (type , 'view:') asSymbol.
|
|
121 |
] ifFalse:[
|
|
122 |
selector := (type , 'View:') asSymbol.
|
|
123 |
].
|
|
124 |
arguments isNil ifTrue:[
|
23
|
125 |
delegate perform:selector with:view
|
11
|
126 |
] ifFalse:[
|
23
|
127 |
delegate perform:selector withArguments:(arguments copyWith:view)
|
11
|
128 |
]
|
|
129 |
] ifFalse:[
|
|
130 |
view perform:type withArguments:arguments
|
|
131 |
]
|
|
132 |
]
|
|
133 |
! !
|
|
134 |
|
|
135 |
!WindowEvent methodsFor:'private accessing'!
|
|
136 |
|
|
137 |
for:aView type:aSymbol arguments:argArray
|
|
138 |
"set the instances of the window event"
|
|
139 |
|
|
140 |
view := aView.
|
|
141 |
type := aSymbol.
|
|
142 |
arguments := argArray
|
|
143 |
! !
|