*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;
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.
-
- eg. "description1 (*.ex1)|*.ex1|description2 (*.ex2)|*.ex2"
+ size_t items = wxParseCommonDialogsFilter(m_wildCard, wildDescriptions, wildFilters);
- If you put a single wild card, it works as before the modification.
- */
- //=======================================================================
+ wxASSERT_MSG( items > 0 , _T("empty wildcard list") );
- 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 >>=========================================