1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/carbon/cursor.cpp
3 // Purpose: wxCursor class
4 // Author: Stefan Csomor
7 // Copyright: (c) Stefan Csomor
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #include "wx/wxprec.h"
13 #include "wx/cursor.h"
21 #include "wx/xpmdecod.h"
23 #include "wx/osx/private.h"
26 IMPLEMENT_DYNAMIC_CLASS(wxCursor
, wxGDIObject
)
29 class WXDLLEXPORT wxCursorRefData
: public wxGDIRefData
33 wxCursorRefData(const wxCursorRefData
& cursor
);
34 virtual ~wxCursorRefData();
36 virtual bool IsOk() const
38 #if wxOSX_USE_COCOA_OR_CARBON
39 if ( m_hCursor
!= NULL
)
42 if ( m_themeCursor
!= -1 )
48 // in order to avoid asserts, always claim to have a valid cursor
55 WX_NSCursor m_hCursor
;
56 #elif wxOSX_USE_CARBON
62 #elif wxOSX_USE_IPHONE
66 friend class wxCursor
;
68 wxDECLARE_NO_ASSIGN_CLASS(wxCursorRefData
);
71 #define M_CURSORDATA static_cast<wxCursorRefData*>(m_refData)
73 #if wxOSX_USE_COCOA_OR_CARBON
75 ClassicCursor gMacCursors
[kwxCursorLast
+1] =
79 {0x0000, 0x03E0, 0x0630, 0x0808, 0x1004, 0x31C6, 0x2362, 0x2222,
80 0x2362, 0x31C6, 0x1004, 0x0808, 0x0630, 0x03E0, 0x0000, 0x0000},
81 {0x0000, 0x03E0, 0x07F0, 0x0FF8, 0x1FFC, 0x3FFE, 0x3FFE, 0x3FFE,
82 0x3FFE, 0x3FFE, 0x1FFC, 0x0FF8, 0x07F0, 0x03E0, 0x0000, 0x0000},
87 {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
88 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
89 {0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
90 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
95 {0x00F0, 0x0088, 0x0108, 0x0190, 0x0270, 0x0220, 0x0440, 0x0440,
96 0x0880, 0x0880, 0x1100, 0x1E00, 0x1C00, 0x1800, 0x1000, 0x0000},
97 {0x00F0, 0x00F8, 0x01F8, 0x01F0, 0x03F0, 0x03E0, 0x07C0, 0x07C0,
98 0x0F80, 0x0F80, 0x1F00, 0x1E00, 0x1C00, 0x1800, 0x1000, 0x0000},
103 {0x0000, 0x1E00, 0x2100, 0x4080, 0x4080, 0x4080, 0x4080, 0x2180,
104 0x1FC0, 0x00E0, 0x0070, 0x0038, 0x001C, 0x000E, 0x0006, 0x0000},
105 {0x3F00, 0x7F80, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0x7FC0,
106 0x3FE0, 0x1FF0, 0x00F8, 0x007C, 0x003E, 0x001F, 0x000F, 0x0007},
111 {0x0000, 0x07E0, 0x1FF0, 0x3838, 0x3C0C, 0x6E0E, 0x6706, 0x6386,
112 0x61C6, 0x60E6, 0x7076, 0x303C, 0x1C1C, 0x0FF8, 0x07E0, 0x0000},
113 {0x0540, 0x0FF0, 0x3FF8, 0x3C3C, 0x7E0E, 0xFF0F, 0x6F86, 0xE7C7,
114 0x63E6, 0xE1F7, 0x70FE, 0x707E, 0x3C3C, 0x1FFC, 0x0FF0, 0x0540},
119 {0x0000, 0x0380, 0x0380, 0x0380, 0x0380, 0x0380, 0x0380, 0x0FE0,
120 0x1FF0, 0x1FF0, 0x0000, 0x1FF0, 0x1FF0, 0x1550, 0x1550, 0x1550},
121 {0x07C0, 0x07C0, 0x07C0, 0x07C0, 0x07C0, 0x07C0, 0x0FE0, 0x1FF0,
122 0x3FF8, 0x3FF8, 0x3FF8, 0x3FF8, 0x3FF8, 0x3FF8, 0x3FF8, 0x3FF8},
127 {0x00C0, 0x0140, 0x0640, 0x08C0, 0x3180, 0x47FE, 0x8001, 0x8001,
128 0x81FE, 0x8040, 0x01C0, 0x0040, 0x03C0, 0xC080, 0x3F80, 0x0000},
129 {0x00C0, 0x01C0, 0x07C0, 0x0FC0, 0x3F80, 0x7FFE, 0xFFFF, 0xFFFF,
130 0xFFFE, 0xFFC0, 0xFFC0, 0xFFC0, 0xFFC0, 0xFF80, 0x3F80, 0x0000},
135 {0x0100, 0x0280, 0x0260, 0x0310, 0x018C, 0x7FE3, 0x8000, 0x8000,
136 0x7F80, 0x0200, 0x0380, 0x0200, 0x03C0, 0x0107, 0x01F8, 0x0000},
137 {0x0100, 0x0380, 0x03E0, 0x03F0, 0x01FC, 0x7FFF, 0xFFFF, 0xFFFF,
138 0xFFFF, 0x03FF, 0x03FF, 0x03FF, 0x03FF, 0x01FF, 0x01F8, 0x0000},
143 {0x0000, 0x4078, 0x60FC, 0x71CE, 0x7986, 0x7C06, 0x7E0E, 0x7F1C,
144 0x7FB8, 0x7C30, 0x6C30, 0x4600, 0x0630, 0x0330, 0x0300, 0x0000},
145 {0xC078, 0xE0FC, 0xF1FE, 0xFBFF, 0xFFCF, 0xFF8F, 0xFF1F, 0xFFBE,
146 0xFFFC, 0xFE78, 0xFF78, 0xEFF8, 0xCFF8, 0x87F8, 0x07F8, 0x0300},
151 {0x0000, 0x0002, 0x0006, 0x000E, 0x001E, 0x003E, 0x007E, 0x00FE,
152 0x01FE, 0x003E, 0x0036, 0x0062, 0x0060, 0x00C0, 0x00C0, 0x0000},
153 {0x0003, 0x0007, 0x000F, 0x001F, 0x003F, 0x007F, 0x00FF, 0x01FF,
154 0x03FF, 0x07FF, 0x007F, 0x00F7, 0x00F3, 0x01E1, 0x01E0, 0x01C0},
159 {0x0000, 0x0080, 0x01C0, 0x03E0, 0x0080, 0x0080, 0x0080, 0x1FFC,
160 0x1FFC, 0x0080, 0x0080, 0x0080, 0x03E0, 0x01C0, 0x0080, 0x0000},
161 {0x0080, 0x01C0, 0x03E0, 0x07F0, 0x0FF8, 0x01C0, 0x3FFE, 0x3FFE,
162 0x3FFE, 0x3FFE, 0x01C0, 0x0FF8, 0x07F0, 0x03E0, 0x01C0, 0x0080},
167 {0x0000, 0x0080, 0x01C0, 0x03E0, 0x0080, 0x0888, 0x188C, 0x3FFE,
168 0x188C, 0x0888, 0x0080, 0x03E0, 0x01C0, 0x0080, 0x0000, 0x0000},
169 {0x0080, 0x01C0, 0x03E0, 0x07F0, 0x0BE8, 0x1DDC, 0x3FFE, 0x7FFF,
170 0x3FFE, 0x1DDC, 0x0BE8, 0x07F0, 0x03E0, 0x01C0, 0x0080, 0x0000},
175 {0x0000, 0x001E, 0x000E, 0x060E, 0x0712, 0x03A0, 0x01C0, 0x00E0,
176 0x0170, 0x1238, 0x1C18, 0x1C00, 0x1E00, 0x0000, 0x0000, 0x0000},
177 {0x007F, 0x003F, 0x0E1F, 0x0F0F, 0x0F97, 0x07E3, 0x03E1, 0x21F0,
178 0x31F8, 0x3A7C, 0x3C3C, 0x3E1C, 0x3F00, 0x3F80, 0x0000, 0x0000},
183 {0x0000, 0x7800, 0x7000, 0x7060, 0x48E0, 0x05C0, 0x0380, 0x0700,
184 0x0E80, 0x1C48, 0x1838, 0x0038, 0x0078, 0x0000, 0x0000, 0x0000},
185 {0xFE00, 0xFC00, 0xF870, 0xF0F0, 0xE9F0, 0xC7E0, 0x87C0, 0x0F84,
186 0x1F8C, 0x3E5C, 0x3C3C, 0x387C, 0x00FC, 0x01FC, 0x0000, 0x0000},
191 {0x0006, 0x000E, 0x001C, 0x0018, 0x0020, 0x0040, 0x00F8, 0x0004,
192 0x1FF4, 0x200C, 0x2AA8, 0x1FF0, 0x1F80, 0x3800, 0x6000, 0x8000},
193 {0x000F, 0x001F, 0x003E, 0x007C, 0x0070, 0x00E0, 0x01FC, 0x3FF6,
194 0x7FF6, 0x7FFE, 0x7FFC, 0x7FF8, 0x3FF0, 0x7FC0, 0xF800, 0xE000},
199 {0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x0810, 0x1088, 0x1088, 0x1088,
200 0x1388, 0x1008, 0x1008, 0x0810, 0x07E0, 0x07E0, 0x07E0, 0x07E0},
201 {0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x0FF0, 0x1FF8, 0x1FF8, 0x1FF8,
202 0x1FF8, 0x1FF8, 0x1FF8, 0x0FF0, 0x07E0, 0x07E0, 0x07E0, 0x07E0},
210 wxCursor gMacCurrentCursor
;
213 CursHandle
wxGetStockCursor( int number
)
215 wxASSERT_MSG( number
>= 0 && number
<=kwxCursorLast
, wxT("invalid stock cursor id") ) ;
216 CursHandle c
= (CursHandle
) NewHandle( sizeof(Cursor
) ) ;
217 memcpy( *c
, &gMacCursors
[number
], sizeof(Cursor
) ) ;
219 #ifndef WORDS_BIGENDIAN
220 short *sptr
= (short*) *c
;
221 for ( int i
= 0 ; i
< 2 * 16 /* image and mask */ ; ++i
, ++sptr
)
223 *sptr
= CFSwapInt16( *sptr
) ;
230 wxCursorRefData::wxCursorRefData()
234 m_disposeHandle
= false;
235 m_releaseHandle
= false;
236 m_isColorCursor
= false;
241 wxCursorRefData::wxCursorRefData(const wxCursorRefData
& cursor
) : wxGDIRefData()
246 m_hCursor
= (WX_NSCursor
) wxMacCocoaRetain(cursor
.m_hCursor
);
247 #elif wxOSX_USE_CARBON
248 // FIXME: need to copy the cursor
249 m_disposeHandle
= false;
250 m_releaseHandle
= false;
251 m_isColorCursor
= cursor
.m_isColorCursor
;
252 m_themeCursor
= cursor
.m_themeCursor
;
256 wxCursorRefData::~wxCursorRefData()
260 wxMacCocoaRelease(m_hCursor
);
261 #elif wxOSX_USE_CARBON
262 if ( m_isColorCursor
)
265 ::DisposeCCursor( (CCrsrHandle
) m_hCursor
) ;
268 else if ( m_disposeHandle
)
270 ::DisposeHandle( (Handle
) m_hCursor
) ;
272 else if ( m_releaseHandle
)
274 // we don't release the resource since it may already
284 wxCursor::wxCursor( const wxImage
&image
)
287 CreateFromImage( image
) ;
291 wxGDIRefData
*wxCursor::CreateGDIRefData() const
293 return new wxCursorRefData
;
296 wxGDIRefData
*wxCursor::CloneGDIRefData(const wxGDIRefData
*data
) const
298 return new wxCursorRefData(*static_cast<const wxCursorRefData
*>(data
));
301 WXHCURSOR
wxCursor::GetHCURSOR() const
303 return (M_CURSORDATA
? M_CURSORDATA
->m_hCursor
: 0);
307 short GetCTabIndex( CTabHandle colors
, RGBColor
*col
)
310 unsigned long bestdiff
= 0xFFFF ;
312 for ( int i
= 0 ; i
< (**colors
).ctSize
; ++i
)
314 unsigned long diff
= abs(col
->red
- (**colors
).ctTable
[i
].rgb
.red
) +
315 abs(col
->green
- (**colors
).ctTable
[i
].rgb
.green
) +
316 abs(col
->blue
- (**colors
).ctTable
[i
].rgb
.blue
) ;
318 if ( diff
< bestdiff
)
321 retval
= (**colors
).ctTable
[i
].value
;
331 void wxCursor::CreateFromImage(const wxImage
& image
)
333 m_refData
= new wxCursorRefData
;
334 int hotSpotX
= image
.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X
);
335 int hotSpotY
= image
.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y
);
337 wxBitmap
bmp( image
);
338 CGImageRef cgimage
= wxMacCreateCGImageFromBitmap(bmp
);
341 M_CURSORDATA
->m_hCursor
= wxMacCocoaCreateCursorFromCGImage( cgimage
, hotSpotX
, hotSpotY
);
342 CFRelease( cgimage
);
344 #elif wxOSX_USE_CARBON
349 int image_w
= image
.GetWidth();
350 int image_h
= image
.GetHeight();
352 wxASSERT_MSG( hotSpotX
>= 0 && hotSpotX
< image_w
&&
353 hotSpotY
>= 0 && hotSpotY
< image_h
,
354 wxT("invalid cursor hot spot coordinates") );
356 wxImage
image16(image
); // final image of correct size
358 // if image is too small then place it in the center, resize it if too big
359 if ((w
> image_w
) && (h
> image_h
))
361 wxPoint
offset((w
- image_w
) / 2, (h
- image_h
) / 2);
362 hotSpotX
= hotSpotX
+ offset
.x
;
363 hotSpotY
= hotSpotY
+ offset
.y
;
365 image16
= image
.Size(wxSize(w
, h
), offset
);
367 else if ((w
!= image_w
) || (h
!= image_h
))
369 hotSpotX
= int(hotSpotX
* double(w
) / double(image_w
));
370 hotSpotY
= int(hotSpotY
* double(h
) / double(image_h
));
372 image16
= image
.Scale(w
, h
);
375 unsigned char * rgbBits
= image16
.GetData();
376 bool bHasMask
= image16
.HasMask() ;
378 PixMapHandle pm
= (PixMapHandle
) NewHandleClear( sizeof(PixMap
) ) ;
380 short bytesPerPixel
= 1 ;
382 Rect bounds
= { 0 , 0 , extent
, extent
} ;
383 CCrsrHandle ch
= (CCrsrHandle
) NewHandleClear( sizeof(CCrsr
) ) ;
384 CTabHandle newColors
= GetCTable( 8 ) ;
385 HandToHand( (Handle
*) &newColors
);
387 // set the values to the indices
388 for ( int i
= 0 ; i
< (**newColors
).ctSize
; ++i
)
390 (**newColors
).ctTable
[i
].value
= i
;
394 (**ch
).crsrType
= 0x8001; // color cursors
396 short bytesPerRow
= bytesPerPixel
* extent
;
399 (**pm
).rowBytes
= bytesPerRow
| 0x8000;
400 (**pm
).bounds
= bounds
;
401 (**pm
).pmVersion
= 0;
404 (**pm
).hRes
= 0x00480000; // 72 DPI default res
405 (**pm
).vRes
= 0x00480000; // 72 DPI default res
406 (**pm
).pixelSize
= depth
;
407 (**pm
).pixelType
= 0;
409 (**pm
).cmpSize
= depth
;
410 (**pm
).pmTable
= newColors
;
412 (**ch
).crsrData
= NewHandleClear( extent
* bytesPerRow
) ;
413 (**ch
).crsrXData
= NULL
;
414 (**ch
).crsrXValid
= 0;
415 (**ch
).crsrXHandle
= NULL
;
417 (**ch
).crsrHotSpot
.h
= hotSpotX
;
418 (**ch
).crsrHotSpot
.v
= hotSpotY
;
419 (**ch
).crsrXTable
= 0 ;
420 (**ch
).crsrID
= GetCTSeed() ;
422 memset( (**ch
).crsr1Data
, 0 , sizeof( Bits16
) ) ;
423 memset( (**ch
).crsrMask
, 0 , sizeof( Bits16
) ) ;
425 unsigned char mr
= image16
.GetMaskRed() ;
426 unsigned char mg
= image16
.GetMaskGreen() ;
427 unsigned char mb
= image16
.GetMaskBlue() ;
429 for ( int y
= 0 ; y
< h
; ++y
)
431 short rowbits
= 0, maskbits
= 0 ;
433 for ( int x
= 0 ; x
< w
; ++x
)
435 long pos
= (y
* w
+ x
) * 3;
437 unsigned char r
= rgbBits
[pos
] ;
438 unsigned char g
= rgbBits
[pos
+ 1] ;
439 unsigned char b
= rgbBits
[pos
+ 2] ;
440 RGBColor col
= { 0xFFFF, 0xFFFF, 0xFFFF } ;
442 if ( bHasMask
&& r
== mr
&& g
== mg
&& b
== mb
)
444 // masked area, does not appear anywhere
448 if ( (int)r
+ (int)g
+ (int)b
< 0x0200 )
449 rowbits
|= ( 1 << (15 - x
) ) ;
451 maskbits
|= ( 1 << (15 - x
) ) ;
453 wxColor( r
, g
, b
).GetRGBColor( &col
);
456 *((*(**ch
).crsrData
) + y
* bytesPerRow
+ x
) =
457 GetCTabIndex( newColors
, &col
) ;
459 #ifdef WORDS_BIGENDIAN
460 (**ch
).crsr1Data
[y
] = rowbits
;
461 (**ch
).crsrMask
[y
] = maskbits
;
463 (**ch
).crsr1Data
[y
] = CFSwapInt16(rowbits
) ;
464 (**ch
).crsrMask
[y
] = CFSwapInt16(maskbits
) ;
469 memcpy( (**ch
).crsrMask
, (**ch
).crsr1Data
, sizeof( Bits16
) ) ;
471 HUnlock( (Handle
)ch
) ;
472 M_CURSORDATA
->m_hCursor
= ch
;
473 M_CURSORDATA
->m_isColorCursor
= true ;
480 wxCursor::wxCursor(const wxString
& cursor_file
, wxBitmapType flags
, int hotSpotX
, int hotSpotY
)
482 m_refData
= new wxCursorRefData
;
483 if ( flags
== wxBITMAP_TYPE_MACCURSOR_RESOURCE
)
486 wxFAIL_MSG( wxT("Not implemented") );
487 #elif wxOSX_USE_CARBON
490 wxMacStringToPascal( cursor_file
, theName
) ;
492 Handle resHandle
= ::GetNamedResource( 'crsr' , theName
) ;
498 GetResInfo( resHandle
, &theId
, &theType
, theName
) ;
499 ReleaseResource( resHandle
) ;
501 M_CURSORDATA
->m_hCursor
= GetCCursor( theId
) ;
502 if ( M_CURSORDATA
->m_hCursor
)
503 M_CURSORDATA
->m_isColorCursor
= true ;
507 Handle resHandle
= ::GetNamedResource( 'CURS' , theName
) ;
513 GetResInfo( resHandle
, &theId
, &theType
, theName
) ;
514 ReleaseResource( resHandle
) ;
516 M_CURSORDATA
->m_hCursor
= GetCursor( theId
) ;
517 if ( M_CURSORDATA
->m_hCursor
)
518 M_CURSORDATA
->m_releaseHandle
= true ;
528 image
.LoadFile( cursor_file
, flags
) ;
531 image
.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_X
, hotSpotX
) ;
532 image
.SetOption( wxIMAGE_OPTION_CUR_HOTSPOT_Y
, hotSpotY
) ;
533 m_refData
->DecRef() ;
535 CreateFromImage( image
) ;
541 // Cursors by stock number
542 void wxCursor::InitFromStock(wxStockCursor cursor_type
)
544 m_refData
= new wxCursorRefData
;
546 M_CURSORDATA
->m_hCursor
= wxMacCocoaCreateStockCursor( cursor_type
);
547 #elif wxOSX_USE_CARBON
550 case wxCURSOR_COPY_ARROW
:
551 M_CURSORDATA
->m_themeCursor
= kThemeCopyArrowCursor
;
555 M_CURSORDATA
->m_themeCursor
= kThemeWatchCursor
;
559 M_CURSORDATA
->m_themeCursor
= kThemeIBeamCursor
;
563 M_CURSORDATA
->m_themeCursor
= kThemeCrossCursor
;
566 case wxCURSOR_SIZENWSE
:
567 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorSizeNWSE
);
570 case wxCURSOR_SIZENESW
:
571 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorSizeNESW
);
574 case wxCURSOR_SIZEWE
:
575 M_CURSORDATA
->m_themeCursor
= kThemeResizeLeftRightCursor
;
578 case wxCURSOR_SIZENS
:
579 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorSizeNS
);
582 case wxCURSOR_SIZING
:
583 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorSize
);
587 M_CURSORDATA
->m_themeCursor
= kThemePointingHandCursor
;
590 case wxCURSOR_BULLSEYE
:
591 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorBullseye
);
594 case wxCURSOR_PENCIL
:
595 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorPencil
);
598 case wxCURSOR_MAGNIFIER
:
599 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorMagnifier
);
602 case wxCURSOR_NO_ENTRY
:
603 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorNoEntry
);
607 M_CURSORDATA
->m_themeCursor
= kThemeWatchCursor
;
610 case wxCURSOR_PAINT_BRUSH
:
611 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorPaintBrush
);
614 case wxCURSOR_POINT_LEFT
:
615 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorPointLeft
);
618 case wxCURSOR_POINT_RIGHT
:
619 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorPointRight
);
622 case wxCURSOR_QUESTION_ARROW
:
623 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorQuestionArrow
);
627 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorBlank
);
630 case wxCURSOR_RIGHT_ARROW
:
631 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorRightArrow
);
634 case wxCURSOR_SPRAYCAN
:
635 M_CURSORDATA
->m_hCursor
= wxGetStockCursor(kwxCursorRoller
);
638 case wxCURSOR_OPEN_HAND
:
639 M_CURSORDATA
->m_themeCursor
= kThemeOpenHandCursor
;
642 case wxCURSOR_CLOSED_HAND
:
643 M_CURSORDATA
->m_themeCursor
= kThemeClosedHandCursor
;
648 case wxCURSOR_LEFT_BUTTON
:
649 case wxCURSOR_RIGHT_BUTTON
:
650 case wxCURSOR_MIDDLE_BUTTON
:
652 M_CURSORDATA
->m_themeCursor
= kThemeArrowCursor
;
656 if ( M_CURSORDATA
->m_themeCursor
== -1 )
657 M_CURSORDATA
->m_releaseHandle
= true;
661 void wxCursor::MacInstall() const
663 gMacCurrentCursor
= *this ;
666 wxMacCocoaSetCursor( M_CURSORDATA
->m_hCursor
);
667 #elif wxOSX_USE_CARBON
668 if ( m_refData
&& M_CURSORDATA
->m_themeCursor
!= -1 )
670 SetThemeCursor( M_CURSORDATA
->m_themeCursor
) ;
672 else if ( m_refData
&& M_CURSORDATA
->m_hCursor
)
675 if ( M_CURSORDATA
->m_isColorCursor
)
676 ::SetCCursor( (CCrsrHandle
) M_CURSORDATA
->m_hCursor
) ;
678 ::SetCursor( * (CursHandle
) M_CURSORDATA
->m_hCursor
) ;
683 SetThemeCursor( kThemeArrowCursor
) ;
688 wxCursor::~wxCursor()
692 // Global cursor setting
693 wxCursor gGlobalCursor
;
694 void wxSetCursor(const wxCursor
& cursor
)
696 cursor
.MacInstall() ;
697 gGlobalCursor
= cursor
;