NavigateView.cpp
上传用户:xiaoke98
上传日期:2014-06-29
资源大小:5718k
文件大小:3k
源码类别:

家庭/个人应用

开发平台:

Visual C++

  1. // NavigateView.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "HomeFinanceManager.h"
  5. #include "NavigateView.h"
  6. #include "HomeFinanceManagerDoc.h"
  7. #include "CMD.h"
  8. #include "SysStatus.h"
  9. #ifdef _DEBUG
  10. #define new DEBUG_NEW
  11. #undef THIS_FILE
  12. static char THIS_FILE[] = __FILE__;
  13. #endif
  14. /////////////////////////////////////////////////////////////////////////////
  15. // CNavigateView
  16. IMPLEMENT_DYNCREATE(CNavigateView, CView)
  17. CNavigateView::CNavigateView()
  18. {
  19. }
  20. CNavigateView::~CNavigateView()
  21. {
  22. }
  23. BEGIN_MESSAGE_MAP(CNavigateView, CView)
  24. //{{AFX_MSG_MAP(CNavigateView)
  25. ON_WM_SIZE()
  26. //}}AFX_MSG_MAP
  27. END_MESSAGE_MAP()
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CNavigateView drawing
  30. void CNavigateView::OnDraw(CDC* pDC)
  31. {
  32. CDocument* pDoc = GetDocument();
  33. // TODO: add draw code here
  34. }
  35. /////////////////////////////////////////////////////////////////////////////
  36. // CNavigateView diagnostics
  37. #ifdef _DEBUG
  38. void CNavigateView::AssertValid() const
  39. {
  40. CView::AssertValid();
  41. }
  42. void CNavigateView::Dump(CDumpContext& dc) const
  43. {
  44. CView::Dump(dc);
  45. }
  46. #endif //_DEBUG
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CNavigateView message handlers
  49. void CNavigateView::DisplayNavigate(void)
  50. {
  51. if(!m_DialogNavigate)
  52. {
  53. m_DialogNavigate.Create(IDD_NAVIGATE, this);
  54. m_DialogNavigate.setParentView(this);
  55. }
  56. RECT rcClient;
  57. this->GetClientRect(&rcClient);
  58. m_DialogNavigate.ShowWindow(SW_SHOW);
  59. m_DialogNavigate.MoveWindow(&rcClient);
  60. }
  61. void CNavigateView::OnSize(UINT nType, int cx, int cy) 
  62. {
  63. CView::OnSize(nType, cx, cy);
  64. // TODO: Add your message handler code here
  65. DisplayNavigate();
  66. }
  67. //------------------------------------------------------------------------------
  68. CHomeFinanceManagerDoc* CNavigateView::GetDocument()
  69. {
  70. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CHomeFinanceManagerDoc)));
  71. return (CHomeFinanceManagerDoc*)m_pDocument;
  72. }
  73. //------------------------------------------------------------------------------
  74. //切换到登录窗口
  75. void CNavigateView::Login(void)
  76. {
  77. CHomeFinanceManagerDoc* pDoc =  GetDocument();
  78. pDoc->Login(this);
  79. }
  80. //------------------------------------------------------------------------------
  81. //切换到账目状态窗口
  82. void CNavigateView::Balance(void)
  83. {
  84. CHomeFinanceManagerDoc* pDoc =  GetDocument();
  85. pDoc->Balance(this);
  86. }
  87. //------------------------------------------------------------------------------
  88. void CNavigateView::FinanceIn(void)
  89. {
  90. CHomeFinanceManagerDoc* pDoc =  GetDocument();
  91. pDoc->FinanceIn(this);
  92. }
  93. //------------------------------------------------------------------------------
  94. void CNavigateView::FinanceOut(void)
  95. {
  96. CHomeFinanceManagerDoc* pDoc =  GetDocument();
  97. pDoc->FinanceOut(this);
  98. }
  99. //------------------------------------------------------------------------------
  100. void CNavigateView::OnUpdate( CView* pSender, LPARAM lHint, CObject* pHint )
  101. {
  102. CCMD* pCmd = (CCMD*)pHint;
  103. if(pCmd == 0)
  104. {
  105. return;
  106. }
  107. if(pCmd->getType() == CMD_VERIFY_OK)
  108. {
  109. CString strCurrUser;
  110. strCurrUser = gSysStatus.getUserName();
  111. m_DialogNavigate.setCurrUser(strCurrUser);
  112. Balance();
  113. }
  114. }