X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/88a7a4e10ed18f81a576dcd866cfbf02bf404c00..3f4a2351e4c677c88c18ea812b609477adee7380:/src/mac/classic/utils.cpp?ds=sidebyside diff --git a/src/mac/classic/utils.cpp b/src/mac/classic/utils.cpp index d5e2c91cfb..a14b39d556 100644 --- a/src/mac/classic/utils.cpp +++ b/src/mac/classic/utils.cpp @@ -15,14 +15,16 @@ #ifndef WX_PRECOMP #include "wx/intl.h" + #include "wx/app.h" + #if wxUSE_GUI + #include "wx/font.h" + #endif #endif -#include "wx/app.h" #include "wx/apptrait.h" #if wxUSE_GUI #include "wx/mac/uma.h" - #include "wx/font.h" #endif #include @@ -54,33 +56,28 @@ #include #endif -// --------------------------------------------------------------------------- -// code used in both base and GUI compilation -// --------------------------------------------------------------------------- +#if wxUSE_BASE // our OS version is the same in non GUI and GUI cases -static int DoGetOSVersion(int *majorVsn, int *minorVsn) +wxOperatingSystemId wxGetOsVersion(int *majorVsn, int *minorVsn) { - long theSystem ; + long theSystem; + Gestalt(gestaltSystemVersion, &theSystem); - // are there x-platform conventions ? + if ( majorVsn != NULL ) + *majorVsn = (theSystem >> 8); - Gestalt(gestaltSystemVersion, &theSystem) ; - if (minorVsn != NULL) { - *minorVsn = (theSystem & 0xFF ) ; - } - if (majorVsn != NULL) { - *majorVsn = (theSystem >> 8 ) ; - } -#ifdef __DARWIN__ - return wxMAC_DARWIN; + if ( minorVsn != NULL ) + *minorVsn = (theSystem & 0xFF); + + +#if defined( __DARWIN__ ) + return wxOS_MAC_OSX_DARWIN; #else - return wxMAC; + return wxOS_MAC_OS; #endif } -#if wxUSE_BASE - #ifndef __DARWIN__ // defined in unix/utilsunx.cpp for Mac OS X @@ -189,18 +186,6 @@ bool wxShutdown(wxShutdownFlags wFlags) return false; } -wxPowerType wxGetPowerType() -{ - // TODO - return wxPOWER_UNKNOWN; -} - -wxBatteryState wxGetBatteryState() -{ - // TODO - return wxBATTERY_UNKNOWN_STATE; -} - // Get free memory in bytes, or -1 if cannot determine amount (e.g. on UNIX) wxMemorySize wxGetFreeMemory() { @@ -234,29 +219,16 @@ void wxBell() SysBeep(30); } -wxToolkitInfo& wxConsoleAppTraits::GetToolkitInfo() -{ - static wxToolkitInfo info; - info.os = DoGetOSVersion(&info.versionMajor, &info.versionMinor); - info.name = _T("wxBase"); - return info; -} - #endif // wxUSE_BASE #if wxUSE_GUI -wxToolkitInfo& wxGUIAppTraits::GetToolkitInfo() +wxPortId wxGUIAppTraits::GetToolkitVersion(int *verMaj, int *verMin) const { - static wxToolkitInfo info; - info.os = DoGetOSVersion(&info.versionMajor, &info.versionMinor); - info.shortName = _T("mac"); - info.name = _T("wxMac"); -#ifdef __WXUNIVERSAL__ - info.shortName << _T("univ"); - info.name << _T("/wxUniversal"); -#endif - return info; + // We suppose that toolkit version is the same as OS version under Mac + wxGetOsVersion(verMaj, verMin); + + return wxPORT_MAC; } // Reading and writing resources (eg WIN.INI, .Xdefaults)