Click here to Skip to main content
15,881,281 members
Articles / Desktop Programming / WTL

A WTL DocView framework

Rate me:
Please Sign up or sign in to vote.
4.78/5 (14 votes)
10 Jan 2006CPOL1 min read 64.9K   1.3K   18  
Implemetation of a simple DocView framework like MFC.
// MDIChildFrameImpl.cpp: implementation of the CMDIChildFrameImpl class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MDIChildFrameImpl.h"
#include "View.h"

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CView* CMDIFrameBase::GetActiveView()
{
	return m_pViewActive;
}

CDocument* CMDIFrameBase::GetActiveDocument()
{
	CView* pView = GetActiveView();
	return pView != NULL ? pView->GetDocument() : NULL;
}

void CMDIFrameBase::SetActiveView(CView* pViewNew, BOOL bNotify)
{
	CView* pViewOld = m_pViewActive;
	if (pViewNew == pViewOld)
		return;     // do not re-activate if SetActiveView called more than once
	
	// deactivate the old one
	if (pViewOld != NULL)
		pViewOld->OnActivateView(FALSE, pViewNew, pViewOld);
	
	// if the OnActivateView moves the active window,
	//    that will veto this change
	if (m_pViewActive != NULL)
		return;     // already set
	m_pViewActive = pViewNew;
	
	// activate
	if (pViewNew != NULL && bNotify)
		pViewNew->OnActivateView(TRUE, pViewNew, pViewOld);
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
CEO bring-it-together s.r.o.
Slovakia Slovakia
Jozef Božek is currently a software engineer at bring-it-together s.r.o. in area of large scale infomation systems and mobile applications development.
He has been developing in C++ nearly full time since 2000, in Java since 2004 and in Objective-C since 2009. He is programming using Java EE SDK, iOS SDK, COM/DCOM, MFC, ATL, STL and so on Smile | :)

Comments and Discussions