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.

206 lines
4.4 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1998
  6. //
  7. // File: ipeditor.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _IPEDITOR_H
  11. #define _IPEDITOR_H
  12. /////////////////////////////////////////////////////////////////////////////
  13. #include "uiutil.h"
  14. #include "browser.h"
  15. ///////////////////////////////////////////////////////////////////////////////
  16. // FORWARD DECLARATIONS
  17. class CComponentDataObject;
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CIPListBox
  20. class CIPEditor; // fwd decl
  21. class CIPListBox : public CListBox
  22. {
  23. // Construction
  24. public:
  25. CIPListBox() {}
  26. // Attributes
  27. public:
  28. // Operations
  29. public:
  30. void SetEditor(CIPEditor* pEditor) { ASSERT(pEditor != NULL); m_pEditor = pEditor; }
  31. BOOL OnAdd(DWORD dwIpAddr);
  32. BOOL OnAddEx(DWORD dwIpAddr, LPCTSTR lpszServerName);
  33. void OnRemove(DWORD* pdwIpAddr);
  34. void OnUp();
  35. void OnDown();
  36. void UpdateHorizontalExtent();
  37. int FindIndexOfIpAddr(DWORD dwIpAddr);
  38. // Overrides
  39. // ClassWizard generated virtual function overrides
  40. //{{AFX_VIRTUAL(CIPListBox)
  41. //}}AFX_VIRTUAL
  42. // Implementation
  43. public:
  44. virtual ~CIPListBox() {}
  45. // Generated message map functions
  46. protected:
  47. CIPEditor* m_pEditor;
  48. //{{AFX_MSG(CIPListBox)
  49. afx_msg void OnSelChange();
  50. //}}AFX_MSG
  51. DECLARE_MESSAGE_MAP()
  52. };
  53. /////////////////////////////////////////////////////////////////////////////
  54. // CIPEdit
  55. class CIPEdit : public CDNSIPv4Control
  56. {
  57. // Construction
  58. public:
  59. CIPEdit() {};
  60. // Attributes
  61. public:
  62. // Operations
  63. public:
  64. void SetEditor(CIPEditor* pEditor) { ASSERT(pEditor != NULL); m_pEditor = pEditor; }
  65. // Overrides
  66. // ClassWizard generated virtual function overrides
  67. //{{AFX_VIRTUAL(CIPEdit)
  68. //}}AFX_VIRTUAL
  69. // Implementation
  70. public:
  71. virtual ~CIPEdit(){};
  72. // Generated message map functions
  73. protected:
  74. CIPEditor* m_pEditor;
  75. //{{AFX_MSG(CIPEdit)
  76. afx_msg void OnChange();
  77. //}}AFX_MSG
  78. DECLARE_MESSAGE_MAP()
  79. };
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CMyButton
  82. class CMyButton : public CButton
  83. {
  84. // Construction
  85. public:
  86. CMyButton() {}
  87. // Attributes
  88. public:
  89. // Operations
  90. public:
  91. void SetEditor(CIPEditor* pEditor) { ASSERT(pEditor != NULL); m_pEditor = pEditor; }
  92. // Overrides
  93. // ClassWizard generated virtual function overrides
  94. //{{AFX_VIRTUAL(CMyButton)
  95. //}}AFX_VIRTUAL
  96. // Implementation
  97. public:
  98. virtual ~CMyButton() {}
  99. // Generated message map functions
  100. protected:
  101. CIPEditor* m_pEditor;
  102. //{{AFX_MSG(CMyButton)
  103. afx_msg void OnClicked();
  104. //}}AFX_MSG
  105. DECLARE_MESSAGE_MAP()
  106. };
  107. /////////////////////////////////////////////////////////////////////////////
  108. // CIPEditor
  109. class CIPEditor
  110. {
  111. public:
  112. CIPEditor(BOOL bNoUpDown = FALSE)
  113. {
  114. m_bNoUpDown = bNoUpDown;
  115. m_pParentWnd = NULL;
  116. m_bUIEnabled = TRUE;
  117. m_nDefID = 0;
  118. }
  119. ~CIPEditor() {}
  120. BOOL Initialize(CWnd* pParentWnd,
  121. CWnd* pControlWnd,
  122. UINT nIDBtnUp, UINT nIDBtnDown,
  123. UINT nIDBtnAdd, UINT nIDBtnRemove,
  124. UINT nIDIPCtrl, UINT nIDIPListBox);
  125. BOOL OnButtonClicked(CMyButton* pButton);
  126. void OnEditChange();
  127. void OnListBoxSelChange()
  128. {
  129. SetButtonsState();
  130. }
  131. void AddAddresses(DWORD* pArr, int nArraySize);
  132. void GetAddresses(DWORD* pArr, int nArraySize, int* pFilled);
  133. void Clear();
  134. BOOL BrowseFromDNSNamespace(CComponentDataObject* pComponentDataObject,
  135. CPropertyPageHolderBase* pHolder,
  136. BOOL bEnableBrowseEdit = FALSE,
  137. LPCTSTR lpszExcludeServerName = NULL);
  138. void FindNames();
  139. void EnableUI(BOOL bEnable, BOOL bListBoxAlwaysEnabled = FALSE);
  140. void ShowUI(BOOL bShow);
  141. int GetCount() { return m_listBox.GetCount();}
  142. CWnd* GetParentWnd() { ASSERT(m_pParentWnd != NULL); return m_pParentWnd;}
  143. protected:
  144. virtual void OnChangeData() {}
  145. private:
  146. void AddAddresses(DWORD* pArr, LPCTSTR* lpszServerNameArr, int nArraySize);
  147. BOOL m_bNoUpDown; // disable and hide the up/down buttons
  148. BOOL m_bUIEnabled;
  149. // Control Objects the editor uses
  150. CMyButton m_upButton;
  151. CMyButton m_removeButton;
  152. CMyButton m_downButton;
  153. CMyButton m_addButton;
  154. CIPEdit m_edit;
  155. CIPListBox m_listBox;
  156. CWnd* m_pParentWnd; // parent dialog or property page
  157. CWnd* m_pControlWnd; // parent dialog or property sheet when being used in a property page
  158. UINT m_nDefID;
  159. void SetButtonsState();
  160. };
  161. #endif //_IPEDITOR_H