]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dialog.cpp
Change wxNotebook selection before sending page changed event in wxMSW.
[wxWidgets.git] / src / osx / carbon / dialog.cpp
index 47795946625287f51caf09a7f21bf9cc5377e056..42000d9a52982d5e4c0aacf708e8ddf74e65d59d 100644 (file)
 #include "wx/osx/private.h"
 #include "wx/evtloop.h"
 
-extern wxList wxModalDialogs;
-
-void wxDialog::DoShowModal()
+void wxDialog::EndWindowModal()
 {
-    wxCHECK_RET( !IsModal(), wxT("DoShowModal() called twice") );
-
-    wxModalDialogs.Append(this);
-
-    SetFocus() ;
-
-    WindowRef windowRef = (WindowRef) GetWXWindow();
-    WindowGroupRef windowGroup;
-    WindowGroupRef formerParentGroup;
-    bool resetGroupParent = false;
+    // Nothing to do for now.
+}
 
-    if ( GetParent() == NULL )
-    {
-        windowGroup = GetWindowGroup(windowRef) ;
-        formerParentGroup = GetWindowGroupParent( windowGroup );
-        SetWindowGroupParent( windowGroup, GetWindowGroupOfClass( kMovableModalWindowClass ) );
-        resetGroupParent = true;
-    }
-    BeginAppModalStateForWindow(windowRef) ;
-
-    wxEventLoop * const
-        loop = wx_static_cast(wxEventLoop *, wxEventLoop::GetActive());
-        
-    
-    wxASSERT_MSG( loop , wxT("No Event Loop in place") );
-        
-    if ( loop )
-    {
-        while ( IsModal() )
-            loop->Dispatch();
-    }
-
-    EndAppModalStateForWindow(windowRef) ;
-    if ( resetGroupParent )
-    {
-        SetWindowGroupParent( windowGroup , formerParentGroup );
-    }
-}
\ No newline at end of file
+void wxDialog::DoShowWindowModal()
+{
+    // 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.
+
+    m_modality = wxDIALOG_MODALITY_APP_MODAL;
+    ShowModal();
+    SendWindowModalDialogEvent ( wxEVT_WINDOW_MODAL_DIALOG_CLOSED  );
+}