X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a4578b0ceda90e103620894d3aa86284178ab1cd..47e175a24f862aa8b7ca7dd4a2bb5957991e7f2d:/src/osx/carbon/msgdlg.cpp?ds=sidebyside diff --git a/src/osx/carbon/msgdlg.cpp b/src/osx/carbon/msgdlg.cpp index 20be0469e5..808fbcc385 100644 --- a/src/osx/carbon/msgdlg.cpp +++ b/src/osx/carbon/msgdlg.cpp @@ -19,6 +19,7 @@ #endif #include "wx/thread.h" +#include "wx/testing.h" #include "wx/osx/uma.h" @@ -30,12 +31,14 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& caption, long style, const wxPoint& WXUNUSED(pos)) - : wxMessageDialogWithCustomLabels(parent, message, caption, style) + : wxMessageDialogBase(parent, message, caption, style) { } int wxMessageDialog::ShowModal() { + WX_TESTING_SHOW_MODAL_HOOK(); + int resultbutton = wxID_CANCEL; const long style = GetMessageDialogStyle(); @@ -61,18 +64,26 @@ int wxMessageDialog::ShowModal() break; } + // (the standard alert has two slots [title, text] + // for the three wxStrings [caption, message, extended message]) + // + // if the extended text is empty we use the caption and + // the message (for backwards compatibility) + // + // if the extended text is not empty we ignore the caption + // and use the message and the extended message - // work out what to display - // if the extended text is empty then we use the caption as the title - // and the message as the text (for backwards compatibility) - // but if the extended message is not empty then we use the message as the title - // and the extended message as the text because that makes more sense wxString msgtitle,msgtext; if(m_extendedMessage.IsEmpty()) { - msgtitle = m_caption; - msgtext = m_message; + if ( m_caption.IsEmpty() ) + msgtitle = m_message; + else + { + msgtitle = m_caption; + msgtext = m_message; + } } else { @@ -150,7 +161,7 @@ int wxMessageDialog::ShowModal() wxCFStringRef cfCancelString( GetCancelLabel().c_str(), GetFont().GetEncoding() ); wxCFStringRef cfTitle( msgtitle, GetFont().GetEncoding() ); - wxCFStringRef cfText( msgtext, GetFont().GetEncoding() ); + wxCFStringRef cfText = msgtext.IsEmpty() ? NULL : wxCFStringRef( msgtext, GetFont().GetEncoding() ); param.movable = true; param.flags = 0; @@ -208,7 +219,9 @@ int wxMessageDialog::ShowModal() { DialogRef alertRef; CreateStandardAlert( alertType, cfTitle, cfText, ¶m, &alertRef ); + wxDialog::OSXBeginModalDialog(); RunStandardAlert( alertRef, NULL, &result ); + wxDialog::OSXEndModalDialog(); } else { @@ -256,7 +269,7 @@ int wxMessageDialog::ShowModal() } } } - + SetReturnCode(resultbutton); return resultbutton;