- if (!show && m_modalShowing)
- {
- EndModal( wxID_CANCEL );
- };
-
- wxWindow::Show( show );
-
- if (show) InitDialog();
-
- if (show && m_modalShowing)
- {
+ if (!show && IsModal())
+ {
+ EndModal( wxID_CANCEL );
+ }
+
+ if (show && !m_sizeSet)
+ {
+ /* by calling GtkOnSize here, we don't have to call
+ either after showing the frame, which would entail
+ much ugly flicker nor from within the size_allocate
+ handler, because GTK 1.1.X forbids that. */
+
+ GtkOnSize( m_x, m_y, m_width, m_height );
+ }
+
+ bool ret = wxWindow::Show( show );
+
+ if (show) InitDialog();
+
+ return ret;
+}
+
+bool wxDialog::IsModal() const
+{
+ return m_modalShowing;
+}
+
+void wxDialog::SetModal( bool WXUNUSED(flag) )
+{
+ 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 &&
+ parent->IsBeingDeleted() &&
+ !(parent->GetExtraStyle() & wxWS_EX_TRANSIENT) )
+ {
+ 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 );
+
+ SetFocus();
+
+ m_modalShowing = TRUE;
+
+ g_openDialogs++;
+