+ m_isShown = show;
+
+ if (show)
+ InitDialog();
+
+ bool modal = ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL) ;
+
+#if WXGARBAGE_COLLECTION_ON /* MATTHEW: GC */
+ if (!modal)
+ {
+ if (show)
+ {
+ if (!wxModelessWindows.Find(this))
+ wxModelessWindows.Append(this);
+ }
+ else
+ wxModelessWindows.DeleteObject(this);
+ }
+ if (show)
+ {
+ if (!wxTopLevelWindows.Find(this))
+ wxTopLevelWindows.Append(this);
+ }
+ else
+ wxTopLevelWindows.DeleteObject(this);
+#endif
+
+ if ( modal )
+ {
+ s_macIsInModalLoop = true ;
+ if (show)
+ {
+ if (m_modalShowing)
+ {
+// BringWindowToTop((HWND) GetHWND());
+ return TRUE;
+ }
+
+ m_modalShowing = TRUE;
+ // if we don't do it, some window might be deleted while we have pointers
+ // to them in our disabledWindows list and the program will crash when it
+ // will try to reenable them after the modal dialog end
+ wxTheApp->DeletePendingObjects();
+
+ UMAShowWindow( m_macWindowData->m_macWindow ) ;
+ UMASelectWindow( m_macWindowData->m_macWindow ) ;
+
+ if (!wxModalDialogs.Member(this))
+ wxModalDialogs.Append(this);
+
+ while (wxModalDialogs.Member(this) )
+ {
+ wxTheApp->MacDoOneEvent() ;
+ }
+ }
+ else
+ {
+ wxModalDialogs.DeleteObject(this);
+ UMAHideWindow( m_macWindowData->m_macWindow ) ;
+ }
+ s_macIsInModalLoop = false ;
+ }
+ else // !modal
+ {
+ if (show)
+ {
+ UMAShowWindow( m_macWindowData->m_macWindow ) ;
+ UMASelectWindow( m_macWindowData->m_macWindow ) ;
+ }
+ else
+ {
+ UMAHideWindow( m_macWindowData->m_macWindow ) ;
+ }
+ }
+ return TRUE ;