X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e031f1df56a1595c7ebb4027eb89bf1c9f286bdf..07aec89fe1e7bad8010911aa8863efecfa909946:/src/cocoa/filedlg.mm?ds=sidebyside diff --git a/src/cocoa/filedlg.mm b/src/cocoa/filedlg.mm index 42e88594d6..1ed7ea0182 100644 --- a/src/cocoa/filedlg.mm +++ b/src/cocoa/filedlg.mm @@ -4,7 +4,6 @@ // Author: Ryan Norton // Modified by: // Created: 2004-10-02 -// RCS-ID: $Id$ // Copyright: (c) Ryan Norton // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -22,9 +21,10 @@ #if wxUSE_FILEDLG +#include "wx/filedlg.h" + #ifndef WX_PRECOMP #include "wx/msgdlg.h" - #include "wx/filedlg.h" #include "wx/app.h" #endif @@ -32,6 +32,7 @@ #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" +#include "wx/modalhook.h" #import #import @@ -47,11 +48,17 @@ IMPLEMENT_CLASS(wxCocoaFileDialog, wxFileDialogBase) // wxFileDialog // ---------------------------------------------------------------------------- -wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, - const wxString& defaultDir, const wxString& defaultFileName, - const wxString& wildCard, long style, const wxPoint& pos) -: wxFileDialogBase(parent, message, defaultDir, defaultFileName, - wildCard, style, pos) +wxFileDialog::wxFileDialog(wxWindow *parent, + const wxString& message, + const wxString& defaultDir, + const wxString& defaultFileName, + const wxString& wildCard, + long style, + const wxPoint& pos, + const wxSize& sz, + const wxString& name) + : wxFileDialogBase(parent, message, defaultDir, defaultFileName, + wildCard, style, pos, sz, name) { wxTopLevelWindows.Append(this); @@ -68,7 +75,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, //If the user requests to save - use a NSSavePanel //else use a NSOpenPanel - if (m_dialogStyle & wxFD_SAVE) + if (HasFlag(wxFD_SAVE)) { SetNSPanel([NSSavePanel savePanel]); @@ -92,7 +99,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, SetNSPanel([NSOpenPanel openPanel]); [m_cocoaNSWindow setTitle:wxNSStringWithWxString(message)]; - [(NSOpenPanel*)m_cocoaNSWindow setAllowsMultipleSelection:(m_dialogStyle & wxFD_MULTIPLE)]; + [(NSOpenPanel*)m_cocoaNSWindow setAllowsMultipleSelection:(HasFlag(wxFD_MULTIPLE))]; [(NSOpenPanel*)m_cocoaNSWindow setResolvesAliases:YES]; [(NSOpenPanel*)m_cocoaNSWindow setCanChooseFiles:YES]; [(NSOpenPanel*)m_cocoaNSWindow setCanChooseDirectories:NO]; @@ -161,8 +168,8 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const paths.Empty(); wxString dir(m_dir); - if ( m_dir.Last() != _T('\\') ) - dir += _T('\\'); + if ( m_dir.Last() != wxT('\\') ) + dir += wxT('\\'); size_t count = m_fileNames.GetCount(); for ( size_t n = 0; n < count; n++ ) @@ -182,20 +189,22 @@ void wxFileDialog::GetFilenames(wxArrayString& files) const void wxFileDialog::SetPath(const wxString& path) { wxString ext; - wxSplitPath(path, &m_dir, &m_fileName, &ext); + wxFileName::SplitPath(path, &m_dir, &m_fileName, &ext); if ( !ext.empty() ) - m_fileName << _T('.') << ext; + m_fileName << wxT('.') << ext; } int wxFileDialog::ShowModal() { + WX_HOOK_MODAL_DIALOG(); + wxAutoNSAutoreleasePool thePool; m_fileNames.Empty(); int nResult; - if (m_dialogStyle & wxFD_SAVE) + if (HasFlag(wxFD_SAVE)) { nResult = [GetNSSavePanel() runModalForDirectory:wxNSStringWithWxString(m_dir)