// CustomCtrlView.cpp : implementation file // #include "stdafx.h" #include "CustomCtrlView.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CCustomCtrlView IMPLEMENT_DYNCREATE(CCustomCtrlView, CView) CCustomCtrlView::CCustomCtrlView() { m_pCustomCtrl = NULL; } CCustomCtrlView::~CCustomCtrlView() { delete m_pCustomCtrl; } BEGIN_MESSAGE_MAP(CCustomCtrlView, CView) //{{AFX_MSG_MAP(CCustomCtrlView) ON_WM_SETFOCUS() ON_WM_SIZE() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CCustomCtrlView drawing void CCustomCtrlView::OnDraw(CDC* pDC) { CDocument* pDoc = GetDocument(); // TODO: add draw code here } ///////////////////////////////////////////////////////////////////////////// // CCustomCtrlView diagnostics #ifdef _DEBUG void CCustomCtrlView::AssertValid() const { CView::AssertValid(); } void CCustomCtrlView::Dump(CDumpContext& dc) const { CView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// // CCustomCtrlView message handlers void CCustomCtrlView::OnSetFocus(CWnd* pOldWnd) { // Focus the control if (m_pCustomCtrl->GetSafeHwnd()) { m_pCustomCtrl->SetFocus(); } } void CCustomCtrlView::OnSize(UINT nType, int cx, int cy) { // Resize the control to the size of the client area if (m_pCustomCtrl->GetSafeHwnd()) { m_pCustomCtrl->SetWindowPos(NULL, 0, 0, cx, cy, SWP_NOZORDER | SWP_NOMOVE); } } BOOL CCustomCtrlView::OnCmdMsg(UINT nID, int nCode, void* pExtra, AFX_CMDHANDLERINFO* pHandlerInfo) { // Route the command dispatch & UI update code to the control if (m_pCustomCtrl->GetSafeHwnd()) { BOOL bHandled; bHandled = m_pCustomCtrl->OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); if (bHandled) { return TRUE; } } return CView::OnCmdMsg(nID, nCode, pExtra, pHandlerInfo); }