# endif /* wxUSE_DYNAMIC_LOADER */
#endif /* wxMSW */
+/* wxMAC-specific dependencies */
+#ifdef __WXMAC__
+# if wxUSE_UNICODE
+# if !TARGET_CARBON
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_UNICODE is only supported for Carbon Targets."
+# else
+# define wxUSE_UNICODE 0
+# endif
+# endif
+# endif
+#endif /* wxMAC */
/* wxMotif-specific dependencies */
#if defined(__WXMOTIF__) && wxUSE_NOTEBOOK && !wxUSE_TAB_DIALOG
# undef wxUSE_TAB_DIALOG
#if wxUSE_UNICODE
# define wxNEED_WX_UNISTD_H
+#if defined(__MWERKS__) && defined(macintosh)
+ #include <sys/stat.h>
+#endif
WXDLLEXPORT int wxStat( const wxChar *file_name, wxStructStat *buf );
WXDLLEXPORT int wxAccess( const wxChar *pathname, int mode );
WXDLLEXPORT int wxOpen( const wxChar *pathname, int flags, mode_t mode );
#include "wx/button.h"
-WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
#define wxDEFAULT_BUTTON_MARGIN 4
#include "wx/control.h"
#include "wx/gdicmn.h"
-WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
// Pushbutton
class WXDLLEXPORT wxButton: public wxButtonBase
#include "wx/dynarray.h"
-WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ;
wxColour( const wxString &colourName )
: m_isInit(FALSE), m_red(0), m_blue(0), m_green(0)
{ InitFromName(colourName); }
- wxColour( const char *colourName )
+ wxColour( const wxChar *colourName )
: m_isInit(FALSE), m_red(0), m_blue(0), m_green(0)
{ InitFromName(colourName); }
#include "wx/textctrl.h"
#include "wx/choice.h"
-WXDLLEXPORT_DATA(extern const char*) wxComboBoxNameStr;
-WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
+WXDLLEXPORT_DATA(extern const wxChar*) wxComboBoxNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
// Combobox item
class WXDLLEXPORT wxComboBox: public wxChoice
#include "wx/panel.h"
-WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
* File selector
*/
-WXDLLEXPORT_DATA(extern const char*) wxFileSelectorPromptStr;
-WXDLLEXPORT_DATA(extern const char*) wxFileSelectorDefaultWildcardStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorPromptStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxFileSelectorDefaultWildcardStr;
class WXDLLEXPORT wxFileDialog: public wxDialog
{
int m_filterIndex;
public:
wxFileDialog(wxWindow *parent, const wxString& message = wxFileSelectorPromptStr,
- const wxString& defaultDir = "", const wxString& defaultFile = "", const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
+ const wxString& defaultDir = wxEmptyString, const wxString& defaultFile = wxEmptyString, const wxString& wildCard = wxFileSelectorDefaultWildcardStr,
long style = 0, const wxPoint& pos = wxDefaultPosition);
inline void SetMessage(const wxString& message) { m_message = message; }
#define wxFILE_MUST_EXIST 0x0010
// File selector - backward compatibility
-WXDLLEXPORT wxString wxFileSelector(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
- const char *default_filename = NULL, const char *default_extension = NULL,
- const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
+WXDLLEXPORT wxString wxFileSelector(const wxChar *message = wxFileSelectorPromptStr, const wxChar *default_path = NULL,
+ const wxChar *default_filename = NULL, const wxChar *default_extension = NULL,
+ const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = NULL, int x = -1, int y = -1);
// An extended version of wxFileSelector
-WXDLLEXPORT wxString wxFileSelectorEx(const char *message = wxFileSelectorPromptStr, const char *default_path = NULL,
- const char *default_filename = NULL, int *indexDefaultExtension = NULL,
- const char *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
+WXDLLEXPORT wxString wxFileSelectorEx(const wxChar *message = wxFileSelectorPromptStr, const wxChar *default_path = NULL,
+ const wxChar *default_filename = NULL, int *indexDefaultExtension = NULL,
+ const wxChar *wildcard = wxFileSelectorDefaultWildcardStr, int flags = 0,
wxWindow *parent = NULL, int x = -1, int y = -1);
// Generic file load dialog
-WXDLLEXPORT wxString wxLoadFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
+WXDLLEXPORT wxString wxLoadFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name = NULL, wxWindow *parent = NULL);
// Generic file save dialog
-WXDLLEXPORT wxString wxSaveFileSelector(const char *what, const char *extension, const char *default_name = NULL, wxWindow *parent = NULL);
+WXDLLEXPORT wxString wxSaveFileSelector(const wxChar *what, const wxChar *extension, const wxChar *default_name = NULL, wxWindow *parent = NULL);
#endif
// _WX_FILEDLG_H_
, m_style(wxNORMAL)
, m_weight(wxNORMAL)
, m_underlined(FALSE)
- , m_faceName("Geneva")
+ , m_faceName(wxT("Geneva"))
, m_encoding(wxFONTENCODING_DEFAULT)
, m_macFontNum(0)
, m_macFontSize(0)
, m_macATSUFontID()
{
Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
- "Geneva", wxFONTENCODING_DEFAULT);
+ wxT("Geneva"), wxFONTENCODING_DEFAULT);
}
wxFontRefData(const wxFontRefData& data)
#include "wx/accel.h"
#include "wx/icon.h"
-WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
-WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
class WXDLLEXPORT wxMenuBar;
class WXDLLEXPORT wxStatusBar;
#include "wx/control.h"
-WXDLLEXPORT_DATA(extern const char*) wxGaugeNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr;
// Group box
class WXDLLEXPORT wxGauge: public wxGaugeBase
void SetCurrent();
void Update(); // must be called after window drag/grows/zoom or clut change
- void SetColour(const char *colour);
+ void SetColour(const wxChar *colour);
void SwapBuffers();
public:
wxGLCanvas(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
- const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette);
+ const wxString& name = wxT("GLCanvas") , int *attribList = 0, const wxPalette& palette = wxNullPalette);
wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
- const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas",
+ const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxT("GLCanvas"),
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
- const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
+ const wxString& name = wxT("GLCanvas"), int *attribList = 0, const wxPalette& palette = wxNullPalette );
~wxGLCanvas();
int *attribList, const wxPalette& palette);
void SetCurrent();
- void SetColour(const char *colour);
+ void SetColour(const wxChar *colour);
void SwapBuffers();
void UpdateContext();
void SetViewport();
public:
inline wxICONResourceHandler()
{
- m_name = "ICON resource";
- m_extension = "";
+ m_name = wxT("ICON resource");
+ m_extension = wxEmptyString;
m_type = wxBITMAP_TYPE_ICON_RESOURCE;
};
protected:
void MacDestroy() ;
void MacDelete( int n ) ;
- void MacInsert( int n , const char * text) ;
- void MacAppend( const char * text) ;
- void MacSet( int n , const char *text ) ;
+ void MacInsert( int n , const wxString& item) ;
+ void MacAppend( const wxString& item) ;
+ void MacSet( int n , const wxString& item ) ;
void MacClear() ;
void MacSetSelection( int n , bool select ) ;
int MacGetSelection() const ;
#include "wx/frame.h"
-WXDLLEXPORT_DATA(extern const char*) wxFrameNameStr;
-WXDLLEXPORT_DATA(extern const char*) wxStatusLineNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxStatusLineNameStr;
class WXDLLEXPORT wxMDIClientWindow;
class WXDLLEXPORT wxMDIChildFrame;
: wxGDIObject()
{ Ref(metafile); }
- wxMetafile(const wxString& file = "");
+ wxMetafile(const wxString& file = wxEmptyString);
~wxMetafile(void);
// After this is called, the metafile cannot be used for anything
public:
// Don't supply origin and extent
// Supply them to wxMakeMetaFilePlaceable instead.
- wxMetafileDC(const wxString& file = "");
+ wxMetafileDC(const wxString& file = wxEmptyString);
// Supply origin and extent (recommended).
// Then don't need to supply them to wxMakeMetaFilePlaceable.
* Message box dialog
*/
-WXDLLEXPORT_DATA(extern const char*) wxMessageBoxCaptionStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
class WXDLLEXPORT wxMessageDialog: public wxDialog
{
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
- const wxString& name = "notebook");
+ const wxString& name = wxT("notebook"));
// Create() function
bool Create(wxWindow *parent,
wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
- const wxString& name = "notebook");
+ const wxString& name = wxT("notebook"));
// dtor
~wxNotebook();
public:
inline wxPNGFileHandler(void)
{
- m_name = "PNG bitmap file";
- m_extension = "bmp";
+ m_name = wxT("PNG bitmap file");
+ m_extension = wxT("bmp");
m_type = wxBITMAP_TYPE_PNG;
};
// 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 ) ;
// wxMac string conversions
//---------------------------------------------------------------------------
+void wxMacSetupConverters() ;
+void wxMacCleanupConverters() ;
+
+void wxMacStringToPascal( const wxString&from , StringPtr to ) ;
+wxString wxMacMakeStringFromPascal( ConstStringPtr from ) ;
+
+wxCharBuffer wxMacStringToCString( const wxString &from ) ;
+wxWCharBuffer wxMacStringToWString( const wxString &from ) ;
+wxString wxMacMakeStringFromCString( const char * from , int len ) ;
+wxString wxMacMakeStringFromCString( const char * from ) ;
+
+#if TARGET_CARBON
+
+class wxMacCFStringHolder
+{
+public:
+ wxMacCFStringHolder()
+ {
+ m_cfs = NULL ;
+ m_release = false ;
+ }
+
+ wxMacCFStringHolder(const wxString &str)
+ {
+ m_cfs = NULL ;
+ m_release = false ;
+ Assign( str ) ;
+ }
+
+ wxMacCFStringHolder(CFStringRef ref , bool release = true )
+ {
+ m_cfs = ref ;
+ m_release = release ;
+ }
+
+ ~wxMacCFStringHolder()
+ {
+ Release() ;
+ }
+
+ wxMacCFStringHolder& operator=(const wxString& str)
+ {
+ Release() ;
+ Assign( str ) ;
+ return *this;
+ }
+
+ 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 ;
+ }
+
+ operator CFStringRef () { return m_cfs; }
+ wxString AsString() ;
+
+private:
+ void Assign( const wxString &str ) ;
+
+ CFStringRef m_cfs;
+ bool m_release ;
+} ;
+
+// CFStringRef wxMacStringToCFString( const wxString &str ) ;
+// wxString wxMacMakeStringFromCFString( CFStringRef cf ) ;
+#endif
+
+#if 0
+
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 wxChar * p ) ;
+
+wxString wxMacMakePCStringFromMac( const wxChar * p ) ;
+
+
+// converts this c string into a wxString with optional mac 2 pc encoding
+wxString wxMacMakeStringFromMacString( const wxChar* from , bool mac2pcEncoding ) ;
+
+// converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
+inline wxString wxMacMakeStringFromMacString( const wxChar* from )
+ { return wxMacMakeStringFromMacString( from , wxApp::s_macDefaultEncodingIsPC ) ; }
+
+#if wxUSE_UNICODE
+
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 ) ;
inline wxString wxMacMakeStringFromMacString( const char* from )
{ return wxMacMakeStringFromMacString( from , wxApp::s_macDefaultEncodingIsPC ) ; }
+#endif
+
// 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 ?
//
// converts this string into a pascal with optional pc 2 mac encoding
-void wxMacStringToPascal( const char * from , StringPtr to , bool pc2macEncoding ) ;
+void wxMacStringToPascal( const wxChar * 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 )
+inline void wxMacStringToPascal( const wxChar * from , StringPtr to )
{ wxMacStringToPascal( from , to , wxApp::s_macDefaultEncodingIsPC ) ; }
// converts this string into a pascal with optional mac 2 pc encoding
#if TARGET_CARBON
// converts this string into a carbon foundation string with optional pc 2 mac encoding
-CFStringRef wxMacCreateCFString( const wxString &str , bool pc2macEncoding ) ;
+CFStringRef wxMacStringToCFString( 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 ) ; }
+inline CFStringRef wxMacStringToCFString( const wxString &str )
+ { return wxMacStringToCFString( str , wxApp::s_macDefaultEncodingIsPC ) ; }
#endif //TARGET_CARBON
+#endif
#endif
// _WX_PRIVATE_H_
#include "wx/control.h"
-WXDLLEXPORT_DATA(extern const char*) wxScrollBarNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxScrollBarNameStr;
// Scrollbar item
class WXDLLEXPORT wxScrollBar: public wxControl
#include "wx/slider.h"
#include "wx/stattext.h"
-WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxSliderNameStr;
// Slider
class WXDLLEXPORT wxSlider: public wxControl
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
- const wxString& name = "wxSpinButton")
+ const wxString& name = wxT("wxSpinButton"))
{
Create(parent, id, pos, size, style, name);
}
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSP_VERTICAL | wxSP_ARROW_KEYS,
- const wxString& name = "wxSpinButton");
+ const wxString& name = wxT("wxSpinButton"));
// accessors
#include "wx/control.h"
-WXDLLEXPORT_DATA(extern const char*) wxStaticBoxNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBoxNameStr;
// Group box
class WXDLLEXPORT wxStaticBox: public wxControl
wxTabCtrl();
inline wxTabCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = 0, const wxString& name = "tabCtrl")
+ long style = 0, const wxString& name = wxT("tabCtrl"))
{
Create(parent, id, pos, size, style, name);
}
// Operations
bool Create(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
- long style = 0, const wxString& name = "tabCtrl");
+ long style = 0, const wxString& name = wxT("tabCtrl"));
// Delete all items
bool DeleteAllItems();
// Accessors
// Operations
- bool SetIcon(const wxIcon& icon, const wxString& tooltip = "");
+ bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString);
bool RemoveIcon();
// Overridables
#include "wx/control.h"
-WXDLLEXPORT_DATA(extern const char*) wxTextCtrlNameStr;
-WXDLLEXPORT_DATA(extern const char*) wxEmptyString;
+WXDLLEXPORT_DATA(extern const wxChar*) wxTextCtrlNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
// Single-line text item
class WXDLLEXPORT wxTextCtrl: public wxTextCtrlBase
#include "wx/tbarbase.h"
#include "wx/dynarray.h"
-WXDLLEXPORT_DATA(extern const char*) wxToolBarNameStr;
+WXDLLEXPORT_DATA(extern const wxChar*) wxToolBarNameStr;
class WXDLLEXPORT wxToolBar: public wxToolBarBase
{
GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ;
void UMADisposeWindow( WindowRef inWindowRef ) ;
-void UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
+void UMASetWTitle( WindowRef inWindowRef , const wxString& title ) ;
void UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
void UMADrawGrowIcon( WindowRef inWindowRef ) ;
void UMAHideControl (ControlHandle theControl);
void UMAActivateControl (ControlHandle inControl);
void UMADeactivateControl (ControlHandle inControl);
+void UMASetControlTitle( ControlHandle inControl , const wxString& title ) ;
void UMAMoveControl( ControlHandle inControl , short x , short y ) ;
void UMASizeControl( ControlHandle inControl , short x , short y ) ;
// ----------------------------------------------------------------------------
// filenames are multibyte on Unix and probably widechar on Windows?
-#if defined(__UNIX__) || defined(__BORLANDC__)
+#if defined(__UNIX__) || defined(__BORLANDC__) || defined(__WXMAC__ )
#define wxMBFILES 1
#else
#define wxMBFILES 0
#define wxNEED_WX_STDIO_H
#define wxNEED_WX_STDLIB_H
#define wxNEED_WX_TIME_H
- #else // !glibc
+ #elif defined(__MWERKS__) && defined(macintosh)
+ // ctype.h functions (wctype.h)
+ #define wxIsalnum iswalnum
+ #define wxIsalpha iswalpha
+ #define wxIsctrl iswcntrl
+ #define wxIsdigit iswdigit
+ #define wxIsgraph iswgraph
+ #define wxIslower iswlower
+ #define wxIsprint iswprint
+ #define wxIspunct iswpunct
+ #define wxIsspace iswspace
+ #define wxIsupper iswupper
+ #define wxIsxdigit iswxdigit
+ #define wxTolower towlower
+ #define wxToupper towupper
+
+ // string.h functions (wchar.h)
+ #define wxStrcat wcscat
+ #define wxStrchr wcschr
+ #define wxStrcmp wcscmp
+ #define wxStrcoll wcscoll
+ #define wxStrcpy wcscpy
+ #define wxStrcspn wcscspn
+ #define wxStrlen_ wxWcslen // wxStrlen_() is used in wxStrlen()
+ #define wxStrncat wcsncat
+ #define wxStrncmp wcsncmp
+ #define wxStrncpy wcsncpy
+ #define wxStrpbrk wcspbrk
+ #define wxStrrchr wcsrchr
+ #define wxStrspn wcsspn
+ #define wxStrstr wcsstr
+ #define wxStrtod wcstod
+ #define wxStrtol wcstol
+ #define wxStrtoul wcstoul
+ #define wxStrxfrm wcsxfrm
+
+ #define wxFgetc fgetwc
+ #define wxFgetchar fgetwchar
+ #define wxFgets fgetws
+ #define wxFputc fputwc
+ #define wxFputchar fputwchar
+ #define wxGetc getwc
+ #define wxGetchar getwchar
+ #define wxGets getws
+ #define wxUngetc ungetwc
+
+ #define wxNEED_FPUTWC
+
+ #include <stdio.h>
+
+ int wxFputs(const wxChar *ch, FILE *stream);
+ int wxPutc(wxChar ch, FILE *stream);
+
+ #define wxPuts(ws) wxFputs(ws, stdout)
+ #define wxPutchar(wch) wxPutc(wch, stdout)
+
+ // we need %s to %ls conversion for printf and scanf etc
+ #define wxNEED_PRINTF_CONVERSION
+ // glibc doesn't have wide char equivalents of the other stuff so
+ // use our own versions
+ #define wxNEED_WX_STDIO_H
+ #define wxNEED_WX_STDLIB_H
+ #define wxNEED_WX_TIME_H
+ #else // !metrowerks for apple
#error "Please define wide character functions for your environment"
#endif
#else // ASCII
// time.h functions
#ifdef wxNEED_WX_TIME_H
+#if defined(__MWERKS__) && defined(macintosh)
+ #include <time.h>
+#endif
WXDLLEXPORT size_t wxStrftime(wxChar *s, size_t max,
const wxChar *fmt, const struct tm *tm);
#endif // wxNEED_WX_TIME_H
CFragSymbolClass symClass;
Str255 symName;
-#if TARGET_CARBON
- c2pstrcpy( (StringPtr) symName, name );
-#else
- strcpy( (char *) symName, name );
- c2pstr( (char *) symName );
-#endif
+ wxMacStringToPascal( name.c_str() , symName ) ;
+
if( FindSymbol( ((CFragConnectionID)dllHandle), symName, &symAddress, &symClass ) == noErr )
symbol = (void *)symAddress;
{
// if bOverwrite we create a new file or truncate the existing one,
// otherwise we only create the new file and fail if it already exists
-#if defined(__WXMAC__) && !defined(__UNIX__)
+#if defined(__WXMAC__) && !defined(__UNIX__) && !wxUSE_UNICODE
// Dominic Mazzoni [dmazzoni+@cs.cmu.edu] reports that open is still broken on the mac, so we replace
// int fd = open(wxUnix2MacFilename( szFileName ), O_CREAT | (bOverwrite ? O_TRUNC : O_EXCL), access);
int fd = creat( szFileName , accessMode);
if ( wxStrchr(szFile, wxT('.')) == NULL )
#if defined( __WXMAC__ )
- str << " Preferences";
+ str << wxT(" Preferences") ;
#elif defined( __UNIX__ )
str << wxT(".conf");
#else // Windows
#endif
#ifdef __WXMAC__
- str << " Preferences";
+ str << wxT(" Preferences") ;
#endif
return str;
#include <stat.h>
#include <unistd.h>
#include <unix.h>
+ #include <fcntl.h>
#endif
#ifdef __UNIX__
(*myPath)[length-1] = 0 ;
// create path string for return value
- wxString result( (char*) *myPath ) ;
+ wxString result = wxMacMakeStringFromCString( *myPath ) ;
// free allocated handle
::HUnlock( myPath ) ;
// Mac file names are POSIX (Unix style) under Darwin
// therefore the conversion functions below are not needed
-static char sMacFileNameConversion[ 1000 ] ;
+static wxChar sMacFileNameConversion[ 1000 ] ;
+static char scMacFileNameConversion[ 1000 ] ;
#endif
void wxMacFilename2FSSpec( const char *path , FSSpec *spec )
if ( strchr( path , ':' ) == NULL )
{
// try whether it is a volume / or a mounted volume
- strncpy( sMacFileNameConversion , path , 1000 ) ;
- sMacFileNameConversion[998] = 0 ;
- strcat( sMacFileNameConversion , ":" ) ;
- err = FSpLocationFromFullPath( strlen(sMacFileNameConversion) , sMacFileNameConversion , spec ) ;
+ strncpy( scMacFileNameConversion , path , 1000 ) ;
+ scMacFileNameConversion[998] = 0 ;
+ strcat( scMacFileNameConversion , ":" ) ;
+ err = FSpLocationFromFullPath( strlen(scMacFileNameConversion) , scMacFileNameConversion , spec ) ;
}
else
{
#endif
}
+#if wxUSE_UNICODE
+WXDLLEXPORT void wxMacFilename2FSSpec( const wxChar *path , FSSpec *spec )
+{
+ return wxMacFilename2FSSpec( wxMacStringToCString( wxString( path ) ) , spec ) ;
+}
+#endif
+
#ifndef __DARWIN__
-wxString wxMac2UnixFilename (const char *str)
+wxString wxMac2UnixFilename (const wxChar *str)
{
- char *s = sMacFileNameConversion ;
- strcpy( s , str ) ;
+ wxChar *s = sMacFileNameConversion ;
+ wxStrcpy( s , str ) ;
if (s)
{
- memmove( s+1 , s ,strlen( s ) + 1) ;
+ memmove( s+1 , s ,wxStrlen( s ) + 1 * sizeof(wxChar)) ;
if ( *s == ':' )
*s = '.' ;
else
return wxString(sMacFileNameConversion) ;
}
-wxString wxUnix2MacFilename (const char *str)
+wxString wxUnix2MacFilename (const wxChar *str)
{
- char *s = sMacFileNameConversion ;
- strcpy( s , str ) ;
+ wxChar *s = sMacFileNameConversion ;
+ wxStrcpy( s , str ) ;
if (s)
{
if ( *s == '.' )
{
// relative path , since it goes on with slash which is translated to a :
- memmove( s , s+1 ,strlen( s ) ) ;
+ memmove( s , s+1 ,wxStrlen( s ) * sizeof(wxChar)) ;
}
else if ( *s == '/' )
{
// absolute path -> on mac just start with the drive name
- memmove( s , s+1 ,strlen( s ) ) ;
+ memmove( s , s+1 ,wxStrlen( s ) * sizeof(wxChar) ) ;
}
else
{
- wxASSERT_MSG( 1 , "unkown path beginning" ) ;
+ wxASSERT_MSG( 1 , wxT("unkown path beginning") ) ;
}
while (*s)
{
if ( *(s+1) == '.' && *(s+2) == '.' && ( (*(s+3) == '/' || *(s+3) == '\\') ) )
{
*s = ':';
- memmove( s+1 , s+3 ,strlen( s+3 ) + 1 ) ;
+ memmove( s+1 , s+3 ,(wxStrlen( s+3 ) + 1)*sizeof(wxChar) ) ;
}
else
*s = ':';
s++ ;
}
}
- return wxString (sMacFileNameConversion) ;
+ return wxString(sMacFileNameConversion) ;
}
wxString wxMacFSSpec2UnixFilename( const FSSpec *spec )
|| defined(__WATCOMC__) \
|| defined(__GNUWIN32__)
int res = wxRemove(file);
+#elif defined(__WXMAC__)
+ int res = unlink(wxFNCONV(file));
#else
int res = unlink(OS_FILENAME(file));
#endif
bool wxMkdir(const wxString& dir, int perm)
{
#if defined(__WXMAC__) && !defined(__UNIX__)
- return (mkdir( dir , 0 ) == 0);
+ return (mkdir( wxFNCONV(dir) , 0 ) == 0);
#else // !Mac
const wxChar *dirname = dir.c_str();
cwdSpec.parID = pb.ioFCBParID;
cwdSpec.name[0] = 0 ;
wxString res = wxMacFSSpec2MacFilename( &cwdSpec ) ;
-
- strcpy( cbuf , res ) ;
- cbuf[res.length()]=0 ;
-
+ wxStrcpy( buf , res ) ;
ok = TRUE;
}
else
ok = getcwd(cbuf, sz) != NULL;
#endif // platform
- #if wxUSE_UNICODE
+ #if wxUSE_UNICODE && !defined(__WXMAC__)
// finally convert the result to Unicode if needed
wxConvFile.MB2WC(buf, cbuf, sz);
#endif // wxUSE_UNICODE