+
+ int FilterIndex = 0;
+ wxString pathTmp = wxFileSelectorEx(_("Select a file"),
+ _T(""),
+ _T(""),
+ &FilterIndex,
+ descrBuf,
+ 0,
+ wxTheApp->GetTopWindow());
+
+ if (!pathTmp.IsEmpty())
+ {
+ path = pathTmp;
+ wxString theExt = FindExtension(path);
+ if (!theExt)
+ return (wxDocTemplate *) NULL;
+
+ // This is dodgy in that we're selecting the template on the
+ // basis of the file extension, which may not be a standard
+ // one. We really want to know exactly which template was
+ // chosen by using a more advanced file selector.
+ wxDocTemplate *theTemplate = FindTemplateForPath(path);
+ if ( !theTemplate )
+ theTemplate = templates[FilterIndex];
+
+ return theTemplate;
+ }
+ else
+ {
+ path = _T("");
+ return (wxDocTemplate *) NULL;
+ }
+#if 0
+ // In all other windowing systems, until we have more advanced
+ // file selectors, we must select the document type (template) first, and
+ // _then_ pop up the file selector.
+ wxDocTemplate *temp = SelectDocumentType(templates, noTemplates);
+ if (!temp)
+ return (wxDocTemplate *) NULL;
+
+ wxChar *pathTmp = wxFileSelector(_("Select a file"), _T(""), _T(""),
+ temp->GetDefaultExtension(),
+ temp->GetFileFilter(),
+ 0, wxTheApp->GetTopWindow());
+
+ if (pathTmp)
+ {
+ path = pathTmp;
+ return temp;
+ }
+ else
+ return (wxDocTemplate *) NULL;
+#endif // 0