setting correct alertType
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
bfa92264c0
commit
0aeac464d1
@ -25,6 +25,23 @@
|
|||||||
IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
|
IMPLEMENT_CLASS(wxMessageDialog, wxDialog)
|
||||||
|
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
NSAlertStyle GetAlertStyleFromWXStyle( long style )
|
||||||
|
{
|
||||||
|
NSAlertStyle alertType = NSWarningAlertStyle;
|
||||||
|
if (style & wxICON_EXCLAMATION)
|
||||||
|
alertType = NSCriticalAlertStyle;
|
||||||
|
else if (style & wxICON_HAND)
|
||||||
|
alertType = NSWarningAlertStyle;
|
||||||
|
else if (style & wxICON_INFORMATION)
|
||||||
|
alertType = NSInformationalAlertStyle;
|
||||||
|
else if (style & wxICON_QUESTION)
|
||||||
|
alertType = NSInformationalAlertStyle;
|
||||||
|
return alertType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
wxMessageDialog::wxMessageDialog(wxWindow *parent,
|
||||||
const wxString& message,
|
const wxString& message,
|
||||||
const wxString& caption,
|
const wxString& caption,
|
||||||
@ -42,17 +59,6 @@ int wxMessageDialog::ShowModal()
|
|||||||
|
|
||||||
wxASSERT_MSG( (style & 0x3F) != wxYES, wxT("this style is not supported on Mac") );
|
wxASSERT_MSG( (style & 0x3F) != wxYES, wxT("this style is not supported on Mac") );
|
||||||
|
|
||||||
NSAlertStyle alertType = NSWarningAlertStyle;
|
|
||||||
if (style & wxICON_EXCLAMATION)
|
|
||||||
alertType = NSCriticalAlertStyle;
|
|
||||||
else if (style & wxICON_HAND)
|
|
||||||
alertType = NSWarningAlertStyle;
|
|
||||||
else if (style & wxICON_INFORMATION)
|
|
||||||
alertType = NSInformationalAlertStyle;
|
|
||||||
else if (style & wxICON_QUESTION)
|
|
||||||
alertType = NSInformationalAlertStyle;
|
|
||||||
|
|
||||||
|
|
||||||
// work out what to display
|
// work out what to display
|
||||||
// if the extended text is empty then we use the caption as the title
|
// if the extended text is empty then we use the caption as the title
|
||||||
// and the message as the text (for backwards compatibility)
|
// and the message as the text (for backwards compatibility)
|
||||||
@ -86,6 +92,8 @@ int wxMessageDialog::ShowModal()
|
|||||||
wxCFStringRef cfOKString( GetOKLabel(), GetFont().GetEncoding()) ;
|
wxCFStringRef cfOKString( GetOKLabel(), GetFont().GetEncoding()) ;
|
||||||
wxCFStringRef cfCancelString( GetCancelLabel(), GetFont().GetEncoding() );
|
wxCFStringRef cfCancelString( GetCancelLabel(), GetFont().GetEncoding() );
|
||||||
|
|
||||||
|
NSAlertStyle alertType = GetAlertStyleFromWXStyle(style);
|
||||||
|
|
||||||
int m_buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ };
|
int m_buttonId[4] = { 0, 0, 0, wxID_CANCEL /* time-out */ };
|
||||||
|
|
||||||
if (style & wxYES_NO)
|
if (style & wxYES_NO)
|
||||||
@ -210,6 +218,7 @@ void* wxMessageDialog::ConstructNSAlert()
|
|||||||
}
|
}
|
||||||
|
|
||||||
NSAlert* alert = [[NSAlert alloc] init];
|
NSAlert* alert = [[NSAlert alloc] init];
|
||||||
|
NSAlertStyle alertType = GetAlertStyleFromWXStyle(style);
|
||||||
|
|
||||||
wxCFStringRef cfNoString( GetNoLabel(), GetFont().GetEncoding() );
|
wxCFStringRef cfNoString( GetNoLabel(), GetFont().GetEncoding() );
|
||||||
wxCFStringRef cfYesString( GetYesLabel(), GetFont().GetEncoding() );
|
wxCFStringRef cfYesString( GetYesLabel(), GetFont().GetEncoding() );
|
||||||
@ -221,6 +230,7 @@ void* wxMessageDialog::ConstructNSAlert()
|
|||||||
|
|
||||||
[alert setMessageText:cfTitle.AsNSString()];
|
[alert setMessageText:cfTitle.AsNSString()];
|
||||||
[alert setInformativeText:cfText.AsNSString()];
|
[alert setInformativeText:cfText.AsNSString()];
|
||||||
|
[alert setAlertStyle:alertType];
|
||||||
|
|
||||||
m_buttonCount = 0;
|
m_buttonCount = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user