wxMac Unicode support
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19838 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -991,6 +991,18 @@
|
||||
# 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
|
||||
|
@@ -143,6 +143,9 @@ WXDLLEXPORT_DATA(extern const wxChar*) wxEmptyString;
|
||||
|
||||
#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 );
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "wx/button.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxButtonNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxButtonNameStr;
|
||||
|
||||
#define wxDEFAULT_BUTTON_MARGIN 4
|
||||
|
||||
|
@@ -19,7 +19,7 @@
|
||||
#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
|
||||
|
@@ -20,7 +20,7 @@
|
||||
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxChoiceNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxChoiceNameStr;
|
||||
|
||||
WX_DEFINE_ARRAY( char * , wxChoiceDataArray ) ;
|
||||
|
||||
|
@@ -36,7 +36,7 @@ public:
|
||||
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); }
|
||||
|
||||
|
@@ -19,8 +19,8 @@
|
||||
#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
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "wx/panel.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
|
||||
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
|
||||
|
||||
|
@@ -22,8 +22,8 @@
|
||||
* 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
|
||||
{
|
||||
@@ -41,7 +41,7 @@ protected:
|
||||
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; }
|
||||
@@ -78,22 +78,22 @@ public:
|
||||
#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_
|
||||
|
@@ -27,7 +27,7 @@ public:
|
||||
, 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)
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
, m_macATSUFontID()
|
||||
{
|
||||
Init(10, wxDEFAULT, wxNORMAL, wxNORMAL, FALSE,
|
||||
"Geneva", wxFONTENCODING_DEFAULT);
|
||||
wxT("Geneva"), wxFONTENCODING_DEFAULT);
|
||||
}
|
||||
|
||||
wxFontRefData(const wxFontRefData& data)
|
||||
|
@@ -21,8 +21,8 @@
|
||||
#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;
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxGaugeNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxGaugeNameStr;
|
||||
|
||||
// Group box
|
||||
class WXDLLEXPORT wxGauge: public wxGaugeBase
|
||||
|
@@ -69,7 +69,7 @@ public:
|
||||
|
||||
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();
|
||||
|
||||
|
||||
@@ -88,15 +88,15 @@ class WXDLLEXPORT wxGLCanvas: public wxWindow
|
||||
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();
|
||||
|
||||
@@ -105,7 +105,7 @@ class WXDLLEXPORT wxGLCanvas: public wxWindow
|
||||
int *attribList, const wxPalette& palette);
|
||||
|
||||
void SetCurrent();
|
||||
void SetColour(const char *colour);
|
||||
void SetColour(const wxChar *colour);
|
||||
void SwapBuffers();
|
||||
void UpdateContext();
|
||||
void SetViewport();
|
||||
|
@@ -76,8 +76,8 @@ class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
|
||||
public:
|
||||
inline wxICONResourceHandler()
|
||||
{
|
||||
m_name = "ICON resource";
|
||||
m_extension = "";
|
||||
m_name = wxT("ICON resource");
|
||||
m_extension = wxEmptyString;
|
||||
m_type = wxBITMAP_TYPE_ICON_RESOURCE;
|
||||
};
|
||||
|
||||
|
@@ -123,9 +123,9 @@ public:
|
||||
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 ;
|
||||
|
@@ -20,8 +20,8 @@
|
||||
|
||||
#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;
|
||||
|
@@ -55,7 +55,7 @@ class WXDLLEXPORT wxMetafile: public wxGDIObject
|
||||
: 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
|
||||
@@ -84,7 +84,7 @@ class WXDLLEXPORT wxMetafileDC: public wxDC
|
||||
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.
|
||||
|
@@ -24,7 +24,7 @@
|
||||
* Message box dialog
|
||||
*/
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxMessageBoxCaptionStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
|
||||
|
||||
class WXDLLEXPORT wxMessageDialog: public wxDialog
|
||||
{
|
||||
|
@@ -48,14 +48,14 @@ public:
|
||||
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();
|
||||
|
||||
|
@@ -22,8 +22,8 @@ class WXDLLEXPORT wxPNGFileHandler: public wxBitmapHandler
|
||||
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;
|
||||
};
|
||||
|
||||
|
@@ -110,6 +110,7 @@ bool wxMacConvertEventToRecord( EventRef event , EventRecord *rec) ;
|
||||
// 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 ) ;
|
||||
@@ -146,15 +147,106 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
|
||||
// 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 ) ;
|
||||
|
||||
@@ -162,6 +254,8 @@ 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 ?
|
||||
@@ -172,10 +266,10 @@ inline wxString wxMacMakeStringFromMacString( const wxString& from )
|
||||
//
|
||||
|
||||
// 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
|
||||
@@ -191,14 +285,15 @@ inline wxString wxMacMakeStringFromPascal( ConstStringPtr from )
|
||||
|
||||
#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_
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxScrollBarNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxScrollBarNameStr;
|
||||
|
||||
// Scrollbar item
|
||||
class WXDLLEXPORT wxScrollBar: public wxControl
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#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
|
||||
|
@@ -40,7 +40,7 @@ public:
|
||||
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);
|
||||
}
|
||||
@@ -52,7 +52,7 @@ public:
|
||||
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
|
||||
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include "wx/control.h"
|
||||
|
||||
WXDLLEXPORT_DATA(extern const char*) wxStaticBoxNameStr;
|
||||
WXDLLEXPORT_DATA(extern const wxChar*) wxStaticBoxNameStr;
|
||||
|
||||
// Group box
|
||||
class WXDLLEXPORT wxStaticBox: public wxControl
|
||||
|
@@ -38,7 +38,7 @@ class WXDLLEXPORT wxTabCtrl: 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);
|
||||
}
|
||||
@@ -97,7 +97,7 @@ class WXDLLEXPORT wxTabCtrl: public wxControl
|
||||
// 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();
|
||||
|
@@ -29,7 +29,7 @@ public:
|
||||
// Accessors
|
||||
|
||||
// Operations
|
||||
bool SetIcon(const wxIcon& icon, const wxString& tooltip = "");
|
||||
bool SetIcon(const wxIcon& icon, const wxString& tooltip = wxEmptyString);
|
||||
bool RemoveIcon();
|
||||
|
||||
// Overridables
|
||||
|
@@ -18,8 +18,8 @@
|
||||
|
||||
#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
|
||||
|
@@ -21,7 +21,7 @@
|
||||
#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
|
||||
{
|
||||
|
@@ -56,7 +56,7 @@ OSStatus UMAPrClose(void *macPrintSession) ;
|
||||
|
||||
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 ) ;
|
||||
@@ -75,6 +75,7 @@ void UMAShowControl (ControlHandle theControl
|
||||
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 ) ;
|
||||
|
@@ -146,7 +146,7 @@ WXDLLEXPORT_DATA(extern wxMBConv *) wxConvCurrent;
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// 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
|
||||
|
@@ -434,7 +434,70 @@
|
||||
#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
|
||||
@@ -813,6 +876,9 @@ WXDLLEXPORT int wxSystem(const wxChar *psz);
|
||||
|
||||
// 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
|
||||
|
@@ -310,12 +310,8 @@ void *wxDllLoader::GetSymbol(wxDllType dllHandle, const wxString &name, bool *su
|
||||
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;
|
||||
|
||||
|
@@ -201,7 +201,7 @@ bool wxFile::Create(const wxChar *szFileName, bool bOverwrite, int accessMode)
|
||||
{
|
||||
// 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);
|
||||
|
@@ -331,7 +331,7 @@ wxString wxFileConfig::GetGlobalFileName(const wxChar *szFile)
|
||||
|
||||
if ( wxStrchr(szFile, wxT('.')) == NULL )
|
||||
#if defined( __WXMAC__ )
|
||||
str << " Preferences";
|
||||
str << wxT(" Preferences") ;
|
||||
#elif defined( __UNIX__ )
|
||||
str << wxT(".conf");
|
||||
#else // Windows
|
||||
@@ -364,7 +364,7 @@ wxString wxFileConfig::GetLocalFileName(const wxChar *szFile)
|
||||
#endif
|
||||
|
||||
#ifdef __WXMAC__
|
||||
str << " Preferences";
|
||||
str << wxT(" Preferences") ;
|
||||
#endif
|
||||
|
||||
return str;
|
||||
|
@@ -63,6 +63,7 @@
|
||||
#include <stat.h>
|
||||
#include <unistd.h>
|
||||
#include <unix.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
|
||||
#ifdef __UNIX__
|
||||
@@ -935,7 +936,7 @@ wxString wxMacFSSpec2MacFilename( const FSSpec *spec )
|
||||
(*myPath)[length-1] = 0 ;
|
||||
|
||||
// create path string for return value
|
||||
wxString result( (char*) *myPath ) ;
|
||||
wxString result = wxMacMakeStringFromCString( *myPath ) ;
|
||||
|
||||
// free allocated handle
|
||||
::HUnlock( myPath ) ;
|
||||
@@ -948,7 +949,8 @@ wxString wxMacFSSpec2MacFilename( const FSSpec *spec )
|
||||
// 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 )
|
||||
@@ -965,10 +967,10 @@ 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
|
||||
{
|
||||
@@ -977,15 +979,22 @@ void wxMacFilename2FSSpec( const char *path , FSSpec *spec )
|
||||
#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
|
||||
@@ -1003,25 +1012,25 @@ wxString wxMac2UnixFilename (const char *str)
|
||||
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)
|
||||
{
|
||||
@@ -1031,7 +1040,7 @@ wxString wxUnix2MacFilename (const char *str)
|
||||
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 = ':';
|
||||
@@ -1039,7 +1048,7 @@ wxString wxUnix2MacFilename (const char *str)
|
||||
s++ ;
|
||||
}
|
||||
}
|
||||
return wxString (sMacFileNameConversion) ;
|
||||
return wxString(sMacFileNameConversion) ;
|
||||
}
|
||||
|
||||
wxString wxMacFSSpec2UnixFilename( const FSSpec *spec )
|
||||
@@ -1255,6 +1264,8 @@ bool wxRemoveFile(const wxString& file)
|
||||
|| defined(__WATCOMC__) \
|
||||
|| defined(__GNUWIN32__)
|
||||
int res = wxRemove(file);
|
||||
#elif defined(__WXMAC__)
|
||||
int res = unlink(wxFNCONV(file));
|
||||
#else
|
||||
int res = unlink(OS_FILENAME(file));
|
||||
#endif
|
||||
@@ -1265,7 +1276,7 @@ bool wxRemoveFile(const wxString& file)
|
||||
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();
|
||||
|
||||
@@ -1497,10 +1508,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
||||
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
|
||||
@@ -1518,7 +1526,7 @@ wxChar *wxGetWorkingDirectory(wxChar *buf, int sz)
|
||||
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
|
||||
|
Reference in New Issue
Block a user