#error "please update to Apple's lastest universal headers from http://developer.apple.com/sdk/"
#endif
+#if wxUSE_GUI
+
#include "wx/window.h"
class wxMacPortStateHelper
// app.h
bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) ;
+#endif // wxUSE_GUI
+
// filefn.h
WXDLLEXPORT wxString wxMacFSSpec2MacFilename( const FSSpec *spec ) ;
WXDLLEXPORT void wxMacFilename2FSSpec( const char *path , FSSpec *spec ) ;
+WXDLLEXPORT void wxMacFilename2FSSpec( const wxChar *path , FSSpec *spec ) ;
# ifndef __DARWIN__
// Mac file names are POSIX (Unix style) under Darwin, so these are not needed
WXDLLEXPORT wxString wxMacFSSpec2UnixFilename( const FSSpec *spec ) ;
OSType folderType,
Boolean createFolder);
+#if wxUSE_GUI
+
GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
void wxMacDestroyGWorld( GWorldPtr gw ) ;
PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
#define MAC_WXPOINTPTR(a) ((Point*)a)
#define MAC_WXHMENU(a) ((MenuHandle)a)
+#endif // wxUSE_GUI
+
//---------------------------------------------------------------------------
// wxMac string conversions
//---------------------------------------------------------------------------
-void wxMacConvertToPC( const char *from , char *to , int len ) ;
-void wxMacConvertFromPC( const char *from , char *to , int len ) ;
-void wxMacConvertToPC( const char *from , char *to , int len ) ;
-
-wxString wxMacMakeMacStringFromPC( const char * p ) ;
-
-wxString wxMacMakePCStringFromMac( const char * p ) ;
-
-
-// converts this c string into a wxString with optional mac 2 pc encoding
-wxString wxMacMakeStringFromMacString( const char* from , bool mac2pcEncoding ) ;
+void wxMacSetupConverters() ;
+void wxMacCleanupConverters() ;
-// converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
-inline wxString wxMacMakeStringFromMacString( const char* from )
- { return wxMacMakeStringFromMacString( from , wxApp::s_macDefaultEncodingIsPC ) ; }
+void wxMacStringToPascal( const wxString&from , StringPtr to ) ;
+wxString wxMacMakeStringFromPascal( ConstStringPtr from ) ;
-// converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
-inline wxString wxMacMakeStringFromMacString( const wxString& from )
- { return wxApp::s_macDefaultEncodingIsPC ?
- wxMacMakeStringFromMacString( from.c_str() , true ) : from ; }
+void wxMacConvertNewlines13To10( char * data ) ;
+void wxMacConvertNewlines10To13( char * data ) ;
+void wxMacConvertNewlines13To10( wxString *data ) ;
+void wxMacConvertNewlines10To13( wxString *data ) ;
-//
-// Pascal Strings
-//
-
-// converts this string into a pascal with optional pc 2 mac encoding
-void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding ) ;
-
-// converts this string into a pascal with pc 2 mac encoding if s_macDefaultEncodingIsPC
-inline void wxMacStringToPascal( const char * from , StringPtr to )
- { wxMacStringToPascal( from , to , wxApp::s_macDefaultEncodingIsPC ) ; }
+#if wxUSE_UNICODE
+void wxMacConvertNewlines13To10( wxChar * data ) ;
+void wxMacConvertNewlines10To13( wxChar * data ) ;
+#endif
-// converts this string into a pascal with optional mac 2 pc encoding
-wxString wxMacMakeStringFromPascal( ConstStringPtr from , bool mac2pcEncoding ) ;
+#if TARGET_CARBON
-// converts this pascal string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
-inline wxString wxMacMakeStringFromPascal( ConstStringPtr from )
- { return wxMacMakeStringFromPascal( from , wxApp::s_macDefaultEncodingIsPC ) ; }
+class wxMacCFStringHolder
+{
+public:
+ wxMacCFStringHolder()
+ {
+ m_cfs = NULL ;
+ m_release = false ;
+ }
+
+ wxMacCFStringHolder(const wxString &str , wxFontEncoding encoding )
+ {
+ m_cfs = NULL ;
+ m_release = false ;
+ Assign( str , encoding ) ;
+ }
+
+ wxMacCFStringHolder(CFStringRef ref , bool release = true )
+ {
+ m_cfs = ref ;
+ m_release = release ;
+ }
+
+ ~wxMacCFStringHolder()
+ {
+ Release() ;
+ }
+
+ CFStringRef Detach()
+ {
+ CFStringRef retval = m_cfs ;
+ m_release = false ;
+ m_cfs = NULL ;
+ return retval ;
+ }
+
+ void Release()
+ {
+ if ( m_release && m_cfs)
+ CFRelease( m_cfs ) ;
+ m_cfs = NULL ;
+ }
+
+ void Assign( const wxString &str , wxFontEncoding encoding ) ;
+
+ operator CFStringRef () { return m_cfs; }
+ wxString AsString( wxFontEncoding encoding = wxFONTENCODING_DEFAULT ) ;
+
+private:
+
+ CFStringRef m_cfs;
+ bool m_release ;
+} ;
-//
-// CFStringRefs (Carbon only)
-//
+#endif
-#if TARGET_CARBON
-// converts this string into a carbon foundation string with optional pc 2 mac encoding
-CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) ;
-// converts this string into a carbon foundation string with optional pc 2 mac encoding
-inline CFStringRef wxMacCreateCFString( const wxString &str )
- { return wxMacCreateCFString( str , wxApp::s_macDefaultEncodingIsPC ) ; }
-#endif //TARGET_CARBON
+wxUint32 wxMacGetSystemEncFromFontEnc(wxFontEncoding encoding) ;
+wxFontEncoding wxMacGetFontEncFromSystemEnc(wxUint32 encoding) ;
#endif