wxDocManager gets the only view if none other specified as the current view;

added ProcessEvent so views get their events processed properly.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-07-18 22:04:25 +00:00
parent 0fc1a7137c
commit 637f467a06
2 changed files with 28 additions and 1 deletions

View File

@@ -839,6 +839,30 @@ void wxDocManager::OnRedo(wxCommandEvent& WXUNUSED(event))
doc->GetCommandProcessor()->Redo();
}
wxView *wxDocManager::GetCurrentView(void) const
{
if (m_currentView)
return m_currentView;
if (m_docs.Number() == 1)
{
wxDocument* doc = (wxDocument*) m_docs.First()->Data();
return doc->GetFirstView();
}
return 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.Number()];