using the CF Message box only for non main thread alerts
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44202 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -53,6 +53,8 @@ int wxMessageDialog::ShowModal()
|
|||||||
alertType = kAlertCautionAlert;
|
alertType = kAlertCautionAlert;
|
||||||
|
|
||||||
#if TARGET_API_MAC_OSX
|
#if TARGET_API_MAC_OSX
|
||||||
|
if ( !wxIsMainThread() )
|
||||||
|
{
|
||||||
CFStringRef defaultButtonTitle = NULL;
|
CFStringRef defaultButtonTitle = NULL;
|
||||||
CFStringRef alternateButtonTitle = NULL;
|
CFStringRef alternateButtonTitle = NULL;
|
||||||
CFStringRef otherButtonTitle = NULL;
|
CFStringRef otherButtonTitle = NULL;
|
||||||
@@ -108,13 +110,12 @@ int wxMessageDialog::ShowModal()
|
|||||||
defaultButtonTitle, alternateButtonTitle, otherButtonTitle, &exitButton );
|
defaultButtonTitle, alternateButtonTitle, otherButtonTitle, &exitButton );
|
||||||
if (err == noErr)
|
if (err == noErr)
|
||||||
resultbutton = buttonId[exitButton];
|
resultbutton = buttonId[exitButton];
|
||||||
|
}
|
||||||
#else
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
short result;
|
short result;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 )
|
|
||||||
{
|
|
||||||
AlertStdCFStringAlertParamRec param;
|
AlertStdCFStringAlertParamRec param;
|
||||||
wxMacCFStringHolder cfNoString( _("No"), m_font.GetEncoding() );
|
wxMacCFStringHolder cfNoString( _("No"), m_font.GetEncoding() );
|
||||||
wxMacCFStringHolder cfYesString( _("Yes"), m_font.GetEncoding() );
|
wxMacCFStringHolder cfYesString( _("Yes"), m_font.GetEncoding() );
|
||||||
@@ -172,12 +173,6 @@ int wxMessageDialog::ShowModal()
|
|||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
else
|
|
||||||
{
|
|
||||||
skipDialog = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
param.position = kWindowDefaultPosition;
|
param.position = kWindowDefaultPosition;
|
||||||
if ( !skipDialog )
|
if ( !skipDialog )
|
||||||
@@ -190,72 +185,6 @@ int wxMessageDialog::ShowModal()
|
|||||||
{
|
{
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
AlertStdAlertParamRec param;
|
|
||||||
Str255 yesPString, noPString;
|
|
||||||
Str255 pascalTitle, pascalText;
|
|
||||||
|
|
||||||
wxMacStringToPascal( m_caption, pascalTitle );
|
|
||||||
wxMacStringToPascal( _("Yes"), yesPString );
|
|
||||||
wxMacStringToPascal( _("No"), noPString );
|
|
||||||
wxMacStringToPascal( m_message, pascalText );
|
|
||||||
|
|
||||||
param.movable = true;
|
|
||||||
param.filterProc = NULL;
|
|
||||||
|
|
||||||
if (style & wxYES_NO)
|
|
||||||
{
|
|
||||||
if (style & wxCANCEL)
|
|
||||||
{
|
|
||||||
param.defaultText = yesPString;
|
|
||||||
param.cancelText = (StringPtr) kAlertDefaultCancelText;
|
|
||||||
param.otherText = noPString;
|
|
||||||
param.helpButton = false;
|
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
|
||||||
param.cancelButton = kAlertStdAlertCancelButton;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
param.defaultText = yesPString;
|
|
||||||
param.cancelText = NULL;
|
|
||||||
param.otherText = noPString;
|
|
||||||
param.helpButton = false;
|
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
|
||||||
param.cancelButton = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (style & wxOK)
|
|
||||||
{
|
|
||||||
if (style & wxCANCEL)
|
|
||||||
{
|
|
||||||
param.defaultText = (StringPtr) kAlertDefaultOKText;
|
|
||||||
param.cancelText = (StringPtr) kAlertDefaultCancelText;
|
|
||||||
param.otherText = NULL;
|
|
||||||
param.helpButton = false;
|
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
|
||||||
param.cancelButton = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
param.defaultText = (StringPtr) kAlertDefaultOKText;
|
|
||||||
param.cancelText = NULL;
|
|
||||||
param.otherText = NULL;
|
|
||||||
param.helpButton = false;
|
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
|
||||||
param.cancelButton = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return resultbutton;
|
|
||||||
}
|
|
||||||
|
|
||||||
param.position = 0;
|
|
||||||
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
|
|
||||||
}
|
|
||||||
|
|
||||||
if (style & wxOK)
|
if (style & wxOK)
|
||||||
{
|
{
|
||||||
@@ -297,7 +226,7 @@ int wxMessageDialog::ShowModal()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
return resultbutton;
|
return resultbutton;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user