+ gint defaultButton;
+ if ( m_dialogStyle & wxCANCEL_DEFAULT )
+ defaultButton = GTK_RESPONSE_CANCEL;
+ else if ( m_dialogStyle & wxNO_DEFAULT )
+ defaultButton = GTK_RESPONSE_NO;
+ else if ( m_dialogStyle & wxYES_NO )
+ defaultButton = GTK_RESPONSE_YES;
+ else // No need to change the default value, whatever it is.
+ defaultButton = GTK_RESPONSE_NONE;
+
+ if ( defaultButton != GTK_RESPONSE_NONE )
+ gtk_dialog_set_default_response(dlg, defaultButton);
+}
+
+int wxMessageDialog::ShowModal()
+{
+ // break the mouse capture as it would interfere with modal dialog (see
+ // wxDialog::ShowModal)
+ wxWindow * const win = wxWindow::GetCapture();
+ if ( win )
+ win->GTKReleaseMouseAndNotify();
+
+ if ( !m_widget )
+ {
+ GTKCreateMsgDialog();
+ wxCHECK_MSG( m_widget, wxID_CANCEL,
+ wxT("failed to create GtkMessageDialog") );
+ }
+
+ // This should be necessary, but otherwise the
+ // parent TLW will disappear..
+ if (m_parent)
+ gtk_window_present( GTK_WINDOW(m_parent->m_widget) );
+
+ gint result = gtk_dialog_run(GTK_DIALOG(m_widget));
+ gtk_widget_destroy(m_widget);
+ g_object_unref(m_widget);
+ m_widget = NULL;