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