Add support for wxHELP button to wxMessageDialog.
Implement support for wxHELP for wxMSW, wxGTK and wxOSX/Cocoa (at least when showing the message box from the main thread, there doesn't seem to be any way to show more than three buttons with CFUserNotificationDisplayAlert() so "Help" button is not supported when using it). This is useful not only on its own, i.e. to allow the user to ask for help, but also because it brings the total number of buttons supported by the message dialog to 4, meaning that more choices can be offered to the user (which is rarely, but not quite never, useful). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68537 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -511,6 +511,11 @@ int wxMessageDialog::ShowMessageBox()
|
||||
}
|
||||
}
|
||||
|
||||
if ( wxStyle & wxHELP )
|
||||
{
|
||||
msStyle |= MB_HELP;
|
||||
}
|
||||
|
||||
// set the icon style
|
||||
switch ( GetEffectiveIcon() )
|
||||
{
|
||||
@@ -630,7 +635,7 @@ void wxMessageDialog::DoCentre(int dir)
|
||||
#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();
|
||||
@@ -665,6 +670,7 @@ wxMSWTaskDialogConfig::wxMSWTaskDialogConfig(const wxMessageDialogBase& dlg)
|
||||
btnNoLabel = dlg.GetNoLabel();
|
||||
btnOKLabel = dlg.GetOKLabel();
|
||||
btnCancelLabel = dlg.GetCancelLabel();
|
||||
btnHelpLabel = dlg.GetHelpLabel();
|
||||
}
|
||||
|
||||
void wxMSWTaskDialogConfig::MSWCommonTaskDialogInit(TASKDIALOGCONFIG &tdc)
|
||||
@@ -755,6 +761,15 @@ 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,
|
||||
@@ -770,6 +785,10 @@ 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
|
||||
{
|
||||
@@ -839,6 +858,9 @@ int wxMSWMessageDialog::MSWTranslateReturnCode(int msAns)
|
||||
case IDNO:
|
||||
ans = wxID_NO;
|
||||
break;
|
||||
case IDHELP:
|
||||
ans = wxID_HELP;
|
||||
break;
|
||||
}
|
||||
|
||||
return ans;
|
||||
|
Reference in New Issue
Block a user