+ wxDocument *doc = GetCurrentDocument();
+ event.Enable( (doc != (wxDocument*) NULL) );
+}
+
+void wxDocManager::OnUpdateFileNew(wxUpdateUIEvent& event)
+{
+ event.Enable( true );
+}
+
+void wxDocManager::OnUpdateFileSave(wxUpdateUIEvent& event)
+{
+ wxDocument *doc = GetCurrentDocument();
+ event.Enable( doc && doc->IsModified() );
+}
+
+void wxDocManager::OnUpdateFileSaveAs(wxUpdateUIEvent& event)
+{
+ wxDocument *doc = GetCurrentDocument();
+ event.Enable( (doc != (wxDocument*) NULL) );
+}
+
+void wxDocManager::OnUpdateUndo(wxUpdateUIEvent& event)
+{
+ wxDocument *doc = GetCurrentDocument();
+ if (!doc)
+ event.Enable(false);
+ else if (!doc->GetCommandProcessor())
+ event.Skip();
+ else
+ {
+ 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)