/////////////////////////////////////////////////////////////////////////////
-// Name: filedlg.cpp
+// Name: src/mac/carbon/filedlg.cpp
// Purpose: wxFileDialog
// Author: Stefan Csomor
// Modified by:
#include "wx/wxprec.h"
-#include "wx/app.h"
-#include "wx/utils.h"
-#include "wx/dialog.h"
#include "wx/filedlg.h"
-#include "wx/intl.h"
+
+#ifndef WX_PRECOMP
+ #include "wx/intl.h"
+ #include "wx/app.h"
+ #include "wx/utils.h"
+ #include "wx/dialog.h"
+#endif
+
#include "wx/tokenzr.h"
#include "wx/filename.h"
#include "wx/mac/private.h"
#ifndef __DARWIN__
- #include <Navigation.h>
- #include "PLStringFuncs.h"
+ #include <Navigation.h>
+ #include "PLStringFuncs.h"
#endif
#include "MoreFilesX.h"
}
else if ( inSelector == kNavCBStart )
{
- if (data && !(data->defaultLocation).IsEmpty())
+ if (data && !(data->defaultLocation).empty())
{
// Set default location for the modern Navigation APIs
// Apple Technical Q&A 1151
bool isName = true ;
wxString current ;
- for ( unsigned int i = 0; i < filter2.Len() ; i++ )
+ for ( unsigned int i = 0; i < filter2.length() ; i++ )
{
if ( filter2.GetChar(i) == wxT('|') )
{
// an explanatory text, in that case the first part is name and extension at the same time
wxASSERT_MSG( filterIndex == 0 || !isName , wxT("incorrect format of format string") ) ;
- if ( current.IsEmpty() )
+ if ( current.empty() )
myData->extensions.Add( myData->name[filterIndex] ) ;
else
myData->extensions.Add( current.MakeUpper() ) ;
wxString extension = myData->extensions[i];
// Remove leading '*'
- if (extension.GetChar(0) == '*')
+ if (extension.length() && (extension.GetChar(0) == '*'))
extension = extension.Mid( 1 );
// Remove leading '.'
- if (extension.GetChar(0) == '.')
+ if (extension.length() && (extension.GetChar(0) == '.'))
extension = extension.Mid( 1 );
-
+
if (wxFileName::MacFindDefaultTypeAndCreator( extension, &fileType, &creator ))
myData->filtermactypes.Add( (OSType)fileType );
else
if ( extension.GetChar(0) == '*' )
extension = extension.Mid(1) ;
- if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
+ if ( file.length() >= extension.length() && extension == file.Right(extension.length() ) )
return true ;
}
}
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)
+ long style, const wxPoint& pos, const wxSize& sz, const wxString& name)
+ : wxFileDialogBase(parent, message, defaultDir, defaultFileName, wildCard, style, pos, sz, name)
{
wxASSERT_MSG( NavServicesAvailable() , wxT("Navigation Services are not running") ) ;
}
}
}
- if (m_dialogStyle & wxSAVE)
+ if (HasFlag(wxFD_SAVE))
{
myData.saveMode = true;
dialogCreateOptions.optionFlags |= kNavPreserveSaveFileExtension;
#if TARGET_API_MAC_OSX
- if (!(m_dialogStyle & wxOVERWRITE_PROMPT))
+ if (!(m_windowStyle & wxFD_OVERWRITE_PROMPT))
dialogCreateOptions.optionFlags |= kNavDontConfirmReplacement;
#endif
{
// let the user select bundles/programs in dialogs
dialogCreateOptions.optionFlags |= kNavSupportPackages;
-
+
navFilterUPP = NewNavObjectFilterUPP(CrossPlatformFilterCallback);
err = ::NavCreateGetFileDialog(
&dialogCreateOptions,
if (err != noErr)
break;
- if (m_dialogStyle & wxSAVE)
+ if (HasFlag(wxFD_SAVE))
thePath = wxMacFSRefToPath( &theFSRef, navReply.saveFileName );
else
thePath = wxMacFSRefToPath( &theFSRef );
-
+
if (!thePath)
{
::NavDisposeReply(&navReply);
return (err == noErr) ? wxID_OK : wxID_CANCEL;
}
-