// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#include "wx/utils.h"
-#include "wx/app.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/app.h"
+ #if wxUSE_GUI
+ #include "wx/font.h"
+ #endif
+#endif
+
#include "wx/apptrait.h"
#if wxUSE_GUI
#include "wx/mac/uma.h"
- #include "wx/font.h"
-#else
- #include "wx/intl.h"
#endif
#include <ctype.h>
#include <wtime.h>
#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
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()
{
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)
wxCursor gMacStoredActiveCursor ;
// Set the cursor to the busy cursor for all windows
-void wxBeginBusyCursor(wxCursor *cursor)
+void wxBeginBusyCursor(const wxCursor *cursor)
{
if (gs_wxBusyCursorCount++ == 0)
{
#if wxUSE_BASE
-wxString wxMacFindFolder( short vol,
+wxString wxMacFindFolderNoSeparator( short vol,
OSType folderType,
Boolean createFolder)
{
FSSpec file ;
if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
{
- strDir = wxMacFSSpec2MacFilename( &file ) + wxFILE_SEP_PATH ;
+ strDir = wxMacFSSpec2MacFilename( &file );
}
}
return strDir ;
}
+wxString wxMacFindFolder( short vol,
+ OSType folderType,
+ Boolean createFolder)
+{
+ return wxMacFindFolderNoSeparator(vol, folderType, createFolder) + wxFILE_SEP_PATH;
+}
+
#endif // wxUSE_BASE
#if wxUSE_GUI
return NULL;
}
-bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
+bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspaceSize_t *pFree)
{
if ( path.empty() )
return false;
OSErr err = XGetVolumeInfoNoName( volumeName , 0 , &pb ) ;
if ( err == noErr ) {
if ( pTotal ) {
- (*pTotal) = wxLongLong( pb.ioVTotalBytes ) ;
+ (*pTotal) = wxDiskspaceSize_t( pb.ioVTotalBytes ) ;
}
if ( pFree ) {
- (*pFree) = wxLongLong( pb.ioVFreeBytes ) ;
+ (*pFree) = wxDiskspaceSize_t( pb.ioVFreeBytes ) ;
}
}
void wxMacConvertNewlines13To10( wxString * data )
{
- size_t len = data->Length() ;
+ size_t len = data->length() ;
if ( len == 0 || wxStrchr(data->c_str(),0x0d)==NULL)
return ;
void wxMacConvertNewlines10To13( wxString * data )
{
- size_t len = data->Length() ;
+ size_t len = data->length() ;
- if ( data->Length() == 0 || wxStrchr(data->c_str(),0x0a)==NULL)
+ if ( data->empty() || wxStrchr(data->c_str(),0x0a)==NULL)
return ;
wxString temp(*data) ;