CalDlg.cpp
Upload User: kelijie
Upload Date: 2007-01-01
Package Size: 123k
Code Size: 2k
Category:

Graph program

Development Platform:

Visual C++

  1. // CalDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ebdlib2.h"
  5. #include "CalDlg.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CCalDlg dialog
  13. CCalDlg::CCalDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CCalDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CCalDlg)
  17. // NOTE: the ClassWizard will add member initialization here
  18. //}}AFX_DATA_INIT
  19.     m_iOperand = OPERAND_ADD;
  20. }
  21. void CCalDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(CCalDlg)
  25. // NOTE: the ClassWizard will add DDX and DDV calls here
  26. //}}AFX_DATA_MAP
  27. }
  28. BEGIN_MESSAGE_MAP(CCalDlg, CDialog)
  29. //{{AFX_MSG_MAP(CCalDlg)
  30. ON_BN_CLICKED(IDC_ADD, OnAdd)
  31. ON_BN_CLICKED(IDC_DVD, OnDvd)
  32. ON_BN_CLICKED(IDC_MUL, OnMul)
  33. ON_BN_CLICKED(IDC_SUB, OnSub)
  34. //}}AFX_MSG_MAP
  35. END_MESSAGE_MAP()
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CCalDlg message handlers
  38. void CCalDlg::OnAdd() 
  39. {
  40. // TODO: Add your control notification handler code here
  41.     m_iOperand = OPERAND_ADD;
  42. SetCheckBox();
  43. }
  44. void CCalDlg::OnDvd() 
  45. {
  46. // TODO: Add your control notification handler code here
  47.     m_iOperand = OPERAND_DVD;
  48.     SetCheckBox();
  49. }
  50. void CCalDlg::OnMul() 
  51. {
  52. // TODO: Add your control notification handler code here
  53.     m_iOperand = OPERAND_MUL;
  54.     SetCheckBox();
  55. }
  56. void CCalDlg::OnSub() 
  57. {
  58. // TODO: Add your control notification handler code here
  59.     m_iOperand = OPERAND_SUB;
  60.     
  61. SetCheckBox();
  62. }
  63. BOOL CCalDlg::OnInitDialog() 
  64. {
  65. CDialog::OnInitDialog();
  66. // TODO: Add extra initialization here
  67.     SetCheckBox();
  68. return TRUE;  // return TRUE unless you set the focus to a control
  69.               // EXCEPTION: OCX Property Pages should return FALSE
  70. }
  71. void CCalDlg::SetCheckBox(void)
  72. {
  73. ((CButton*)GetDlgItem(IDC_ADD))->SetCheck(m_iOperand == OPERAND_ADD ? TRUE : FALSE);
  74. ((CButton*)GetDlgItem(IDC_SUB))->SetCheck(m_iOperand == OPERAND_SUB ? TRUE : FALSE);
  75.   ((CButton*)GetDlgItem(IDC_MUL))->SetCheck(m_iOperand == OPERAND_MUL ? TRUE : FALSE);
  76.   ((CButton*)GetDlgItem(IDC_DVD))->SetCheck(m_iOperand == OPERAND_DVD ? TRUE : FALSE);
  77. }