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