+void wxDocManager::RemoveFileFromHistory(size_t i)
+{
+ if (m_fileHistory)
+ m_fileHistory->RemoveFileFromHistory(i);
+}
+
+wxString wxDocManager::GetHistoryFile(size_t i) const
+{
+ wxString histFile;
+
+ if (m_fileHistory)
+ histFile = m_fileHistory->GetHistoryFile(i);
+
+ return histFile;
+}
+
+void wxDocManager::FileHistoryUseMenu(wxMenu *menu)
+{
+ if (m_fileHistory)
+ m_fileHistory->UseMenu(menu);
+}
+
+void wxDocManager::FileHistoryRemoveMenu(wxMenu *menu)
+{
+ if (m_fileHistory)
+ m_fileHistory->RemoveMenu(menu);
+}
+
+#if wxUSE_CONFIG
+void wxDocManager::FileHistoryLoad(wxConfigBase& config)
+{
+ if (m_fileHistory)
+ m_fileHistory->Load(config);
+}
+
+void wxDocManager::FileHistorySave(wxConfigBase& config)
+{
+ if (m_fileHistory)
+ m_fileHistory->Save(config);
+}
+#endif
+
+void wxDocManager::FileHistoryAddFilesToMenu(wxMenu* menu)
+{
+ if (m_fileHistory)
+ m_fileHistory->AddFilesToMenu(menu);
+}
+
+void wxDocManager::FileHistoryAddFilesToMenu()
+{
+ if (m_fileHistory)
+ m_fileHistory->AddFilesToMenu();
+}
+
+size_t wxDocManager::GetHistoryFilesCount() const
+{
+ return m_fileHistory ? m_fileHistory->GetCount() : 0;
+}
+
+
+// Find out the document template via matching in the document file format
+// against that of the template
+wxDocTemplate *wxDocManager::FindTemplateForPath(const wxString& path)
+{
+ wxDocTemplate *theTemplate = (wxDocTemplate *) NULL;
+
+ // Find the template which this extension corresponds to
+ for (size_t i = 0; i < m_templates.GetCount(); i++)
+ {
+ wxDocTemplate *temp = (wxDocTemplate *)m_templates.Item(i)->GetData();
+ if ( temp->FileMatchesTemplate(path) )
+ {
+ theTemplate = temp;
+ break;
+ }
+ }
+ return theTemplate;
+}
+
+// Try to get a more suitable parent frame than the top window,
+// for selection dialogs. Otherwise you may get an unexpected
+// window being activated when a dialog is shown.
+static wxWindow* wxFindSuitableParent()
+{
+ wxWindow* parent = wxTheApp->GetTopWindow();
+
+ wxWindow* focusWindow = wxWindow::FindFocus();
+ if (focusWindow)
+ {
+ while (focusWindow &&
+ !focusWindow->IsKindOf(CLASSINFO(wxDialog)) &&
+ !focusWindow->IsKindOf(CLASSINFO(wxFrame)))
+
+ focusWindow = focusWindow->GetParent();
+
+ if (focusWindow)
+ parent = focusWindow;
+ }
+ return parent;
+}
+
+// Prompts user to open a file, using file specs in templates.
+// Must extend the file selector dialog or implement own; OR
+// match the extension to the template extension.
+
+wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
+#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__)
+ int noTemplates,
+#else
+ int WXUNUSED(noTemplates),
+#endif
+ wxString& path,
+ long WXUNUSED(flags),
+ bool WXUNUSED(save))
+{
+ // We can only have multiple filters in Windows and GTK
+#if defined(__WXMSW__) || defined(__WXGTK__) || defined(__WXMAC__)
+ wxString descrBuf;
+
+ int i;
+ for (i = 0; i < noTemplates; i++)
+ {
+ if (templates[i]->IsVisible())
+ {
+ // add a '|' to separate this filter from the previous one
+ if ( !descrBuf.IsEmpty() )
+ descrBuf << wxT('|');
+
+ descrBuf << templates[i]->GetDescription()
+ << wxT(" (") << templates[i]->GetFileFilter() << wxT(") |")
+ << templates[i]->GetFileFilter();
+ }
+ }
+#else
+ wxString descrBuf = wxT("*.*");
+#endif