From 24689293df6521eeb31a51f2b848cc033f02cefb Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 12 Sep 2008 00:06:42 +0000 Subject: [PATCH] add wxCANCEL_DEFAULT support git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55564 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/msgdlg.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/gtk/msgdlg.cpp b/src/gtk/msgdlg.cpp index 428b1e2720..d7b27a4777 100644 --- a/src/gtk/msgdlg.cpp +++ b/src/gtk/msgdlg.cpp @@ -208,10 +208,16 @@ void wxMessageDialog::GTKCreateMsgDialog() } } - gtk_dialog_set_default_response(dlg, - m_dialogStyle & wxNO_DEFAULT - ? GTK_RESPONSE_NO - : GTK_RESPONSE_YES); + // it'd probably be harmless to call gtk_dialog_set_default_response() + // twice but why do it if we're going to change the default below + // anyhow + if ( !(m_dialogStyle & wxCANCEL_DEFAULT) ) + { + gtk_dialog_set_default_response(dlg, + m_dialogStyle & wxNO_DEFAULT + ? GTK_RESPONSE_NO + : GTK_RESPONSE_YES); + } } else if ( addButtons ) // Ok or Ok/Cancel dialog { @@ -222,6 +228,11 @@ void wxMessageDialog::GTKCreateMsgDialog() GTK_RESPONSE_CANCEL); } } + + if ( m_dialogStyle & wxCANCEL_DEFAULT ) + { + gtk_dialog_set_default_response(dlg, GTK_RESPONSE_CANCEL); + } } int wxMessageDialog::ShowModal() -- 2.45.2