X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/968c951fe1f6aba8276d6585c452b89bfa95993d..0c1cc9483ecba053bc9a0983a4a8d48898e334f2:/src/mac/carbon/cursor.cpp diff --git a/src/mac/carbon/cursor.cpp b/src/mac/carbon/cursor.cpp index e8f6425947..c48663d7fd 100644 --- a/src/mac/carbon/cursor.cpp +++ b/src/mac/carbon/cursor.cpp @@ -29,14 +29,23 @@ IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxGDIObject) class WXDLLEXPORT wxCursorRefData: public wxGDIRefData { - friend class wxCursor; - - DECLARE_NO_COPY_CLASS(wxCursorRefData) - public: wxCursorRefData(); + wxCursorRefData(const wxCursorRefData& cursor); virtual ~wxCursorRefData(); + virtual bool IsOk() const + { + if ( m_hCursor != NULL ) + return true; +#if !wxMAC_USE_COCOA + if ( m_themeCursor != -1 ) + return true; +#endif + + return false; + } + protected: #if wxMAC_USE_COCOA WX_NSCursor m_hCursor; @@ -47,6 +56,10 @@ protected: bool m_isColorCursor; long m_themeCursor; #endif + + friend class wxCursor; + + DECLARE_NO_ASSIGN_CLASS(wxCursorRefData) }; #define M_CURSORDATA wx_static_cast(wxCursorRefData*, m_refData) @@ -208,6 +221,21 @@ wxCursorRefData::wxCursorRefData() #endif } +wxCursorRefData::wxCursorRefData(const wxCursorRefData& cursor) +{ + // FIXME: need to copy the cursor + m_hCursor = NULL; + +#if wxMAC_USE_COCOA + wxUnusedVar(cursor); +#else + m_disposeHandle = false; + m_releaseHandle = false; + m_isColorCursor = cursor.m_isColorCursor; + m_themeCursor = cursor.m_themeCursor; +#endif +} + wxCursorRefData::~wxCursorRefData() { #if wxMAC_USE_COCOA @@ -248,17 +276,22 @@ wxCursor::wxCursor( const wxImage &image ) #endif } -wxCursor::wxCursor(const char **bits) +wxCursor::wxCursor(const char* const* bits) { (void) CreateFromXpm(bits); } -wxCursor::wxCursor(char **bits) +wxGDIRefData *wxCursor::CreateGDIRefData() const { - (void) CreateFromXpm((const char **)bits); + return new wxCursorRefData; } -bool wxCursor::CreateFromXpm(const char **bits) +wxGDIRefData *wxCursor::CloneGDIRefData(const wxGDIRefData *data) const +{ + return new wxCursorRefData(*wx_static_cast(const wxCursorRefData *, data)); +} + +bool wxCursor::CreateFromXpm(const char* const* bits) { #if wxUSE_IMAGE wxCHECK_MSG( bits != NULL, false, wxT("invalid cursor data") ); @@ -277,15 +310,6 @@ WXHCURSOR wxCursor::GetHCURSOR() const return (M_CURSORDATA ? M_CURSORDATA->m_hCursor : 0); } -bool wxCursor::IsOk() const -{ -#if wxMAC_USE_COCOA - return GetHCURSOR() != NULL; -#else - return (m_refData != NULL && ( M_CURSORDATA->m_hCursor != NULL || M_CURSORDATA->m_themeCursor != -1 ) ) ; -#endif -} - #if !wxMAC_USE_COCOA short GetCTabIndex( CTabHandle colors , RGBColor *col ) { @@ -665,7 +689,9 @@ wxCursor::~wxCursor() } // Global cursor setting +wxCursor gGlobalCursor; void wxSetCursor(const wxCursor& cursor) { cursor.MacInstall() ; + gGlobalCursor = cursor; }