applied an extended version of patch 685795: clean up view [de]activation

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-07-10 09:32:35 +00:00
parent 427716213f
commit 18759f7850
2 changed files with 14 additions and 22 deletions

View File

@ -379,7 +379,7 @@ public:
// 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 void ActivateView(wxView *view, bool activate = TRUE);
virtual wxView *GetCurrentView() const;
wxList& GetDocuments() { return m_docs; }

View File

@ -568,16 +568,14 @@ void wxDocument::SetFilename(const wxString& filename, bool notifyViews)
wxView::wxView()
{
// SetDocument(doc);
m_viewDocument = (wxDocument*) NULL;
m_viewTypeName = wxT("");
m_viewFrame = (wxFrame *) NULL;
}
wxView::~wxView()
{
// GetDocumentManager()->ActivateView(this, FALSE, TRUE);
GetDocumentManager()->ActivateView(this, FALSE);
m_viewDocument->RemoveView(this);
}
@ -586,8 +584,8 @@ bool wxView::ProcessEvent(wxEvent& event)
{
if ( !GetDocument() || !GetDocument()->ProcessEvent(event) )
return wxEvtHandler::ProcessEvent(event);
else
return TRUE;
return TRUE;
}
void wxView::OnActivateView(bool WXUNUSED(activate), wxView *WXUNUSED(activeView), wxView *WXUNUSED(deactiveView))
@ -1710,25 +1708,19 @@ void wxDocManager::RemoveDocument(wxDocument *doc)
// Views or windows should inform the document manager
// when a view is going in or out of focus
void wxDocManager::ActivateView(wxView *view, bool activate, bool WXUNUSED(deleting))
void wxDocManager::ActivateView(wxView *view, bool activate)
{
// If we're deactiving, and if we're not actually deleting the view, then
// don't reset the current view because we may be going to
// a window without a view.
// WHAT DID I MEAN BY THAT EXACTLY?
/*
if (deleting)
{
if (m_currentView == view)
m_currentView = NULL;
}
else
*/
if ( activate )
{
if (activate)
m_currentView = view;
else
m_currentView = view;
}
else // deactivate
{
if ( m_currentView == view )
{
// don't keep stale pointer
m_currentView = (wxView *) NULL;
}
}
}