X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f313deaa38ebd9d8a9a2755a105e12999dd5493c..cc4d5638c66a409e421420ed7110917755a66788:/src/common/dlgcmn.cpp diff --git a/src/common/dlgcmn.cpp b/src/common/dlgcmn.cpp index 6b70e66e97..c1cc7eb7b4 100644 --- a/src/common/dlgcmn.cpp +++ b/src/common/dlgcmn.cpp @@ -4,7 +4,6 @@ // Author: Vadim Zeitlin // Modified by: // Created: 28.06.99 -// RCS-ID: $Id$ // Copyright: (c) Vadim Zeitlin // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -43,6 +42,7 @@ #include "wx/bookctrl.h" #include "wx/scrolwin.h" #include "wx/textwrapper.h" +#include "wx/modalhook.h" #if wxUSE_DISPLAY #include "wx/display.h" @@ -224,13 +224,7 @@ wxSizer *wxDialogBase::CreateTextSizer(const wxString& message, widthMax = wxSystemSettings::GetMetric( wxSYS_SCREEN_X ) - 25; } - // '&' is used as accel mnemonic prefix in the wxWidgets controls but in - // the static messages created by CreateTextSizer() (used by wxMessageBox, - // for example), we don't want this special meaning, so we need to quote it - wxString text(message); - text.Replace(wxT("&"), wxT("&&")); - - return wrapper.CreateSizer(text, widthMax); + return wrapper.CreateSizer(message, widthMax); } #endif // wxUSE_STATTEXT @@ -428,7 +422,7 @@ bool wxDialogBase::EmulateButtonClickIfPresent(int id) if ( !btn || !btn->IsEnabled() || !btn->IsShown() ) return false; - wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, id); + wxCommandEvent event(wxEVT_BUTTON, id); event.SetEventObject(btn); btn->GetEventHandler()->ProcessEvent(event); @@ -467,14 +461,16 @@ bool wxDialogBase::SendCloseButtonClickEvent() bool wxDialogBase::IsEscapeKey(const wxKeyEvent& event) { - // for most platforms, Esc key is used to close the dialogs - return event.GetKeyCode() == WXK_ESCAPE && - event.GetModifiers() == wxMOD_NONE; + // For most platforms, Esc key is used to close the dialogs. + // + // Notice that we intentionally don't check for modifiers here, Shift-Esc, + // Alt-Esc and so on still close the dialog, typically. + return event.GetKeyCode() == WXK_ESCAPE; } void wxDialogBase::OnCharHook(wxKeyEvent& event) { - if ( event.GetKeyCode() == WXK_ESCAPE ) + if ( IsEscapeKey(event) ) { if ( SendCloseButtonClickEvent() ) {