void OnUndo(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 wxView *CreateView(wxDocument *doc, long flags = 0);
virtual void DeleteTemplate(wxDocTemplate *temp, long flags = 0);
// Views or windows should inform the document manager
// when a view is going in or out of focus
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; }
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()];