- if (!show && m_modalShowing)
- {
- EndModal( wxID_CANCEL );
- };
-
- wxWindow::Show( show );
-
- if (show) InitDialog();
-
- if (show && m_modalShowing)
- {
+/*
+ if (flag)
+ m_windowStyle |= wxDIALOG_MODAL;
+ else
+ if (m_windowStyle & wxDIALOG_MODAL) m_windowStyle -= wxDIALOG_MODAL;
+*/
+ wxFAIL_MSG( wxT("wxDialog:SetModal obsolete now") );
+}
+
+int wxDialog::ShowModal()
+{
+ if (IsModal())
+ {
+ wxFAIL_MSG( wxT("wxDialog:ShowModal called twice") );
+ return GetReturnCode();
+ }
+
+ // use the apps top level window as parent if none given unless explicitly
+ // forbidden
+ if ( !GetParent() && !(GetWindowStyleFlag() & wxDIALOG_NO_PARENT) )
+ {
+ wxWindow *parent = wxTheApp->GetTopWindow();
+ if ( parent && parent != this )
+ {
+ m_parent = parent;
+ gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(parent->m_widget) );
+ }
+ }
+
+ wxBusyCursorSuspender cs; // temporarily suppress the busy cursor
+
+ Show( TRUE );
+
+ m_modalShowing = TRUE;
+
+ g_openDialogs++;
+