X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2d4e4f802f8a165c8d41053d2cd6d33c32b08f79..dc259b792613550edda31cc6202b42e172e2a240:/src/mac/utils.cpp?ds=sidebyside diff --git a/src/mac/utils.cpp b/src/mac/utils.cpp index d651da7ca9..aae75333d7 100644 --- a/src/mac/utils.cpp +++ b/src/mac/utils.cpp @@ -317,49 +317,38 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c } #endif // wxUSE_RESOURCES -int wxBusyCursorCount = 0; -extern CursHandle gMacCurrentCursor ; -CursHandle gMacStoredActiveCursor = NULL ; +int gs_wxBusyCursorCount = 0; +extern wxCursor gMacCurrentCursor ; +wxCursor gMacStoredActiveCursor ; // Set the cursor to the busy cursor for all windows void wxBeginBusyCursor(wxCursor *cursor) { - wxBusyCursorCount ++; - if (wxBusyCursorCount == 1) + if (gs_wxBusyCursorCount++ == 0) { gMacStoredActiveCursor = gMacCurrentCursor ; - ::SetCursor( *::GetCursor( watchCursor ) ) ; - } - else - { - // TODO + cursor->MacInstall() ; } + //else: nothing to do, already set } // Restore cursor to normal void wxEndBusyCursor() { - if (wxBusyCursorCount == 0) - return; + wxCHECK_RET( gs_wxBusyCursorCount > 0, + wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") ); - wxBusyCursorCount --; - if (wxBusyCursorCount == 0) + if (--gs_wxBusyCursorCount == 0) { - if ( gMacStoredActiveCursor ) - ::SetCursor( *gMacStoredActiveCursor ) ; - else - { - Cursor MacArrow ; - ::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ; - } - gMacStoredActiveCursor = NULL ; + gMacStoredActiveCursor.MacInstall() ; + gMacStoredActiveCursor = wxNullCursor ; } } // TRUE if we're between the above two calls bool wxIsBusy() { - return (wxBusyCursorCount > 0); + return (gs_wxBusyCursorCount > 0); } wxString wxMacFindFolder( short vol, @@ -518,3 +507,18 @@ wxString wxGetOsDescription() #endif } +//--------------------------------------------------------------------------- +// wxMac Specific utility functions +//--------------------------------------------------------------------------- + +#if TARGET_CARBON +// converts this string into a carbon foundation string with optional pc 2 mac encoding +CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) +{ + return CFStringCreateWithCString( kCFAllocatorSystemDefault , str.c_str() , + pc2macEncoding ? + kCFStringEncodingWindowsLatin1 : CFStringGetSystemEncoding() ) ; +} + +#endif //TARGET_CARBON +