//identical mask that is 1 for on and 0 for off
NSImage *theImage = [[NSImage alloc] initWithSize:NSMakeSize(16.0,16.0)];
//identical mask that is 1 for on and 0 for off
NSImage *theImage = [[NSImage alloc] initWithSize:NSMakeSize(16.0,16.0)];
//NSCursor takes an NSImage takes a number of Representations - here
//we need only one for the raw data
//NSCursor takes an NSImage takes a number of Representations - here
//we need only one for the raw data
colorSpaceName: NSCalibratedWhiteColorSpace // Normal B/W - 0 black 1 white
bytesPerRow: 0 // I don't care - figure it out for me :)
bitsPerPixel: 2]; // bitsPerSample * samplesPerPixel
colorSpaceName: NSCalibratedWhiteColorSpace // Normal B/W - 0 black 1 white
bytesPerRow: 0 // I don't care - figure it out for me :)
bitsPerPixel: 2]; // bitsPerSample * samplesPerPixel
//unsigned int is better to put data in then a void*
//note that working with bitfields would be a lot better here -
//but since it breaks some compilers...
//unsigned int is better to put data in then a void*
//note that working with bitfields would be a lot better here -
//but since it breaks some compilers...
//traverse through the bitmap data
for (int i = 0; i < 16; ++i)
{
//bit alpha bit alpha ... :D
//traverse through the bitmap data
for (int i = 0; i < 16; ++i)
{
//bit alpha bit alpha ... :D
- data[i] |= (!!(pCursor->bits[i] & (1 << (shift >> 1) ))) << shift;
- data[i] |= (!(pCursor->mask[i] & (1 << (shift >> 1) ))) << ++shift;
+ const int bit = 1 << (shift >> 1);
+ data[i] |= ( !!( (pCursor->mask[i] & bit) ) ) << shift;
+ data[i] |= ( !( (pCursor->bits[i] & bit) ) ) << ++shift;
- NSCursor* theCursor = [[NSCursor alloc] initWithImage:theImage
- hotSpot:NSMakePoint(pCursor->hotspot[0], pCursor->hotspot[1])
+ NSCursor* theCursor = [[NSCursor alloc] initWithImage:theImage
+ hotSpot:NSMakePoint(pCursor->hotspot[1], pCursor->hotspot[0])
wxCursorRefData::wxCursorRefData() :
m_width(32), m_height(32), m_hCursor(nil)
wxCursorRefData::wxCursorRefData() :
m_width(32), m_height(32), m_hCursor(nil)
wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY), const char WXUNUSED(maskBits)[])
{
wxCursor::wxCursor(const char WXUNUSED(bits)[], int WXUNUSED(width), int WXUNUSED(height),
int WXUNUSED(hotSpotX), int WXUNUSED(hotSpotY), const char WXUNUSED(maskBits)[])
{
}
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
{
m_refData = new wxCursorRefData;
}
wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int hotSpotY)
{
m_refData = new wxCursorRefData;
M_CURSORDATA->m_hCursor = [[NSCursor alloc] initWithImage:theImage
hotSpot:NSMakePoint(hotSpotX, hotSpotY)
];
M_CURSORDATA->m_hCursor = [[NSCursor alloc] initWithImage:theImage
hotSpot:NSMakePoint(hotSpotX, hotSpotY)
];