#pragma hdrstop
#endif
-#if wxUSE_FILEDLG && !wxUSE_SMARTPHONE
+#if wxUSE_FILEDLG && !defined(__SMARTPHONE__)
#ifndef WX_PRECOMP
#include "wx/utils.h"
}
}
+void wxFileDialog::GetFilenames(wxArrayString& files) const
+{
+ files = m_fileNames;
+}
+
void wxFileDialog::SetPath(const wxString& path)
{
wxString ext;
*fileNameBuffer = wxT('\0');
*titleBuffer = wxT('\0');
+#if WXWIN_COMPATIBILITY_2_4
long msw_flags = 0;
if ( (m_dialogStyle & wxHIDE_READONLY) || (m_dialogStyle & wxSAVE) )
msw_flags |= OFN_HIDEREADONLY;
+#else
+ long msw_flags = OFN_HIDEREADONLY;
+#endif
+
if ( m_dialogStyle & wxFILE_MUST_EXIST )
msw_flags |= OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
{
msw_flags |= OFN_NOCHANGEDIR;
}
-/* chris elliott for some reason this does not work usefully if no extension
- is given, as it test for junk instead of junk.ext
+
if ( m_dialogStyle & wxOVERWRITE_PROMPT )
{
msw_flags |= OFN_OVERWRITEPROMPT;
}
-*/
+
OPENFILENAME of;
wxZeroMemory(of);
of.Flags = msw_flags;
+ wxArrayString wildDescriptions, wildFilters;
- //=== Like Alejandro Sierra's wildcard modification >>===================
- /*
- In wxFileSelector you can put, instead of a single wild_card,
- pairs of strings separated by '|'.
- The first string is a description, and the
- second is the wild card. You can put any number of pairs.
+ size_t items = wxParseCommonDialogsFilter(m_wildCard, wildDescriptions, wildFilters);
- eg. "description1 (*.ex1)|*.ex1|description2 (*.ex2)|*.ex2"
+ wxASSERT_MSG( items > 0 , _T("empty wildcard list") );
- If you put a single wild card, it works as before the modification.
- */
- //=======================================================================
-
- wxString theFilter;
- if ( wxStrlen(m_wildCard) == 0 )
- theFilter = wxString(wxT("*.*"));
- else
- theFilter = m_wildCard ;
wxString filterBuffer;
- if ( !wxStrchr( theFilter, wxT('|') ) ) { // only one filter ==> default text
- filterBuffer.Printf(_("Files (%s)|%s"),
- theFilter.c_str(), theFilter.c_str());
- }
- else { // more then one filter
- filterBuffer = theFilter;
-
+ for (i = 0; i < items ; i++)
+ {
+ filterBuffer += wildDescriptions[i];
+ filterBuffer += wxT("|");
+ filterBuffer += wildFilters[i];
+ filterBuffer += wxT("|");
}
- filterBuffer += wxT("|");
// Replace | with \0
for (i = 0; i < filterBuffer.Len(); i++ ) {
if ( filterBuffer.GetChar(i) == wxT('|') ) {
}
}
- of.lpstrFilter = (LPTSTR)(const wxChar *)filterBuffer;
+ of.lpstrFilter = (LPTSTR)filterBuffer.c_str();
of.nFilterIndex = m_filterIndex + 1;
//=== Setting defaultFileName >>=========================================
dir += _T('\\');
m_path = dir + m_fileName;
+ m_filterIndex = (int)of.nFilterIndex - 1;
}
else
{
m_fileNames.Add(m_fileName);
m_dir = wxPathOnly(fileNameBuffer);
}
- //=== Simulating the wxOVERWRITE_PROMPT >>============================
- //should we also test for file save style ??
- if ( (m_dialogStyle & wxOVERWRITE_PROMPT) &&
- ::wxFileExists( fileNameBuffer ) )
- {
- wxString messageText;
- messageText.Printf(_("File '%s' already exists.\nDo you want to replace it?"), fileNameBuffer);
- if ( wxMessageBox(messageText, _("Save File As"), wxYES_NO | wxICON_EXCLAMATION ) != wxYES )
- {
- success = FALSE;
- }
- }
}
else
{