From dde33f39c1488b4cd67d13103415060204a3ee30 Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Thu, 14 Jun 2007 23:07:20 +0000 Subject: [PATCH] use CFAlerts on mac for asserts, better isolation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@46469 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/common/appcmn.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/src/common/appcmn.cpp b/src/common/appcmn.cpp index e6a72a3d27..199664b10c 100644 --- a/src/common/appcmn.cpp +++ b/src/common/appcmn.cpp @@ -52,6 +52,10 @@ #include "wx/msw/private.h" // includes windows.h for LOGFONT #endif +#if defined(__WXMAC__) + #include "wx/mac/private.h" +#endif + #if wxUSE_FONTMAP #include "wx/fontmap.h" #endif // wxUSE_FONTMAP @@ -596,6 +600,28 @@ bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) wxT("You can also choose [Cancel] to suppress ") wxT("further warnings."); +#ifdef __WXMAC__ + // in order to avoid reentrancy problems, use the lowest alert API available + CFOptionFlags exitButton; + wxMacCFStringHolder cfText(msgDlg); + OSStatus err = CFUserNotificationDisplayAlert( + 0, kAlertStopAlert, NULL, NULL, NULL, CFSTR("wxWidgets Debug Alert"), cfText, + CFSTR("Yes"), CFSTR("No"), CFSTR("Cancel"), &exitButton ); + if ( err == noErr ) + { + switch( exitButton ) + { + case 0 : // yes + wxTrap(); + break; + case 2 : // cancel + // no more asserts + return true; + case 1 : // no -> nothing to do + break ; + } + } +#else switch ( wxMessageBox(msgDlg, wxT("wxWidgets Debug Alert"), wxYES_NO | wxCANCEL | wxICON_STOP ) ) { @@ -609,7 +635,7 @@ bool wxGUIAppTraitsBase::ShowAssertDialog(const wxString& msg) //case wxNO: nothing to do } - +#endif return false; #endif // !wxUSE_MSGDLG/wxUSE_MSGDLG }