Don't require using wxCommandProcessor for this, only use it if it exists.
Closes #14011.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70651
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
wxCommandProcessor * const cmdproc = GetCurrentCommandProcessor();
if ( !cmdproc )
{
wxCommandProcessor * const cmdproc = GetCurrentCommandProcessor();
if ( !cmdproc )
{
+ // If we don't have any document at all, the menu item should really be
+ // disabled.
+ if ( !GetCurrentDocument() )
+ event.Enable(false);
+ else // But if we do have it, it might handle wxID_UNDO on its own
+ event.Skip();
event.Enable(cmdproc->CanUndo());
cmdproc->SetMenuStrings();
}
event.Enable(cmdproc->CanUndo());
cmdproc->SetMenuStrings();
}
wxCommandProcessor * const cmdproc = GetCurrentCommandProcessor();
if ( !cmdproc )
{
wxCommandProcessor * const cmdproc = GetCurrentCommandProcessor();
if ( !cmdproc )
{
+ // Use same logic as in OnUpdateUndo() above.
+ if ( !GetCurrentDocument() )
+ event.Enable(false);
+ else
+ event.Skip();
event.Enable(cmdproc->CanRedo());
cmdproc->SetMenuStrings();
}
event.Enable(cmdproc->CanRedo());
cmdproc->SetMenuStrings();
}