- event.Enable( TRUE );
-}
-
-void wxDocManager::OnUpdateFileClose(wxUpdateUIEvent& event)
-{
- wxDocument *doc = GetCurrentDocument();
- event.Enable( (doc != (wxDocument*) NULL) );
-}
-
-void wxDocManager::OnUpdateFileRevert(wxUpdateUIEvent& event)
-{
- 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();
- }
+ // CreateDocument() (which is called from OnFileOpen) may succeed
+ // only when there is at least a template:
+ event.Enable( GetTemplates().GetCount()>0 );