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.

142 lines
3.9 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1999 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. sscoppp.cpp
  7. The superscope properties page
  8. FILE HISTORY:
  9. */
  10. #include "stdafx.h"
  11. #include "sscoppp.h"
  12. #include "server.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. //
  20. // CSuperscopeProperties holder
  21. //
  22. /////////////////////////////////////////////////////////////////////////////
  23. CSuperscopeProperties::CSuperscopeProperties
  24. (
  25. ITFSNode * pNode,
  26. IComponentData * pComponentData,
  27. ITFSComponentData * pTFSCompData,
  28. LPCTSTR pszSheetName
  29. ) : CPropertyPageHolderBase(pNode, pComponentData, pszSheetName)
  30. {
  31. //ASSERT(pFolderNode == GetContainerNode());
  32. m_bAutoDeletePages = FALSE; // we have the pages as embedded members
  33. AddPageToList((CPropertyPageBase*) &m_pageGeneral);
  34. Assert(pTFSCompData != NULL);
  35. m_spTFSCompData.Set(pTFSCompData);
  36. }
  37. CSuperscopeProperties::~CSuperscopeProperties()
  38. {
  39. RemovePageFromList((CPropertyPageBase*) &m_pageGeneral, FALSE);
  40. }
  41. /////////////////////////////////////////////////////////////////////////////
  42. // CSuperscopePropGeneral property page
  43. IMPLEMENT_DYNCREATE(CSuperscopePropGeneral, CPropertyPageBase)
  44. CSuperscopePropGeneral::CSuperscopePropGeneral() : CPropertyPageBase(CSuperscopePropGeneral::IDD)
  45. {
  46. //{{AFX_DATA_INIT(CSuperscopePropGeneral)
  47. m_strSuperscopeName = _T("");
  48. //}}AFX_DATA_INIT
  49. m_uImage = 0;
  50. }
  51. CSuperscopePropGeneral::~CSuperscopePropGeneral()
  52. {
  53. }
  54. void CSuperscopePropGeneral::DoDataExchange(CDataExchange* pDX)
  55. {
  56. CPropertyPageBase::DoDataExchange(pDX);
  57. //{{AFX_DATA_MAP(CSuperscopePropGeneral)
  58. DDX_Text(pDX, IDC_EDIT_SUPERSCOPE_NAME, m_strSuperscopeName);
  59. //}}AFX_DATA_MAP
  60. }
  61. BEGIN_MESSAGE_MAP(CSuperscopePropGeneral, CPropertyPageBase)
  62. //{{AFX_MSG_MAP(CSuperscopePropGeneral)
  63. ON_EN_CHANGE(IDC_EDIT_SUPERSCOPE_NAME, OnChangeEditSuperscopeName)
  64. //}}AFX_MSG_MAP
  65. END_MESSAGE_MAP()
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CSuperscopePropGeneral message handlers
  68. BOOL CSuperscopePropGeneral::OnPropertyChange(BOOL bScope, LONG_PTR *ChangeMask)
  69. {
  70. SPITFSNode spSuperscopeNode;
  71. spSuperscopeNode = GetHolder()->GetNode();
  72. CDhcpSuperscope * pSuperscope = GETHANDLER(CDhcpSuperscope, spSuperscopeNode);
  73. BEGIN_WAIT_CURSOR;
  74. pSuperscope->Rename(spSuperscopeNode, m_strSuperscopeName);
  75. END_WAIT_CURSOR;
  76. *ChangeMask = SCOPE_PANE_CHANGE_ITEM_DATA;
  77. return FALSE;
  78. }
  79. void CSuperscopePropGeneral::OnChangeEditSuperscopeName()
  80. {
  81. SetDirty(TRUE);
  82. }
  83. BOOL CSuperscopePropGeneral::OnApply()
  84. {
  85. UpdateData();
  86. return CPropertyPageBase::OnApply();
  87. }
  88. BOOL CSuperscopePropGeneral::OnInitDialog()
  89. {
  90. CPropertyPageBase::OnInitDialog();
  91. // Limit the name and comment fields to 255 chars
  92. CEdit *pEditName = reinterpret_cast<CEdit *>(GetDlgItem( IDC_EDIT_SUPERSCOPE_NAME ));
  93. if ( 0 != pEditName ) {
  94. pEditName->LimitText( MAX_NAME_LENGTH ); // max characters for superscope name
  95. }
  96. // load the correct icon
  97. for (int i = 0; i < ICON_IDX_MAX; i++)
  98. {
  99. if (g_uIconMap[i][1] == m_uImage)
  100. {
  101. HICON hIcon = LoadIcon(AfxGetResourceHandle(), MAKEINTRESOURCE(g_uIconMap[i][0]));
  102. if (hIcon)
  103. ((CStatic *) GetDlgItem(IDC_STATIC_ICON))->SetIcon(hIcon);
  104. break;
  105. }
  106. }
  107. SetDirty(FALSE);
  108. return TRUE; // return TRUE unless you set the focus to a control
  109. // EXCEPTION: OCX Property Pages should return FALSE
  110. }