]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dialog.cpp
fixing warning
[wxWidgets.git] / src / osx / carbon / dialog.cpp
index 16a77b7ce23919e540b0f9a8a0d34ba07fd86b35..8b198abb76117715827708e9fae252a79f623316 100644 (file)
 #include "wx/osx/private.h"
 #include "wx/evtloop.h"
 
-extern wxList wxModalDialogs;
+void wxDialog::EndWindowModal()
+{
+    // Nothing to do for now.
+}
 
-void wxDialog::DoShowModal()
+void wxDialog::DoShowWindowModal()
 {
-    wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
+    // If someone wants to add support for this to wxOSX Carbon, here would 
+    // be the place to start: http://trac.wxwidgets.org/ticket/9459
+    // Unfortunately, supporting sheets in Carbon isn't as straightforward
+    // as with Cocoa, so it will probably take some tweaking.
 
-    wxModalDialogs.Append(this);
+    m_modality = wxDIALOG_MODALITY_APP_MODAL;
+    ShowModal();
+    SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED  );
+}
+
+void wxDialog::DoShowModal()
+{
 
     SetFocus() ;
 
@@ -41,13 +53,18 @@ void wxDialog::DoShowModal()
     if ( GetParent() == NULL )
     {
         windowGroup = GetWindowGroup(windowRef) ;
-        formerParentGroup = GetWindowGroupParent( windowGroup );
-        SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
-        resetGroupParent = true;
+        if ( windowGroup != GetWindowGroupOfClass( kMovableModalWindowClass ) )
+        {
+            formerParentGroup = GetWindowGroupParent( windowGroup );
+            SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
+            resetGroupParent = true;
+        }
     }
     BeginAppModalStateForWindow(windowRef) ;
 
+#if wxUSE_CONSOLE_EVENTLOOP
     wxEventLoopGuarantor ensureHasLoop;
+#endif
     wxEventLoopBase * const loop = wxEventLoop::GetActive();
     while ( IsModal() )
         loop->Dispatch();