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
This commit is contained in:
Stefan Csomor
2007-06-14 23:07:20 +00:00
parent ea3bf30068
commit dde33f39c1

View File

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