]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/carbon/dirdlg.cpp
avoid setting initial position if it was not specified, broken in r70734
[wxWidgets.git] / src / osx / carbon / dirdlg.cpp
index 5caa7f6b4bb218fc37308e82dfdbe19e22f721e5..b6cc8a45ef1ad94ec6b2b710c2bd449aa097b505 100644 (file)
@@ -1,35 +1,28 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/mac/carbon/dirdlg.cpp
+// Name:        src/osx/carbon/dirdlg.cpp
 // Purpose:     wxDirDialog
 // Author:      Stefan Csomor
 // Modified by:
 // Created:     1998-01-01
-// RCS-ID:      $Id$
 // Copyright:   (c) Stefan Csomor
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/wxprec.h"
 
-#if wxUSE_DIRDLG
+#if wxUSE_DIRDLG && !defined(__WXUNIVERSAL__)
 
 #include "wx/dirdlg.h"
 
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/dialog.h"
-    #include "wx/cmndata.h"
 #endif // WX_PRECOMP
 
 #include "wx/filename.h"
+#include "wx/modalhook.h"
 
-#include "wx/mac/private.h"
-
-#ifdef __DARWIN__
-    #include <Carbon/Carbon.h>
-#else
-    #include <Navigation.h>
-#endif
+#include "wx/osx/private.h"
 
 IMPLEMENT_CLASS(wxDirDialog, wxDialog)
 
@@ -61,22 +54,30 @@ static pascal void NavEventProc(
     }
 }
 
-wxDirDialog::wxDirDialog(wxWindow *parent,
+void wxDirDialog::Init()
+{
+}
+
+void wxDirDialog::Create(wxWindow *parent,
                          const wxString& message,
                          const wxString& defaultPath,
-                         long WXUNUSED(style),
+                         long style,
                          const wxPoint& WXUNUSED(pos),
                          const wxSize& WXUNUSED(size),
                          const wxString& WXUNUSED(name))
 {
     wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
-    m_message = message;
     m_parent = parent;
-    m_path = defaultPath;
+
+    SetMessage( message );
+    SetWindowStyle(style);
+    SetPath(defaultPath);
 }
 
 int wxDirDialog::ShowModal()
 {
+    WX_HOOK_MODAL_DIALOG();
+
     NavDialogRef dialog = NULL;
     NavDialogCreationOptions options;
     NavReplyRecord reply ;
@@ -92,7 +93,9 @@ int wxDirDialog::ShowModal()
         err = NavCreateChooseFolderDialog(&options, sStandardNavEventFilter , NULL,  this , &dialog);
         if (err == noErr)
         {
+            wxDialog::OSXBeginModalDialog();
             err = NavDialogRun(dialog);
+            wxDialog::OSXEndModalDialog();
             if ( err == noErr )
             {
                 err = NavDialogGetReply(dialog, &reply);
@@ -136,8 +139,8 @@ int wxDirDialog::ShowModal()
     if ( err != noErr && err != userCanceledErr )
         m_path = wxEmptyString ;
 
-       if ( dialog )
-       ::NavDialogDispose(dialog);
+    if ( dialog )
+        ::NavDialogDispose(dialog);
 
     return (err == noErr) ? wxID_OK : wxID_CANCEL ;
 }