author | Claus Gittinger <cg@exept.de> |
Thu, 05 Jun 1997 21:08:55 +0200 | |
changeset 1741 | b84a2f4317e9 |
parent 1698 | dbe81b9c195e |
child 1811 | 6b10d567fb89 |
permissions | -rw-r--r-- |
0 | 1 |
" |
6 | 2 |
COPYRIGHT (c) 1992 by Claus Gittinger |
80 | 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 |
" |
|
12 |
||
13 |
Object subclass:#Cursor |
|
577 | 14 |
instanceVariableNames:'shape sourceForm maskForm hotX hotY device cursorId' |
15 |
classVariableNames:'Lobby DefaultFgColor DefaultBgColor NormalCursor HandCursor |
|
16 |
ArrowCursor WaitCursor CrossHairCursor OriginCursor CornerCursor |
|
17 |
SquareCursor FourWayCursor UpDownArrowCursor LeftRightArrowCursor |
|
18 |
ThumbsUpCursor ThumbsDownCursor ReadCursor WriteCursor XeqCursor |
|
19 |
StopCursor EyeCursor BlankCursor MarkerCursor UpCursor DownCursor |
|
20 |
LeftCursor RightCursor XMarkerCursor CaretCursor' |
|
21 |
poolDictionaries:'' |
|
22 |
category:'Graphics-Support' |
|
0 | 23 |
! |
24 |
||
1140 | 25 |
!Cursor class methodsFor:'documentation'! |
0 | 26 |
|
46 | 27 |
copyright |
28 |
" |
|
29 |
COPYRIGHT (c) 1992 by Claus Gittinger |
|
80 | 30 |
All Rights Reserved |
46 | 31 |
|
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 |
! |
|
40 |
||
0 | 41 |
documentation |
38 | 42 |
" |
43 |
I represents cursors in a device independent manner. |
|
144 | 44 |
Normally, cursors are defined at view creation time, |
601 | 45 |
via |
1698 | 46 |
'aView cursor:aCursor'. |
601 | 47 |
|
48 |
[Instance variables:] |
|
0 | 49 |
|
1698 | 50 |
shape <Symbol> a shape (i.e. #arrow, #hand, ...) or nil |
51 |
sourceForm <Form> if shape is nil, the source bits |
|
52 |
maskForm <Form> if shape is nil, the mask bits |
|
53 |
hotX <SmallInteger> if shape is nil, the hotSpot x of the cursor |
|
54 |
hotY <SmallInteger> if shape is nil, the hotSpot y of the cursor |
|
55 |
device <aDevice> the device, if associated to one |
|
56 |
cursorId <anObject> the device-specific id if device is nonNil |
|
0 | 57 |
|
601 | 58 |
[class variables:] |
59 |
||
1698 | 60 |
Lobby <Registry> keeps track of known device cursors |
61 |
(dont use it: this will be moved to the device) |
|
601 | 62 |
|
1698 | 63 |
DefaultFgColor <Color> default foreground color for cursors (usually black) |
64 |
DefaultBgColor <Color> default background color for cursors (usually white) |
|
0 | 65 |
|
1698 | 66 |
NormalCursor <Cursor> cached instance of normal (arrow) cursor |
67 |
... |
|
0 | 68 |
|
601 | 69 |
[see also:] |
1698 | 70 |
DeviceWorkstation |
71 |
DisplaySurface |
|
72 |
Font Cursor Color Form |
|
73 |
( introduction to view programming :html: programming/viewintro.html#CURSOR ) |
|
611 | 74 |
|
75 |
[author:] |
|
1698 | 76 |
Claus Gittinger |
38 | 77 |
" |
144 | 78 |
! |
79 |
||
80 |
examples |
|
81 |
" |
|
82 |
get a standard cursor: |
|
83 |
||
974 | 84 |
Cursor wait |
85 |
Cursor stop |
|
86 |
Cursor normal |
|
144 | 87 |
|
88 |
create a custom cursor: |
|
89 |
||
974 | 90 |
Cursor extent:16@16 |
91 |
fromArray:#[ 2r00000000 2r00000000 |
|
92 |
2r00000000 2r00000000 |
|
93 |
2r00000000 2r00000000 |
|
94 |
2r11111111 2r11111111 |
|
95 |
2r11111111 2r11111111 |
|
96 |
2r00000000 2r00000000 |
|
97 |
2r00000000 2r00000000 |
|
98 |
2r11111111 2r11111111 |
|
99 |
2r11111111 2r11111111 |
|
100 |
2r00000000 2r00000000 |
|
101 |
2r00000000 2r00000000 |
|
102 |
2r11111111 2r11111111 |
|
103 |
2r11111111 2r11111111 |
|
104 |
2r00000000 2r00000000 |
|
105 |
2r00000000 2r00000000 |
|
106 |
2r00000000 2r00000000] |
|
107 |
offset:-8@ -8 |
|
619 | 108 |
|
109 |
||
144 | 110 |
|
111 |
define a cursor for a view: |
|
974 | 112 |
[exBegin] |
113 |
|v| |
|
144 | 114 |
|
974 | 115 |
v := StandardSystemView extent:100@100. |
116 |
v cursor:Cursor stop. |
|
117 |
v open. |
|
118 |
[exEnd] |
|
619 | 119 |
|
144 | 120 |
|
121 |
with above custom cursor: |
|
974 | 122 |
[exBegin] |
123 |
|v| |
|
144 | 124 |
|
974 | 125 |
v := StandardSystemView extent:100@100. |
126 |
v cursor:( |
|
127 |
Cursor extent:16@16 |
|
128 |
fromArray:#[ 2r00000000 2r00000000 |
|
129 |
2r00000000 2r00000000 |
|
130 |
2r00000000 2r00000000 |
|
131 |
2r11111111 2r11111111 |
|
132 |
2r11111111 2r11111111 |
|
133 |
2r00000000 2r00000000 |
|
134 |
2r00000000 2r00000000 |
|
135 |
2r11111111 2r11111111 |
|
136 |
2r11111111 2r11111111 |
|
137 |
2r00000000 2r00000000 |
|
138 |
2r00000000 2r00000000 |
|
139 |
2r11111111 2r11111111 |
|
140 |
2r11111111 2r11111111 |
|
141 |
2r00000000 2r00000000 |
|
142 |
2r00000000 2r00000000 |
|
143 |
2r00000000 2r00000000] |
|
144 |
offset:-8@ -8). |
|
145 |
v open. |
|
146 |
[exEnd] |
|
619 | 147 |
|
144 | 148 |
|
149 |
with multiple views: |
|
974 | 150 |
[exBegin] |
151 |
|v1 v2 top| |
|
144 | 152 |
|
974 | 153 |
top := StandardSystemView new. |
154 |
top extent:300@300. |
|
155 |
v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
156 |
v1 viewBackground:(Color grey:75). |
|
157 |
v1 cursor:Cursor thumbsUp. |
|
158 |
v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
|
159 |
v2 viewBackground:(Color white). |
|
160 |
v2 cursor:Cursor wait. |
|
161 |
top open. |
|
162 |
[exEnd] |
|
144 | 163 |
|
164 |
||
702 | 165 |
show a cursor (in the active ST/X view) for a while: |
974 | 166 |
[exBegin] |
619 | 167 |
|
974 | 168 |
Cursor wait |
169 |
showWhile:[ |
|
170 |
Delay waitForSeconds:5 |
|
171 |
] |
|
172 |
[exEnd] |
|
144 | 173 |
|
174 |
||
151 | 175 |
show a cursor in all views belonging to a windowGroup: |
176 |
(have to wait until top is visible to access windowGroup) |
|
974 | 177 |
[exBegin] |
178 |
|v1 v2 top| |
|
151 | 179 |
|
974 | 180 |
top := StandardSystemView new. |
181 |
top extent:300@300. |
|
182 |
v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
183 |
v1 viewBackground:(Color grey:75). |
|
184 |
v1 cursor:(Cursor normal). |
|
702 | 185 |
|
974 | 186 |
v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
187 |
v2 viewBackground:(Color white). |
|
188 |
v2 cursor:(Cursor crossHair). |
|
189 |
top openAndWait. |
|
151 | 190 |
|
974 | 191 |
Delay waitForSeconds:3. |
151 | 192 |
|
974 | 193 |
top windowGroup |
194 |
withCursor:Cursor wait |
|
195 |
do:[ |
|
196 |
Delay waitForSeconds:5 |
|
197 |
] |
|
198 |
[exEnd] |
|
151 | 199 |
|
200 |
||
144 | 201 |
show a cursor in a single view for a while: |
974 | 202 |
[exBegin] |
203 |
|v1 v2 top| |
|
144 | 204 |
|
974 | 205 |
top := StandardSystemView new. |
206 |
top extent:300@300. |
|
207 |
v1 := View origin:0.0@0.0 corner:1.0@0.5 in:top. |
|
208 |
v1 viewBackground:(Color grey:75). |
|
209 |
v1 cursor:(Cursor normal). |
|
702 | 210 |
|
974 | 211 |
v2 := View origin:0.0@0.5 corner:1.0@1.0 in:top. |
212 |
v2 viewBackground:(Color white). |
|
213 |
v2 cursor:(Cursor crossHair). |
|
702 | 214 |
|
974 | 215 |
top openAndWait. |
702 | 216 |
|
974 | 217 |
Delay waitForSeconds:3. |
144 | 218 |
|
974 | 219 |
v1 withCursor:Cursor wait |
220 |
do:[ |
|
221 |
Delay waitForSeconds:5 |
|
222 |
] |
|
223 |
[exEnd] |
|
144 | 224 |
" |
0 | 225 |
! ! |
226 |
||
1140 | 227 |
!Cursor class methodsFor:'initialization'! |
0 | 228 |
|
229 |
flushDeviceCursors |
|
230 |
"unassign all cursors from their device" |
|
231 |
||
223 | 232 |
Lobby notNil ifTrue:[ |
499 | 233 |
Lobby do:[:aCursor | |
223 | 234 |
aCursor restored. |
235 |
Lobby registerChange:aCursor |
|
499 | 236 |
] |
0 | 237 |
] |
238 |
! |
|
239 |
||
577 | 240 |
initialize |
241 |
Lobby isNil ifTrue:[ |
|
242 |
Lobby := Registry new. |
|
243 |
||
244 |
"want to be informed when returning from snapshot" |
|
245 |
ObjectMemory addDependent:self |
|
246 |
] |
|
247 |
! |
|
248 |
||
1495 | 249 |
initializeNewCursors |
1564 | 250 |
"Create the new cursors |
1698 | 251 |
Cursor blank |
252 |
Cursor down |
|
253 |
Cursor execute |
|
254 |
Cursor left |
|
255 |
Cursor marker |
|
256 |
Cursor normal |
|
257 |
Cursor read |
|
258 |
Cursor right |
|
259 |
Cursor square |
|
260 |
Cursor up |
|
261 |
Cursor wait |
|
262 |
Cursor write |
|
263 |
Cursor thumbsUp |
|
264 |
Cursor thumbsDown |
|
265 |
Cursor xMarker |
|
266 |
Cursor caret |
|
267 |
Cursor stop |
|
268 |
Cursor eye" |
|
1495 | 269 |
|
1564 | 270 |
|device builtIn| |
1495 | 271 |
|
1564 | 272 |
device := Display. |
273 |
builtIn := device builtInCursorShapes. |
|
1495 | 274 |
|
1564 | 275 |
(builtIn includes:#origin) ifFalse:[ |
1698 | 276 |
OriginCursor := |
277 |
(Cursor |
|
278 |
extent: 16@16 |
|
279 |
sourceArray: #( |
|
280 |
2r0000000000000000 |
|
281 |
2r0111111111111111 |
|
282 |
2r0111111111111111 |
|
283 |
2r0110000000000000 |
|
284 |
2r0110000000000000 |
|
285 |
2r0110000000000000 |
|
286 |
2r0110000000000000 |
|
287 |
2r0110000000000000 |
|
288 |
2r0110000000000000 |
|
289 |
2r0110000000000000 |
|
290 |
2r0110000000000000 |
|
291 |
2r0110000000000000 |
|
292 |
2r0110000000000000 |
|
293 |
2r0110000000000000 |
|
294 |
2r0110000000000000 |
|
295 |
2r0110000000000000) |
|
296 |
maskArray: #( |
|
297 |
2r1111111111111111 |
|
298 |
2r1111111111111111 |
|
299 |
2r1111111111111111 |
|
300 |
2r1111111111111111 |
|
301 |
2r1111000000000000 |
|
302 |
2r1111000000000000 |
|
303 |
2r1111000000000000 |
|
304 |
2r1111000000000000 |
|
305 |
2r1111000000000000 |
|
306 |
2r1111000000000000 |
|
307 |
2r1111000000000000 |
|
308 |
2r1111000000000000 |
|
309 |
2r1111000000000000 |
|
310 |
2r1111000000000000 |
|
311 |
2r1111000000000000 |
|
312 |
2r1111000000000000) |
|
313 |
offset: -1@ -1). |
|
1564 | 314 |
]. |
1495 | 315 |
|
1564 | 316 |
(builtIn includes:#corner) ifFalse:[ |
1698 | 317 |
CornerCursor := |
318 |
(Cursor |
|
319 |
extent: 16@16 |
|
320 |
sourceArray: #( |
|
321 |
2r0000000000000110 |
|
322 |
2r0000000000000110 |
|
323 |
2r0000000000000110 |
|
324 |
2r0000000000000110 |
|
325 |
2r0000000000000110 |
|
326 |
2r0000000000000110 |
|
327 |
2r0000000000000110 |
|
328 |
2r0000000000000110 |
|
329 |
2r0000000000000110 |
|
330 |
2r0000000000000110 |
|
331 |
2r0000000000000110 |
|
332 |
2r0000000000000110 |
|
333 |
2r0000000000000110 |
|
334 |
2r1111111111111110 |
|
335 |
2r1111111111111110 |
|
336 |
2r0000000000000000) |
|
337 |
maskArray: #( |
|
338 |
2r0000000000001111 |
|
339 |
2r0000000000001111 |
|
340 |
2r0000000000001111 |
|
341 |
2r0000000000001111 |
|
342 |
2r0000000000001111 |
|
343 |
2r0000000000001111 |
|
344 |
2r0000000000001111 |
|
345 |
2r0000000000001111 |
|
346 |
2r0000000000001111 |
|
347 |
2r0000000000001111 |
|
348 |
2r0000000000001111 |
|
349 |
2r0000000000001111 |
|
350 |
2r1111111111111111 |
|
351 |
2r1111111111111111 |
|
352 |
2r1111111111111111 |
|
353 |
2r1111111111111111) |
|
354 |
offset: -14@ -14). |
|
1564 | 355 |
]. |
1495 | 356 |
|
1564 | 357 |
(builtIn includes:#read) ifFalse:[ |
1698 | 358 |
ReadCursor := (Cursor |
359 |
extent: 16@16 |
|
360 |
sourceArray: #( |
|
361 |
2r0 |
|
362 |
2r0000110000000110 |
|
363 |
2r0001001000001001 |
|
364 |
2r0001001000001001 |
|
365 |
2r0010000000010000 |
|
366 |
2r0100000000100000 |
|
367 |
2r1111101111100000 |
|
368 |
2r1000010000100000 |
|
369 |
2r1000010000100000 |
|
370 |
2r1011010110100000 |
|
371 |
2r0111101111000000 |
|
372 |
2r0000000000000000 |
|
373 |
2r0000000000000000 |
|
374 |
2r0000000000000000 |
|
375 |
2r0000000000000000 |
|
376 |
2r0000000000000000) |
|
377 |
maskArray: #( |
|
378 |
2r0001111000001111 |
|
379 |
2r0001111000011111 |
|
380 |
2r0011111000011111 |
|
381 |
2r0011100000111100 |
|
382 |
2r0111000000111000 |
|
383 |
2r1111111111110000 |
|
384 |
2r1111111111110000 |
|
385 |
2r1111111111110000 |
|
386 |
2r1111111111110000 |
|
387 |
2r1111111111110000 |
|
388 |
2r1111111111100000 |
|
389 |
2r0111111111000000 |
|
390 |
2r0000000000000000 |
|
391 |
2r0000000000000000 |
|
392 |
2r0000000000000000 |
|
393 |
2r0000000000000000) |
|
394 |
offset: -5 @ -7). |
|
1564 | 395 |
]. |
1495 | 396 |
|
1564 | 397 |
(builtIn includes:#write) ifFalse:[ |
1698 | 398 |
WriteCursor := (Cursor |
399 |
extent: 16@16 |
|
400 |
sourceArray: #( |
|
401 |
2r0000000000000110 |
|
402 |
2r0000000000001111 |
|
403 |
2r0000000000010110 |
|
404 |
2r0000000000100100 |
|
405 |
2r0000000001001000 |
|
406 |
2r0000000010010000 |
|
407 |
2r0000000100100000 |
|
408 |
2r0000001001000011 |
|
409 |
2r0000010010000010 |
|
410 |
2r0000100100000110 |
|
411 |
2r0001001000001000 |
|
412 |
2r0010010000001000 |
|
413 |
2r0111100001001000 |
|
414 |
2r0101000010111000 |
|
415 |
2r0110000110000000 |
|
416 |
2r1111111100000000) |
|
417 |
maskArray: #( |
|
418 |
2r0000000000000111 |
|
419 |
2r0000000000001111 |
|
420 |
2r0000000000011110 |
|
421 |
2r0000000000111100 |
|
422 |
2r0000000001111000 |
|
423 |
2r0000000011110000 |
|
424 |
2r0000000111100001 |
|
425 |
2r0000001111000110 |
|
426 |
2r0000011110000110 |
|
427 |
2r0000111100001110 |
|
428 |
2r0001111000001100 |
|
429 |
2r0011110001001100 |
|
430 |
2r0111100011111000 |
|
431 |
2r0111000110111000 |
|
432 |
2r0111111110000000 |
|
433 |
2r1111111100000000) |
|
434 |
offset: 0@ -15). |
|
1564 | 435 |
]. |
1495 | 436 |
|
1564 | 437 |
(builtIn includes:#wait) ifFalse:[ |
1698 | 438 |
WaitCursor := |
439 |
(Cursor |
|
440 |
extent: 16@16 |
|
441 |
sourceArray: #( |
|
442 |
2r1111111111111111 |
|
443 |
2r1000000000000001 |
|
444 |
2r0100000000000010 |
|
445 |
2r0010000000000100 |
|
446 |
2r0001110000111000 |
|
447 |
2r0000111101110000 |
|
448 |
2r0000011011100000 |
|
449 |
2r0000001111000000 |
|
450 |
2r0000001111000000 |
|
451 |
2r0000010110100000 |
|
452 |
2r0000100010010000 |
|
453 |
2r0001000110001000 |
|
454 |
2r0010001101000100 |
|
455 |
2r0100111111110010 |
|
456 |
2r1011111111111101 |
|
457 |
2r1111111111111111) |
|
458 |
maskArray: #( |
|
459 |
2r1111111111111111 |
|
460 |
2r1111111111111111 |
|
461 |
2r1111111111111111 |
|
462 |
2r0111111111111110 |
|
463 |
2r0011111111111100 |
|
464 |
2r0001111111111000 |
|
465 |
2r0000111111110000 |
|
466 |
2r0000011111100000 |
|
467 |
2r0000011111100000 |
|
468 |
2r0000111111110000 |
|
469 |
2r0001111111111000 |
|
470 |
2r0011111111111100 |
|
471 |
2r0111111111111110 |
|
472 |
2r1111111111111111 |
|
473 |
2r1111111111111111 |
|
474 |
2r1111111111111111) |
|
475 |
offset: -8@ -8). |
|
1564 | 476 |
]. |
1495 | 477 |
|
1564 | 478 |
BlankCursor := Cursor new. |
1495 | 479 |
|
1564 | 480 |
(builtIn includes:#execute) ifFalse:[ |
1698 | 481 |
XeqCursor := |
482 |
(Cursor |
|
483 |
extent: 16@16 |
|
484 |
sourceArray: #( |
|
485 |
2r1000000000010000 |
|
486 |
2r1100000000010000 |
|
487 |
2r1110000000111000 |
|
488 |
2r1111000111111111 |
|
489 |
2r1111100011000110 |
|
490 |
2r1111110001000100 |
|
491 |
2r1111111001111100 |
|
492 |
2r1111000001101100 |
|
493 |
2r1101100011000110 |
|
494 |
2r1001100010000010 |
|
495 |
2r0000110000000000 |
|
496 |
2r0000110000000000 |
|
497 |
2r0000011000000000 |
|
498 |
2r0000011000000000 |
|
499 |
2r0000001100000000 |
|
500 |
2r0000001100000000) |
|
501 |
maskArray: #( |
|
502 |
2r1100000000111000 |
|
503 |
2r1110000000111000 |
|
504 |
2r1111000111111111 |
|
505 |
2r1111100111111111 |
|
506 |
2r1111110011111111 |
|
507 |
2r1111111001111110 |
|
508 |
2r1111111101111100 |
|
509 |
2r1111100001111110 |
|
510 |
2r1101110011100111 |
|
511 |
2r1001110011000010 |
|
512 |
2r0000111000000000 |
|
513 |
2r0000111000000000 |
|
514 |
2r0000011100000000 |
|
515 |
2r0000011100000000 |
|
516 |
2r0000001110000000 |
|
517 |
2r0000001110000000) |
|
518 |
offset: 0@0). |
|
1564 | 519 |
]. |
1495 | 520 |
|
1564 | 521 |
(builtIn includes:#square) ifFalse:[ |
1698 | 522 |
SquareCursor := |
523 |
(Cursor |
|
524 |
extent: 16@16 |
|
525 |
fromArray: #( |
|
526 |
2r0000000000000000 |
|
527 |
2r0000000000000000 |
|
528 |
2r0000000000000000 |
|
529 |
2r0000000000000000 |
|
530 |
2r0000000000000000 |
|
531 |
2r0000001111000000 |
|
532 |
2r0000001111000000 |
|
533 |
2r0000001111000000 |
|
534 |
2r0000001111000000 |
|
535 |
2r0000000000000000 |
|
536 |
2r0000000000000000 |
|
537 |
2r0000000000000000 |
|
538 |
2r0000000000000000 |
|
539 |
2r0000000000000000 |
|
540 |
2r0000000000000000 |
|
541 |
2r0000000000000000) |
|
542 |
offset: -8@ -8). |
|
1564 | 543 |
]. |
1495 | 544 |
|
1564 | 545 |
(builtIn includes:#upLeftArrow) ifFalse:[ |
1698 | 546 |
NormalCursor := |
547 |
(Cursor |
|
548 |
extent: 16@16 |
|
549 |
sourceArray: #( |
|
550 |
2r1000000000000000 |
|
551 |
2r1100000000000000 |
|
552 |
2r1110000000000000 |
|
553 |
2r1111000000000000 |
|
554 |
2r1111100000000000 |
|
555 |
2r1111110000000000 |
|
556 |
2r1111111000000000 |
|
557 |
2r1111100000000000 |
|
558 |
2r1111100000000000 |
|
559 |
2r1001100000000000 |
|
560 |
2r0000110000000000 |
|
561 |
2r0000110000000000 |
|
562 |
2r0000011000000000 |
|
563 |
2r0000011000000000 |
|
564 |
2r0000001100000000 |
|
565 |
2r0000001100000000) |
|
566 |
maskArray: #( |
|
567 |
2r1100000000000000 |
|
568 |
2r1110000000000000 |
|
569 |
2r1111000000000000 |
|
570 |
2r1111100000000000 |
|
571 |
2r1111110000000000 |
|
572 |
2r1111111000000000 |
|
573 |
2r1111111100000000 |
|
574 |
2r1111110000000000 |
|
575 |
2r1111110000000000 |
|
576 |
2r1001110000000000 |
|
577 |
2r0000111000000000 |
|
578 |
2r0000111000000000 |
|
579 |
2r0000011100000000 |
|
580 |
2r0000011100000000 |
|
581 |
2r0000001110000000 |
|
582 |
2r0000001110000000) |
|
583 |
offset: 0@0). |
|
1564 | 584 |
]. |
1495 | 585 |
|
586 |
||
1564 | 587 |
(builtIn includes:#crossHair) ifFalse:[ |
1698 | 588 |
CrossHairCursor := |
589 |
(Cursor |
|
590 |
extent: 16@16 |
|
591 |
sourceArray: #( |
|
592 |
2r0000000100000000 |
|
593 |
2r0000000100000000 |
|
594 |
2r0000000100000000 |
|
595 |
2r0000000100000000 |
|
596 |
2r0000000100000000 |
|
597 |
2r0000000100000000 |
|
598 |
2r0000000100000000 |
|
599 |
2r1111111111111110 |
|
600 |
2r0000000100000000 |
|
601 |
2r0000000100000000 |
|
602 |
2r0000000100000000 |
|
603 |
2r0000000100000000 |
|
604 |
2r0000000100000000 |
|
605 |
2r0000000100000000 |
|
606 |
2r0000000100000000 |
|
607 |
2r0) |
|
608 |
maskArray: #( |
|
609 |
2r0000000110000000 |
|
610 |
2r0000000110000000 |
|
611 |
2r0000000110000000 |
|
612 |
2r0000000110000000 |
|
613 |
2r0000000110000000 |
|
614 |
2r0000000110000000 |
|
615 |
2r0000000110000000 |
|
616 |
2r1111111111111110 |
|
617 |
2r1111111111111110 |
|
618 |
2r0000000110000000 |
|
619 |
2r0000000110000000 |
|
620 |
2r0000000110000000 |
|
621 |
2r0000000110000000 |
|
622 |
2r0000000110000000 |
|
623 |
2r0000000110000000 |
|
624 |
2r0) |
|
625 |
offset: -7@ -7). |
|
1564 | 626 |
]. |
1495 | 627 |
|
1564 | 628 |
(builtIn includes:#scrollMarkerH) ifFalse:[ |
1698 | 629 |
MarkerCursor := |
630 |
Cursor |
|
631 |
extent: 16@16 |
|
632 |
fromArray: #( |
|
633 |
2r0000000000000000 |
|
634 |
2r0000000000000000 |
|
635 |
2r0000000000000000 |
|
636 |
2r0000001000000000 |
|
637 |
2r0000001110000000 |
|
638 |
2r0000001111100000 |
|
639 |
2r1111111111111000 |
|
640 |
2r1111111111111110 |
|
641 |
2r1111111111111000 |
|
642 |
2r0000001111100000 |
|
643 |
2r0000001110000000 |
|
644 |
2r0000001000000000 |
|
645 |
2r0000000000000000 |
|
646 |
2r0000000000000000 |
|
647 |
2r0000000000000000 |
|
648 |
2r0000000000000000) |
|
649 |
offset: -7@ -7. |
|
1564 | 650 |
]. |
1495 | 651 |
|
1564 | 652 |
(builtIn includes:#scrollUp) ifFalse:[ |
1698 | 653 |
UpCursor := |
654 |
Cursor |
|
655 |
extent: 16@16 |
|
656 |
fromArray: #( |
|
657 |
2r1000000000000000 |
|
658 |
2r1100000000000000 |
|
659 |
2r1110000000000000 |
|
660 |
2r1111000000000000 |
|
661 |
2r1111100000000000 |
|
662 |
2r1111110000000000 |
|
663 |
2r1100000000000000 |
|
664 |
2r1100000000000000 |
|
665 |
2r1100000000000000 |
|
666 |
2r1100000000000000 |
|
667 |
2r1100000000000000 |
|
668 |
2r1100000000000000 |
|
669 |
2r1100000000000000 |
|
670 |
2r1100000000000000 |
|
671 |
2r1100000000000000 |
|
672 |
2r1100000000000000) |
|
673 |
offset: 0@ -7. |
|
1564 | 674 |
]. |
1495 | 675 |
|
1564 | 676 |
(builtIn includes:#scrollDown) ifFalse:[ |
1698 | 677 |
DownCursor := |
678 |
Cursor |
|
679 |
extent: 16@16 |
|
680 |
fromArray: #( |
|
681 |
2r0000110000000000 |
|
682 |
2r0000110000000000 |
|
683 |
2r0000110000000000 |
|
684 |
2r0000110000000000 |
|
685 |
2r0000110000000000 |
|
686 |
2r0000110000000000 |
|
687 |
2r0000110000000000 |
|
688 |
2r0000110000000000 |
|
689 |
2r0000110000000000 |
|
690 |
2r0000110000000000 |
|
691 |
2r1111110000000000 |
|
692 |
2r0111110000000000 |
|
693 |
2r0011110000000000 |
|
694 |
2r0001110000000000 |
|
695 |
2r0000110000000000 |
|
696 |
2r0000010000000000) |
|
697 |
offset: -5@ -7. |
|
1564 | 698 |
]. |
1495 | 699 |
|
1564 | 700 |
(builtIn includes:#scrollLeft) ifFalse:[ |
1698 | 701 |
LeftCursor := |
702 |
Cursor |
|
703 |
extent: 16@16 |
|
704 |
fromArray: #( |
|
705 |
2r1111111111111111 |
|
706 |
2r0111111111111111 |
|
707 |
2r0011110000000000 |
|
708 |
2r0001110000000000 |
|
709 |
2r0000110000000000 |
|
710 |
2r0000010000000000 |
|
711 |
2r0000000000000000 |
|
712 |
2r0000000000000000 |
|
713 |
2r0000000000000000 |
|
714 |
2r0000000000000000 |
|
715 |
2r0000000000000000 |
|
716 |
2r0000000000000000 |
|
717 |
2r0000000000000000 |
|
718 |
2r0000000000000000 |
|
719 |
2r0000000000000000 |
|
720 |
2r0000000000000000) |
|
721 |
offset: -7@0. |
|
1564 | 722 |
]. |
1495 | 723 |
|
1564 | 724 |
(builtIn includes:#scrollRight) ifFalse:[ |
1698 | 725 |
RightCursor := |
726 |
Cursor |
|
727 |
extent: 16@16 |
|
728 |
fromArray: #( |
|
729 |
2r0000000000100000 |
|
730 |
2r0000000000110000 |
|
731 |
2r0000000000111000 |
|
732 |
2r0000000000111100 |
|
733 |
2r1111111111111110 |
|
734 |
2r1111111111111111 |
|
735 |
2r0000000000000000 |
|
736 |
2r0000000000000000 |
|
737 |
2r0000000000000000 |
|
738 |
2r0000000000000000 |
|
739 |
2r0000000000000000 |
|
740 |
2r0000000000000000 |
|
741 |
2r0000000000000000 |
|
742 |
2r0000000000000000 |
|
743 |
2r0000000000000000 |
|
744 |
2r0000000000000000) |
|
745 |
offset: -7@ -5. |
|
1564 | 746 |
]. |
747 |
||
748 |
(builtIn includes:#scrollMarkerV) ifFalse:[ |
|
1698 | 749 |
XMarkerCursor := |
750 |
Cursor |
|
751 |
extent: 16@16 |
|
752 |
fromArray: #( |
|
753 |
2r0 |
|
754 |
2r0000000100000000 |
|
755 |
2r0000000100000000 |
|
756 |
2r0000001110000000 |
|
757 |
2r0000001110000000 |
|
758 |
2r0000011111000000 |
|
759 |
2r0000011111000000 |
|
760 |
2r0000111111100000 |
|
761 |
2r0000111111100000 |
|
762 |
2r0001111111110000 |
|
763 |
2r0000001110000000 |
|
764 |
2r0000001110000000 |
|
765 |
2r0000001110000000 |
|
766 |
2r0000001110000000 |
|
767 |
2r0000001110000000 |
|
768 |
2r0000001110000000) |
|
769 |
offset: -7@ -7. |
|
1564 | 770 |
]. |
1495 | 771 |
|
1564 | 772 |
(builtIn includes:#fourWay) ifFalse:[ |
1698 | 773 |
FourWayCursor := |
774 |
Cursor |
|
775 |
extent: 16@16 |
|
776 |
sourceArray: #( |
|
777 |
2r0000000100000000 |
|
778 |
2r0000001110000000 |
|
779 |
2r0000011111000000 |
|
780 |
2r0000111111100000 |
|
781 |
2r0001001110010000 |
|
782 |
2r0011001110011000 |
|
783 |
2r0111111111111100 |
|
784 |
2r1111111111111110 |
|
785 |
2r0111111111111100 |
|
786 |
2r0011001110011000 |
|
787 |
2r0001001110010000 |
|
788 |
2r0000111111100000 |
|
789 |
2r0000011111000000 |
|
790 |
2r0000001110000000 |
|
791 |
2r0000000100000000 |
|
792 |
2r0000000000000000) |
|
793 |
maskArray: #( |
|
794 |
2r0000001110000000 |
|
795 |
2r0000011111000000 |
|
796 |
2r0000111111100000 |
|
797 |
2r0001111111110000 |
|
798 |
2r0010111111101000 |
|
799 |
2r0111111111111100 |
|
800 |
2r1111111111111110 |
|
801 |
2r1111111111111110 |
|
802 |
2r1111111111111110 |
|
803 |
2r0111111111111100 |
|
804 |
2r0010111111101000 |
|
805 |
2r0001111111110000 |
|
806 |
2r0000111111100000 |
|
807 |
2r0000011111000000 |
|
808 |
2r0000001110000000 |
|
809 |
2r0000000000000000) |
|
810 |
offset: -7@ -7. |
|
1564 | 811 |
]. |
1495 | 812 |
|
1564 | 813 |
(builtIn includes:#thumbsUp) ifFalse:[ |
1698 | 814 |
ThumbsUpCursor := (Cursor |
815 |
extent: 16@16 |
|
816 |
sourceArray: #( |
|
817 |
2r0000000000100000 |
|
818 |
2r0000000001010000 |
|
819 |
2r0000000010010000 |
|
820 |
2r0000000011110000 |
|
821 |
2r0000000100010000 |
|
822 |
2r0000000100010000 |
|
823 |
2r0001111100011000 |
|
824 |
2r0010000100000110 |
|
825 |
2r0100000000000000 |
|
826 |
2r0111111000000000 |
|
827 |
2r0100000000000000 |
|
828 |
2r0111111000000000 |
|
829 |
2r0100000000000000 |
|
830 |
2r0011111000001110 |
|
831 |
2r0001000000010000 |
|
832 |
2r0001111111100000) |
|
833 |
maskArray: #( |
|
834 |
2r0000000000100000 |
|
835 |
2r0000000001110000 |
|
836 |
2r0000000011110000 |
|
837 |
2r0000000011110000 |
|
838 |
2r0000000111110000 |
|
839 |
2r0000000111110000 |
|
840 |
2r0001111111111000 |
|
841 |
2r0011111111111110 |
|
842 |
2r0111111111111110 |
|
843 |
2r0111111111111110 |
|
844 |
2r0111111111111110 |
|
845 |
2r0111111111111110 |
|
846 |
2r0111111111111110 |
|
847 |
2r0011111111111110 |
|
848 |
2r0001111111110000 |
|
849 |
2r0001111111100000) |
|
850 |
offset: -8@ 0). |
|
1564 | 851 |
]. |
1495 | 852 |
|
1564 | 853 |
(builtIn includes:#caret) ifFalse:[ |
1698 | 854 |
CaretCursor := (Cursor |
855 |
extent: 16@16 |
|
856 |
fromArray: #( |
|
857 |
2r0000000110000000 |
|
858 |
2r0000000110000000 |
|
859 |
2r0000001111000000 |
|
860 |
2r0000011111100000 |
|
861 |
2r0000011001100000 |
|
862 |
2r0000000000000000 |
|
863 |
2r0000000000000000 |
|
864 |
2r0000000000000000 |
|
865 |
2r0000000000000000 |
|
866 |
2r0000000000000000 |
|
867 |
2r0000000000000000 |
|
868 |
2r0000000000000000 |
|
869 |
2r0000000000000000 |
|
870 |
2r0000000000000000 |
|
871 |
2r0000000000000000 |
|
872 |
2r0000000000000000) |
|
873 |
offset: -8@0). |
|
1564 | 874 |
]. |
1495 | 875 |
|
1564 | 876 |
(builtIn includes:#thumbsDown) ifFalse:[ |
1698 | 877 |
ThumbsDownCursor := (Cursor |
878 |
extent: 16@16 |
|
879 |
sourceArray: #( |
|
880 |
2r0001111111100000 |
|
881 |
2r0001000000010000 |
|
882 |
2r0011111000001110 |
|
883 |
2r0100000000000000 |
|
884 |
2r0111111000000000 |
|
885 |
2r0100000000000000 |
|
886 |
2r0111111000000000 |
|
887 |
2r0100000000000000 |
|
888 |
2r0010000100000110 |
|
889 |
2r0001111100011000 |
|
890 |
2r0000000100010000 |
|
891 |
2r0000000100010000 |
|
892 |
2r0000000011110000 |
|
893 |
2r0000000010010000 |
|
894 |
2r0000000001010000 |
|
895 |
2r0000000000100000) |
|
1495 | 896 |
|
1698 | 897 |
maskArray: #( |
898 |
2r0001111111100000 |
|
899 |
2r0001111111110000 |
|
900 |
2r0011111111111110 |
|
901 |
2r0111111111111110 |
|
902 |
2r0111111111111110 |
|
903 |
2r0111111111111110 |
|
904 |
2r0111111111111110 |
|
905 |
2r0111111111111110 |
|
906 |
2r0011111111111110 |
|
907 |
2r0001111111111000 |
|
908 |
2r0000000111110000 |
|
909 |
2r0000000111110000 |
|
910 |
2r0000000011110000 |
|
911 |
2r0000000011110000 |
|
912 |
2r0000000001110000 |
|
913 |
2r0000000000100000) |
|
914 |
offset: -8@ -16). |
|
1564 | 915 |
]. |
1495 | 916 |
|
1564 | 917 |
(builtIn includes:#stop) ifFalse:[ |
1698 | 918 |
StopCursor := (Cursor |
919 |
extent: 16@16 |
|
920 |
sourceArray: #( |
|
921 |
2r0000000000000000 |
|
922 |
2r0000011111000000 |
|
923 |
2r0001111111110000 |
|
924 |
2r0011111111111000 |
|
925 |
2r0011111111111000 |
|
926 |
2r0111111111111100 |
|
927 |
2r0111111111111100 |
|
928 |
2r0100000000000100 |
|
929 |
2r0100000000000100 |
|
930 |
2r0111111111111100 |
|
931 |
2r0111111111111100 |
|
932 |
2r0011111111111000 |
|
933 |
2r0011111111111000 |
|
934 |
2r0001111111110000 |
|
935 |
2r0000011111000000 |
|
936 |
2r0000000000000000 |
|
937 |
) |
|
938 |
maskArray: #( |
|
939 |
2r0000011111000000 |
|
940 |
2r0001111111110000 |
|
941 |
2r0011111111111000 |
|
942 |
2r0111111111111100 |
|
943 |
2r0111111111111100 |
|
944 |
2r1111111111111110 |
|
945 |
2r1111111111111110 |
|
946 |
2r1111111111111110 |
|
947 |
2r1111111111111110 |
|
948 |
2r1111111111111110 |
|
949 |
2r1111111111111110 |
|
950 |
2r0111111111111100 |
|
951 |
2r0111111111111100 |
|
952 |
2r0011111111111000 |
|
953 |
2r0001111111110000 |
|
954 |
2r0000011111000000 |
|
955 |
) |
|
956 |
offset: -8 @ -8). |
|
1564 | 957 |
]. |
1495 | 958 |
|
1564 | 959 |
(builtIn includes:#eyeBullet) ifFalse:[ |
1698 | 960 |
EyeCursor := (Cursor |
961 |
extent: 16@16 |
|
962 |
sourceArray: #( |
|
963 |
2r0000000000000000 |
|
964 |
2r0000000000000000 |
|
965 |
2r0000000000000000 |
|
966 |
2r0000011111000000 |
|
967 |
2r0001111111110000 |
|
968 |
2r0011000000011000 |
|
969 |
2r0110001110001100 |
|
970 |
2r1100011111000110 |
|
971 |
2r1100011111000110 |
|
972 |
2r0110001110001100 |
|
973 |
2r0011000000011000 |
|
974 |
2r0001111111110000 |
|
975 |
2r0000011111000000 |
|
976 |
2r0000000000000000 |
|
977 |
2r0000000000000000 |
|
978 |
2r0000000000000000 |
|
979 |
) |
|
980 |
maskArray: #( |
|
981 |
2r0000000000000000 |
|
982 |
2r0000000000000000 |
|
983 |
2r0000000000000000 |
|
984 |
2r0000011111000000 |
|
985 |
2r0001111111110000 |
|
986 |
2r0011111111111000 |
|
987 |
2r0111111111111100 |
|
988 |
2r1111111111111110 |
|
989 |
2r1111111111111110 |
|
990 |
2r0111111111111100 |
|
991 |
2r0011111111111000 |
|
992 |
2r0001111111110000 |
|
993 |
2r0000011111000000 |
|
994 |
2r0000000000000000 |
|
995 |
2r0000000000000000 |
|
996 |
2r0000000000000000 |
|
997 |
) |
|
998 |
offset: -8 @ -8). |
|
1564 | 999 |
]. |
1495 | 1000 |
|
1564 | 1001 |
FourWayCursor notNil ifTrue:[FourWayCursor := FourWayCursor onDevice:device]. |
1002 |
LeftCursor notNil ifTrue:[LeftCursor := LeftCursor onDevice:device]. |
|
1003 |
RightCursor notNil ifTrue:[RightCursor := RightCursor onDevice:device]. |
|
1004 |
XMarkerCursor notNil ifTrue:[XMarkerCursor := XMarkerCursor onDevice:device]. |
|
1495 | 1005 |
|
1564 | 1006 |
OriginCursor notNil ifTrue:[OriginCursor := OriginCursor onDevice:device]. |
1007 |
CornerCursor notNil ifTrue:[CornerCursor := CornerCursor onDevice:device]. |
|
1495 | 1008 |
|
1564 | 1009 |
ReadCursor notNil ifTrue:[ReadCursor := ReadCursor onDevice:device]. |
1010 |
WriteCursor notNil ifTrue:[WriteCursor := WriteCursor onDevice:device]. |
|
1011 |
WaitCursor notNil ifTrue:[WaitCursor := WaitCursor onDevice:device]. |
|
1012 |
XeqCursor notNil ifTrue:[XeqCursor := XeqCursor onDevice:device]. |
|
1495 | 1013 |
|
1564 | 1014 |
SquareCursor notNil ifTrue:[SquareCursor := SquareCursor onDevice:device]. |
1015 |
||
1016 |
NormalCursor notNil ifTrue:[NormalCursor := NormalCursor onDevice:device]. |
|
1495 | 1017 |
|
1564 | 1018 |
CrossHairCursor notNil ifTrue:[CrossHairCursor := CrossHairCursor onDevice:device]. |
1495 | 1019 |
|
1564 | 1020 |
MarkerCursor notNil ifTrue:[MarkerCursor := MarkerCursor onDevice:device]. |
1021 |
UpCursor notNil ifTrue:[UpCursor := UpCursor onDevice:device]. |
|
1022 |
DownCursor notNil ifTrue:[DownCursor := DownCursor onDevice:device]. |
|
1023 |
LeftCursor notNil ifTrue:[LeftCursor := LeftCursor onDevice:device]. |
|
1024 |
RightCursor notNil ifTrue:[RightCursor := RightCursor onDevice:device]. |
|
1025 |
XMarkerCursor notNil ifTrue:[XMarkerCursor := XMarkerCursor onDevice:device]. |
|
1026 |
CaretCursor notNil ifTrue:[CaretCursor := CaretCursor onDevice:device]. |
|
1495 | 1027 |
|
1564 | 1028 |
ThumbsUpCursor notNil ifTrue:[ThumbsUpCursor := ThumbsUpCursor onDevice:device]. |
1029 |
ThumbsDownCursor notNil ifTrue:[ThumbsDownCursor := ThumbsDownCursor onDevice:device]. |
|
1030 |
StopCursor notNil ifTrue:[StopCursor := StopCursor onDevice:device]. |
|
1031 |
EyeCursor notNil ifTrue:[EyeCursor := EyeCursor onDevice:device]. |
|
1495 | 1032 |
|
1564 | 1033 |
" |
1034 |
Cursor initializeNewCursors |
|
1035 |
" |
|
1495 | 1036 |
|
1564 | 1037 |
"Modified: 8.4.1997 / 10:31:09 / cg" |
1495 | 1038 |
! |
1039 |
||
864 | 1040 |
update:something with:aParameter from:changedObject |
0 | 1041 |
"sent when restarted after a snapIn" |
1042 |
||
1043 |
(something == #restarted) ifTrue:[ |
|
974 | 1044 |
self flushDeviceCursors |
0 | 1045 |
] |
864 | 1046 |
|
1047 |
"Created: 15.6.1996 / 15:18:47 / cg" |
|
0 | 1048 |
! ! |
1049 |
||
1140 | 1050 |
!Cursor class methodsFor:'instance creation'! |
0 | 1051 |
|
1052 |
extent:extent fromArray:array offset:offset |
|
1053 |
"create a new bitmap cursor from bits in the array argument |
|
1054 |
- ST-80 compatibility" |
|
1055 |
||
1056 |
|sourceForm| |
|
1057 |
||
1058 |
sourceForm := Form extent:extent fromArray:array offset:offset. |
|
1059 |
^ self sourceForm:sourceForm maskForm:sourceForm hotSpot:(offset negated) |
|
1060 |
! |
|
1061 |
||
1062 |
extent:extent sourceArray:sourceArray maskArray:maskArray offset:offset |
|
1063 |
"create a new bitmap cursor with mask from bits in sourceArray and |
|
1064 |
maskArray" |
|
1065 |
||
1066 |
|sourceForm maskForm| |
|
1067 |
||
1068 |
sourceForm := Form extent:extent fromArray:sourceArray offset:offset. |
|
1069 |
maskForm := Form extent:extent fromArray:maskArray offset:offset. |
|
1070 |
^ self sourceForm:sourceForm maskForm:maskForm hotSpot:(offset negated) |
|
1071 |
! |
|
1072 |
||
577 | 1073 |
fileCursorNamed:cursorName |
1074 |
"return a cursor read from the files 'cursorName_bits.bit' and |
|
1075 |
'cursorName_mask.bit' - return nil if file does not exist" |
|
1076 |
||
1077 |
|cursorBits maskBits| |
|
1078 |
||
1140 | 1079 |
cursorBits := Image fromFile:('bitmaps/' , cursorName , '_bits.bit'). |
577 | 1080 |
cursorBits notNil ifTrue:[ |
1698 | 1081 |
maskBits := Image fromFile:('bitmaps/' , cursorName , '_mask.bit'). |
1082 |
maskBits notNil ifTrue:[ |
|
1083 |
^ self sourceForm:cursorBits maskForm:maskBits |
|
1084 |
] |
|
577 | 1085 |
]. |
1086 |
^ nil |
|
1140 | 1087 |
|
1088 |
"Modified: 1.1.1970 / 13:57:27 / cg" |
|
577 | 1089 |
! |
1090 |
||
1414 | 1091 |
fromImage:anImage |
1092 |
"return a new cursor. |
|
1093 |
Source- and (optional) mask-Bits are taken from anImage; |
|
1094 |
hotSpot is center" |
|
1095 |
||
1096 |
|mask sourceForm maskForm| |
|
1097 |
||
1098 |
anImage depth ~~ 1 ifTrue:[ |
|
1698 | 1099 |
sourceForm := anImage asMonochromeFormOn:Screen current. |
1414 | 1100 |
] ifFalse:[ |
1698 | 1101 |
sourceForm := anImage asFormOn:Screen current. |
1414 | 1102 |
]. |
1103 |
mask := anImage mask. |
|
1104 |
mask isNil ifTrue:[ |
|
1698 | 1105 |
maskForm := sourceForm |
1414 | 1106 |
] ifFalse:[ |
1698 | 1107 |
mask depth ~~ 1 ifTrue:[ |
1108 |
maskForm := mask asMonochromeFormOn:Screen current. |
|
1109 |
] ifFalse:[ |
|
1110 |
maskForm := mask asFormOn:Screen current |
|
1111 |
] |
|
1414 | 1112 |
]. |
1113 |
^ self sourceForm:sourceForm |
|
1698 | 1114 |
maskForm:maskForm |
1115 |
hotX:(anImage width // 2) |
|
1116 |
hotY:(anImage height // 2) |
|
1414 | 1117 |
|
1118 |
" |
|
1119 |
|i c| |
|
1120 |
||
1121 |
i := Image fromFile:'bitmaps/xpmBitmaps/cursors/ul_br_arrow.xpm'. |
|
1122 |
c := Cursor fromImage:i. |
|
1123 |
WindowGroup activeGroup |
|
1698 | 1124 |
withCursor:c |
1125 |
do:[(Delay forSeconds:5)wait] |
|
1414 | 1126 |
" |
1127 |
||
1128 |
"Modified: 4.3.1997 / 14:23:43 / cg" |
|
1129 |
! |
|
1130 |
||
577 | 1131 |
imageArray:imageBits maskArray:maskBits |
1132 |
"ST-80 compatible cursor creation - the extent is fixed to 16@16" |
|
1133 |
||
1134 |
"name is ignored ..." |
|
1135 |
||
1136 |
^ self imageArray:imageBits maskArray:maskBits hotSpot:8@8 |
|
1137 |
! |
|
1138 |
||
1139 |
imageArray:imageBits maskArray:maskBits hotSpot:hot |
|
1140 |
"ST-80 compatible cursor creation - the extent is fixed to 16@16" |
|
1141 |
||
1142 |
^ self |
|
1143 |
extent:16@16 |
|
1144 |
sourceArray:imageBits |
|
1145 |
maskArray:maskBits |
|
1146 |
offset:hot negated |
|
1147 |
||
1148 |
" |
|
1149 |
|cursor| |
|
1150 |
||
1151 |
cursor := Cursor |
|
1152 |
imageArray: #( |
|
1153 |
2r0000000000000000 |
|
1154 |
2r0000000100001110 |
|
1155 |
2r0000000100001110 |
|
1156 |
2r0000000100001110 |
|
1157 |
2r0000000100000000 |
|
1158 |
2r0000000100000000 |
|
1159 |
2r0000000100000000 |
|
1160 |
2r0111111111111110 |
|
1161 |
2r0000000100000000 |
|
1162 |
2r0000000100000000 |
|
1163 |
2r0000000100000000 |
|
1164 |
2r0000000100000000 |
|
1165 |
2r0000000100000000 |
|
1166 |
2r0000000100000000 |
|
1167 |
2r0000000100000000 |
|
1168 |
2r0000000000000000) |
|
1169 |
maskArray: #( |
|
1170 |
2r0000001110011111 |
|
1171 |
2r0000001110011111 |
|
1172 |
2r0000001110011111 |
|
1173 |
2r0000001110011111 |
|
1174 |
2r0000001110011111 |
|
1175 |
2r0000001110000000 |
|
1176 |
2r1111111111111111 |
|
1177 |
2r1111111111111111 |
|
1178 |
2r1111111111111111 |
|
1179 |
2r0000001110000000 |
|
1180 |
2r0000001110000000 |
|
1181 |
2r0000001110000000 |
|
1182 |
2r0000001110000000 |
|
1183 |
2r0000001110000000 |
|
1184 |
2r0000001110000000 |
|
1185 |
2r0000001110000000) |
|
1186 |
hotSpot: 8@8. |
|
1187 |
||
1188 |
WindowGroup activeGroup |
|
1189 |
withCursor:cursor |
|
1190 |
do:[(Delay forSeconds:10)wait] |
|
1191 |
" |
|
1192 |
! |
|
1193 |
||
1194 |
imageArray:imageBits maskArray:maskBits hotSpot:hot name:aString |
|
1195 |
"ST-80 compatible cursor creation - the extent is fixed to 16@16" |
|
1196 |
||
1197 |
"name is ignored ..." |
|
1198 |
||
1199 |
^ self imageArray:imageBits maskArray:maskBits hotSpot:hot |
|
1200 |
! |
|
1201 |
||
1202 |
shape:aShape |
|
1203 |
"return one of the standard cursors. |
|
1204 |
Each display may offer different shapes - see for example XWorkstation |
|
1205 |
for details (however a basic minimum set should be supported by all)" |
|
1206 |
||
1207 |
|newCursor| |
|
1208 |
||
1209 |
"first look if not already known" |
|
1210 |
Lobby isNil ifTrue:[ |
|
1211 |
self initialize |
|
1212 |
]. |
|
1213 |
Lobby do:[:aCursor | |
|
1214 |
(aCursor shape == aShape) ifTrue:[ |
|
1215 |
^ aCursor |
|
1216 |
] |
|
1217 |
]. |
|
1218 |
newCursor := self basicNew setShape:aShape. |
|
1219 |
Lobby register:newCursor. |
|
1220 |
^ newCursor |
|
1221 |
! |
|
1222 |
||
1223 |
shape:aShape on:aDevice |
|
1224 |
"return one of the standard cursors already associated to aDevice. |
|
1225 |
This is the same as '(Cursor shape:aShape) on:aDevice' but somwehat faster." |
|
1226 |
||
1227 |
|newCursor oldCursor| |
|
1228 |
||
1229 |
"first look if not already known" |
|
1230 |
Lobby isNil ifTrue:[ |
|
974 | 1231 |
self initialize |
577 | 1232 |
]. |
1233 |
Lobby do:[:aCursor | |
|
974 | 1234 |
(aCursor shape == aShape) ifTrue:[ |
1235 |
(aCursor graphicsDevice == aDevice) ifTrue:[^ aCursor]. |
|
1236 |
oldCursor := aCursor |
|
1237 |
]. |
|
577 | 1238 |
]. |
1239 |
||
1240 |
"found one with same shape, but different device" |
|
1241 |
oldCursor notNil ifTrue:[ |
|
974 | 1242 |
^ oldCursor newOn:aDevice |
577 | 1243 |
]. |
1244 |
||
1245 |
newCursor := self basicNew setShape:aShape. |
|
1246 |
Lobby register:newCursor. |
|
1247 |
^ newCursor |
|
927
c4bc2a7ff733
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
864
diff
changeset
|
1248 |
|
c4bc2a7ff733
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
864
diff
changeset
|
1249 |
"Modified: 5.7.1996 / 17:58:06 / cg" |
577 | 1250 |
! |
1251 |
||
0 | 1252 |
sourceForm:aForm |
1253 |
"return a new cursor. |
|
1254 |
Source- and mask-Bits are taken from aForm; hotSpot is center" |
|
1255 |
||
1256 |
^ self sourceForm:aForm |
|
80 | 1257 |
maskForm:aForm |
1258 |
hotX:(aForm width // 2) |
|
1259 |
hotY:(aForm height // 2) |
|
0 | 1260 |
! |
1261 |
||
1262 |
sourceForm:sourceForm maskForm:maskForm |
|
1263 |
"return a new cursor. hotSpot is center" |
|
1264 |
||
1265 |
^ self sourceForm:sourceForm |
|
80 | 1266 |
maskForm:maskForm |
1267 |
hotX:(sourceForm width // 2) |
|
1268 |
hotY:(sourceForm height // 2) |
|
0 | 1269 |
! |
1270 |
||
1271 |
sourceForm:sourceForm maskForm:maskForm hotSpot:aPoint |
|
1272 |
"return a new cursor" |
|
1273 |
||
1274 |
^ self sourceForm:sourceForm |
|
80 | 1275 |
maskForm:maskForm |
1276 |
hotX:(aPoint x) |
|
1277 |
hotY:(aPoint y) |
|
0 | 1278 |
! |
1279 |
||
1280 |
sourceForm:sourceForm maskForm:maskForm hotX:hotX hotY:hotY |
|
1281 |
"return a new cursor" |
|
1282 |
||
1283 |
|newCursor| |
|
1284 |
||
1285 |
"first look if not already known" |
|
223 | 1286 |
Lobby isNil ifTrue:[ |
499 | 1287 |
self initialize |
223 | 1288 |
]. |
115 | 1289 |
Lobby do:[:aCursor | |
80 | 1290 |
(aCursor sourceForm == sourceForm) ifTrue:[ |
1291 |
(aCursor maskForm == maskForm) ifTrue:[ |
|
1292 |
(aCursor hotX == hotX) ifTrue:[ |
|
1293 |
(aCursor hotY == hotY) ifTrue:[ |
|
1294 |
^ aCursor |
|
1295 |
] |
|
1296 |
] |
|
1297 |
] |
|
1298 |
] |
|
0 | 1299 |
]. |
35 | 1300 |
(sourceForm isNil or:[maskForm isNil]) ifTrue:[^ nil]. |
1301 |
||
2 | 1302 |
newCursor := self basicNew setSourceForm:sourceForm |
80 | 1303 |
maskForm:maskForm |
1304 |
hotX:hotX |
|
1305 |
hotY:hotY. |
|
23 | 1306 |
Lobby register:newCursor. |
0 | 1307 |
^ newCursor |
577 | 1308 |
! ! |
1309 |
||
1224
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1310 |
!Cursor class methodsFor:'cleanup'! |
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1311 |
|
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1312 |
releaseResourcesOnDevice:aDevice |
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1313 |
"this is sent when a display connection is closed, |
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1314 |
to release all cached Cursors from that device" |
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1315 |
|
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1316 |
Lobby unregisterAllForWhich:[:aCursor | aCursor graphicsDevice == aDevice] |
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1317 |
|
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1318 |
"Created: 16.1.1997 / 16:43:59 / cg" |
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1319 |
! ! |
2a2270ec4236
added #releaseResourcesOnDevice:, to allow cleanup when
Claus Gittinger <cg@exept.de>
parents:
1188
diff
changeset
|
1320 |
|
1140 | 1321 |
!Cursor class methodsFor:'default access'! |
577 | 1322 |
|
1323 |
defaultFgColor:fgColor defaultBgColor:bgColor |
|
1324 |
"set the default colors used for cursors" |
|
1325 |
||
1326 |
DefaultFgColor := fgColor. |
|
1327 |
DefaultBgColor := bgColor |
|
0 | 1328 |
! ! |
1329 |
||
1140 | 1330 |
!Cursor class methodsFor:'standard cursors'! |
0 | 1331 |
|
1332 |
arrow |
|
1333 |
"return an arrow (up-left-arrow) cursor" |
|
1334 |
||
71 | 1335 |
^ self shape:#upLeftArrow on:Display |
0 | 1336 |
! |
1337 |
||
577 | 1338 |
blank |
1339 |
"Answer the instance of me that is an invisible cursor." |
|
0 | 1340 |
|
577 | 1341 |
^BlankCursor! |
80 | 1342 |
|
1343 |
bottomLeft |
|
1344 |
"return a bottom-left corner cursor" |
|
1345 |
||
1346 |
^ self shape:#bottomLeft on:Display |
|
1347 |
! |
|
1348 |
||
1349 |
bottomRight |
|
1350 |
"return a bottom-right corner cursor" |
|
1351 |
||
1352 |
^ self corner |
|
1353 |
! |
|
1354 |
||
577 | 1355 |
caret |
1356 |
"return a caret cursor" |
|
1357 |
||
1358 |
^ CaretCursor! |
|
1359 |
||
1360 |
corner |
|
1361 |
"return a corner cursor" |
|
80 | 1362 |
|
577 | 1363 |
CornerCursor isNil ifTrue:[ |
1364 |
CornerCursor := self shape:#corner on:Display |
|
1365 |
]. |
|
1366 |
^ CornerCursor |
|
1367 |
! |
|
1368 |
||
1369 |
cross |
|
1370 |
"return a cross cursor" |
|
1371 |
||
1372 |
^ self shape:#cross on:Display |
|
80 | 1373 |
! |
1374 |
||
0 | 1375 |
crossHair |
1376 |
"return a crossHair cursor" |
|
1377 |
||
1378 |
CrossHairCursor isNil ifTrue:[ |
|
80 | 1379 |
CrossHairCursor := self shape:#crossHair on:Display |
0 | 1380 |
]. |
1381 |
^ CrossHairCursor |
|
1382 |
! |
|
1383 |
||
577 | 1384 |
down |
1385 |
"Answer the instance of me that is the shape of a down-arrow." |
|
0 | 1386 |
|
577 | 1387 |
^DownCursor! |
0 | 1388 |
|
577 | 1389 |
downLimitArrow |
1390 |
"return a down-arrow-to-limit cursor" |
|
0 | 1391 |
|
577 | 1392 |
^ self shape:#downLimitArrow on:Display |
0 | 1393 |
! |
1394 |
||
1395 |
execute |
|
157 | 1396 |
"return a execute cursor - (the default here is a wait-cursor)" |
0 | 1397 |
|
157 | 1398 |
XeqCursor notNil ifTrue:[ |
1399 |
^ XeqCursor |
|
1400 |
]. |
|
71 | 1401 |
^ self wait |
56 | 1402 |
! |
1403 |
||
577 | 1404 |
eye |
1405 |
"return an eye cursor" |
|
1406 |
||
1407 |
^ EyeCursor |
|
1408 |
! |
|
1409 |
||
1410 |
fourWay |
|
1411 |
"return a four-way arrow cursor" |
|
1412 |
||
1413 |
FourWayCursor isNil ifTrue:[ |
|
1414 |
FourWayCursor := self shape:#fourWay on:Display |
|
1415 |
]. |
|
1416 |
^ FourWayCursor |
|
1417 |
! |
|
1418 |
||
1419 |
hand |
|
1420 |
"return a hand cursor" |
|
1421 |
||
1422 |
HandCursor isNil ifTrue:[ |
|
1423 |
HandCursor := self shape:#upRightHand on:Display |
|
1424 |
]. |
|
1425 |
^ HandCursor |
|
1426 |
! |
|
1427 |
||
1428 |
left |
|
1429 |
"Answer the instance of me that is the shape of an arrow facing to the left." |
|
1430 |
||
1431 |
^LeftCursor! |
|
1432 |
||
1433 |
leftHand |
|
1434 |
"return a left-hand cursor" |
|
1435 |
||
1436 |
^ self shape:#leftHand |
|
1437 |
! |
|
1438 |
||
1439 |
leftLimitArrow |
|
1440 |
"return a left-arrow-to-limit cursor" |
|
1441 |
||
1442 |
^ self shape:#leftLimitArrow on:Display |
|
1443 |
! |
|
1444 |
||
1445 |
leftRightArrow |
|
1446 |
"return a left-right-arrow cursor" |
|
1447 |
||
1448 |
LeftRightArrowCursor isNil ifTrue:[ |
|
1449 |
LeftRightArrowCursor := self shape:#leftRightArrow on:Display |
|
1450 |
]. |
|
1451 |
^ LeftRightArrowCursor |
|
1452 |
! |
|
1453 |
||
1454 |
marker |
|
1455 |
"Answer the instance of me that is the shape of a horizontal arrow." |
|
1456 |
||
1457 |
^MarkerCursor! |
|
56 | 1458 |
|
577 | 1459 |
normal |
1460 |
"return the normal cursor; an arrow. |
|
1461 |
for ST-80 compatibility" |
|
1462 |
||
1463 |
NormalCursor isNil ifTrue:[ |
|
1698 | 1464 |
NormalCursor := self arrow |
577 | 1465 |
]. |
1466 |
^ NormalCursor |
|
1568 | 1467 |
|
1468 |
"Modified: 10.4.1997 / 14:36:38 / cg" |
|
577 | 1469 |
! |
1470 |
||
1471 |
origin |
|
1472 |
"return an origin cursor" |
|
1473 |
||
1474 |
OriginCursor isNil ifTrue:[ |
|
1475 |
OriginCursor := self shape:#origin on:Display |
|
157 | 1476 |
]. |
577 | 1477 |
^ OriginCursor |
1478 |
! |
|
1479 |
||
1480 |
questionMark |
|
1481 |
"return a question-mark cursor" |
|
1482 |
||
1483 |
^ self shape:#questionMark on:Display |
|
1484 |
! |
|
1485 |
||
1486 |
read |
|
1487 |
"return a reading-file cursor (the default here is a wait-cursor)" |
|
1488 |
||
1489 |
ReadCursor notNil ifTrue:[ |
|
1490 |
^ ReadCursor |
|
1491 |
]. |
|
1492 |
^ self wait |
|
1493 |
! |
|
1494 |
||
1495 |
right |
|
1496 |
"Answer the instance of me that is the shape of an arrow facing to the right." |
|
1497 |
||
1498 |
^RightCursor! |
|
1499 |
||
1500 |
rightLimitArrowOn |
|
1501 |
"return a right-arrow-to-limit cursor" |
|
1502 |
||
1503 |
^ self shape:#rightLimitArrow on:Display |
|
1504 |
! |
|
1505 |
||
1506 |
stop |
|
1507 |
"return a stop cursor (the default here is a wait-cursor)" |
|
1508 |
||
1509 |
StopCursor notNil ifTrue:[ |
|
1510 |
^ StopCursor |
|
1511 |
]. |
|
1512 |
^ self wait |
|
1513 |
! |
|
1514 |
||
1515 |
text |
|
1516 |
"return a text-cursor" |
|
1517 |
||
1518 |
^ self shape:#text on:Display |
|
56 | 1519 |
! |
1520 |
||
1521 |
thumbsDown |
|
1522 |
"return a hand cursor - ST-80 compatibility" |
|
1523 |
||
157 | 1524 |
ThumbsDownCursor notNil ifTrue:[ |
1525 |
^ ThumbsDownCursor |
|
1526 |
]. |
|
56 | 1527 |
^ self hand |
577 | 1528 |
! |
1529 |
||
1530 |
thumbsUp |
|
1531 |
"return a hand cursor - ST-80 compatibility" |
|
1532 |
||
1533 |
ThumbsUpCursor notNil ifTrue:[ |
|
1534 |
^ ThumbsUpCursor |
|
1535 |
]. |
|
1536 |
^ self hand |
|
1537 |
! |
|
1538 |
||
1539 |
topLeft |
|
1540 |
"return a top-left corner cursor" |
|
0 | 1541 |
|
577 | 1542 |
^ self origin |
1543 |
! |
|
1544 |
||
1545 |
topRight |
|
1546 |
"return a top-right corner cursor" |
|
1547 |
||
1548 |
^ self shape:#topRight on:Display |
|
1549 |
! |
|
1550 |
||
1551 |
up |
|
1552 |
"Answer the instance of me that is the shape of an up-arrow." |
|
1553 |
||
1554 |
^UpCursor! |
|
71 | 1555 |
|
577 | 1556 |
upDownArrow |
1557 |
"return an up-down-arrow cursor" |
|
1558 |
||
1559 |
UpDownArrowCursor isNil ifTrue:[ |
|
1560 |
UpDownArrowCursor := self shape:#upDownArrow on:Display |
|
1561 |
]. |
|
1562 |
^ UpDownArrowCursor |
|
1563 |
! |
|
1564 |
||
1565 |
upLeftArrow |
|
1566 |
"return an up-right-arrow cursor" |
|
1567 |
||
1568 |
^ self shape:#upLeftArrow on:Display |
|
1569 |
! |
|
71 | 1570 |
|
577 | 1571 |
upLimitArrow |
1572 |
"return an up-arrow-to-limit cursor" |
|
1573 |
||
1574 |
^ self shape:#upLimitArrow on:Display |
|
1575 |
! |
|
0 | 1576 |
|
577 | 1577 |
upRightArrow |
1578 |
"return an up-right-arrow cursor" |
|
1579 |
||
1580 |
^ self shape:#upRightArrow on:Display |
|
1581 |
! |
|
1582 |
||
1583 |
upRightHand |
|
1584 |
"return an up-right-hand cursor" |
|
1585 |
||
1586 |
^ self shape:#upRightHand |
|
71 | 1587 |
! |
1588 |
||
577 | 1589 |
wait |
1590 |
"return a wait cursor" |
|
1591 |
||
1592 |
WaitCursor isNil ifTrue:[ |
|
1593 |
WaitCursor := self shape:#wait on:Display |
|
1594 |
]. |
|
1595 |
^ WaitCursor |
|
1596 |
! |
|
1597 |
||
1598 |
write |
|
1599 |
"return a writing-file cursor (the default here is a wait-cursor)" |
|
0 | 1600 |
|
577 | 1601 |
WriteCursor notNil ifTrue:[ |
1602 |
^ WriteCursor |
|
1603 |
]. |
|
1604 |
^ self wait |
|
1605 |
! |
|
1606 |
||
1607 |
xMarker |
|
1608 |
"Answer the instance of me that is displayed when thumb-scrolling on the x-axis." |
|
1609 |
||
1610 |
^XMarkerCursor! ! |
|
1611 |
||
1612 |
!Cursor methodsFor:'ST-80 displaying'! |
|
1613 |
||
1614 |
displayOn:aGC at:origin clippingBox:aRectangle rule:aRule mask:aMask |
|
1615 |
"ST-80 compatibility; |
|
1616 |
limited functionality: can only display bitmap cursors (yet)" |
|
1617 |
||
1618 |
sourceForm notNil ifTrue:[ |
|
1619 |
sourceForm displayOn:aGC at:origin clippingBox:aRectangle |
|
1620 |
rule:aRule mask:aMask |
|
0 | 1621 |
] |
2 | 1622 |
! |
1623 |
||
577 | 1624 |
show |
1625 |
"ST-80 mimicri: change cursors in active groups views to the receiver." |
|
2 | 1626 |
|
1188
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1627 |
|wg| |
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1628 |
|
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1629 |
(wg := WindowGroup activeGroup) notNil ifTrue:[ |
1698 | 1630 |
wg showCursor:self |
1188
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1631 |
] |
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1632 |
|
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1633 |
"Modified: 13.1.1997 / 20:10:01 / cg" |
577 | 1634 |
! |
1635 |
||
1636 |
showIn:aView |
|
1637 |
"ST-80 mimicri: install the receiver as aViews cursor" |
|
1638 |
||
1639 |
aView cursor:self |
|
2 | 1640 |
! |
1641 |
||
577 | 1642 |
showIn:aView while:aBlock |
1643 |
"ST-80 mimicri: change aViews cursors to the receiver, while evaluationg aBlock. |
|
1644 |
Return the value as returned by aBlock." |
|
1645 |
||
1646 |
|savedCursor| |
|
1647 |
||
1648 |
savedCursor := aView cursor. |
|
1649 |
aView cursor:self. |
|
1650 |
^ aBlock valueNowOrOnUnwindDo:[aView cursor:savedCursor] |
|
1651 |
! |
|
2 | 1652 |
|
577 | 1653 |
showWhile:aBlock |
1654 |
"ST-80 mimicri: change all views cursors to the receiver. |
|
1655 |
Return the value as returned by aBlock." |
|
1656 |
||
1188
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1657 |
|wg| |
577 | 1658 |
|
1188
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1659 |
(wg := WindowGroup activeGroup) notNil ifTrue:[ |
1698 | 1660 |
^ wg withCursor:self do:aBlock |
1188
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1661 |
] ifFalse:[ |
1698 | 1662 |
aBlock value |
1188
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1663 |
] |
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1664 |
|
2a4d644e8828
care for nil-windowGroup in #show and #showWhile:
Claus Gittinger <cg@exept.de>
parents:
1181
diff
changeset
|
1665 |
"Modified: 13.1.1997 / 20:10:25 / cg" |
2 | 1666 |
! ! |
1667 |
||
0 | 1668 |
!Cursor methodsFor:'accessing'! |
1669 |
||
577 | 1670 |
device |
1671 |
"return the device I am associated with" |
|
1672 |
||
1673 |
^ device |
|
1674 |
! |
|
1675 |
||
1676 |
foreground:fgColor background:bgColor |
|
1677 |
"set the cursor colors" |
|
1678 |
||
1679 |
device colorCursor:cursorId foreground:fgColor background:bgColor |
|
1680 |
! |
|
1681 |
||
733 | 1682 |
graphicsDevice |
1683 |
"same as #device, for ST-80 compatibility naming. |
|
1684 |
Return the device I am associated with." |
|
1685 |
||
1686 |
^ device |
|
1687 |
||
1688 |
"Created: 28.5.1996 / 18:39:01 / cg" |
|
1689 |
! |
|
1690 |
||
577 | 1691 |
hotX |
1692 |
"return the hotspots x-coordinate of the receiver" |
|
1693 |
||
1694 |
^ hotX |
|
1695 |
! |
|
1696 |
||
1697 |
hotY |
|
1698 |
"return the hotspots y-coordinate of the receiver" |
|
1699 |
||
1700 |
^ hotY |
|
1701 |
! |
|
1702 |
||
0 | 1703 |
id |
1704 |
"return the cursors deviceId" |
|
1705 |
||
1706 |
^ cursorId |
|
1707 |
! |
|
1708 |
||
577 | 1709 |
maskForm |
1710 |
"return the mask-form of the receiver" |
|
0 | 1711 |
|
577 | 1712 |
^ maskForm |
1713 |
! |
|
1714 |
||
1715 |
maskForm:aForm |
|
1716 |
"set the mask-form of the receiver" |
|
1717 |
||
1718 |
maskForm := aForm |
|
0 | 1719 |
! |
1720 |
||
1721 |
shape |
|
1722 |
"return the shape" |
|
1723 |
||
1724 |
^ shape |
|
1725 |
! |
|
1726 |
||
1727 |
sourceForm |
|
1728 |
"return the source-form of the receiver" |
|
1729 |
||
1730 |
^ sourceForm |
|
1731 |
! |
|
1732 |
||
1733 |
sourceForm:aForm |
|
1734 |
"set the source-form of the receiver" |
|
1735 |
||
1736 |
sourceForm := aForm |
|
577 | 1737 |
! ! |
0 | 1738 |
|
577 | 1739 |
!Cursor methodsFor:'copying'! |
0 | 1740 |
|
577 | 1741 |
postCopy |
1742 |
sourceForm := sourceForm copy. |
|
1743 |
maskForm := maskForm copy. |
|
1744 |
device := cursorId := nil |
|
0 | 1745 |
! ! |
1746 |
||
1747 |
!Cursor methodsFor:'creating a device cursor'! |
|
1748 |
||
1749 |
on:aDevice |
|
1750 |
"create a new Cursor representing the same cursor as |
|
1751 |
myself on aDevice; if one already exists, return the one" |
|
1752 |
||
1741 | 1753 |
"/ send out a warning: #on: is typically used to create viewa |
1754 |
"/ operating on a model. |
|
1755 |
"/ Please use #onDevice: to avoid confusion. |
|
1756 |
||
1494
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1757 |
self obsoleteMethodWarning:'use #onDevice:'. |
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1758 |
^ self onDevice:aDevice |
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1759 |
|
1741 | 1760 |
"Modified: 5.6.1997 / 21:04:35 / cg" |
1494
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1761 |
! |
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1762 |
|
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1763 |
onDevice:aDevice |
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1764 |
"create a new Cursor representing the same cursor as |
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1765 |
myself on aDevice; if one already exists, return the one" |
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1766 |
|
0 | 1767 |
aDevice isNil ifTrue:[ |
1698 | 1768 |
"this may not happen" |
1769 |
self error:'nil device' |
|
0 | 1770 |
]. |
1771 |
||
71 | 1772 |
"if I am already assigned to that device ..." |
0 | 1773 |
(device == aDevice) ifTrue:[^ self]. |
1774 |
||
1775 |
"first look if not already there" |
|
115 | 1776 |
Lobby do:[:aCursor | |
1698 | 1777 |
(aCursor graphicsDevice == aDevice) ifTrue:[ |
1778 |
shape notNil ifTrue:[ |
|
1779 |
(aCursor shape == shape) ifTrue:[ |
|
1780 |
^ aCursor |
|
1781 |
] |
|
1782 |
] ifFalse:[ |
|
1783 |
(aCursor sourceForm == sourceForm) ifTrue:[ |
|
1784 |
(aCursor maskForm == maskForm) ifTrue:[ |
|
1785 |
(aCursor hotX == hotX) ifTrue:[ |
|
1786 |
(aCursor hotY == hotY) ifTrue:[ |
|
1787 |
^ aCursor |
|
1788 |
] |
|
1789 |
] |
|
1790 |
] |
|
1791 |
] |
|
1792 |
] |
|
1793 |
] |
|
0 | 1794 |
]. |
71 | 1795 |
^ self newOn:aDevice |
927
c4bc2a7ff733
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
864
diff
changeset
|
1796 |
|
c4bc2a7ff733
use #graphicsDevice instead of #device.
Claus Gittinger <cg@exept.de>
parents:
864
diff
changeset
|
1797 |
"Modified: 5.7.1996 / 17:58:00 / cg" |
1494
4faf11deec70
cursor #on: is obsoleted by #onDevice:.
Claus Gittinger <cg@exept.de>
parents:
1414
diff
changeset
|
1798 |
"Created: 28.3.1997 / 13:46:38 / cg" |
71 | 1799 |
! ! |
1800 |
||
577 | 1801 |
!Cursor methodsFor:'instance release'! |
1802 |
||
1803 |
disposed |
|
1698 | 1804 |
"some Cursor has been collected - tell it to the display" |
577 | 1805 |
|
1806 |
cursorId notNil ifTrue:[ |
|
1807 |
device destroyCursor:cursorId. |
|
1698 | 1808 |
cursorId := nil. |
577 | 1809 |
] |
1810 |
! |
|
1811 |
||
1812 |
shallowCopyForFinalization |
|
1813 |
"redefined to return a lightweight copy |
|
1814 |
- all we need is the device handle" |
|
1815 |
||
1816 |
^ self class basicNew setDevice:device id:cursorId |
|
1817 |
||
1818 |
"Modified: 20.4.1996 / 23:23:19 / cg" |
|
1819 |
! ! |
|
1820 |
||
71 | 1821 |
!Cursor methodsFor:'private'! |
1822 |
||
577 | 1823 |
device:aDevice |
1698 | 1824 |
"set the cursors device" |
1825 |
||
577 | 1826 |
device := aDevice |
1827 |
! |
|
1828 |
||
1829 |
id:anId |
|
1698 | 1830 |
"set the cursors id" |
577 | 1831 |
|
1832 |
cursorId := anId |
|
1833 |
! |
|
1834 |
||
71 | 1835 |
newOn:aDevice |
1836 |
"create a new Cursor representing the same cursor as |
|
1837 |
myself on aDevice. Dont search the lobby." |
|
1838 |
||
974 | 1839 |
|newCursor id sF mF w h| |
0 | 1840 |
|
1841 |
"ask that device for the cursor" |
|
1842 |
shape notNil ifTrue:[ |
|
1698 | 1843 |
id := aDevice createCursorShape:shape. |
1844 |
id isNil ifTrue:[ |
|
1845 |
'Cursor [warning]: no cursor with shape:' errorPrint. shape errorPrintCR. |
|
1846 |
^ self |
|
1847 |
]. |
|
0 | 1848 |
] ifFalse:[ |
1698 | 1849 |
aDevice needDeviceFormsForCursor ifTrue:[ |
1850 |
sourceForm notNil ifTrue:[ |
|
1851 |
sF := sourceForm asFormOn:aDevice. |
|
1852 |
]. |
|
1853 |
maskForm notNil ifTrue:[ |
|
1854 |
mF := maskForm asFormOn:aDevice. |
|
1855 |
] ifFalse:[ |
|
1856 |
mF := sF |
|
1857 |
]. |
|
1858 |
(sF notNil and:[mF notNil]) ifTrue:[ |
|
1859 |
sourceForm := sF. |
|
1860 |
maskForm := mF. |
|
1861 |
]. |
|
1862 |
] ifFalse:[ |
|
1863 |
sourceForm notNil ifTrue:[ |
|
1864 |
sF := sourceForm bits |
|
1865 |
]. |
|
1866 |
maskForm notNil ifTrue:[ |
|
1867 |
mF := maskForm bits. |
|
1868 |
] ifFalse:[ |
|
1869 |
mF := sF |
|
1870 |
]. |
|
1871 |
]. |
|
1872 |
(sF isNil or:[mF isNil]) ifTrue:[ |
|
1873 |
'Cursor [warning]: cursor has no form' errorPrintCR. |
|
1874 |
^ self |
|
1875 |
]. |
|
1876 |
w := sourceForm width. |
|
1877 |
h := sourceForm height. |
|
133 | 1878 |
|
1698 | 1879 |
id := aDevice createCursorSourceForm:sF |
1880 |
maskForm:mF |
|
1881 |
hotX:hotX |
|
1882 |
hotY:hotY |
|
1883 |
width:w |
|
1884 |
height:h. |
|
1885 |
id isNil ifTrue:[ |
|
1886 |
'Cursor [warning]: cannot create pixmap cursor' errorPrintCR. |
|
1887 |
^ self |
|
1888 |
]. |
|
0 | 1889 |
]. |
1890 |
||
1891 |
"goody for IRIXs red cursor" |
|
1892 |
DefaultFgColor notNil ifTrue:[ |
|
1698 | 1893 |
aDevice colorCursor:id foreground:DefaultFgColor |
1894 |
background:DefaultBgColor |
|
0 | 1895 |
]. |
1896 |
||
1897 |
device isNil ifTrue:[ |
|
1698 | 1898 |
"receiver was not associated - do it now" |
1899 |
device := aDevice. |
|
1900 |
cursorId := id. |
|
0 | 1901 |
|
1698 | 1902 |
"must re-register, the old registration had a nil cursorId in it" |
1903 |
Lobby registerChange:self. |
|
1904 |
^ self |
|
0 | 1905 |
]. |
1906 |
||
1907 |
"receiver was already associated to another device - need a new cursor" |
|
2 | 1908 |
newCursor := self class basicNew. |
0 | 1909 |
shape notNil ifTrue:[ |
1698 | 1910 |
newCursor setShape:shape. |
0 | 1911 |
] ifFalse:[ |
1698 | 1912 |
newCursor setSourceForm:sourceForm |
1913 |
maskForm:maskForm |
|
1914 |
hotX:hotX |
|
1915 |
hotY:hotY |
|
0 | 1916 |
]. |
2 | 1917 |
newCursor setDevice:aDevice id:id. |
23 | 1918 |
Lobby register:newCursor. |
0 | 1919 |
^ newCursor |
1140 | 1920 |
|
1181 | 1921 |
"Modified: 10.1.1997 / 19:08:20 / cg" |
71 | 1922 |
! |
0 | 1923 |
|
2 | 1924 |
restored |
0 | 1925 |
"set both device and id" |
1926 |
||
1927 |
device := nil. |
|
1928 |
cursorId := nil |
|
1929 |
! ! |
|
1930 |
||
577 | 1931 |
!Cursor methodsFor:'private accessing'! |
0 | 1932 |
|
577 | 1933 |
setDevice:aDevice id:anId |
1934 |
"set the device and deviceId of the receiver" |
|
160 | 1935 |
|
577 | 1936 |
device := aDevice. |
1937 |
cursorId := anId |
|
0 | 1938 |
! |
1939 |
||
577 | 1940 |
setShape:aShapeSymbol |
1941 |
"set the shape" |
|
160 | 1942 |
|
577 | 1943 |
shape := aShapeSymbol. |
0 | 1944 |
! |
1945 |
||
577 | 1946 |
setSourceForm:sForm maskForm:mForm hotX:hx hotY:hy |
1947 |
"set the forms and hotspot" |
|
0 | 1948 |
|
577 | 1949 |
sourceForm := sForm. |
1950 |
maskForm := mForm. |
|
1951 |
hotX := hx. |
|
1952 |
hotY := hy. |
|
1953 |
! ! |
|
157 | 1954 |
|
1140 | 1955 |
!Cursor class methodsFor:'documentation'! |
0 | 1956 |
|
577 | 1957 |
version |
1741 | 1958 |
^ '$Header: /cvs/stx/stx/libview/Cursor.st,v 1.52 1997-06-05 19:08:55 cg Exp $' |
0 | 1959 |
! ! |
577 | 1960 |
Cursor initialize! |