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:
Stefan Csomor
2003-03-27 20:14:39 +00:00
parent 76806f5906
commit c4e41ce37a
36 changed files with 276 additions and 95 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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 ) ;

View File

@@ -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); }

View File

@@ -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

View File

@@ -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;

View File

@@ -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_

View File

@@ -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)

View File

@@ -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;

View File

@@ -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

View File

@@ -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();

View File

@@ -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;
};

View File

@@ -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 ;

View File

@@ -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;

View File

@@ -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.

View File

@@ -24,7 +24,7 @@
* Message box dialog
*/
WXDLLEXPORT_DATA(extern const char*) wxMessageBoxCaptionStr;
WXDLLEXPORT_DATA(extern const wxChar*) wxMessageBoxCaptionStr;
class WXDLLEXPORT wxMessageDialog: public wxDialog
{

View File

@@ -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();

View File

@@ -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;
};

View File

@@ -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_

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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();

View File

@@ -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

View File

@@ -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

View File

@@ -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
{

View File

@@ -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 ) ;