Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

138 lines
2.8 KiB

  1. // regsheet.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "regtrace.h"
  5. #include "regsheet.h"
  6. #ifdef _DEBUG
  7. #undef THIS_FILE
  8. static char BASED_CODE THIS_FILE[] = __FILE__;
  9. #endif
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CRegPropertySheet
  12. IMPLEMENT_DYNAMIC(CRegPropertySheet, CPropertySheet)
  13. CRegPropertySheet::CRegPropertySheet(UINT nIDCaption, CWnd* pParentWnd, UINT iSelectPage)
  14. :CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
  15. {
  16. }
  17. CRegPropertySheet::CRegPropertySheet(LPCTSTR pszCaption, CWnd* pParentWnd, UINT iSelectPage)
  18. :CPropertySheet(pszCaption, pParentWnd, iSelectPage)
  19. {
  20. }
  21. CRegPropertySheet::~CRegPropertySheet()
  22. {
  23. }
  24. //
  25. // Need to override the default MFC behaviour to achieve the Win'95 behaviour
  26. //
  27. void CRegPropertySheet::OnApplyNow()
  28. {
  29. if ( GetActivePage()->OnKillActive() )
  30. {
  31. for ( int i=0; i<GetPageCount(); i++ )
  32. {
  33. CPropertyPage* pPage = GetPage( i );
  34. ASSERT( pPage->IsKindOf( RUNTIME_CLASS( CRegPropertyPage ) ) );
  35. if ( ((CRegPropertyPage *)pPage)->IsModified() )
  36. {
  37. pPage->OnOK();
  38. }
  39. }
  40. }
  41. }
  42. void CRegPropertySheet::OnOK()
  43. {
  44. OnApplyNow();
  45. if (!m_bModeless)
  46. {
  47. EndDialog(IDOK);
  48. }
  49. }
  50. void CRegPropertySheet::OnCancel()
  51. {
  52. int i;
  53. for ( i=0; i<GetPageCount(); i++ )
  54. {
  55. GetPage( i )->OnCancel();
  56. }
  57. if (!m_bModeless)
  58. {
  59. EndDialog(IDCANCEL);
  60. }
  61. }
  62. BEGIN_MESSAGE_MAP(CRegPropertySheet, CPropertySheet)
  63. //{{AFX_MSG_MAP(CRegPropertySheet)
  64. ON_COMMAND(ID_APPLY_NOW, OnApplyNow)
  65. ON_COMMAND(IDOK, OnOK)
  66. ON_COMMAND(IDCANCEL, OnCancel)
  67. //}}AFX_MSG_MAP
  68. END_MESSAGE_MAP()
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CRegPropertySheet message handlers
  71. /////////////////////////////////////////////////////////////////////////////
  72. // CRegPropertyPage property page
  73. IMPLEMENT_DYNAMIC(CRegPropertyPage, CPropertyPage)
  74. CRegPropertyPage::~CRegPropertyPage()
  75. {
  76. #if _MFC_VER >= 0x0400
  77. m_bChanged = FALSE;
  78. #endif // _MFC_VER >= 0x0400
  79. }
  80. void CRegPropertyPage::DoDataExchange(CDataExchange* pDX)
  81. {
  82. CPropertyPage::DoDataExchange(pDX);
  83. //{{AFX_DATA_MAP(CRegPropertyPage)
  84. // NOTE: the ClassWizard will add DDX and DDV calls here
  85. //}}AFX_DATA_MAP
  86. }
  87. BEGIN_MESSAGE_MAP(CRegPropertyPage, CPropertyPage)
  88. //{{AFX_MSG_MAP(CRegPropertyPage)
  89. // NOTE: the ClassWizard will add message map macros here
  90. //}}AFX_MSG_MAP
  91. END_MESSAGE_MAP()
  92. #if _MFC_VER >= 0x0400
  93. //
  94. // Keep private check on dirty state of the property page.
  95. //
  96. void
  97. CRegPropertyPage::SetModified(
  98. BOOL bChanged
  99. )
  100. {
  101. CPropertyPage::SetModified(bChanged);
  102. m_bChanged = bChanged;
  103. }
  104. #endif // _MFC_VER >= 0x0400
  105. /////////////////////////////////////////////////////////////////////////////
  106. // CRegPropertyPage message handlers