X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/536732e4822cc89c41a3b753c2a7f83abf98793d..9c7f49f569dcabe360a3a51a94eff77225b39d69:/src/mac/carbon/utils.cpp diff --git a/src/mac/carbon/utils.cpp b/src/mac/carbon/utils.cpp index 345bbe9a4e..ae2d5b4140 100644 --- a/src/mac/carbon/utils.cpp +++ b/src/mac/carbon/utils.cpp @@ -18,7 +18,10 @@ #include "wx/utils.h" #include "wx/app.h" #include "wx/apptrait.h" -#include "wx/mac/uma.h" + +#if wxUSE_GUI + #include "wx/mac/uma.h" +#endif #include @@ -51,6 +54,7 @@ #include #endif +#if wxUSE_BASE #ifndef __DARWIN__ // defined in unix/utilsunx.cpp for Mac OS X @@ -193,11 +197,8 @@ void wxBell() SysBeep(30); } -#if defined(__WXMAC__) && !defined(__DARWIN__) -int wxAppTraits::GetOSVersion(int *majorVsn, int *minorVsn) -#else -int wxGUIAppTraits::GetOSVersion(int *majorVsn, int *minorVsn) -#endif +// our OS version is the same in non GUI and GUI cases +static int DoGetOSVersion(int *majorVsn, int *minorVsn) { long theSystem ; @@ -217,6 +218,19 @@ int wxGUIAppTraits::GetOSVersion(int *majorVsn, int *minorVsn) #endif } +int wxConsoleAppTraits::GetOSVersion(int *majorVsn, int *minorVsn) +{ + return DoGetOSVersion(majorVsn, minorVsn); +} + +#endif // wxUSE_BASE + +#if wxUSE_GUI + +int wxGUIAppTraits::GetOSVersion(int *majorVsn, int *minorVsn) +{ + return DoGetOSVersion(majorVsn, minorVsn); +} // Reading and writing resources (eg WIN.INI, .Xdefaults) #if wxUSE_RESOURCES @@ -349,48 +363,6 @@ wxString wxMacFindFolder( short vol, return strDir ; } -#ifndef __DARWIN__ -wxChar *wxGetUserHome (const wxString& user) -{ - // TODO - return NULL; -} - -bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) -{ - if ( path.empty() ) - return FALSE; - - wxString p = path ; - if (p[0] == ':' ) { - p = wxGetCwd() + p ; - } - - int pos = p.Find(':') ; - if ( pos != wxNOT_FOUND ) { - p = p.Mid(1,pos) ; - } - - p = p + wxT(":") ; - - Str255 volumeName ; - XVolumeParam pb ; - - wxMacStringToPascal( p , volumeName ) ; - OSErr err = XGetVolumeInfoNoName( volumeName , 0 , &pb ) ; - if ( err == noErr ) { - if ( pTotal ) { - (*pTotal) = wxLongLong( pb.ioVTotalBytes ) ; - } - if ( pFree ) { - (*pFree) = wxLongLong( pb.ioVFreeBytes ) ; - } - } - - return err == noErr ; -} -#endif - // Check whether this window wants to process messages, e.g. Stop button // in long calculations. bool wxCheckForInterrupt(wxWindow *wnd) @@ -491,6 +463,10 @@ wxWindow* wxFindWindowAtPoint(const wxPoint& pt) return wxGenericFindWindowAtPoint(pt); } +#endif // wxUSE_GUI + +#if wxUSE_BASE + wxString wxGetOsDescription() { #ifdef WXWIN_OS_DESCRIPTION @@ -501,6 +477,52 @@ wxString wxGetOsDescription() #endif } +#ifndef __DARWIN__ +wxChar *wxGetUserHome (const wxString& user) +{ + // TODO + return NULL; +} + +bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree) +{ + if ( path.empty() ) + return FALSE; + + wxString p = path ; + if (p[0] == ':' ) { + p = wxGetCwd() + p ; + } + + int pos = p.Find(':') ; + if ( pos != wxNOT_FOUND ) { + p = p.Mid(1,pos) ; + } + + p = p + wxT(":") ; + + Str255 volumeName ; + XVolumeParam pb ; + + wxMacStringToPascal( p , volumeName ) ; + OSErr err = XGetVolumeInfoNoName( volumeName , 0 , &pb ) ; + if ( err == noErr ) { + if ( pTotal ) { + (*pTotal) = wxLongLong( pb.ioVTotalBytes ) ; + } + if ( pFree ) { + (*pFree) = wxLongLong( pb.ioVFreeBytes ) ; + } + } + + return err == noErr ; +} +#endif // !__DARWIN__ + +#endif // wxUSE_BASE + +#if wxUSE_GUI + //--------------------------------------------------------------------------- // wxMac Specific utility functions //--------------------------------------------------------------------------- @@ -986,3 +1008,5 @@ extern bool WXDLLEXPORT wxIsDebuggerRunning() #endif // defined(__WXMAC__) && !defined(__DARWIN__) && (__MWERKS__ >= 0x2400) +#endif // wxUSE_GUI +