1 /***************************************************************************
3 NList.mcc - New List MUI Custom Class
4 Registered MUI class, Serial Number: 1d51 0x9d510030 to 0x9d5100A0
5 0x9d5100C0 to 0x9d5100FF
7 Copyright (C) 1996-2001 by Gilles Masson
8 Copyright (C) 2001-2014 NList Open Source Team
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 NList classes Support Site: http://www.sf.net/projects/nlist-classes
24 ***************************************************************************/
28 #include <clib/alib_protos.h>
30 #include <exec/execbase.h>
31 #include <intuition/pointerclass.h>
33 #include <proto/utility.h>
34 #include <proto/intuition.h>
35 #include <proto/exec.h>
36 #include <proto/graphics.h>
41 // the meta data of our pointers
42 #define sizePointerWidth 16
43 #define sizePointerHeight 16
44 #define sizePointerXOffset -8
45 #define sizePointerYOffset -8
47 #define movePointerWidth 14
48 #define movePointerHeight 6
49 #define movePointerXOffset -7
50 #define movePointerYOffset -3
52 #define selectPointerWidth 7
53 #define selectPointerHeight 16
54 #define selectPointerXOffset -3
55 #define selectPointerYOffset -8
57 #if defined(__amigaos4__)
58 // a 32bit ARGB pointer image where we can define every color of the pixels
59 // on our own and put an alpha-channel information in it as well.
60 static const ULONG sizePointer
[] =
62 /* ......++++...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
63 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
64 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
65 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
66 /* ...++.+##+.++... */ 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
67 /* ..+#+.+##+.+#+.. */ 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xffffffff, 0x00000000, 0x00000000,
68 /* .+##+++##+++##+. */ 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000,
69 /* +##############+ */ 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff,
70 /* +##############+ */ 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff,
71 /* .+##+++##+++##+. */ 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000,
72 /* ..+#+.+##+.+#+.. */ 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xffffffff, 0x00000000, 0x00000000,
73 /* ...++.+##+.++... */ 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
74 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
75 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
76 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
77 /* ......++++...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
80 static const ULONG movePointer
[] =
82 /* ..#########... */ 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
83 /* .##+++++++##.. */ 0x00000000, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000,
84 /* ###+......###. */ 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000,
85 /* .##+......##++ */ 0x00000000, 0xffffffff, 0xffffffff, 0xff000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000,
86 /* ..#########++. */ 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0x00000000,
87 /* ...+++++++++.. */ 0x00000000, 0x00000000, 0x00000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0x00000000, 0x00000000,
90 static const ULONG selectPointer
[] =
92 0xff6d6d6d, 0xff000000, 0x00000000, 0x00000000, 0xffbbbbbb, 0xff6d6d6d, 0xff000000, // +# :+#
93 0x00000000, 0xffbbbbbb, 0xff000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, // :#:#
94 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
95 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
96 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
97 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
98 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
99 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
100 0x00000000, 0xffbbbbbb, 0xff000000, 0xff000000, 0xff000000, 0x00000000, 0x00000000, // :###
101 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
102 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
103 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
104 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
105 0x00000000, 0x00000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, 0x00000000, // :#
106 0x00000000, 0xffbbbbbb, 0xff000000, 0xffbbbbbb, 0xff000000, 0x00000000, 0x00000000, // :#:#
107 0xff6d6d6d, 0xff000000, 0x00000000, 0x00000000, 0xffbbbbbb, 0xff6d6d6d, 0xff000000, // +# :+#
110 #ifndef POINTERA_ImageData
111 #define POINTERA_ImageData (POINTERA_Dummy + 0x07) // ARGB (width * height * sizeof(ULONG))
113 #ifndef POINTERA_Width
114 #define POINTERA_Width (POINTERA_Dummy + 0x08) // <= 64
116 #ifndef POINTERA_Height
117 #define POINTERA_Height (POINTERA_Dummy + 0x09) // <= 64
119 #ifndef WA_PointerType
120 #define WA_PointerType (WA_Dummy + 0x50)
122 #ifndef POINTERTYPE_COLUMNRESIZE
123 #define POINTERTYPE_COLUMNRESIZE 4
125 #ifndef POINTERTYPE_SCROLLALL
126 #define POINTERTYPE_SCROLLALL 26
128 #ifndef POINTERTYPE_TEXT
129 #define POINTERTYPE_TEXT 30
132 #else // __amigaos4__
134 #if defined(__MORPHOS__)
135 #ifndef POINTERTYPE_SELECTTEXT
136 #define POINTERTYPE_SELECTTEXT 7
137 #define POINTERTYPE_HORIZONTALRESIZE 11
138 #define POINTERTYPE_MOVE 14
140 #ifndef WA_PointerType
141 #define WA_PointerType (WA_Dummy + 164)
145 #if !defined(__AROS__)
146 static const UWORD sizePointer
[] =
171 static const UWORD movePointer
[] =
186 static const UWORD selectPointer
[] =
211 #endif // __amigaos4__
213 // Classic bitmap data for the pointers. These will be used for OS4 aswell,
214 // if the graphic card cannot handle 32bit pointers.
217 static const UWORD sizePointer_bp0
[] =
219 /* ......++++...... */ 0x03c0,
220 /* ......+..+...... */ 0x0240,
221 /* ......+..+...... */ 0x0240,
222 /* ......+..+...... */ 0x0240,
223 /* ...++.+..+.++... */ 0x1a58,
224 /* ..+.+.+..+.+.+.. */ 0x2a54,
225 /* .+..+++..+++..+. */ 0x4e72,
226 /* +..............+ */ 0x8001,
227 /* +..............+ */ 0x8001,
228 /* .+..+++..+++..+. */ 0x4e72,
229 /* ..+.+.+..+.+.+.. */ 0x2a54,
230 /* ...++.+..+.++... */ 0x1a58,
231 /* ......+..+...... */ 0x0240,
232 /* ......+..+...... */ 0x0240,
233 /* ......+..+...... */ 0x0240,
234 /* ......++++...... */ 0x03c0,
237 static const UWORD sizePointer_bp1
[] =
239 /* ................ */ 0x0000,
240 /* .......##....... */ 0x0180,
241 /* .......##....... */ 0x0180,
242 /* .......##....... */ 0x0180,
243 /* .......##....... */ 0x0180,
244 /* ...#...##...#... */ 0x1188,
245 /* ..##...##...##.. */ 0x318c,
246 /* .##############. */ 0x7ffe,
247 /* .##############. */ 0x7ffe,
248 /* ..##...##...##.. */ 0x318c,
249 /* ...#...##...#... */ 0x1188,
250 /* .......##....... */ 0x0180,
251 /* .......##....... */ 0x0180,
252 /* .......##....... */ 0x0180,
253 /* .......##....... */ 0x0180,
254 /* ................ */ 0x0000,
257 static const UWORD sizePointer_bp2
[] =
259 /* ......++++...... */ 0x03c0,
260 /* ......+##+...... */ 0x03c0,
261 /* ......+##+...... */ 0x03c0,
262 /* ......+##+...... */ 0x03c0,
263 /* ...++.+##+.++... */ 0x1bd8,
264 /* ..+#+.+##+.+#+.. */ 0x3bdc,
265 /* .+##+++##+++##+. */ 0x7ffe,
266 /* +##############+ */ 0xffff,
267 /* +##############+ */ 0xffff,
268 /* .+##+++##+++##+. */ 0x7ffe,
269 /* ..+#+.+##+.+#+.. */ 0x3bdc,
270 /* ...++.+##+.++... */ 0x1bd8,
271 /* ......+##+...... */ 0x03c0,
272 /* ......+##+...... */ 0x03c0,
273 /* ......+##+...... */ 0x03c0,
274 /* ......++++...... */ 0x03c0,
277 static struct BitMap sizePointerBitmap
=
280 { (PLANEPTR
)sizePointer_bp0
, (PLANEPTR
)sizePointer_bp1
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
}
284 static const UWORD movePointer_bp0
[] =
286 0x3fe0, // ..#########.....
287 0x6030, // .##.......##....
288 0xe038, // ###.......###...
289 0x6030, // .##.......##....
290 0x3fe0, // ..#########.....
291 0x0000 // ................
294 static const UWORD movePointer_bp1
[] =
296 0x0000, // ................
297 0x1fc0, // ...#######......
298 0x1000, // ...#............
299 0x100c, // ...#........##..
300 0x0018, // ...........##...
301 0x1ff0 // ...#########....
304 static const UWORD movePointer_bp2
[] =
306 0x3fe0, // ..%%%%%%%%%.....
307 0x7ff0, // .%%#######%%....
308 0xf038, // %%%#......%%%...
309 0x703c, // .%%#......%%##..
310 0x3ffc, // ..%%%%%%%%%##...
311 0x0000 // ...#########....
314 static struct BitMap movePointerBitmap
=
317 { (PLANEPTR
)movePointer_bp0
, (PLANEPTR
)movePointer_bp1
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
}
321 // the selection pointer
322 static const UWORD selectPointer_bp0
[] =
324 0x8800, // #...#...........
325 0x5000, // .#.#............
326 0x2000, // ..#.............
327 0x2000, // ..#.............
328 0x2000, // ..#.............
329 0x2000, // ..#.............
330 0x2000, // ..#.............
331 0x2000, // ..#.............
332 0x4000, // .#..............
333 0x2000, // ..#.............
334 0x2000, // ..#.............
335 0x2000, // ..#.............
336 0x2000, // ..#.............
337 0x2000, // ..#.............
338 0x5000, // .#.#............
339 0x8800, // #...#...........
342 static const UWORD selectPointer_bp1
[] =
344 0x4600, // .#...##.........
345 0x2800, // ..#.#...........
346 0x1000, // ...#............
347 0x1000, // ...#............
348 0x1000, // ...#............
349 0x1000, // ...#............
350 0x1000, // ...#............
351 0x1000, // ...#............
352 0x3800, // ..###...........
353 0x1000, // ...#............
354 0x1000, // ...#............
355 0x1000, // ...#............
356 0x1000, // ...#............
357 0x1000, // ...#............
358 0x2800, // ..#.#...........
359 0x4600, // .#...##.........
362 static const UWORD selectPointer_bp2
[] =
364 0xce00, // %#..%##.........
365 0x7800, // .%#%#...........
366 0x3000, // ..%#............
367 0x3000, // ..%#............
368 0x3000, // ..%#............
369 0x3000, // ..%#............
370 0x3000, // ..%#............
371 0x3000, // ..%#............
372 0x7800, // .%%%#...........
373 0x3000, // ..%#............
374 0x3000, // ..%#............
375 0x3000, // ..%#............
376 0x3000, // ..%#............
377 0x3000, // ..%#............
378 0x7800, // .%#%#...........
379 0xce00, // %#..%##.........
382 static struct BitMap selectPointerBitmap
=
385 { (PLANEPTR
)selectPointer_bp0
, (PLANEPTR
)selectPointer_bp1
, NULL
, NULL
, NULL
, NULL
, NULL
}
389 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
392 static void IdentifyPointerColors(Object
*obj
)
403 // get the current screen's pointer colors (17 to 19)
404 GetRGB32(_window(obj
)->WScreen
->ViewPort
.ColorMap
, 17, 3, colors
);
412 // normalize the colors to 8 bit per gun as GetRGB32() returns
413 // 32bit left aligned values
414 colors
[i
*3+0] >>= 24;
415 colors
[i
*3+1] >>= 24;
416 colors
[i
*3+2] >>= 24;
418 // calculate the geometric difference to the color black (=0x00000000)
419 dr
= 0x00000000 - colors
[i
*3+0];
420 dg
= 0x00000000 - colors
[i
*3+1];
421 db
= 0x00000000 - colors
[i
*3+2];
422 blackDiff
[i
] = dr
* dr
+ dg
* dg
+ db
* db
;
424 // calculate the geometric difference to the color white (=0x000000ff)
425 dr
= 0x000000ff - colors
[i
*3+0];
426 dg
= 0x000000ff - colors
[i
*3+1];
427 db
= 0x000000ff - colors
[i
*3+2];
428 whiteDiff
[i
] = dr
* dr
+ dg
* dg
+ db
* db
;
431 // the smallest difference defines the color which is closest to black or
433 if(blackDiff
[0] > blackDiff
[1])
435 if(blackDiff
[1] > blackDiff
[2])
440 else if(blackDiff
[0] > blackDiff
[2])
445 // the smallest difference defines the color which is closest to white or
447 if(whiteDiff
[0] > whiteDiff
[1])
449 if(whiteDiff
[1] > whiteDiff
[2])
454 else if(whiteDiff
[0] > whiteDiff
[2])
459 // Here we expect the user to have set up quite "different" colors. That
460 // means the color closest to white will never be close to black and vice
461 // versa. According to these differences we spread the required bitplanes.
466 sizePointerBitmap
.Planes
[0] = (PLANEPTR
)sizePointer_bp0
;
467 sizePointerBitmap
.Planes
[1] = (PLANEPTR
)sizePointer_bp1
;
468 movePointerBitmap
.Planes
[0] = (PLANEPTR
)movePointer_bp0
;
469 movePointerBitmap
.Planes
[1] = (PLANEPTR
)movePointer_bp1
;
470 selectPointerBitmap
.Planes
[0] = (PLANEPTR
)selectPointer_bp0
;
471 selectPointerBitmap
.Planes
[1] = (PLANEPTR
)selectPointer_bp1
;
473 else // blackIndex == 19
475 sizePointerBitmap
.Planes
[0] = (PLANEPTR
)sizePointer_bp2
;
476 sizePointerBitmap
.Planes
[1] = (PLANEPTR
)sizePointer_bp1
;
477 movePointerBitmap
.Planes
[0] = (PLANEPTR
)movePointer_bp2
;
478 movePointerBitmap
.Planes
[1] = (PLANEPTR
)movePointer_bp1
;
479 selectPointerBitmap
.Planes
[0] = (PLANEPTR
)selectPointer_bp2
;
480 selectPointerBitmap
.Planes
[1] = (PLANEPTR
)selectPointer_bp1
;
483 else if(whiteIndex
== 18)
487 sizePointerBitmap
.Planes
[0] = (PLANEPTR
)sizePointer_bp1
;
488 sizePointerBitmap
.Planes
[1] = (PLANEPTR
)sizePointer_bp0
;
489 movePointerBitmap
.Planes
[0] = (PLANEPTR
)movePointer_bp1
;
490 movePointerBitmap
.Planes
[1] = (PLANEPTR
)movePointer_bp0
;
491 selectPointerBitmap
.Planes
[0] = (PLANEPTR
)selectPointer_bp1
;
492 selectPointerBitmap
.Planes
[1] = (PLANEPTR
)selectPointer_bp0
;
494 else // blackIndex == 19
496 sizePointerBitmap
.Planes
[0] = (PLANEPTR
)sizePointer_bp1
;
497 sizePointerBitmap
.Planes
[1] = (PLANEPTR
)sizePointer_bp2
;
498 movePointerBitmap
.Planes
[0] = (PLANEPTR
)movePointer_bp1
;
499 movePointerBitmap
.Planes
[1] = (PLANEPTR
)movePointer_bp2
;
500 selectPointerBitmap
.Planes
[0] = (PLANEPTR
)selectPointer_bp1
;
501 selectPointerBitmap
.Planes
[1] = (PLANEPTR
)selectPointer_bp2
;
504 else // whiteIndex == 19
508 sizePointerBitmap
.Planes
[0] = (PLANEPTR
)sizePointer_bp2
;
509 sizePointerBitmap
.Planes
[1] = (PLANEPTR
)sizePointer_bp0
;
510 movePointerBitmap
.Planes
[0] = (PLANEPTR
)movePointer_bp2
;
511 movePointerBitmap
.Planes
[1] = (PLANEPTR
)movePointer_bp0
;
512 selectPointerBitmap
.Planes
[0] = (PLANEPTR
)selectPointer_bp2
;
513 selectPointerBitmap
.Planes
[1] = (PLANEPTR
)selectPointer_bp0
;
515 else // blackIndex == 18
517 sizePointerBitmap
.Planes
[0] = (PLANEPTR
)sizePointer_bp0
;
518 sizePointerBitmap
.Planes
[1] = (PLANEPTR
)sizePointer_bp2
;
519 movePointerBitmap
.Planes
[0] = (PLANEPTR
)movePointer_bp0
;
520 movePointerBitmap
.Planes
[1] = (PLANEPTR
)movePointer_bp2
;
521 selectPointerBitmap
.Planes
[0] = (PLANEPTR
)selectPointer_bp0
;
522 selectPointerBitmap
.Planes
[1] = (PLANEPTR
)selectPointer_bp2
;
529 void SetupCustomPointers(struct NLData
*data
)
533 #if defined(__amigaos4__)
534 if(LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 53, 41))
536 data
->SizePointerObj
= (APTR
)POINTERTYPE_COLUMNRESIZE
;
537 data
->MovePointerObj
= (APTR
)POINTERTYPE_SCROLLALL
;
538 data
->SelectPointerObj
= (APTR
)POINTERTYPE_TEXT
;
540 #elif defined(__MORPHOS__)
541 if(LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 51, 0)) // Check for V51 Intuition and use built-in pointers
543 data
->SizePointerObj
= (APTR
)POINTERTYPE_HORIZONTALRESIZE
;
544 data
->MovePointerObj
= (APTR
)POINTERTYPE_MOVE
;
545 data
->SelectPointerObj
= (APTR
)POINTERTYPE_SELECTTEXT
;
549 if(data
->SizePointerObj
== NULL
)
551 #if defined(__amigaos4__)
552 data
->SizePointerObj
= (Object
*)NewObject(NULL
, "pointerclass",
553 POINTERA_ImageData
, sizePointer
,
554 POINTERA_Width
, sizePointerWidth
,
555 POINTERA_Height
, sizePointerHeight
,
556 POINTERA_BitMap
, (LONG
)&sizePointerBitmap
,
557 POINTERA_WordWidth
, (ULONG
)1,
558 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
559 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
560 POINTERA_XOffset
, (LONG
)sizePointerXOffset
,
561 POINTERA_YOffset
, (LONG
)sizePointerYOffset
,
564 data
->SizePointerObj
= (Object
*)NewObject(NULL
, (STRPTR
)"pointerclass",
565 POINTERA_BitMap
, (IPTR
)&sizePointerBitmap
,
566 POINTERA_WordWidth
, (ULONG
)1,
567 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
568 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
569 POINTERA_XOffset
, (LONG
)sizePointerXOffset
,
570 POINTERA_YOffset
, (LONG
)sizePointerYOffset
,
575 if(data
->MovePointerObj
== NULL
)
577 #if defined(__amigaos4__)
578 data
->MovePointerObj
= (Object
*)NewObject(NULL
, "pointerclass",
579 POINTERA_ImageData
, movePointer
,
580 POINTERA_Width
, movePointerWidth
,
581 POINTERA_Height
, movePointerHeight
,
582 POINTERA_BitMap
, (LONG
)&movePointerBitmap
,
583 POINTERA_WordWidth
, (ULONG
)1,
584 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
585 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
586 POINTERA_XOffset
, (LONG
)movePointerXOffset
,
587 POINTERA_YOffset
, (LONG
)movePointerYOffset
,
590 data
->MovePointerObj
= (Object
*)NewObject(NULL
, (STRPTR
)"pointerclass",
591 POINTERA_BitMap
, (IPTR
)&movePointerBitmap
,
592 POINTERA_WordWidth
, (ULONG
)1,
593 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
594 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
595 POINTERA_XOffset
, (LONG
)movePointerXOffset
,
596 POINTERA_YOffset
, (LONG
)movePointerYOffset
,
601 if(data
->SelectPointerObj
== NULL
)
603 #if defined(__amigaos4__)
604 data
->SelectPointerObj
= (Object
*)NewObject(NULL
, "pointerclass",
605 POINTERA_ImageData
, selectPointer
,
606 POINTERA_Width
, selectPointerWidth
,
607 POINTERA_Height
, selectPointerHeight
,
608 POINTERA_BitMap
, (LONG
)&selectPointerBitmap
,
609 POINTERA_WordWidth
, (ULONG
)1,
610 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
611 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
612 POINTERA_XOffset
, (LONG
)selectPointerXOffset
,
613 POINTERA_YOffset
, (LONG
)selectPointerYOffset
,
616 data
->SelectPointerObj
= (Object
*)NewObject(NULL
, (STRPTR
)"pointerclass",
617 POINTERA_BitMap
, (IPTR
)&selectPointerBitmap
,
618 POINTERA_WordWidth
, (ULONG
)1,
619 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
620 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
621 POINTERA_XOffset
, (LONG
)selectPointerXOffset
,
622 POINTERA_YOffset
, (LONG
)selectPointerYOffset
,
630 void CleanupCustomPointers(struct NLData
*data
)
634 #if defined(__amigaos4__)
635 if(LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 53, 41))
637 data
->SizePointerObj
= NULL
;
638 data
->MovePointerObj
= NULL
;
639 data
->SelectPointerObj
= NULL
;
641 #elif defined(__MORPHOS__)
642 if(LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 51, 0)) // Check for V51 Intuition and use built-in pointers
644 data
->SizePointerObj
= NULL
;
645 data
->MovePointerObj
= NULL
;
646 data
->SelectPointerObj
= NULL
;
650 // dispose the different pointer objects
651 if(data
->SizePointerObj
!= NULL
)
653 DisposeObject(data
->SizePointerObj
);
654 data
->SizePointerObj
= NULL
;
657 if(data
->MovePointerObj
!= NULL
)
659 DisposeObject(data
->MovePointerObj
);
660 data
->MovePointerObj
= NULL
;
663 if(data
->SelectPointerObj
!= NULL
)
665 DisposeObject(data
->SelectPointerObj
);
666 data
->SelectPointerObj
= NULL
;
669 data
->activeCustomPointer
= PT_NONE
;
674 void ShowCustomPointer(struct NLData
*data
, enum PointerType type
)
676 Object
*obj
= data
->this;
680 // even if it seems to be a waste of performance, but
681 // we unfortunately have to always set the window pointer
682 // regardless of the point if it was previously set or not.
683 // This is required as any other gadget or process might
684 // reset the window pointer and as such we would end up
685 // with no custom pointer as well. So we only check the window
686 // sleep status here :(
687 if(xget(_win(obj
), MUIA_Window_Sleep
) == FALSE
)
689 Object
*ptrObject
= NULL
;
694 ptrObject
= data
->SizePointerObj
;
698 ptrObject
= data
->MovePointerObj
;
702 ptrObject
= data
->SelectPointerObj
;
710 if(ptrObject
!= NULL
)
712 // try to identify the black/white colors
713 // of the current screen colormap
714 IdentifyPointerColors(obj
);
716 #if defined(__amigaos4__)
717 SetWindowPointer(_window(obj
), LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 53, 41) ? WA_PointerType
: WA_Pointer
, ptrObject
, TAG_DONE
);
718 #elif defined(__MORPHOS__)
719 SetWindowPointer(_window(obj
), LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 51, 0) ? WA_PointerType
: WA_Pointer
, ptrObject
, TAG_DONE
);
721 SetWindowPointer(_window(obj
), WA_Pointer
, ptrObject
, TAG_DONE
);
724 data
->activeCustomPointer
= type
;
727 HideCustomPointer(data
);
733 void HideCustomPointer(struct NLData
*data
)
737 if(data
->activeCustomPointer
!= PT_NONE
)
739 SetWindowPointer(_window(data
->this), TAG_DONE
);
740 data
->activeCustomPointer
= PT_NONE
;