#include <string.h>
#include <stdarg.h>
-#ifdef __DARWIN__
-# include "MoreFilesX.h"
-#else
-# include "MoreFiles.h"
-# include "MoreFilesExtras.h"
-#endif
+#include "MoreFilesX.h"
#ifndef __DARWIN__
#include <Threads.h>
OSType folderType,
Boolean createFolder)
{
- short vRefNum ;
- long dirID ;
+ FSRef fsRef ;
wxString strDir ;
- if ( FindFolder( vol, folderType, createFolder, &vRefNum, &dirID) == noErr)
- {
- FSSpec file ;
- if ( FSMakeFSSpec( vRefNum , dirID , "\p" , &file ) == noErr )
- {
- strDir = wxMacFSSpec2MacFilename( &file ) + wxFILE_SEP_PATH ;
- }
- }
+ if ( FSFindFolder( vol, folderType, createFolder, &fsRef) == noErr)
+ strDir = wxMacFSRefToPath( &fsRef ) + wxFILE_SEP_PATH ;
+
return strDir ;
}
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 ) ;
- }
+ OSErr err = noErr ;
+
+ FSRef fsRef ;
+ err = wxMacPathToFSRef( p , &fsRef ) ;
+ if ( noErr == err )
+ {
+ FSVolumeRefNum vRefNum ;
+ err = FSGetVRefNum( &fsRef , &vRefNum ) ;
+ if ( noErr == err )
+ {
+ UInt64 freeBytes , totalBytes ;
+ err = FSGetVInfo( vRefNum , NULL , &freeBytes , &totalBytes ) ;
+ if ( noErr == err )
+ {
+ if ( pTotal )
+ *pTotal = wxLongLong( totalBytes ) ;
+ if ( pFree )
+ *pFree = wxLongLong( freeBytes ) ;
+ }
+ }
}
-
+
return err == noErr ;
}
#endif // !__DARWIN__
void wxMacControl::SetRect( Rect *r )
{
#if TARGET_API_MAC_OSX
- HIRect hir = { r->left , r->top , r->right - r->left , r->bottom - r->top } ;
+ //A HIRect is actually a CGRect on OSX - which consists of two structures -
+ //CGPoint and CGSize, which have two floats each
+ HIRect hir = { { r->left , r->top }, { r->right - r->left , r->bottom - r->top } } ;
HIViewSetFrame ( m_controlRef , &hir ) ;
#else
SetControlBounds( m_controlRef , r ) ;
void wxMacControl::SetTitle( const wxString &title )
{
- UMASetControlTitle( m_controlRef , title , m_font.GetEncoding() ) ;
+ wxFontEncoding encoding;
+
+ if ( m_font.Ok() )
+ encoding = m_font.GetEncoding();
+ else
+ encoding = wxFont::GetDefaultEncoding();
+
+ UMASetControlTitle( m_controlRef , title , encoding ) ;
}
void wxMacControl::GetFeatures( UInt32 * features )