+ event.Enable( doc->GetCommandProcessor()->CanUndo() );
+ doc->GetCommandProcessor()->SetMenuStrings();
+ }
+}
+
+void wxDocManager::OnUpdateRedo(wxUpdateUIEvent& event)
+{
+ wxDocument *doc = GetCurrentDocument();
+ if (!doc)
+ event.Enable(false);
+ else if (!doc->GetCommandProcessor())
+ event.Skip();
+ else
+ {
+ event.Enable( doc->GetCommandProcessor()->CanRedo() );
+ doc->GetCommandProcessor()->SetMenuStrings();
+ }
+}
+
+void wxDocManager::OnUpdatePrint(wxUpdateUIEvent& event)
+{
+ wxDocument *doc = GetCurrentDocument();
+ event.Enable( (doc != (wxDocument*) NULL) );
+}
+
+void wxDocManager::OnUpdatePreview(wxUpdateUIEvent& event)
+{
+ wxDocument *doc = GetCurrentDocument();
+ event.Enable( (doc != (wxDocument*) NULL) );
+}
+
+wxView *wxDocManager::GetCurrentView() const
+{
+ if (m_currentView)
+ return m_currentView;
+ if (m_docs.GetCount() == 1)
+ {
+ wxDocument* doc = (wxDocument*) m_docs.GetFirst()->GetData();
+ return doc->GetFirstView();
+ }
+ return (wxView *) NULL;
+}
+
+// Extend event processing to search the view's event table
+bool wxDocManager::ProcessEvent(wxEvent& event)
+{
+ wxView* view = GetCurrentView();
+ if (view)
+ {
+ if (view->ProcessEvent(event))
+ return true;
+ }
+ return wxEvtHandler::ProcessEvent(event);
+}
+
+wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags)
+{
+ wxDocTemplate **templates = new wxDocTemplate *[m_templates.GetCount()];
+ int n = 0;