- // NavigateView.cpp : implementation file
- //
- #include "stdafx.h"
- #include "HomeFinanceManager.h"
- #include "NavigateView.h"
- #include "HomeFinanceManagerDoc.h"
- #include "CMD.h"
- #include "SysStatus.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CNavigateView
- IMPLEMENT_DYNCREATE(CNavigateView, CView)
- CNavigateView::CNavigateView()
- {
- }
- CNavigateView::~CNavigateView()
- {
- }
- BEGIN_MESSAGE_MAP(CNavigateView, CView)
- //{{AFX_MSG_MAP(CNavigateView)
- ON_WM_SIZE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CNavigateView drawing
- void CNavigateView::OnDraw(CDC* pDC)
- {
- CDocument* pDoc = GetDocument();
- // TODO: add draw code here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CNavigateView diagnostics
- #ifdef _DEBUG
- void CNavigateView::AssertValid() const
- {
- CView::AssertValid();
- }
- void CNavigateView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CNavigateView message handlers
- void CNavigateView::DisplayNavigate(void)
- {
- if(!m_DialogNavigate)
- {
- m_DialogNavigate.Create(IDD_NAVIGATE, this);
- m_DialogNavigate.setParentView(this);
- }
- RECT rcClient;
- this->GetClientRect(&rcClient);
- m_DialogNavigate.ShowWindow(SW_SHOW);
- m_DialogNavigate.MoveWindow(&rcClient);
- }
- void CNavigateView::OnSize(UINT nType, int cx, int cy)
- {
- CView::OnSize(nType, cx, cy);
- // TODO: Add your message handler code here
- DisplayNavigate();
- }
- //------------------------------------------------------------------------------
- CHomeFinanceManagerDoc* CNavigateView::GetDocument()
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHomeFinanceManagerDoc)));
- return (CHomeFinanceManagerDoc*)m_pDocument;
- }
- //------------------------------------------------------------------------------
- //切换到登录窗口
- void CNavigateView::Login(void)
- {
- CHomeFinanceManagerDoc* pDoc = GetDocument();
- pDoc->Login(this);
- }
- //------------------------------------------------------------------------------
- //切换到账目状态窗口
- void CNavigateView::Balance(void)
- {
- CHomeFinanceManagerDoc* pDoc = GetDocument();
- pDoc->Balance(this);
- }
- //------------------------------------------------------------------------------
- void CNavigateView::FinanceIn(void)
- {
- CHomeFinanceManagerDoc* pDoc = GetDocument();
- pDoc->FinanceIn(this);
- }
- //------------------------------------------------------------------------------
- void CNavigateView::FinanceOut(void)
- {
- CHomeFinanceManagerDoc* pDoc = GetDocument();
- pDoc->FinanceOut(this);
- }
- //------------------------------------------------------------------------------
- void CNavigateView::OnUpdate( CView* pSender, LPARAM lHint, CObject* pHint )
- {
- CCMD* pCmd = (CCMD*)pHint;
- if(pCmd == 0)
- {
- return;
- }
- if(pCmd->getType() == CMD_VERIFY_OK)
- {
- CString strCurrUser;
- strCurrUser = gSysStatus.getUserName();
- m_DialogNavigate.setCurrUser(strCurrUser);
- Balance();
- }
- }