diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index 4f81cc473e..8e20c9dd3c 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -618,4 +618,45 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const #endif // wxUSE_GUI +// our OS version is the same in non GUI and GUI cases +wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn) +{ +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_10 + if ([NSProcessInfo instancesRespondToSelector:@selector(operatingSystemVersion)]) + { + NSOperatingSystemVersion osVer = [NSProcessInfo processInfo].operatingSystemVersion; + + if ( majorVsn != NULL ) + *majorVsn = osVer.majorVersion; + + if ( minorVsn != NULL ) + *minorVsn = osVer.minorVersion; + } + else +#endif + { + // On OS X versions prior to 10.10 NSProcessInfo does not provide the OS version + SInt32 maj, min; + Gestalt(gestaltSystemVersionMajor, &maj); + Gestalt(gestaltSystemVersionMinor, &min); + + if ( majorVsn != NULL ) + *majorVsn = maj; + + if ( minorVsn != NULL ) + *minorVsn = min; + } + + return wxOS_MAC_OSX_DARWIN; +} + +wxString wxGetOsDescription() +{ + NSString* osDesc = [NSProcessInfo processInfo].operatingSystemVersionString; + wxCFStringRef cf(wxCFRetain(osDesc)); + + return wxString::Format(wxT("Mac OS X %s"), + cf.AsString()); +} + #endif // wxOSX_USE_COCOA diff --git a/src/osx/core/utilsexc_base.cpp b/src/osx/core/utilsexc_base.cpp index c33b88a235..3f325b3683 100644 --- a/src/osx/core/utilsexc_base.cpp +++ b/src/osx/core/utilsexc_base.cpp @@ -53,7 +53,7 @@ extern WXDLLIMPEXP_BASE wxSocketManager *wxOSXSocketManagerCF; wxSocketManager *wxOSXSocketManagerCF = NULL; #endif // wxUSE_SOCKETS -#if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_COCOA_OR_CARBON +#if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_CARBON // our OS version is the same in non GUI and GUI cases wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn) @@ -85,6 +85,10 @@ wxString wxGetOsDescription() wxString::FromAscii(name.machine).c_str()); } +#endif // wxOSX_USE_CARBON + +#if ( !wxUSE_GUI && !wxOSX_USE_IPHONE ) || wxOSX_USE_COCOA_OR_CARBON + //=========================================================================== // IMPLEMENTATION //===========================================================================