X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..33754c4d83c59b7523a6da0c4fb21079cb60301c:/src/mac/msgdlg.cpp diff --git a/src/mac/msgdlg.cpp b/src/mac/msgdlg.cpp index f19da7bb4f..20186c5ecf 100644 --- a/src/mac/msgdlg.cpp +++ b/src/mac/msgdlg.cpp @@ -13,10 +13,14 @@ #pragma implementation "msgdlg.h" #endif +#include "wx/app.h" #include "wx/msgdlg.h" +#include "wx/intl.h" #include "wx/mac/uma.h" +#if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxMessageDialog, wxDialog) +#endif #define kMacOKAlertResourceID 128 #define kMacYesNoAlertResourceID 129 @@ -26,6 +30,7 @@ IMPLEMENT_CLASS(wxMessageDialog, wxDialog) short language = 0 ; +void wxMacConvertNewlines( const char *source , char * destination ) ; void wxMacConvertNewlines( const char *source , char * destination ) { const char *s = source ; @@ -69,12 +74,28 @@ int wxMessageDialog::ShowModal() short result ; Str255 pascalTitle ; Str255 pascalText ; + char cText[256] ; + + Str255 yesPString ; + Str255 noPString ; + + wxMacStringToPascal( m_caption , pascalTitle ) ; + wxMacStringToPascal( _("Yes") , yesPString ) ; + wxMacStringToPascal( _("No") , noPString ) ; - strcpy( (char*) pascalTitle , m_caption ) ; - c2pstr( (char*) pascalTitle ) ; - strcpy( (char*) pascalText , m_message ) ; - wxMacConvertNewlines( (char*)pascalText ,(char*) pascalText) ; - c2pstr( (char*) pascalText ) ; + if (wxApp::s_macDefaultEncodingIsPC) + { + strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ; + } + else + { + strcpy( cText , m_message ) ; + } + + wxMacConvertNewlines( cText , cText ) ; + CopyCStringToPascal( cText , pascalText ) ; + + wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ; if ( !UMAHasAppearance() ) { @@ -164,18 +185,18 @@ int wxMessageDialog::ShowModal() { if (m_dialogStyle & wxCANCEL) { - param.defaultText = "\pYes" ; + param.defaultText = yesPString ; param.cancelText = (StringPtr) kAlertDefaultCancelText; - param.otherText = "\pNo"; + param.otherText = noPString ; param.helpButton = false ; param.defaultButton = kAlertStdAlertOKButton; param.cancelButton = kAlertStdAlertCancelButton; } else { - param.defaultText = "\pYes" ; + param.defaultText = yesPString ; param.cancelText = NULL; - param.otherText = "\pNo"; + param.otherText = noPString ; param.helpButton = false ; param.defaultButton = kAlertStdAlertOKButton; param.cancelButton = 0;