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.

165 lines
4.3 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 2000, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // grouppage.h
  8. //
  9. // SYNOPSIS
  10. //
  11. // Declares the class ServerGroupPage
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 02/20/2000 Original version.
  16. // 04/19/2000 Marshall SDOs across apartments.
  17. //
  18. ///////////////////////////////////////////////////////////////////////////////
  19. #ifndef GROUPPAGE_H
  20. #define GROUPPAGE_H
  21. #if _MSC_VER >= 1000
  22. #pragma once
  23. #endif
  24. ///////////////////////////////////////////////////////////////////////////////
  25. //
  26. // CLASS
  27. //
  28. // CSysColorImageList
  29. //
  30. // DESCRIPTION
  31. //
  32. // I stole this from MMC.
  33. //
  34. ///////////////////////////////////////////////////////////////////////////////
  35. class CSysColorImageList : public CImageList
  36. {
  37. public:
  38. CSysColorImageList(HINSTANCE hInst, UINT nID);
  39. void OnSysColorChange();
  40. operator HIMAGELIST() const
  41. {
  42. return (CImageList::operator HIMAGELIST());
  43. }
  44. private:
  45. void CreateSysColorImageList();
  46. HINSTANCE m_hInst;
  47. HRSRC m_hRsrc;
  48. };
  49. ///////////////////////////////////////////////////////////////////////////////
  50. //
  51. // CLASS
  52. //
  53. // ServerList
  54. //
  55. // DESCRIPTION
  56. //
  57. // Encapsulates the functionality for manipulating a list of RADIUS servers.
  58. //
  59. ///////////////////////////////////////////////////////////////////////////////
  60. class ServerList
  61. {
  62. public:
  63. ServerList();
  64. void onInitDialog(HWND dialog, Sdo& serverGroup);
  65. void onSysColorChange();
  66. void onColumnClick(int column);
  67. void onServerChanged();
  68. bool onAdd();
  69. bool onEdit();
  70. bool onRemove();
  71. void getData();
  72. void setData();
  73. void saveChanges(bool apply = true);
  74. void discardChanges();
  75. bool isEmpty()
  76. { return serverList.GetItemCount() == 0; }
  77. protected:
  78. // Sort the server list.
  79. void sort();
  80. // Add or update an item in the server list.
  81. void updateServer(Sdo& server, UINT nItem, bool create);
  82. typedef ObjectVector<ISdo> SdoVector;
  83. typedef ObjectVector<ISdo>::iterator SdoIterator;
  84. SdoCollection servers; // Servers in this group.
  85. HWND removeButton; // Handle to remove button.
  86. HWND editButton; // Handle to edit button.
  87. CImageList serverIcons; // ImageList for the ListCtrl.
  88. CSysColorImageList sortIcons; // ImageList for the HeaderCtrl.
  89. CListCtrl serverList; // Server ListCtrl.
  90. SdoVector original; // Original set of server SDOs.
  91. SdoVector dirty; // Servers that have been edited.
  92. SdoVector added; // Servers that have been added.
  93. SdoVector removed; // Servers that have been removed.
  94. int sortColumn; // Current sort column.
  95. bool descending[3]; // Sort order for each column.
  96. // Not implemented.
  97. ServerList(const ServerList&);
  98. ServerList& operator=(const ServerList&);
  99. };
  100. ///////////////////////////////////////////////////////////////////////////////
  101. //
  102. // CLASS
  103. //
  104. // ServerGroupPage
  105. //
  106. // DESCRIPTION
  107. //
  108. // Implements the lone property page for a RADIUS server group.
  109. //
  110. ///////////////////////////////////////////////////////////////////////////////
  111. class ServerGroupPage : public SnapInPropertyPage
  112. {
  113. public:
  114. ServerGroupPage(
  115. LONG_PTR notifyHandle,
  116. LPARAM notifyParam,
  117. Sdo& groupSdo,
  118. bool useName = true
  119. );
  120. protected:
  121. virtual BOOL OnInitDialog();
  122. virtual void OnSysColorChange();
  123. afx_msg void onAdd();
  124. afx_msg void onEdit();
  125. afx_msg void onRemove();
  126. afx_msg void onColumnClick(NMLISTVIEW* listView, LRESULT* result);
  127. afx_msg void onItemActivate(NMITEMACTIVATE* itemActivate, LRESULT* result);
  128. afx_msg void onServerChanged(NMLISTVIEW* listView, LRESULT* result);
  129. DECLARE_MESSAGE_MAP()
  130. DEFINE_ERROR_CAPTION(IDS_GROUP_E_CAPTION);
  131. // From SnapInPropertyPage
  132. virtual void getData();
  133. virtual void setData();
  134. virtual void saveChanges();
  135. virtual void discardChanges();
  136. private:
  137. SdoStream<Sdo> selfStream; // Marshal the SDO to the dialog thread.
  138. Sdo self; // The SDO we're editing.
  139. CComBSTR name; // Group name.
  140. ServerList servers; // Servers in this group.
  141. };
  142. #endif // GROUPPAGE_H