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.

260 lines
9.0 KiB

  1. // cmndgls.h - Common dialogs header file
  2. #ifndef _CMNDLGS_H_
  3. #define _CMNDLGS_H_
  4. #include "resource.h"
  5. #include "menucmd.h"
  6. #include "util.h"
  7. #include "qryprop.h" // For QueryEditNode
  8. #include <list>
  9. class CClassInfo;
  10. class DisplayNameMap;
  11. class CGroupNode;
  12. class CScopeNode;
  13. class CAddGroupNodeDlg : public CDialogImpl<CAddGroupNodeDlg>
  14. {
  15. public:
  16. typedef CDialogImpl<CAddGroupNodeDlg> BC;
  17. CAddGroupNodeDlg() : m_pnode( NULL ) {}
  18. enum { IDD = IDD_ADDGROUPNODE };
  19. int DoModal(CGroupNode* pnode, HWND hwndParent)
  20. {
  21. m_pnode = pnode;
  22. return BC::DoModal(hwndParent);
  23. }
  24. LPCWSTR GetNodeName() { return m_strName.c_str(); }
  25. BEGIN_MSG_MAP( CAddGroupNodeDlg )
  26. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  27. COMMAND_HANDLER(IDC_NAME, EN_CHANGE, OnEditChange)
  28. COMMAND_HANDLER(IDC_FILTER, EN_CHANGE, OnEditChange)
  29. COMMAND_HANDLER(IDC_APPLYSCOPE, BN_CLICKED, OnApplyScopeClicked)
  30. COMMAND_HANDLER(IDC_APPLYFILTER, BN_CLICKED, OnApplyFilterClicked)
  31. COMMAND_HANDLER(IDC_SCOPE_BROWSE, BN_CLICKED, OnScopeBrowse)
  32. COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnClose)
  33. END_MSG_MAP()
  34. // message handlers
  35. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  36. LRESULT OnEditChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  37. LRESULT OnApplyScopeClicked( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  38. LRESULT OnApplyFilterClicked( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  39. LRESULT OnClassSelect( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  40. LRESULT OnScopeBrowse( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  41. LRESULT OnClose( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  42. protected:
  43. void EnableOKButton();
  44. private:
  45. tstring m_strScope;
  46. tstring m_strName;
  47. CGroupNode* m_pnode;
  48. };
  49. class CAddColumnDlg : public CDialogImpl<CAddColumnDlg>
  50. {
  51. public:
  52. typedef CDialogImpl<CAddColumnDlg> BC;
  53. enum { IDD = IDD_ADDCOLUMN };
  54. CAddColumnDlg(LPCWSTR pszClassName) : m_strClassName(pszClassName) {}
  55. BEGIN_MSG_MAP( CAddColumnDlg )
  56. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  57. NOTIFY_HANDLER(IDC_COLUMNLIST, LVN_ITEMCHANGED, OnColumnChanged)
  58. NOTIFY_HANDLER(IDC_COLUMNLIST, LVN_ITEMACTIVATE, OnColumnActivate)
  59. COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnClose)
  60. END_MSG_MAP()
  61. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  62. LRESULT OnClose( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  63. LRESULT OnColumnChanged(int idCtrl, LPNMHDR pNMHDR, BOOL& bHandled);
  64. LRESULT OnColumnActivate(int idCtrl, LPNMHDR pNMHDR, BOOL& bHandled);
  65. string_vector& GetColumns() { return m_vstrColumns; }
  66. private:
  67. tstring m_strClassName;
  68. string_vector m_vstrColumns;
  69. string_vector m_vstrAllColumns;
  70. };
  71. class CAddMenuDlg : public CDialogImpl<CAddMenuDlg>
  72. {
  73. public:
  74. typedef CDialogImpl<CAddMenuDlg> BC;
  75. enum { IDD = IDD_ADDMENU };
  76. CAddMenuDlg(CClassInfo& classInfo, CMenuCmd* pMenu = NULL) :
  77. m_ClassInfo(classInfo), m_pMenuCmd(pMenu), m_bUserModifiedName(FALSE) {};
  78. virtual ~CAddMenuDlg();
  79. CMenuCmd* GetMenu() { return m_pMenuCmd; }
  80. BEGIN_MSG_MAP( CAddMenuDlg )
  81. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  82. NOTIFY_HANDLER(IDC_MENULIST, LVN_ITEMCHANGED, OnMenuChanged)
  83. COMMAND_HANDLER(IDC_COMMAND, EN_CHANGE, OnCommandChange)
  84. COMMAND_HANDLER(IDC_STARTIN, EN_CHANGE, OnStartDirChange)
  85. COMMAND_HANDLER(IDC_NAME, EN_CHANGE, OnNameChange)
  86. COMMAND_HANDLER(IDC_COMMANDTYPE, CBN_SELENDOK, OnTypeSelect )
  87. COMMAND_HANDLER(IDC_COMMAND_BROWSE, BN_CLICKED, OnBrowseForCommand)
  88. COMMAND_HANDLER(IDC_STARTIN_BROWSE, BN_CLICKED, OnBrowseForStartIn)
  89. COMMAND_HANDLER(IDC_PARAMS_MENU, BN_CLICKED, OnParameterMenu)
  90. COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnClose)
  91. END_MSG_MAP()
  92. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  93. LRESULT OnTypeSelect( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  94. LRESULT OnClose( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  95. LRESULT OnBrowseForCommand( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  96. LRESULT OnBrowseForStartIn( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  97. LRESULT OnParameterMenu( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  98. LRESULT OnNameChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  99. LRESULT OnCommandChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  100. LRESULT OnStartDirChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  101. LRESULT OnMenuChanged(int idCtrl, LPNMHDR pNMHDR, BOOL& bHandled);
  102. private:
  103. void SetMenuType(MENUTYPE type);
  104. void LoadClassMenuCmds();
  105. void LoadMenuInfo(CMenuCmd* pMenuCmd);
  106. void EnableOKButton();
  107. string_vector& GetStandardParams();
  108. private:
  109. CClassInfo& m_ClassInfo;
  110. CComboBoxEx m_MenuTypeCB;
  111. CMenuCmd* m_pMenuCmd;
  112. MENUTYPE m_menutype;
  113. HBITMAP m_hbmArrow;
  114. string_vector m_vstrStdParam;
  115. bool m_bCommandChg;
  116. bool m_bStartDirChg;
  117. bool m_bUserModifiedName;
  118. };
  119. class CAddQNMenuDlg : public CDialogImpl<CAddQNMenuDlg>
  120. {
  121. public:
  122. typedef CDialogImpl<CAddQNMenuDlg> BC;
  123. enum { IDD = IDD_ADDQUERYMENU };
  124. CAddQNMenuDlg(CQueryEditObj& editObject, CMenuCmd* pMenu = NULL) :
  125. m_EditObject(editObject), m_pMenuCmd(pMenu), m_bUserModifiedName(FALSE) {};
  126. ~CAddQNMenuDlg() {};
  127. CMenuCmd* GetMenu() { return m_pMenuCmd; }
  128. BEGIN_MSG_MAP( CAddQNMenuDlg )
  129. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  130. COMMAND_HANDLER(IDC_COMMAND, EN_CHANGE, OnCommandChange)
  131. COMMAND_HANDLER(IDC_STARTIN, EN_CHANGE, OnStartDirChange)
  132. COMMAND_HANDLER(IDC_NAME, EN_CHANGE, OnNameChange)
  133. COMMAND_HANDLER(IDC_COMMAND_BROWSE, BN_CLICKED, OnBrowseForCommand)
  134. COMMAND_HANDLER(IDC_STARTIN_BROWSE, BN_CLICKED, OnBrowseForStartIn)
  135. COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnClose)
  136. END_MSG_MAP()
  137. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  138. LRESULT OnClose( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  139. LRESULT OnBrowseForCommand( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  140. LRESULT OnBrowseForStartIn( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  141. LRESULT OnNameChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  142. LRESULT OnCommandChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  143. LRESULT OnStartDirChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  144. private:
  145. void SetMenuType(MENUTYPE type);
  146. void LoadMenuInfo(CMenuCmd* pMenuCmd);
  147. void EnableOKButton();
  148. private:
  149. CQueryEditObj& m_EditObject;
  150. CMenuCmd* m_pMenuCmd;
  151. MENUTYPE m_menutype;
  152. bool m_bCommandChg;
  153. bool m_bStartDirChg;
  154. bool m_bUserModifiedName;
  155. };
  156. class CMoveQueryDlg : public CDialogImpl<CMoveQueryDlg>
  157. {
  158. public:
  159. typedef CDialogImpl<CMoveQueryDlg> BC;
  160. CMoveQueryDlg() : m_pnodeCurFolder(NULL), m_ppnodeDestFolder(NULL) {};
  161. enum { IDD = IDD_MOVEQUERY };
  162. BEGIN_MSG_MAP( CMoveQueryDlg )
  163. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  164. COMMAND_RANGE_HANDLER(IDOK, IDCANCEL, OnClose)
  165. END_MSG_MAP()
  166. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  167. LRESULT OnClose( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  168. int DoModal(CScopeNode* pnodeCurFolder, CScopeNode** ppnodeDestFolder)
  169. {
  170. m_pnodeCurFolder = pnodeCurFolder;
  171. m_ppnodeDestFolder = ppnodeDestFolder;
  172. return BC::DoModal();
  173. }
  174. private:
  175. CScopeNode* m_pnodeCurFolder;
  176. CScopeNode** m_ppnodeDestFolder;
  177. };
  178. //
  179. // Function objects that convert between parameter LDAP and display names
  180. //
  181. class CLookupDisplayName : public CParamLookup
  182. {
  183. public:
  184. CLookupDisplayName(string_vector& vstrParam, DisplayNameMap* pNameMap)
  185. : m_vstrParam(vstrParam), m_pNameMap(pNameMap) {}
  186. virtual BOOL operator() (tstring& strParam, tstring& strValue);
  187. string_vector& m_vstrParam;
  188. DisplayNameMap* m_pNameMap;
  189. };
  190. class CLookupLDAPName : public CParamLookup
  191. {
  192. public:
  193. CLookupLDAPName(string_vector& vstrParam, DisplayNameMap* pNameMap)
  194. : m_vstrParam(vstrParam), m_pNameMap(pNameMap) {}
  195. virtual BOOL operator() (tstring& strParam, tstring& strValue);
  196. string_vector& m_vstrParam;
  197. DisplayNameMap* m_pNameMap;
  198. };
  199. #endif // _CMNDLGS_H_