]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/dirdlg.mm
use native conversions that are close to the native storage of wxString
[wxWidgets.git] / src / cocoa / dirdlg.mm
index 1d14768363862b93282dfa137879df3a60c9953b..1c3c95d8a5c5502a89b161c44cdb55ad8c235def 100644 (file)
 
 #if wxUSE_DIRDLG
 
+#include "wx/dirdlg.h"
+
 #ifndef WX_PRECOMP
     #include "wx/msgdlg.h"
     #include "wx/filedlg.h"
-    #include "wx/dirdlg.h"
     #include "wx/app.h"
 #endif
+
 #include "wx/filename.h"
 
 #include "wx/cocoa/autorelease.h"
@@ -52,9 +54,10 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
         const wxSize& size, const wxString& name)
 {
     wxTopLevelWindows.Append(this);
-    
-       m_message = message;
-    m_dialogStyle = style;
+
+    m_message = message;
+
+    SetWindowStyle(style);
     m_parent = parent;
     m_path = defaultPath;
 
@@ -68,7 +71,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
 
     //If the user requests to save - use a NSSavePanel
     //else use a NSOpenPanel
-    if (m_dialogStyle & wxSAVE)
+    if (HasFlag(wxFD_SAVE))
     {
         SetNSPanel([NSSavePanel savePanel]);
 
@@ -78,7 +81,7 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
         [GetNSSavePanel() setTreatsFilePackagesAsDirectories:YES];
         [GetNSSavePanel() setCanSelectHiddenExtension:YES];
     }
-    else //m_dialogStyle & wxOPEN
+    else //m_dialogStyle & wxFD_OPEN
     {
         SetNSPanel([NSOpenPanel openPanel]);
         [m_cocoaNSWindow setTitle:wxNSStringWithWxString(message)];
@@ -89,10 +92,10 @@ wxDirDialog::wxDirDialog(wxWindow *parent, const wxString& message,
         [GetNSSavePanel() setPrompt:@"Open"];
     }
 
-       if (m_dialogStyle & wxDD_NEW_DIR_BUTTON) //m_dialogStyle & wxDD_NEW_DIR_BUTTON
-       {
+    if (HasFlag(wxDD_NEW_DIR_BUTTON)) //m_dialogStyle & wxDD_NEW_DIR_BUTTON
+    {
         [(NSOpenPanel*)m_cocoaNSWindow setCanCreateDirectories:YES];
-       }
+    }
 }
 
 wxDirDialog::~wxDirDialog()
@@ -107,7 +110,7 @@ int wxDirDialog::ShowModal()
 
     int nResult;
 
-    if (m_dialogStyle & wxSAVE)
+    if (HasFlag(wxFD_SAVE))
     {
         nResult = [GetNSSavePanel()
                     runModalForDirectory:wxNSStringWithWxString(m_dir)
@@ -119,7 +122,7 @@ int wxDirDialog::ShowModal()
             m_path = m_fileNames[0];
         }
     }
-    else //m_dialogStyle & wxOPEN
+    else //m_dialogStyle & wxFD_OPEN
     {
         nResult = [(NSOpenPanel*)m_cocoaNSWindow
                     runModalForDirectory:wxNSStringWithWxString(m_dir)
@@ -141,4 +144,3 @@ int wxDirDialog::ShowModal()
 }
 
 #endif // wxUSE_DIRDLG
-