- if (m_currentView)
- return m_currentView;
- if (m_docs.Number() == 1)
- {
- wxDocument* doc = (wxDocument*) m_docs.First()->Data();
- return doc->GetFirstView();
- }
- return (wxView *) NULL;
+ 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;