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.

253 lines
7.4 KiB

  1. // qryprop.h - Query node property pages header file
  2. #ifndef _QRYPROP_H_
  3. #define _QRYPROP_H_
  4. #include "scopenode.h"
  5. #include "atlwin.h"
  6. #include "atldlgs.h"
  7. #include "atlctrls.h"
  8. #include "rootprop.h"
  9. #include <list>
  10. class CQueryEditObj
  11. {
  12. public:
  13. CQueryEditObj(CQueryNode* pQueryNode)
  14. {
  15. ASSERT(pQueryNode != NULL);
  16. m_spQueryNode = pQueryNode;
  17. if( pQueryNode )
  18. {
  19. m_vObjInfo = pQueryNode->Objects();
  20. m_vMenus = pQueryNode->Menus();
  21. }
  22. m_iPageMax = -1;
  23. m_cRef = 0;
  24. }
  25. HRESULT LoadStrings(IStringTable* pStringTable)
  26. {
  27. menucmd_vector::iterator itMenuCmd;
  28. for (itMenuCmd = Menus().begin(); itMenuCmd != Menus().end(); ++itMenuCmd)
  29. {
  30. HRESULT hr = (*itMenuCmd)->LoadName(pStringTable);
  31. RETURN_ON_FAILURE(hr);
  32. }
  33. return S_OK;
  34. }
  35. void PageActive(HWND hwndPage);
  36. BOOL ApplyChanges(HWND hwndPage);
  37. menucmd_vector& Menus() { return m_vMenus; }
  38. ULONG AddRef() { return ++m_cRef; }
  39. ULONG Release()
  40. {
  41. ASSERT(m_cRef > 0);
  42. if (--m_cRef != 0)
  43. return m_cRef;
  44. delete this;
  45. return 0;
  46. }
  47. public:
  48. CComPtr<CQueryNode> m_spQueryNode;
  49. QueryObjVector m_vObjInfo;
  50. menucmd_vector m_vMenus; // Query Nodes now have menus
  51. private:
  52. int m_iPageMax;
  53. int m_cRef;
  54. };
  55. class CQueryGeneralPage : public CPropertyPageImpl<CQueryGeneralPage>
  56. {
  57. public:
  58. typedef CPropertyPageImpl<CQueryGeneralPage> BC;
  59. // Constructor/destructor
  60. CQueryGeneralPage(CQueryEditObj* pEditObj);
  61. virtual ~CQueryGeneralPage();
  62. enum { IDD = IDD_QUERY_GENERAL_PAGE };
  63. protected:
  64. BEGIN_MSG_MAP( CQueryGeneralPage )
  65. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  66. MESSAGE_HANDLER(WM_CLOSE, OnClose)
  67. COMMAND_HANDLER(IDC_COMMENTS, EN_CHANGE, OnChange)
  68. COMMAND_HANDLER(IDC_QUERYSCOPE, BN_CLICKED, OnScopeChange)
  69. COMMAND_HANDLER(IDC_LOCALSCOPE, BN_CLICKED, OnScopeChange)
  70. CHAIN_MSG_MAP(BC)
  71. END_MSG_MAP()
  72. // message handlers
  73. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  74. LRESULT OnClose( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  75. LRESULT OnChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  76. LRESULT OnScopeChange( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  77. // overrrides
  78. BOOL OnSetActive();
  79. BOOL OnApply();
  80. private:
  81. CQueryEditObj& m_EditObject;
  82. };
  83. class CQueryMenuPage : public CPropertyPageImpl<CQueryMenuPage>
  84. {
  85. public:
  86. typedef CPropertyPageImpl<CQueryMenuPage> BC;
  87. CQueryMenuPage(CQueryEditObj* pEditObj);
  88. virtual ~CQueryMenuPage();
  89. enum { IDD = IDD_QUERY_MENU_PAGE };
  90. protected:
  91. BEGIN_MSG_MAP( CQueryMenuPage )
  92. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  93. NOTIFY_HANDLER(IDC_MENULIST, LVN_ITEMCHANGED, OnMenuChanged)
  94. COMMAND_HANDLER(IDC_DEFAULTMENU, BN_CLICKED, OnDefaultChanged)
  95. COMMAND_HANDLER(IDC_OBJECTLIST, CBN_SELENDOK, OnObjectSelect)
  96. COMMAND_HANDLER(IDC_MOVEUP, BN_CLICKED, OnMoveUpDown)
  97. COMMAND_HANDLER(IDC_MOVEDOWN, BN_CLICKED, OnMoveUpDown);
  98. COMMAND_HANDLER(IDC_PROPERTYMENU, BN_CLICKED, OnPropertyMenuChanged)
  99. CHAIN_MSG_MAP(BC)
  100. END_MSG_MAP()
  101. // handlers
  102. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  103. LRESULT OnMenuChanged(int idCtrl, LPNMHDR pNMHDR, BOOL& bHandled);
  104. LRESULT OnObjectSelect( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  105. LRESULT OnMoveUpDown( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  106. LRESULT OnDefaultChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  107. LRESULT OnPropertyMenuChanged(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  108. // overrrides
  109. BOOL OnSetActive();
  110. BOOL OnApply();
  111. void DisplayMenus();
  112. void DisplayMenuItem(int iIndex, CMenuCmd* pMenuCmd, BOOL bEnabled);
  113. void SaveMenuSet();
  114. private:
  115. CQueryEditObj& m_EditObject;
  116. CComboBox m_ObjectCB;
  117. CListViewEx m_MenuLV;
  118. CQueryObjInfo* m_pObjSel;
  119. BOOL m_bLoading;
  120. BOOL m_DefaultID;
  121. };
  122. class CQueryViewPage : public CPropertyPageImpl<CQueryViewPage>
  123. {
  124. public:
  125. typedef CPropertyPageImpl<CQueryViewPage> BC;
  126. CQueryViewPage(CQueryEditObj* pEditObj);
  127. virtual ~CQueryViewPage();
  128. enum { IDD = IDD_QUERY_VIEW_PAGE };
  129. protected:
  130. BEGIN_MSG_MAP( CQueryViewPage )
  131. NOTIFY_HANDLER(IDC_COLUMNLIST, LVN_ITEMCHANGED, OnColumnChanged)
  132. NOTIFY_HANDLER(IDC_COLUMNLIST, LVN_COLUMNCLICK, OnColumnClick)
  133. COMMAND_HANDLER(IDC_OBJECTLIST, CBN_SELENDOK, OnObjectSelect )
  134. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  135. CHAIN_MSG_MAP(BC)
  136. END_MSG_MAP()
  137. // handlers
  138. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  139. LRESULT OnObjectSelect( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  140. LRESULT OnColumnChanged(int idCtrl, LPNMHDR pNMHDR, BOOL& bHandled);
  141. LRESULT OnColumnClick(int idCtrl, LPNMHDR pNMHDR, BOOL& bHandled);
  142. // overrrides
  143. BOOL OnSetActive();
  144. BOOL OnApply();
  145. void DisplayColumns();
  146. void SaveColumnSet();
  147. private:
  148. CQueryEditObj& m_EditObject;
  149. CQueryObjInfo* m_pObjSel;
  150. CComboBox m_ObjectCB;
  151. CListViewEx m_ColumnLV;
  152. BOOL m_bLoading;
  153. };
  154. class CQueryNodeMenuPage : public CPropertyPageImpl<CQueryNodeMenuPage>
  155. {
  156. public:
  157. typedef CPropertyPageImpl<CQueryNodeMenuPage> BC;
  158. CQueryNodeMenuPage(CQueryEditObj* pEditObj);
  159. virtual ~CQueryNodeMenuPage();
  160. enum { IDD = IDD_QUERY_NODE_MENU_PAGE };
  161. protected:
  162. BEGIN_MSG_MAP( CQueryNodeMenuPage )
  163. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  164. NOTIFY_HANDLER(IDC_MENULIST, LVN_ITEMCHANGED, OnMenuListChanged)
  165. NOTIFY_HANDLER(IDC_MENULIST, NM_DBLCLK, OnMenuListDblClk)
  166. COMMAND_HANDLER(IDC_ADDMENU, BN_CLICKED, OnAddMenu)
  167. COMMAND_HANDLER(IDC_REMOVEMENU, BN_CLICKED, OnRemoveMenu)
  168. COMMAND_HANDLER(IDC_EDITMENU, BN_CLICKED, OnEditMenu)
  169. COMMAND_HANDLER(IDC_MOVEUP, BN_CLICKED, OnMoveUpDown)
  170. COMMAND_HANDLER(IDC_MOVEDOWN, BN_CLICKED, OnMoveUpDown);
  171. CHAIN_MSG_MAP(BC)
  172. END_MSG_MAP()
  173. // handlers
  174. LRESULT OnInitDialog( UINT mMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
  175. LRESULT OnAddMenu( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  176. LRESULT OnRemoveMenu( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  177. LRESULT OnEditMenu( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  178. LRESULT OnMoveUpDown( WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled );
  179. LRESULT OnMenuListChanged(int idCtrl, LPNMHDR pNMHDR, BOOL& bHandled);
  180. LRESULT OnMenuListDblClk(int idCtrl, LPNMHDR pNMHDR, BOOL& bHandled);
  181. // overrrides
  182. BOOL OnSetActive();
  183. BOOL OnApply();
  184. void OnFinalMessage(HWND) { delete this; }
  185. // implementation
  186. void DisplayMenus();
  187. private:
  188. CListViewCtrl m_MenuLV;
  189. CQueryEditObj& m_EditObject;
  190. };
  191. #endif // _QRYPROP_H_