X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f31424dbe95971e8ac8ccf9f11cd79afe19485ea..06a32e049c1bad9249079ad2e91659303424a774:/src/cocoa/filedlg.mm?ds=inline diff --git a/src/cocoa/filedlg.mm b/src/cocoa/filedlg.mm index 7c74ed9246..613f75bfea 100644 --- a/src/cocoa/filedlg.mm +++ b/src/cocoa/filedlg.mm @@ -22,15 +22,18 @@ #if wxUSE_FILEDLG +#include "wx/filedlg.h" + #ifndef WX_PRECOMP #include "wx/msgdlg.h" - #include "wx/filedlg.h" - #include "wx/filename.h" #include "wx/app.h" #endif +#include "wx/filename.h" + #include "wx/cocoa/autorelease.h" #include "wx/cocoa/string.h" +#include "wx/testing.h" #import #import @@ -46,11 +49,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); @@ -67,7 +76,7 @@ wxFileDialog::wxFileDialog(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]); @@ -86,12 +95,12 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message, // dialogs are all that useful, anyway :) // } - else //m_dialogStyle & wxOPEN + else //m_dialogStyle & wxFD_OPEN { SetNSPanel([NSOpenPanel openPanel]); [m_cocoaNSWindow setTitle:wxNSStringWithWxString(message)]; - [(NSOpenPanel*)m_cocoaNSWindow setAllowsMultipleSelection:(m_dialogStyle & wxMULTIPLE)]; + [(NSOpenPanel*)m_cocoaNSWindow setAllowsMultipleSelection:(HasFlag(wxFD_MULTIPLE))]; [(NSOpenPanel*)m_cocoaNSWindow setResolvesAliases:YES]; [(NSOpenPanel*)m_cocoaNSWindow setCanChooseFiles:YES]; [(NSOpenPanel*)m_cocoaNSWindow setCanChooseDirectories:NO]; @@ -160,8 +169,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++ ) @@ -181,20 +190,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_TESTING_SHOW_MODAL_HOOK(); + wxAutoNSAutoreleasePool thePool; m_fileNames.Empty(); int nResult; - if (m_dialogStyle & wxSAVE) + if (HasFlag(wxFD_SAVE)) { nResult = [GetNSSavePanel() runModalForDirectory:wxNSStringWithWxString(m_dir) @@ -206,7 +217,7 @@ int wxFileDialog::ShowModal() m_path = m_fileNames[0]; } } - else //m_dialogStyle & wxOPEN + else //m_dialogStyle & wxFD_OPEN { nResult = [(NSOpenPanel*)m_cocoaNSWindow runModalForDirectory:wxNSStringWithWxString(m_dir) @@ -228,4 +239,3 @@ int wxFileDialog::ShowModal() } #endif // wxUSE_FILEDLG -