Add buttons. Help and Cancel.

This commit is contained in:
James Crook 2018-02-14 21:49:56 +00:00 committed by Paul Licameli
parent f7fe295651
commit 3c5468a1c8
2 changed files with 15 additions and 1 deletions

View File

@ -52,6 +52,7 @@ ShuttleGui.
#include "../widgets/LinkingHtmlWindow.h"
#include "../widgets/ErrorDialog.h"
#include "../FileNames.h"
#include "../widgets/HelpSystem.h"
#include "../commands/CommandTargets.h"
@ -256,6 +257,8 @@ int AudacityCommand::MessageBox(const wxString& message, long style, const wxStr
BEGIN_EVENT_TABLE(AudacityCommandDialog, wxDialogWrapper)
EVT_BUTTON(wxID_OK, AudacityCommandDialog::OnOk)
EVT_BUTTON(wxID_HELP, AudacityCommandDialog::OnHelp)
EVT_BUTTON(wxID_CANCEL, AudacityCommandDialog::OnCancel)
END_EVENT_TABLE()
AudacityCommandDialog::AudacityCommandDialog(wxWindow * parent,
@ -269,7 +272,7 @@ AudacityCommandDialog::AudacityCommandDialog(wxWindow * parent,
mType = type;
wxASSERT( pCommand );
mpCommand = pCommand;
mAdditionalButtons = additionalButtons;
mAdditionalButtons = additionalButtons |eCancelButton | eHelpButton;
}
bool AudacityCommandDialog::Init()
@ -340,3 +343,13 @@ void AudacityCommandDialog::OnCancel(wxCommandEvent & WXUNUSED(evt))
EndModal(false);
}
void AudacityCommandDialog::OnHelp(wxCommandEvent & WXUNUSED(event))
{
if( mpCommand )
{
// otherwise use ShowHelp
HelpSystem::ShowHelp(FindWindow(wxID_HELP), mpCommand->ManualPage(), true);
}
}

View File

@ -172,6 +172,7 @@ public:
virtual void PopulateOrExchange(ShuttleGui & S);
virtual void OnOk(wxCommandEvent & evt);
virtual void OnCancel(wxCommandEvent & evt);
virtual void OnHelp(wxCommandEvent & evt);
private:
int mType;