Implement wxBitmap(const wxCursor&) constructor for OSX
This commit is contained in:
@@ -126,6 +126,11 @@ public:
|
||||
// Convert from wxIcon
|
||||
wxBitmap(const wxIcon& icon) { CopyFromIcon(icon); }
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
// Convert from wxCursor
|
||||
wxBitmap(const wxCursor &cursor);
|
||||
#endif
|
||||
|
||||
virtual ~wxBitmap() {}
|
||||
|
||||
wxImage ConvertToImage() const wxOVERRIDE;
|
||||
|
@@ -45,6 +45,7 @@ void WXDLLIMPEXP_CORE wxOSXSetImageSize(WX_NSImage image, CGFloat width, CGFloat
|
||||
wxBitmap WXDLLIMPEXP_CORE wxOSXCreateSystemBitmap(const wxString& id, const wxString &client, const wxSize& size);
|
||||
WXWindow WXDLLIMPEXP_CORE wxOSXGetMainWindow();
|
||||
WXWindow WXDLLIMPEXP_CORE wxOSXGetKeyWindow();
|
||||
WXImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromNSCursor(const WXHCURSOR cursor);
|
||||
|
||||
class WXDLLIMPEXP_FWD_CORE wxDialog;
|
||||
|
||||
|
@@ -359,9 +359,6 @@ public:
|
||||
This can be useful to display a cursor as it cannot be drawn directly
|
||||
on a window.
|
||||
|
||||
This constructor only exists in wxMSW and wxGTK (where it is
|
||||
implemented for GTK+ 2.8 or later) only.
|
||||
|
||||
@param cursor A valid wxCursor.
|
||||
|
||||
@since 3.1.0
|
||||
|
@@ -577,6 +577,11 @@ WX_NSCursor wxMacCocoaCreateStockCursor( int cursor_type )
|
||||
return cursor;
|
||||
}
|
||||
|
||||
WXImage WXDLLIMPEXP_CORE wxOSXGetNSImageFromNSCursor(const WXHCURSOR cursor)
|
||||
{
|
||||
return [(NSCursor *)cursor image];
|
||||
}
|
||||
|
||||
// C-based style wrapper routines around NSCursor
|
||||
WX_NSCursor wxMacCocoaCreateCursorFromCGImage( CGImageRef cgImageRef, float hotSpotX, float hotSpotY )
|
||||
{
|
||||
|
@@ -919,6 +919,13 @@ wxBitmap::wxBitmap(WXImage image)
|
||||
(void)Create(image);
|
||||
}
|
||||
|
||||
#if wxOSX_USE_COCOA
|
||||
wxBitmap::wxBitmap(const wxCursor &cursor)
|
||||
{
|
||||
m_refData = new wxBitmapRefData( wxOSXGetNSImageFromNSCursor( cursor.GetHCURSOR() ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
bool wxBitmap::Create(WXImage image)
|
||||
{
|
||||
UnRef();
|
||||
|
Reference in New Issue
Block a user