From 22bcdf020e4566f14978a10ca88abb27b3e92973 Mon Sep 17 00:00:00 2001 From: JulianSmart Date: Sun, 17 Jul 2016 18:17:13 +0100 Subject: [PATCH] Don't use Cmd+C accelerator in dilogs on Mac by default. --- src/common/dlgcmn.cpp | 7 ++++++- src/generic/wizard.cpp | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 5067471b11..f9fff28ce6 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -275,7 +275,12 @@ wxStdDialogButtonSizer *wxDialogBase::CreateStdDialogButtonSizer( long flags ) if (flags & wxCANCEL) { - wxButton *cancel = new wxButton(this, wxID_CANCEL); + // Avoid Cmd+C closing dialog on Mac. + wxString cancelLabel(_("&Cancel")); +#ifdef __WXMAC__ + cancelLabel.Replace("&",wxEmptyString); +#endif + wxButton *cancel = new wxButton(this, wxID_CANCEL, cancelLabel); sizer->AddButton(cancel); } diff --git a/src/generic/wizard.cpp b/src/generic/wizard.cpp index d877d14cf8..cb508e83d4 100644 --- a/src/generic/wizard.cpp +++ b/src/generic/wizard.cpp @@ -430,7 +430,12 @@ void wxWizard::AddButtonRow(wxBoxSizer *mainColumn) #endif m_btnNext = new wxButton(this, wxID_FORWARD, _("&Next >")); - wxButton *btnCancel=new wxButton(this, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, buttonStyle); + // Avoid Cmd+C closing dialog on Mac. + wxString cancelLabel(_("&Cancel")); +#ifdef __WXMAC__ + cancelLabel.Replace("&",wxEmptyString); +#endif + wxButton *btnCancel=new wxButton(this, wxID_CANCEL, cancelLabel, wxDefaultPosition, wxDefaultSize, buttonStyle); #ifndef __WXMAC__ if (GetExtraStyle() & wxWIZARD_EX_HELPBUTTON) btnHelp=new wxButton(this, wxID_HELP, _("&Help"), wxDefaultPosition, wxDefaultSize, buttonStyle);