RightPaneFrame.cpp
上传用户:weimei12
上传日期:2022-08-11
资源大小:185k
文件大小:2k
- // RightPaneFrame.cpp : implementation file
- //
- #include "stdafx.h"
- #include "SimpleMail.h"
- #include "ListCtrlView.h"
- #include "EditCtrlView.h"
- #include "SplitterView.h"
- #include "RightPaneFrame.h"
- // CRightPaneFrame
- IMPLEMENT_DYNCREATE(CRightPaneFrame, CFrameWnd)
- CRightPaneFrame::CRightPaneFrame()
- {
- m_pSplitterView= NULL;
- }
- CRightPaneFrame::~CRightPaneFrame()
- {
- }
- BEGIN_MESSAGE_MAP(CRightPaneFrame, CFrameWnd)
- END_MESSAGE_MAP()
- // CRightPaneFrame message handlers
- BOOL CRightPaneFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
- {
- // TODO: Add your specialized code here and/or call the base class
- m_pSplitterView = new CSplitterView;
- m_pSplitterView->Create(NULL, NULL, 0L, CFrameWnd::rectDefault, this, VIEW_SPLITTER, pContext);
- SetActiveView(m_pSplitterView);
- m_pSplitterView->ShowWindow(SW_SHOW);
- m_pSplitterView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
- m_nCurrentViewID = VIEW_SPLITTER;
- RecalcLayout();
- return TRUE;
- }
- void CRightPaneFrame::SwitchToView(UINT nView)
- {
- CView* pOldActiveView = GetActiveView();
- CView* pNewActiveView = NULL;
- switch (nView)
- {
- case VIEW_SPLITTER:
- pNewActiveView = (CView*) m_pSplitterView;
- break;
- case VIEW_LISTCTRL:
- pNewActiveView = (CView*) m_pSplitterView->m_pListCtrlView;
- break;
- case VIEW_EDIT:
- pNewActiveView = (CView*) m_pSplitterView->m_pEditCtrlView;
- break;
- default:
- ASSERT(FALSE);
- return;
- }
- if (pNewActiveView)
- {
- // don't switch when views are the same
- if (pOldActiveView == pNewActiveView)
- {
- return;
- }
- SetActiveView(pNewActiveView);
- pNewActiveView->ShowWindow(SW_SHOW);
- pNewActiveView->SetDlgCtrlID(AFX_IDW_PANE_FIRST);
- pOldActiveView->ShowWindow(SW_HIDE);
- pOldActiveView->SetDlgCtrlID(m_nCurrentViewID);
- m_nCurrentViewID = nView;
- RecalcLayout();
- }
- }