1 /***************************************************************************
3 NBalance.mcc - New Balance MUI Custom Class
4 Copyright (C) 2008-2013 by NList Open Source Team
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 NList classes Support Site: http://www.sf.net/projects/nlist-classes
20 ***************************************************************************/
24 #include <clib/alib_protos.h>
26 #include <intuition/pointerclass.h>
28 #include <proto/utility.h>
29 #include <proto/intuition.h>
30 #include <proto/exec.h>
31 #include <proto/graphics.h>
32 #include <libraries/mui.h>
37 // the meta data of our pointers
38 #define horizSizePointerWidth 16
39 #define horizSizePointerHeight 16
40 #define horizSizePointerXOffset -8
41 #define horizSizePointerYOffset -8
43 #define vertSizePointerWidth 16
44 #define vertSizePointerHeight 16
45 #define vertSizePointerXOffset -8
46 #define vertSizePointerYOffset -8
48 #if defined(__amigaos4__)
49 // a 32bit ARGB pointer image where we can define every color of the pixels
50 // on our own and put an alpha-channel information in it as well.
51 static const ULONG horizSizePointer
[] =
53 /* ......++++...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
54 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
55 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
56 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
57 /* ...++.+##+.++... */ 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
58 /* ..+#+.+##+.+#+.. */ 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xffffffff, 0x00000000, 0x00000000,
59 /* .+##+++##+++##+. */ 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000,
60 /* +##############+ */ 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff,
61 /* +##############+ */ 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff,
62 /* .+##+++##+++##+. */ 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000,
63 /* ..+#+.+##+.+#+.. */ 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xffffffff, 0x00000000, 0x00000000,
64 /* ...++.+##+.++... */ 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000,
65 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
66 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
67 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
68 /* ......++++...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
71 static const ULONG vertSizePointer
[] =
73 /* .......++....... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 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, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
76 /* ....+######+.... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
77 /* ....+++##+++.... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
78 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
79 /* +++++++##+++++++ */ 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
80 /* +##############+ */ 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff,
81 /* +##############+ */ 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff,
82 /* +++++++##+++++++ */ 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
83 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
84 /* ....+++##+++.... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
85 /* ....+######+.... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
86 /* .....+####+..... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
87 /* ......+##+...... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xff000000, 0xff000000, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
88 /* .......++....... */ 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0xffffffff, 0xffffffff, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
91 #ifndef POINTERA_ImageData
92 #define POINTERA_ImageData (POINTERA_Dummy + 0x07) // ARGB (width * height * sizeof(ULONG))
94 #ifndef POINTERA_Width
95 #define POINTERA_Width (POINTERA_Dummy + 0x08) // <= 64
97 #ifndef POINTERA_Height
98 #define POINTERA_Height (POINTERA_Dummy + 0x09) // <= 64
100 #ifndef WA_PointerType
101 #define WA_PointerType (WA_Dummy + 0x50)
103 #ifndef POINTERTYPE_COLUMNRESIZE
104 #define POINTERTYPE_COLUMNRESIZE 4
106 #ifndef POINTERTYPE_ROWRESIZE
107 #define POINTERTYPE_ROWRESIZE 25
110 #else // __amigaos4__
112 #if defined(__MORPHOS__)
113 #ifndef POINTERTYPE_VERTICALRESIZE
114 #define POINTERTYPE_VERTICALRESIZE 10
115 #define POINTERTYPE_HORIZONTALRESIZE 11
117 #ifndef WA_PointerType
118 #define WA_PointerType (WA_Dummy + 164)
122 #if !defined(__AROS__)
123 static const UWORD horizSizePointer
[] =
148 static const UWORD vertSizePointer
[] =
174 #endif // __amigaos4__
176 // Classic bitmap data for the pointers. These will be used for OS4 aswell,
177 // if the graphic card cannot handle 32bit pointers.
179 // the horizontal size pointer
180 static const UWORD horizSizePointer_bp0
[] =
182 /* ......++++...... */ 0x03c0,
183 /* ......+..+...... */ 0x0240,
184 /* ......+..+...... */ 0x0240,
185 /* ......+..+...... */ 0x0240,
186 /* ...++.+..+.++... */ 0x1a58,
187 /* ..+.+.+..+.+.+.. */ 0x2a54,
188 /* .+..+++..+++..+. */ 0x4e72,
189 /* +..............+ */ 0x8001,
190 /* +..............+ */ 0x8001,
191 /* .+..+++..+++..+. */ 0x4e72,
192 /* ..+.+.+..+.+.+.. */ 0x2a54,
193 /* ...++.+..+.++... */ 0x1a58,
194 /* ......+..+...... */ 0x0240,
195 /* ......+..+...... */ 0x0240,
196 /* ......+..+...... */ 0x0240,
197 /* ......++++...... */ 0x03c0,
200 static const UWORD horizSizePointer_bp1
[] =
202 /* ................ */ 0x0000,
203 /* .......##....... */ 0x0180,
204 /* .......##....... */ 0x0180,
205 /* .......##....... */ 0x0180,
206 /* .......##....... */ 0x0180,
207 /* ...#...##...#... */ 0x1188,
208 /* ..##...##...##.. */ 0x318c,
209 /* .##############. */ 0x7ffe,
210 /* .##############. */ 0x7ffe,
211 /* ..##...##...##.. */ 0x318c,
212 /* ...#...##...#... */ 0x1188,
213 /* .......##....... */ 0x0180,
214 /* .......##....... */ 0x0180,
215 /* .......##....... */ 0x0180,
216 /* .......##....... */ 0x0180,
217 /* ................ */ 0x0000,
220 static const UWORD horizSizePointer_bp2
[] =
222 /* ......++++...... */ 0x03c0,
223 /* ......+##+...... */ 0x03c0,
224 /* ......+##+...... */ 0x03c0,
225 /* ......+##+...... */ 0x03c0,
226 /* ...++.+##+.++... */ 0x1bd8,
227 /* ..+#+.+##+.+#+.. */ 0x3bdc,
228 /* .+##+++##+++##+. */ 0x7ffe,
229 /* +##############+ */ 0xffff,
230 /* +##############+ */ 0xffff,
231 /* .+##+++##+++##+. */ 0x7ffe,
232 /* ..+#+.+##+.+#+.. */ 0x3bdc,
233 /* ...++.+##+.++... */ 0x1bd8,
234 /* ......+##+...... */ 0x03c0,
235 /* ......+##+...... */ 0x03c0,
236 /* ......+##+...... */ 0x03c0,
237 /* ......++++...... */ 0x03c0,
240 static struct BitMap horizSizePointerBitmap
=
243 { (PLANEPTR
)horizSizePointer_bp0
, (PLANEPTR
)horizSizePointer_bp1
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
}
246 // the vertical size pointer
247 static const UWORD vertSizePointer_bp0
[] =
249 /* .......++....... */ 0x0180,
250 /* ......+..+...... */ 0x0240,
251 /* .....+....+..... */ 0x0420,
252 /* ....+......+.... */ 0x0810,
253 /* ....+++..+++.... */ 0x0e70,
254 /* ......+..+...... */ 0x0240,
255 /* +++++++..+++++++ */ 0xfe7f,
256 /* +..............+ */ 0x8001,
257 /* +..............+ */ 0x8001,
258 /* +++++++..+++++++ */ 0xfe7f,
259 /* ......+..+...... */ 0x0240,
260 /* ....+++..+++.... */ 0x0e70,
261 /* ....+......+.... */ 0x0810,
262 /* .....+....+..... */ 0x0420,
263 /* ......+..+...... */ 0x0240,
264 /* .......++....... */ 0x0180,
267 static const UWORD vertSizePointer_bp1
[] =
269 /* ................ */ 0x0000,
270 /* .......##....... */ 0x0180,
271 /* ......####...... */ 0x03c0,
272 /* .....######..... */ 0x07e0,
273 /* .......##....... */ 0x0180,
274 /* .......##....... */ 0x0180,
275 /* .......##....... */ 0x0180,
276 /* .##############. */ 0x7ffe,
277 /* .##############. */ 0x7ffe,
278 /* .......##....... */ 0x0180,
279 /* .......##....... */ 0x0180,
280 /* .......##....... */ 0x0180,
281 /* .....######..... */ 0x07e0,
282 /* ......####...... */ 0x03c0,
283 /* .......##....... */ 0x0180,
284 /* ................ */ 0x0000,
287 static const UWORD vertSizePointer_bp2
[] =
289 /* .......++....... */ 0x0180,
290 /* ......+##+...... */ 0x03c0,
291 /* .....+####+..... */ 0x07e0,
292 /* ....+######+.... */ 0x0ff0,
293 /* ....+++##+++.... */ 0x0ff0,
294 /* ......+##+...... */ 0x03c0,
295 /* +++++++##+++++++ */ 0xffff,
296 /* +##############+ */ 0xffff,
297 /* +##############+ */ 0xffff,
298 /* +++++++##+++++++ */ 0xffff,
299 /* ......+##+...... */ 0x03c0,
300 /* ....+++##+++.... */ 0x0ff0,
301 /* ....+######+.... */ 0x0ff0,
302 /* .....+####+..... */ 0x07e0,
303 /* ......+##+...... */ 0x03c0,
304 /* .......++....... */ 0x0180,
307 static struct BitMap vertSizePointerBitmap
=
310 { (PLANEPTR
)vertSizePointer_bp0
, (PLANEPTR
)vertSizePointer_bp1
, NULL
, NULL
, NULL
, NULL
, NULL
, NULL
}
314 #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
317 static void IdentifyPointerColors(Object
*obj
)
328 // get the current screen's pointer colors (17 to 19)
329 GetRGB32(_window(obj
)->WScreen
->ViewPort
.ColorMap
, 17, 3, colors
);
337 // normalize the colors to 8 bit per gun as GetRGB32() returns
338 // 32bit left aligned values
339 colors
[i
*3+0] >>= 24;
340 colors
[i
*3+1] >>= 24;
341 colors
[i
*3+2] >>= 24;
343 // calculate the geometric difference to the color black (=0x00000000)
344 dr
= 0x00000000 - colors
[i
*3+0];
345 dg
= 0x00000000 - colors
[i
*3+1];
346 db
= 0x00000000 - colors
[i
*3+2];
347 blackDiff
[i
] = dr
* dr
+ dg
* dg
+ db
* db
;
349 // calculate the geometric difference to the color white (=0x000000ff)
350 dr
= 0x000000ff - colors
[i
*3+0];
351 dg
= 0x000000ff - colors
[i
*3+1];
352 db
= 0x000000ff - colors
[i
*3+2];
353 whiteDiff
[i
] = dr
* dr
+ dg
* dg
+ db
* db
;
356 // the smallest difference defines the color which is closest to black or
358 if(blackDiff
[0] > blackDiff
[1])
360 if(blackDiff
[1] > blackDiff
[2])
365 else if(blackDiff
[0] > blackDiff
[2])
370 // the smallest difference defines the color which is closest to white or
372 if(whiteDiff
[0] > whiteDiff
[1])
374 if(whiteDiff
[1] > whiteDiff
[2])
379 else if(whiteDiff
[0] > whiteDiff
[2])
384 // Here we expect the user to have set up quite "different" colors. That
385 // means the color closest to white will never be close to black and vice
386 // versa. According to these differences we spread the required bitplanes.
391 horizSizePointerBitmap
.Planes
[0] = (PLANEPTR
)horizSizePointer_bp0
;
392 horizSizePointerBitmap
.Planes
[1] = (PLANEPTR
)horizSizePointer_bp1
;
393 vertSizePointerBitmap
.Planes
[0] = (PLANEPTR
)vertSizePointer_bp0
;
394 vertSizePointerBitmap
.Planes
[1] = (PLANEPTR
)vertSizePointer_bp1
;
396 else // blackIndex == 19
398 horizSizePointerBitmap
.Planes
[0] = (PLANEPTR
)horizSizePointer_bp2
;
399 horizSizePointerBitmap
.Planes
[1] = (PLANEPTR
)horizSizePointer_bp1
;
400 vertSizePointerBitmap
.Planes
[0] = (PLANEPTR
)vertSizePointer_bp2
;
401 vertSizePointerBitmap
.Planes
[1] = (PLANEPTR
)vertSizePointer_bp1
;
404 else if(whiteIndex
== 18)
408 horizSizePointerBitmap
.Planes
[0] = (PLANEPTR
)horizSizePointer_bp1
;
409 horizSizePointerBitmap
.Planes
[1] = (PLANEPTR
)horizSizePointer_bp0
;
410 vertSizePointerBitmap
.Planes
[0] = (PLANEPTR
)vertSizePointer_bp1
;
411 vertSizePointerBitmap
.Planes
[1] = (PLANEPTR
)vertSizePointer_bp0
;
413 else // blackIndex == 19
415 horizSizePointerBitmap
.Planes
[0] = (PLANEPTR
)horizSizePointer_bp1
;
416 horizSizePointerBitmap
.Planes
[1] = (PLANEPTR
)horizSizePointer_bp2
;
417 vertSizePointerBitmap
.Planes
[0] = (PLANEPTR
)vertSizePointer_bp1
;
418 vertSizePointerBitmap
.Planes
[1] = (PLANEPTR
)vertSizePointer_bp2
;
421 else // whiteIndex == 19
425 horizSizePointerBitmap
.Planes
[0] = (PLANEPTR
)horizSizePointer_bp2
;
426 horizSizePointerBitmap
.Planes
[1] = (PLANEPTR
)horizSizePointer_bp0
;
427 vertSizePointerBitmap
.Planes
[0] = (PLANEPTR
)vertSizePointer_bp2
;
428 vertSizePointerBitmap
.Planes
[1] = (PLANEPTR
)vertSizePointer_bp0
;
430 else // blackIndex == 18
432 horizSizePointerBitmap
.Planes
[0] = (PLANEPTR
)horizSizePointer_bp0
;
433 horizSizePointerBitmap
.Planes
[1] = (PLANEPTR
)horizSizePointer_bp2
;
434 vertSizePointerBitmap
.Planes
[0] = (PLANEPTR
)vertSizePointer_bp0
;
435 vertSizePointerBitmap
.Planes
[1] = (PLANEPTR
)vertSizePointer_bp2
;
442 void SetupCustomPointers(struct InstData
*data
)
446 #if defined(__amigaos4__)
447 if(LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 53, 41))
449 data
->horizSizePointerObj
= (APTR
)POINTERTYPE_COLUMNRESIZE
;
450 data
->vertSizePointerObj
= (APTR
)POINTERTYPE_ROWRESIZE
;
452 #elif defined(__MORPHOS__)
453 if(LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 51, 0))
455 data
->horizSizePointerObj
= (APTR
)POINTERTYPE_HORIZONTALRESIZE
;
456 data
->vertSizePointerObj
= (APTR
)POINTERTYPE_VERTICALRESIZE
;
460 if(data
->horizSizePointerObj
== NULL
)
462 #if defined(__amigaos4__)
463 data
->horizSizePointerObj
= (Object
*)NewObject(NULL
, "pointerclass",
464 POINTERA_ImageData
, horizSizePointer
,
465 POINTERA_Width
, horizSizePointerWidth
,
466 POINTERA_Height
, horizSizePointerHeight
,
467 POINTERA_BitMap
, (LONG
)&horizSizePointerBitmap
,
468 POINTERA_WordWidth
, (ULONG
)1,
469 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
470 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
471 POINTERA_XOffset
, (LONG
)horizSizePointerXOffset
,
472 POINTERA_YOffset
, (LONG
)horizSizePointerYOffset
,
475 data
->horizSizePointerObj
= (Object
*)NewObject(NULL
, (STRPTR
)"pointerclass",
476 POINTERA_BitMap
, (IPTR
)&horizSizePointerBitmap
,
477 POINTERA_WordWidth
, (ULONG
)1,
478 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
479 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
480 POINTERA_XOffset
, (LONG
)horizSizePointerXOffset
,
481 POINTERA_YOffset
, (LONG
)horizSizePointerYOffset
,
486 if(data
->vertSizePointerObj
== NULL
)
488 #if defined(__amigaos4__)
489 data
->vertSizePointerObj
= (Object
*)NewObject(NULL
, "pointerclass",
490 POINTERA_ImageData
, vertSizePointer
,
491 POINTERA_Width
, vertSizePointerWidth
,
492 POINTERA_Height
, vertSizePointerHeight
,
493 POINTERA_BitMap
, (LONG
)&vertSizePointerBitmap
,
494 POINTERA_WordWidth
, (ULONG
)1,
495 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
496 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
497 POINTERA_XOffset
, (LONG
)vertSizePointerXOffset
,
498 POINTERA_YOffset
, (LONG
)vertSizePointerYOffset
,
501 data
->vertSizePointerObj
= (Object
*)NewObject(NULL
, (STRPTR
)"pointerclass",
502 POINTERA_BitMap
, (IPTR
)&vertSizePointerBitmap
,
503 POINTERA_WordWidth
, (ULONG
)1,
504 POINTERA_XResolution
, (ULONG
)POINTERXRESN_SCREENRES
,
505 POINTERA_YResolution
, (ULONG
)POINTERYRESN_SCREENRESASPECT
,
506 POINTERA_XOffset
, (LONG
)vertSizePointerXOffset
,
507 POINTERA_YOffset
, (LONG
)vertSizePointerYOffset
,
515 void CleanupCustomPointers(struct InstData
*data
)
519 #if defined(__amigaos4__)
520 if(LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 53, 41))
522 data
->horizSizePointerObj
= NULL
;
523 data
->vertSizePointerObj
= NULL
;
525 #elif defined(__MORPHOS__)
526 if(LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 51, 0))
528 data
->horizSizePointerObj
= NULL
;
529 data
->vertSizePointerObj
= NULL
;
533 // dispose the different pointer objects
534 if(data
->horizSizePointerObj
!= NULL
)
536 DisposeObject(data
->horizSizePointerObj
);
537 data
->horizSizePointerObj
= NULL
;
540 if(data
->vertSizePointerObj
!= NULL
)
542 DisposeObject(data
->vertSizePointerObj
);
543 data
->vertSizePointerObj
= NULL
;
546 data
->activeCustomPointer
= PT_NONE
;
551 void ShowCustomPointer(Object
*obj
, struct InstData
*data
)
555 // even if it seems to be a waste of performance, but
556 // we unfortunately have to always set the window pointer
557 // regardless of the point if it was previously set or not.
558 // This is required as any other gadget or process might
559 // reset the window pointer and as such we would end up
560 // with no custom pointer as well. So we only check the window
561 // sleep status here :(
562 if(xget(_win(obj
), MUIA_Window_Sleep
) == FALSE
)
564 enum PointerType type
= (data
->groupType
== MUIV_Group_Type_Horiz
) ? PT_HORIZ
: PT_VERT
;
565 Object
*ptrObject
= NULL
;
570 ptrObject
= data
->horizSizePointerObj
;
574 ptrObject
= data
->vertSizePointerObj
;
582 if(ptrObject
!= NULL
)
584 // try to identify the black/white colors
585 // of the current screen colormap
586 IdentifyPointerColors(obj
);
588 #if defined(__amigaos4__)
589 SetWindowPointer(_window(obj
), LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 53, 41) ? WA_PointerType
: WA_Pointer
, ptrObject
, TAG_DONE
);
590 #elif defined(__MORPHOS__)
591 SetWindowPointer(_window(obj
), LIB_VERSION_IS_AT_LEAST(IntuitionBase
, 51, 0) ? WA_PointerType
: WA_Pointer
, ptrObject
, TAG_DONE
);
593 SetWindowPointer(_window(obj
), WA_Pointer
, ptrObject
, TAG_DONE
);
596 data
->activeCustomPointer
= type
;
599 HideCustomPointer(obj
, data
);
605 void HideCustomPointer(Object
*obj
, struct InstData
*data
)
609 if(data
->activeCustomPointer
!= PT_NONE
)
611 SetWindowPointer(_window(obj
), TAG_DONE
);
612 data
->activeCustomPointer
= PT_NONE
;