Source code of Windows XP (NT5)
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.

170 lines
4.3 KiB

  1. // GroupGeneralPage.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "snapin.h"
  5. #include "GroupGeneralPage.h"
  6. #include "HMObject.h"
  7. #include "SystemGroup.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CGroupGeneralPage property page
  15. IMPLEMENT_DYNCREATE(CGroupGeneralPage, CHMPropertyPage)
  16. CGroupGeneralPage::CGroupGeneralPage() : CHMPropertyPage(CGroupGeneralPage::IDD)
  17. {
  18. EnableAutomation();
  19. //{{AFX_DATA_INIT(CGroupGeneralPage)
  20. m_sComment = _T("");
  21. m_sName = _T("");
  22. m_sCreationDate = _T("");
  23. m_sLastModifiedDate = _T("");
  24. //}}AFX_DATA_INIT
  25. CnxPropertyPageInit();
  26. }
  27. CGroupGeneralPage::~CGroupGeneralPage()
  28. {
  29. }
  30. void CGroupGeneralPage::OnFinalRelease()
  31. {
  32. // When the last reference for an automation object is released
  33. // OnFinalRelease is called. The base class will automatically
  34. // deletes the object. Add additional cleanup required for your
  35. // object before calling the base class.
  36. CHMPropertyPage::OnFinalRelease();
  37. }
  38. void CGroupGeneralPage::DoDataExchange(CDataExchange* pDX)
  39. {
  40. CHMPropertyPage::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(CGroupGeneralPage)
  42. DDX_Text(pDX, IDC_EDIT_COMMENT, m_sComment);
  43. DDX_Text(pDX, IDC_EDIT_NAME, m_sName);
  44. DDX_Text(pDX, IDC_STATIC_DATE_CREATED, m_sCreationDate);
  45. DDX_Text(pDX, IDC_STATIC_DATE_LAST_MODIFIED, m_sLastModifiedDate);
  46. //}}AFX_DATA_MAP
  47. }
  48. BEGIN_MESSAGE_MAP(CGroupGeneralPage, CHMPropertyPage)
  49. //{{AFX_MSG_MAP(CGroupGeneralPage)
  50. ON_EN_CHANGE(IDC_EDIT_COMMENT, OnChangeEditComment)
  51. ON_WM_DESTROY()
  52. ON_EN_CHANGE(IDC_EDIT_NAME, OnChangeEditName)
  53. //}}AFX_MSG_MAP
  54. END_MESSAGE_MAP()
  55. BEGIN_DISPATCH_MAP(CGroupGeneralPage, CHMPropertyPage)
  56. //{{AFX_DISPATCH_MAP(CGroupGeneralPage)
  57. // NOTE - the ClassWizard will add and remove mapping macros here.
  58. //}}AFX_DISPATCH_MAP
  59. END_DISPATCH_MAP()
  60. // Note: we add support for IID_IGroupGeneralPage to support typesafe binding
  61. // from VBA. This IID must match the GUID that is attached to the
  62. // dispinterface in the .ODL file.
  63. // {C3F44E7A-BA00-11D2-BD76-0000F87A3912}
  64. static const IID IID_IGroupGeneralPage =
  65. { 0xc3f44e7a, 0xba00, 0x11d2, { 0xbd, 0x76, 0x0, 0x0, 0xf8, 0x7a, 0x39, 0x12 } };
  66. BEGIN_INTERFACE_MAP(CGroupGeneralPage, CHMPropertyPage)
  67. INTERFACE_PART(CGroupGeneralPage, IID_IGroupGeneralPage, Dispatch)
  68. END_INTERFACE_MAP()
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CGroupGeneralPage message handlers
  71. BOOL CGroupGeneralPage::OnInitDialog()
  72. {
  73. // unmarshal connmgr
  74. CnxPropertyPageCreate();
  75. CHMPropertyPage::OnInitDialog();
  76. if( GetObjectPtr()->IsKindOf(RUNTIME_CLASS(CSystemGroup)) )
  77. {
  78. m_sHelpTopic = _T("HMon21.chm::/dSGgen.htm");
  79. }
  80. else
  81. {
  82. m_sHelpTopic = _T("HMon21.chm::/dDGgen.htm");
  83. }
  84. m_sName = GetObjectPtr()->GetName();
  85. m_sComment = GetObjectPtr()->GetComment();
  86. GetObjectPtr()->GetCreateDateTime(m_sCreationDate);
  87. GetObjectPtr()->GetModifiedDateTime(m_sLastModifiedDate);
  88. if( GetObjectPtr()->IsKindOf(RUNTIME_CLASS(CSystemGroup)) )
  89. {
  90. CStatic* pStatic = (CStatic*)GetDlgItem(IDC_ICON_STATIC);
  91. pStatic->SetIcon(AfxGetApp()->LoadIcon(IDI_ICON_SYSTEMS));
  92. }
  93. UpdateData(FALSE);
  94. return TRUE; // return TRUE unless you set the focus to a control
  95. // EXCEPTION: OCX Property Pages should return FALSE
  96. }
  97. void CGroupGeneralPage::OnChangeEditComment()
  98. {
  99. // TODO: If this is a RICHEDIT control, the control will not
  100. // send this notification unless you override the CHMPropertyPage::OnInitDialog()
  101. // function and call CRichEditCtrl().SetEventMask()
  102. // with the ENM_CHANGE flag ORed into the mask.
  103. SetModified(TRUE);
  104. }
  105. void CGroupGeneralPage::OnOK()
  106. {
  107. CHMPropertyPage::OnOK();
  108. }
  109. void CGroupGeneralPage::OnDestroy()
  110. {
  111. CHMPropertyPage::OnDestroy();
  112. CnxPropertyPageDestroy();
  113. }
  114. BOOL CGroupGeneralPage::OnApply()
  115. {
  116. if( ! CHMPropertyPage::OnApply() )
  117. {
  118. return FALSE;
  119. }
  120. UpdateData();
  121. GetObjectPtr()->Rename(m_sName);
  122. GetObjectPtr()->UpdateComment(m_sComment);
  123. SetModified(FALSE);
  124. return TRUE;
  125. }
  126. void CGroupGeneralPage::OnChangeEditName()
  127. {
  128. // TODO: If this is a RICHEDIT control, the control will not
  129. // send this notification unless you override the CHMPropertyPage::OnInitDialog()
  130. // function and call CRichEditCtrl().SetEventMask()
  131. // with the ENM_CHANGE flag ORed into the mask.
  132. UpdateData();
  133. SetModified();
  134. }