author | Claus Gittinger <cg@exept.de> |
Mon, 17 Feb 2020 17:54:05 +0100 | |
changeset 4439 | bf5e63a55ea1 |
parent 3772 | 18f86fffbd1c |
child 4440 | 7ad4e1da35ce |
permissions | -rw-r--r-- |
4439 | 1 |
"{ Encoding: utf8 }" |
2 |
||
0 | 3 |
" |
6 | 4 |
COPYRIGHT (c) 1990 by Claus Gittinger |
99 | 5 |
All Rights Reserved |
0 | 6 |
|
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
2250 | 14 |
"{ Package: 'stx:libview2' }" |
0 | 15 |
|
3772 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
65 | 18 |
SimpleView subclass:#InputView |
225 | 19 |
instanceVariableNames:'eventReceiver' |
20 |
classVariableNames:'' |
|
21 |
poolDictionaries:'' |
|
235 | 22 |
category:'Views-Special' |
0 | 23 |
! |
24 |
||
449 | 25 |
!InputView class methodsFor:'documentation'! |
21 | 26 |
|
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 1990 by Claus Gittinger |
|
99 | 30 |
All Rights Reserved |
0 | 31 |
|
21 | 32 |
This software is furnished under a license and may be used |
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
0 | 40 |
|
21 | 41 |
documentation |
42 |
" |
|
43 |
a view for input only - forwarding all events to another object. |
|
3772 | 44 |
This kind of view can be used to be laid on top of another view to catch all |
21 | 45 |
input. (Interface builder) |
4439 | 46 |
NOTICE: the event forwarding is a leftover from times when no delegation mechanism |
225 | 47 |
existed - it will vanish - use delegates for new code. |
48 |
||
49 |
[author:] |
|
50 |
Claus Gittinger |
|
21 | 51 |
" |
52 |
! ! |
|
0 | 53 |
|
130 | 54 |
!InputView methodsFor:'accessing'! |
0 | 55 |
|
130 | 56 |
eventReceiver:aView |
1241 | 57 |
"set the view to which input events are forwarded" |
58 |
||
130 | 59 |
eventReceiver := aView |
60 |
! |
|
0 | 61 |
|
286
b7f2e2aefae1
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
62 |
isInputOnly |
1241 | 63 |
"return true, since this is a transparent input-only view" |
286
b7f2e2aefae1
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
64 |
|
0 | 65 |
^ true |
286
b7f2e2aefae1
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
66 |
|
b7f2e2aefae1
renamed #inputOnly to #isInputOnly
Claus Gittinger <cg@exept.de>
parents:
235
diff
changeset
|
67 |
"Created: 1.6.1996 / 13:22:31 / cg" |
21 | 68 |
! ! |
69 |
||
449 | 70 |
!InputView methodsFor:'drag & drop'! |
71 |
||
2257 | 72 |
canDrop:aDropContext |
73 |
"return true, if aCollectionOfDropObjects can be dropped here. |
|
74 |
Delegated to my eventReceiving view" |
|
75 |
||
76 |
^ eventReceiver notNil |
|
77 |
and:[ eventReceiver canDrop:aDropContext ] |
|
78 |
||
79 |
"Created: / 13-10-2006 / 12:35:07 / cg" |
|
80 |
"Modified: / 13-10-2006 / 16:02:45 / cg" |
|
81 |
! |
|
82 |
||
83 |
canDrop:aDropContext at:aPoint |
|
1241 | 84 |
"return true, if aCollectionOfDropObjects can be dropped here. |
85 |
Delegated to my eventReceiving view" |
|
86 |
||
2257 | 87 |
^ eventReceiver notNil |
88 |
and:[ eventReceiver canDrop:aDropContext at:aPoint ] |
|
449 | 89 |
|
2257 | 90 |
"Created: / 13-10-2006 / 12:35:07 / cg" |
91 |
"Modified: / 13-10-2006 / 16:02:37 / cg" |
|
449 | 92 |
! |
93 |
||
2257 | 94 |
canDropObjects:aCollectionOfDropObjects |
95 |
"return true, if aCollectionOfDropObjects can be dropped here. |
|
96 |
Delegated to my eventReceiving view" |
|
97 |
||
98 |
^ eventReceiver notNil |
|
99 |
and:[ eventReceiver canDropObjects:aCollectionOfDropObjects ] |
|
100 |
||
101 |
"Created: / 13-10-2006 / 16:01:58 / cg" |
|
102 |
! |
|
103 |
||
104 |
canDropObjects:aCollectionOfDropObjects at:aPoint |
|
2250 | 105 |
"return true, if aCollectionOfDropObjects can be dropped here. |
106 |
Delegated to my eventReceiving view" |
|
107 |
||
2257 | 108 |
^ eventReceiver notNil |
109 |
and:[ eventReceiver canDropObjects:aCollectionOfDropObjects at:aPoint] |
|
2250 | 110 |
|
2257 | 111 |
"Created: / 13-10-2006 / 16:02:13 / cg" |
2250 | 112 |
! |
113 |
||
2257 | 114 |
drop:aDropContext |
115 |
"drop aCollectionOfDropObjects here. |
|
116 |
Delegated to my eventReceiving view" |
|
117 |
||
118 |
eventReceiver drop:aDropContext |
|
119 |
||
120 |
"Modified: / 13-10-2006 / 16:03:32 / cg" |
|
121 |
! |
|
122 |
||
123 |
drop:aDropContext at:aPoint |
|
2250 | 124 |
"drop aCollectionOfDropObjects here. |
125 |
Delegated to my eventReceiving view" |
|
126 |
||
2257 | 127 |
eventReceiver drop:aDropContext at:aPoint |
2250 | 128 |
|
2257 | 129 |
"Modified: / 13-10-2006 / 16:03:27 / cg" |
2250 | 130 |
! |
131 |
||
2257 | 132 |
dropObjects:aCollectionOfDropObjects |
1241 | 133 |
"drop aCollectionOfDropObjects here. |
134 |
Delegated to my eventReceiving view" |
|
135 |
||
2257 | 136 |
eventReceiver dropObjects:aCollectionOfDropObjects |
137 |
||
138 |
"Created: / 13-10-2006 / 16:03:05 / cg" |
|
139 |
! |
|
449 | 140 |
|
2257 | 141 |
dropObjects:aCollectionOfDropObjects at:aPoint |
142 |
"drop aCollectionOfDropObjects here. |
|
143 |
Delegated to my eventReceiving view" |
|
144 |
||
145 |
eventReceiver dropObjects:aCollectionOfDropObjects at:aPoint |
|
146 |
||
147 |
"Created: / 13-10-2006 / 16:03:12 / cg" |
|
449 | 148 |
! ! |
149 |
||
0 | 150 |
!InputView methodsFor:'event handling'! |
151 |
||
130 | 152 |
buttonMotion:state x:x y:y |
1241 | 153 |
"redefined to forward the event to my eventReceiver" |
21 | 154 |
|
0 | 155 |
eventReceiver notNil ifTrue:[ |
1185
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
156 |
eventReceiver buttonMotion:state x:x y:y |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
157 |
] ifFalse:[ |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
158 |
super buttonMotion:state x:x y:y |
0 | 159 |
] |
160 |
! |
|
161 |
||
162 |
buttonPress:button x:x y:y |
|
1241 | 163 |
"redefined to forward the event to my eventReceiver" |
21 | 164 |
|
0 | 165 |
eventReceiver notNil ifTrue:[ |
1185
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
166 |
eventReceiver buttonPress:button x:x y:y |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
167 |
] ifFalse:[ |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
168 |
super buttonPress:button x:x y:y |
0 | 169 |
] |
170 |
! |
|
171 |
||
172 |
buttonRelease:button x:x y:y |
|
1241 | 173 |
"redefined to forward the event to my eventReceiver" |
21 | 174 |
|
0 | 175 |
eventReceiver notNil ifTrue:[ |
1185
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
176 |
eventReceiver buttonRelease:button x:x y:y |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
177 |
] ifFalse:[ |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
178 |
super buttonRelease:button x:x y:y |
0 | 179 |
] |
180 |
! |
|
181 |
||
130 | 182 |
exposeX:x y:y width:w height:h |
1241 | 183 |
"dummy - will never be received" |
184 |
||
130 | 185 |
^ self |
186 |
! |
|
187 |
||
0 | 188 |
focusIn |
1241 | 189 |
"redefined to forward the event to my eventReceiver" |
21 | 190 |
|
0 | 191 |
eventReceiver notNil ifTrue:[ |
1241 | 192 |
eventReceiver focusIn |
0 | 193 |
] |
194 |
! |
|
195 |
||
196 |
focusOut |
|
1241 | 197 |
"redefined to forward the event to my eventReceiver" |
21 | 198 |
|
0 | 199 |
eventReceiver notNil ifTrue:[ |
1241 | 200 |
eventReceiver focusOut |
0 | 201 |
] |
202 |
! |
|
203 |
||
130 | 204 |
keyPress:key x:x y:y |
1241 | 205 |
"redefined to forward the event to my eventReceiver" |
130 | 206 |
|
207 |
eventReceiver notNil ifTrue:[ |
|
1185
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
208 |
eventReceiver keyPress:key x:x y:y |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
209 |
] ifFalse:[ |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
210 |
super keyPress:key x:x y:y |
130 | 211 |
] |
212 |
! |
|
213 |
||
214 |
keyRelease:key x:x y:y |
|
1241 | 215 |
"redefined to forward the event to my eventReceiver" |
130 | 216 |
|
217 |
eventReceiver notNil ifTrue:[ |
|
1185
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
218 |
eventReceiver keyRelease:key x:x y:y |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
219 |
] ifFalse:[ |
522d9c84f0a9
fix: if no delegate, perform normal (superclass)
Claus Gittinger <cg@exept.de>
parents:
521
diff
changeset
|
220 |
super keyRelease:key x:x y:y |
130 | 221 |
] |
222 |
! |
|
223 |
||
0 | 224 |
pointerEnter:state x:x y:y |
1241 | 225 |
"redefined to forward the event to my eventReceiver" |
21 | 226 |
|
0 | 227 |
eventReceiver notNil ifTrue:[ |
1241 | 228 |
eventReceiver pointerEnter:state x:x y:y |
0 | 229 |
] |
230 |
! |
|
231 |
||
232 |
pointerLeave:state |
|
1241 | 233 |
"redefined to forward the event to my eventReceiver" |
21 | 234 |
|
0 | 235 |
eventReceiver notNil ifTrue:[ |
1241 | 236 |
eventReceiver pointerLeave:state |
0 | 237 |
] |
238 |
! ! |
|
130 | 239 |
|
240 |
!InputView methodsFor:'initialization'! |
|
241 |
||
242 |
initialize |
|
243 |
super initialize. |
|
2775 | 244 |
self borderWidth:0 |
130 | 245 |
! ! |
246 |
||
247 |
!InputView methodsFor:'redefined dummy'! |
|
248 |
||
249 |
setViewBackground |
|
1241 | 250 |
"dummy - inputviews have no background" |
130 | 251 |
|
252 |
^ self |
|
253 |
! ! |
|
254 |
||
449 | 255 |
!InputView class methodsFor:'documentation'! |
130 | 256 |
|
257 |
version |
|
3772 | 258 |
^ '$Header$' |
2772
71336ba2fc96
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
2257
diff
changeset
|
259 |
! |
71336ba2fc96
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
2257
diff
changeset
|
260 |
|
71336ba2fc96
no more direct accesses to borderWidth and borderColor
Claus Gittinger <cg@exept.de>
parents:
2257
diff
changeset
|
261 |
version_CVS |
3772 | 262 |
^ '$Header$' |
130 | 263 |
! ! |
3772 | 264 |