SSPC-Tester/Driver/PCIE8586/Samples/VC/Advanced/MdiClient.cpp

133 lines
3.9 KiB
C++
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// MdiClient.cpp : implementation file
//
/////////////////////////////////////////////////////////////////////////////
// This class does subclass the MDI-CLIENT window.
// Subclassing means that all messages are first routed to this class, then
// to the original window (in this case the MDI-CLIENT).
// We need this to get notifications of the creation and deletion of the
// MDI child frames (contain views).
/////////////////////////////////////////////////////////////////////////////
//
// Copyright ?1998 Written by Dieter Fauth
// mailto:fauthd@zvw.de
//
// This code may be used in compiled form in any way you desire. This
// file may be redistributed unmodified by any means PROVIDING it is
// not sold for profit without the authors written consent, and
// providing that this notice and the authors name and all copyright
// notices remains intact. If the source code in this file is used in
// any commercial application then a statement along the lines of
// "Portions Copyright ?1999 Dieter Fauth" must be included in
// the startup banner, "About" box or printed documentation. An email
// letting me know that you are using it would be nice as well. That's
// not much to ask considering the amount of work that went into this.
//
// This file is provided "as is" with no expressed or implied warranty.
// The author accepts no liability for any damage/loss of business that
// this product may cause.
//
// ==========================================================================
// HISTORY:
// ==========================================================================
// 1.00 08 May 1999 - Initial release.
// ==========================================================================
//
/////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "TabCtrlBarDoc.h"
#include "MdiClient.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMdiClient
CMdiClient::CMdiClient(): m_sizeClient(0, 0)
{
m_crBkColor = GetSysColor(COLOR_DESKTOP);
m_pWndTabs = NULL;
}
CMdiClient::~CMdiClient()
{
}
BEGIN_MESSAGE_MAP(CMdiClient, CWnd)
//{{AFX_MSG_MAP(CMdiClient)
ON_WM_ERASEBKGND()
ON_WM_SIZE()
ON_MESSAGE(WM_MDICREATE,OnMDICreate)
ON_MESSAGE(WM_MDIDESTROY,OnMDIDestroy)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
void CMdiClient::AddHandle(HWND hWnd)
{
ASSERT(m_pWndTabs != NULL);
// <20><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>
m_pWndTabs->AddHandle(hWnd);
}
void CMdiClient::RemoveHandle(HWND hWnd)
{
ASSERT(m_pWndTabs != NULL);
m_pWndTabs->RemoveHandle(hWnd);
}
/////////////////////////////////////////////////////////////////////////////
// CMdiClient message handlers
LRESULT CMdiClient::OnMDICreate(WPARAM wParam, LPARAM lParam)
{
HWND hWnd = (HWND) DefWindowProc(WM_MDICREATE, wParam, lParam);
AddHandle(hWnd);
return (LRESULT) hWnd;
}
LRESULT CMdiClient::OnMDIDestroy(WPARAM wParam, LPARAM lParam)
{
RemoveHandle((HWND) wParam);
return DefWindowProc(WM_MDIDESTROY, wParam, lParam);
}
BOOL CMdiClient::OnEraseBkgnd(CDC* pDC)
{
return CWnd::OnEraseBkgnd(pDC);
}
void CMdiClient::OnSize(UINT nType, int cx, int cy)
{
// <20><><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>仯ʱ<E4BBAF><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>á<EFBFBD><C3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֡<EFBFBD><D6A1><EFBFBD>ڱ<EFBFBD><DAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>Ҳ<EFBFBD><D2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
CWnd::OnSize(nType, cx, cy);
// <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>򱣴<EFBFBD><F2B1A3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɷ<EFBFBD><C9B7><EFBFBD>
if ((m_sizeClient.cx == 0) && (m_sizeClient.cy == 0))
{
m_sizeClient.cx = cx;
m_sizeClient.cy = cy;
return ;
}
// <20><><EFBFBD><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD><EFBFBD>ڴ<EFBFBD>Сδ<D0A1><CEB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E4BBAF><EFBFBD>򷵻<EFBFBD>
if ((m_sizeClient.cx == cx) && ( m_sizeClient.cy == cy))
{
return;
}
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
m_sizeClient.cx = cx;
m_sizeClient.cy = cy;
// ǿ<><C7BF><EFBFBD>ػ<EFBFBD>
RedrawWindow(NULL, NULL,
RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW | RDW_ALLCHILDREN);
return;
}