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:
parent
0fc1a7137c
commit
637f467a06
@ -283,6 +283,9 @@ class WXDLLEXPORT wxDocManager: public wxEvtHandler
|
|||||||
void OnUndo(wxCommandEvent& event);
|
void OnUndo(wxCommandEvent& event);
|
||||||
void OnRedo(wxCommandEvent& event);
|
void OnRedo(wxCommandEvent& event);
|
||||||
|
|
||||||
|
// Extend event processing to search the view's event table
|
||||||
|
virtual bool ProcessEvent(wxEvent& event);
|
||||||
|
|
||||||
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
|
virtual wxDocument *CreateDocument(const wxString& path, long flags = 0);
|
||||||
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
|
virtual wxView *CreateView(wxDocument *doc, long flags = 0);
|
||||||
virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
|
virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
|
||||||
@ -314,7 +317,7 @@ class WXDLLEXPORT wxDocManager: public wxEvtHandler
|
|||||||
// Views or windows should inform the document manager
|
// Views or windows should inform the document manager
|
||||||
// when a view is going in or out of focus
|
// when a view is going in or out of focus
|
||||||
virtual void ActivateView(wxView *view, bool activate = TRUE, bool deleting = FALSE);
|
virtual void ActivateView(wxView *view, bool activate = TRUE, bool deleting = FALSE);
|
||||||
virtual inline wxView *GetCurrentView(void) const { return m_currentView; }
|
virtual wxView *GetCurrentView(void) const;
|
||||||
|
|
||||||
virtual inline wxList& GetDocuments(void) const { return (wxList&) m_docs; }
|
virtual inline wxList& GetDocuments(void) const { return (wxList&) m_docs; }
|
||||||
|
|
||||||
|
@ -839,6 +839,30 @@ void wxDocManager::OnRedo(wxCommandEvent& WXUNUSED(event))
|
|||||||
doc->GetCommandProcessor()->Redo();
|
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)
|
wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags)
|
||||||
{
|
{
|
||||||
wxDocTemplate **templates = new wxDocTemplate *[m_templates.Number()];
|
wxDocTemplate **templates = new wxDocTemplate *[m_templates.Number()];
|
||||||
|
Loading…
Reference in New Issue
Block a user