]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/dialog.cpp
check that the version of __sync_sub_and_fetch that returns a value is supported...
[wxWidgets.git] / src / mac / carbon / dialog.cpp
index 50cbb8c5ae8c245da68b0b05b09651bb5d82fb90..966b6001baab09493d96f813cb563ae159c3e573 100644 (file)
@@ -53,13 +53,6 @@ bool wxDialog::Create( wxWindow *parent,
     if ( !wxTopLevelWindow::Create( parent, id, title, pos, size, style, name ) )
         return false;
 
     if ( !wxTopLevelWindow::Create( parent, id, title, pos, size, style, name ) )
         return false;
 
-#if TARGET_API_MAC_OSX
-    HIViewRef growBoxRef = 0 ;
-    OSStatus err = HIViewFindByID( HIViewGetRoot( (WindowRef)m_macWindow ), kHIViewWindowGrowBoxID, &growBoxRef  );
-    if ( err == noErr && growBoxRef != 0 )
-        HIGrowBoxViewSetTransparent( growBoxRef, true ) ;
-#endif
-
     return true;
 }
 
     return true;
 }
 
@@ -71,9 +64,7 @@ void wxDialog::SetModal( bool flag )
 
         wxModelessWindows.DeleteObject( this );
 
 
         wxModelessWindows.DeleteObject( this );
 
-#if TARGET_CARBON
         SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ;
         SetWindowModality( (WindowRef)MacGetWindowRef(), kWindowModalityAppModal, NULL ) ;
-#endif
     }
     else
     {
     }
     else
     {
@@ -106,11 +97,6 @@ bool wxDialog::IsModal() const
 }
 
 
 }
 
 
-bool wxDialog::IsModalShowing() const
-{
-    return wxModalDialogs.Find((wxDialog *)this) != NULL; // const_cast
-}
-
 bool wxDialog::Show(bool show)
 {
     if ( !wxDialogBase::Show(show) )
 bool wxDialog::Show(bool show)
 {
     if ( !wxDialogBase::Show(show) )
@@ -121,6 +107,8 @@ bool wxDialog::Show(bool show)
         // usually will result in TransferDataToWindow() being called
         InitDialog();
 
         // usually will result in TransferDataToWindow() being called
         InitDialog();
 
+    HiliteMenu(0);
+
     if ( m_isModalStyle )
     {
         if ( show )
     if ( m_isModalStyle )
     {
         if ( show )
@@ -138,38 +126,39 @@ bool wxDialog::Show(bool show)
     return true;
 }
 
     return true;
 }
 
-#if !TARGET_CARBON
-extern bool s_macIsInModalLoop ;
-#endif
-
 void wxDialog::DoShowModal()
 {
 void wxDialog::DoShowModal()
 {
-    wxCHECK_RET( !IsModalShowing(), wxT("DoShowModal() called twice") );
+    wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
 
     wxModalDialogs.Append(this);
 
     SetFocus() ;
 
 
     wxModalDialogs.Append(this);
 
     SetFocus() ;
 
-#if TARGET_CARBON
-    BeginAppModalStateForWindow(  (WindowRef) MacGetWindowRef()) ;
-#else
-    // TODO : test whether parent gets disabled
-    bool formerModal = s_macIsInModalLoop ;
-    s_macIsInModalLoop = true ;
-#endif
+    WindowRef windowRef = (WindowRef) MacGetWindowRef();
+    WindowGroupRef windowGroup;
+    WindowGroupRef formerParentGroup;
+    bool resetGroupParent = false;
+
+    if ( GetParent() == NULL )
+    {
+        windowGroup = GetWindowGroup(windowRef) ;
+        formerParentGroup = GetWindowGroupParent( windowGroup );
+        SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
+        resetGroupParent = true;
+    }
+    BeginAppModalStateForWindow(windowRef) ;
 
 
-    while ( IsModalShowing() )
+    while ( IsModal() )
     {
         wxTheApp->MacDoOneEvent() ;
         // calls process idle itself
     }
 
     {
         wxTheApp->MacDoOneEvent() ;
         // calls process idle itself
     }
 
-#if TARGET_CARBON
-    EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
-#else
-    // TODO probably reenable the parent window if any
-    s_macIsInModalLoop = formerModal ;
-#endif
+    EndAppModalStateForWindow(windowRef) ;
+    if ( resetGroupParent )
+    {
+        SetWindowGroupParent( windowGroup , formerParentGroup );
+    }
 }
 
 
 }