Only use NSCriticalAlertStyle for serious questions
Don't use NSCriticalAlertStyle for wxICON_WARNING unconditionally, this was a violation of the OS X guidelines. According to the hig HIG, NSCriticalAlertStyle (aka caution icon) is only appropriate in rare cases and only if the user is performing a task that might result in the inadvertent and unexpected destruction of data. It therefore doesn't make sense to use it for information warnings, but only for _questions_, and so NSCriticalAlertStyle is only used if a combination of wxICON_WARNING with either wxYES_NO or wxCANCEL is used.
This commit is contained in:
@@ -53,7 +53,10 @@ const char wxMessageBoxCaptionStr[] = "Message";
|
|||||||
@style{wxICON_ERROR}
|
@style{wxICON_ERROR}
|
||||||
Displays an error icon in the dialog.
|
Displays an error icon in the dialog.
|
||||||
@style{wxICON_WARNING}
|
@style{wxICON_WARNING}
|
||||||
Displays a warning icon in the dialog.
|
Displays a warning icon in the dialog. This style should be used for
|
||||||
|
informative warnings or, in combination with @c wxYES_NO or @c wxCANCEL,
|
||||||
|
for questions that have potentially serious consequences (caution
|
||||||
|
icon is used on OS X in this case).
|
||||||
@style{wxICON_QUESTION}
|
@style{wxICON_QUESTION}
|
||||||
Displays a question mark symbol. This icon is automatically used
|
Displays a question mark symbol. This icon is automatically used
|
||||||
with @c wxYES_NO so it's usually unnecessary to specify it explicitly.
|
with @c wxYES_NO so it's usually unnecessary to specify it explicitly.
|
||||||
|
@@ -31,16 +31,21 @@ namespace
|
|||||||
{
|
{
|
||||||
NSAlertStyle GetAlertStyleFromWXStyle( long style )
|
NSAlertStyle GetAlertStyleFromWXStyle( long style )
|
||||||
{
|
{
|
||||||
NSAlertStyle alertType = NSWarningAlertStyle;
|
if (style & wxICON_WARNING)
|
||||||
if (style & wxICON_EXCLAMATION)
|
{
|
||||||
alertType = NSCriticalAlertStyle;
|
// NSCriticalAlertStyle should only be used for questions where
|
||||||
else if (style & wxICON_HAND)
|
// caution is needed per the OS X HIG. wxICON_WARNING alone doesn't
|
||||||
alertType = NSWarningAlertStyle;
|
// warrant it, but a question with a warning (rather than question)
|
||||||
else if (style & wxICON_INFORMATION)
|
// icon is something serious.
|
||||||
alertType = NSInformationalAlertStyle;
|
if (style & (wxYES_NO | wxCANCEL))
|
||||||
else if (style & wxICON_QUESTION)
|
return NSCriticalAlertStyle;
|
||||||
alertType = NSInformationalAlertStyle;
|
else
|
||||||
return alertType;
|
return NSWarningAlertStyle;
|
||||||
|
}
|
||||||
|
else if (style & wxICON_ERROR)
|
||||||
|
return NSWarningAlertStyle;
|
||||||
|
else
|
||||||
|
return NSInformationalAlertStyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user