#if wxUSE_INTL
// native message box always uses the current user locale but the program
// may be using a different one and in this case we need to manually
- // translate the button labels to avoid mismatch between the language of
- // the message box text and its buttons
+ // translate the default button labels (if they're non default we have no
+ // way to translate them and so we must assume they were already
+ // translated) to avoid mismatch between the language of the message box
+ // text and its buttons
wxLocale * const loc = wxGetLocale();
if ( loc && loc->GetLanguage() != wxLocale::GetSystemLanguage() )
{
- if ( m_dialogStyle & wxYES_NO )
+ if ( m_dialogStyle & wxYES_NO &&
+ (GetCustomYesLabel().empty() && GetCustomNoLabel().empty()) )
+
{
// use the strings with mnemonics here as the native message box
// does
// native message box (which probably doesn't use them because
// Enter/Esc keys can be already used to dismiss the message box
// using keyboard)
- SetOKCancelLabels(_("OK"), _("Cancel"));
+ if ( GetCustomOKLabel().empty() && GetCustomCancelLabel().empty() )
+ SetOKCancelLabels(_("OK"), _("Cancel"));
}
#endif // wxUSE_INTL
}
}
+ if ( wxStyle & wxHELP )
+ {
+ msStyle |= MB_HELP;
+ }
+
// set the icon style
switch ( GetEffectiveIcon() )
{
#ifdef wxHAS_MSW_TASKDIALOG
wxMSWTaskDialogConfig::wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg)
- : buttons(new TASKDIALOG_BUTTON[3])
+ : buttons(new TASKDIALOG_BUTTON[MAX_BUTTONS])
{
parent = dlg.GetParentForModalDialog();
caption = dlg.GetCaption();
btnNoLabel = dlg.GetNoLabel();
btnOKLabel = dlg.GetOKLabel();
btnCancelLabel = dlg.GetCancelLabel();
+ btnHelpLabel = dlg.GetHelpLabel();
}
void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc)
AddTaskDialogButton(tdc, IDCANCEL, TDCBF_CANCEL_BUTTON, btnOKLabel);
}
}
+
+ if ( style & wxHELP )
+ {
+ // There is no support for "Help" button in the task dialog, it can
+ // only show "Retry" or "Close" ones.
+ useCustomLabels = true;
+
+ AddTaskDialogButton(tdc, IDHELP, 0 /* not used */, btnHelpLabel);
+ }
}
void wxMSWTaskDialogConfig::AddTaskDialogButton(TASKDIALOGCONFIG &tdc,
tdBtn.nButtonID = btnCustomId;
tdBtn.pszButtonText = customLabel.wx_str();
tdc.cButtons++;
+
+ // We should never have more than 4 buttons currently as this is the
+ // maximal number of buttons supported by the message dialog.
+ wxASSERT_MSG( tdc.cButtons <= MAX_BUTTONS, wxT("Too many buttons") );
}
else
{
case IDNO:
ans = wxID_NO;
break;
+ case IDHELP:
+ ans = wxID_HELP;
+ break;
}
return ans;