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.

267 lines
9.7 KiB

  1. #ifndef __cmnquryp_h
  2. #define __cmnquryp_h
  3. DEFINE_GUID(IID_IQueryFrame, 0x7e8c7c20, 0x7c9d, 0x11d0, 0x91, 0x3f, 0x0, 0xaa, 0x00, 0xc1, 0x6e, 0x65);
  4. DEFINE_GUID(IID_IQueryHandler, 0xa60cc73f, 0xe0fc, 0x11d0, 0x97, 0x50, 0x0, 0xa0, 0xc9, 0x06, 0xaf, 0x45);
  5. #ifndef GUID_DEFS_ONLY
  6. #define CQFF_ISNEVERLISTED 0x0000004 // = 1 => form not listed in the form selector
  7. #define CQPF_ISGLOBAL 0x00000001 // = 1 => this page is global, and added to all forms
  8. #define OQWF_HIDESEARCHPANE 0x00000100 // = 1 => hide the search pane by on opening
  9. //-----------------------------------------------------------------------------
  10. // Query handler interfaces structures etc
  11. //-----------------------------------------------------------------------------
  12. //
  13. // Query Scopes
  14. // ============
  15. // A query scope is an opaque structure passed between the query handler
  16. // and the query frame. When the handler is first invoked it is asked
  17. // to declare its scope objects, which inturn the frame holds. When the
  18. // query is issued the scope is passed back to the handler.
  19. //
  20. // When a scope is registered the cbSize field of the structure passed
  21. // is used to define how large the scope is, that entire blob is then
  22. // copied into a heap allocation. Therefore allowing the handler
  23. // to create scope blocks on the stack, knowing that the frame will
  24. // take a copy when it calls the AddProc.
  25. //
  26. struct _cqscope;
  27. typedef struct _cqscope CQSCOPE;
  28. typedef CQSCOPE* LPCQSCOPE;
  29. typedef HRESULT (CALLBACK *LPCQSCOPEPROC)(LPCQSCOPE pScope, UINT uMsg, LPVOID pVoid);
  30. struct _cqscope
  31. {
  32. DWORD cbStruct;
  33. DWORD dwFlags;
  34. LPCQSCOPEPROC pScopeProc;
  35. LPARAM lParam;
  36. };
  37. #define CQSM_INITIALIZE 0x0000000
  38. #define CQSM_RELEASE 0x0000001
  39. #define CQSM_GETDISPLAYINFO 0x0000003 // pVoid -> CQSCOPEDISPLAYINFO
  40. #define CQSM_SCOPEEQUAL 0x0000004 // pVoid -> CQSCOPE
  41. typedef struct
  42. {
  43. DWORD cbStruct;
  44. DWORD dwFlags;
  45. LPWSTR pDisplayName;
  46. INT cchDisplayName;
  47. LPWSTR pIconLocation;
  48. INT cchIconLocation;
  49. INT iIconResID;
  50. INT iIndent;
  51. } CQSCOPEDISPLAYINFO, * LPCQSCOPEDISPLAYINFO;
  52. //
  53. // Command ID's reserved for the frame to use when talking to
  54. // the handler. The handler must use only the IDs in the
  55. // range defined by CQID_MINHANDLERMENUID and CQID_MAXHANDLERMENUID
  56. //
  57. #define CQID_MINHANDLERMENUID 0x0100
  58. #define CQID_MAXHANDLERMENUID 0x4000 // all handler IDs must be below this threshold
  59. #define CQID_FILE_CLOSE (CQID_MAXHANDLERMENUID + 0x0100)
  60. #define CQID_VIEW_SEARCHPANE (CQID_MAXHANDLERMENUID + 0x0101)
  61. #define CQID_LOOKFORLABEL (CQID_MAXHANDLERMENUID + 0x0200)
  62. #define CQID_LOOKFOR (CQID_MAXHANDLERMENUID + 0x0201)
  63. #define CQID_LOOKINLABEL (CQID_MAXHANDLERMENUID + 0x0202)
  64. #define CQID_LOOKIN (CQID_MAXHANDLERMENUID + 0x0203)
  65. #define CQID_BROWSE (CQID_MAXHANDLERMENUID + 0x0204)
  66. #define CQID_FINDNOW (CQID_MAXHANDLERMENUID + 0x0205)
  67. #define CQID_STOP (CQID_MAXHANDLERMENUID + 0x0206)
  68. #define CQID_CLEARALL (CQID_MAXHANDLERMENUID + 0x0207)
  69. //
  70. // When calling IQueryHandler::ActivateView the following reason codes
  71. // are passed to indicate the type of activation being performed
  72. //
  73. #define CQRVA_ACTIVATE 0x00 // wParam = 0, lParam = 0
  74. #define CQRVA_DEACTIVATE 0x01 // wParam = 0, lParam = 0
  75. #define CQRVA_INITMENUBAR 0x02 // wParam/lParam => WM_INITMENU
  76. #define CQRVA_INITMENUBARPOPUP 0x03 // wParam/lParam => WM_INITMENUPOPUP
  77. #define CQRVA_FORMCHANGED 0x04 // wParam = title length, lParam -> title string
  78. #define CQRVA_STARTQUERY 0x05 // wParam = fStarted, lParam = 0
  79. #define CQRVA_HELP 0x06 // wParma = 0, lParam = LPHELPINFO
  80. #define CQRVA_CONTEXTMENU 0x07 // wParam/lParam from the WM_CONTEXTMENU call on the frame
  81. //
  82. // The frame creates the view and then queries the handler for display
  83. // information (title, icon, animation etc). These are all loaded as
  84. // resources from the hInstance specified, if 0 is specified for any
  85. // of the resource ID's then defaults are used.
  86. //
  87. typedef struct
  88. {
  89. DWORD dwFlags; // display attributes
  90. HINSTANCE hInstance; // resource hInstance
  91. INT idLargeIcon; // resource ID's for icons
  92. INT idSmallIcon;
  93. INT idTitle; // resource ID for title string
  94. INT idAnimation; // resource ID for animation
  95. } CQVIEWINFO, * LPCQVIEWINFO;
  96. //
  97. // IQueryHandler::GetViewObject is passed a scope indiciator to allow it
  98. // to trim the result set. All handlers must support CQRVS_SELECTION. Also,
  99. // CQRVS_HANDLERMASK defines the flags available for the handler to
  100. // use internally.
  101. //
  102. #define CQRVS_ALL 0x00000001
  103. #define CQRVS_SELECTION 0x00000002
  104. #define CQRVS_MASK 0x00ffffff
  105. #define CQRVS_HANDLERMASK 0xff000000
  106. //
  107. // When invoking the query all the parameters, the scope, the form
  108. // etc are bundled into this structure and then passed to the
  109. // IQueryHandler::IssueQuery method, it inturn populates the view
  110. // previously created with IQueryHandler::CreateResultView.
  111. //
  112. typedef struct
  113. {
  114. DWORD cbStruct;
  115. DWORD dwFlags;
  116. LPCQSCOPE pQueryScope; // handler specific scope
  117. LPVOID pQueryParameters; // handle specific argument block
  118. CLSID clsidForm; // form ID
  119. } CQPARAMS, * LPCQPARAMS;
  120. //
  121. // Query Frame Window Messages
  122. // ===========================
  123. //
  124. // CQFWM_ADDSCOPE
  125. // --------------
  126. // wParam = LPCQSCOPE, lParam = HIWORD(index), LOWORD(fSelect)
  127. //
  128. // Add a scope to the scope list of the dialog, allows async scope collection
  129. // to be performed. When the handlers AddScopes method is called then
  130. // handler can return S_OK, spin off a thread and post CQFWM_ADDSCOPE
  131. // messages to the frame, which will inturn allow the scopes to be
  132. // added to the control. When the frame receives this message it copies
  133. // the scope as it does on IQueryFrame::AddScope, if the call fails it
  134. // returns FALSE.
  135. //
  136. #define CQFWM_ADDSCOPE (WM_USER+256)
  137. //
  138. // CQFWM_GETFRAME
  139. // --------------
  140. // wParam = 0, lParam = (IQueryFrame**)
  141. //
  142. // Allows an object to query for the frame window's IQueryFrame
  143. // interface, this is used by the property well to talk to the
  144. // other forms within the system.
  145. //
  146. #define CQFWM_GETFRAME (WM_USER+257)
  147. //
  148. // CQFWM_ALLSCOPESADDED
  149. // --------------------
  150. // wParam = 0, lParam = 0
  151. //
  152. // If a handler is adding scopes async, then it should issue this message
  153. // when all the scopes have been added. That way if the caller specifies
  154. // OQWF_ISSUEONOPEN we can start the query once all the scopes have been
  155. // added.
  156. //
  157. #define CQFWM_ALLSCOPESADDED (WM_USER+258)
  158. //
  159. // CQFWM_STARTQUERY
  160. // ----------------
  161. // wParam = 0, lParam = 0
  162. //
  163. // This call can be made by the frame or the form, it allows it to
  164. // start the query running in those cases where a form really needs
  165. // this functionality.
  166. //
  167. // NB: this should be kept private!
  168. //
  169. #define CQFWM_STARTQUERY (WM_USER+259)
  170. //
  171. // CQFWM_SETDEFAULTFOCUS
  172. // ---------------------
  173. // Posted to ourselves to ensure focus is on the right control.
  174. //
  175. #define CQFWM_SETDEFAULTFOCUS (WM_USER+260)
  176. //
  177. // IQueryFrame
  178. //
  179. #undef INTERFACE
  180. #define INTERFACE IQueryFrame
  181. DECLARE_INTERFACE_(IQueryFrame, IUnknown)
  182. {
  183. // *** IUnknown methods ***
  184. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  185. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  186. STDMETHOD_(ULONG,Release)(THIS) PURE;
  187. // *** IQueryFrame methods ***
  188. STDMETHOD(AddScope)(THIS_ LPCQSCOPE pScope, INT i, BOOL fSelect) PURE;
  189. STDMETHOD(GetWindow)(THIS_ HWND* phWnd) PURE;
  190. STDMETHOD(InsertMenus)(THIS_ HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidth) PURE;
  191. STDMETHOD(RemoveMenus)(THIS_ HMENU hmenuShared) PURE;
  192. STDMETHOD(SetMenu)(THIS_ HMENU hmenuShared, HOLEMENU holereservedMenu) PURE;
  193. STDMETHOD(SetStatusText)(THIS_ LPCTSTR pszStatusText) PURE;
  194. STDMETHOD(StartQuery)(THIS_ BOOL fStarting) PURE;
  195. STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  196. STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  197. STDMETHOD(CallForm)(THIS_ LPCLSID pForm, UINT uMsg, WPARAM wParam, LPARAM lParam) PURE;
  198. STDMETHOD(GetScope)(THIS_ LPCQSCOPE* ppScope) PURE;
  199. STDMETHOD(GetHandler)(THIS_ REFIID riid, void **ppv) PURE;
  200. };
  201. //
  202. // IQueryHandler interface
  203. //
  204. #undef INTERFACE
  205. #define INTERFACE IQueryHandler
  206. DECLARE_INTERFACE_(IQueryHandler, IUnknown)
  207. {
  208. // *** IUnknown methods ***
  209. STDMETHOD(QueryInterface)(THIS_ REFIID riid, LPVOID * ppvObj) PURE;
  210. STDMETHOD_(ULONG,AddRef)(THIS) PURE;
  211. STDMETHOD_(ULONG,Release)(THIS) PURE;
  212. // *** IQueryHandler methods ***
  213. STDMETHOD(Initialize)(THIS_ IQueryFrame* pQueryFrame, DWORD dwOQWFlags, LPVOID pParameters) PURE;
  214. STDMETHOD(GetViewInfo)(THIS_ LPCQVIEWINFO pViewInfo) PURE;
  215. STDMETHOD(AddScopes)(THIS) PURE;
  216. STDMETHOD(BrowseForScope)(THIS_ HWND hwndParent, LPCQSCOPE pCurrentScope, LPCQSCOPE* ppScope) PURE;
  217. STDMETHOD(CreateResultView)(THIS_ HWND hwndParent, HWND* phWndView) PURE;
  218. STDMETHOD(ActivateView)(THIS_ UINT uState, WPARAM wParam, LPARAM lParam) PURE;
  219. STDMETHOD(InvokeCommand)(THIS_ HWND hwndParent, UINT idCmd) PURE;
  220. STDMETHOD(GetCommandString)(THIS_ UINT idCmd, DWORD dwFlags, LPTSTR pBuffer, INT cchBuffer) PURE;
  221. STDMETHOD(IssueQuery)(THIS_ LPCQPARAMS pQueryParams) PURE;
  222. STDMETHOD(StopQuery)(THIS) PURE;
  223. STDMETHOD(GetViewObject)(THIS_ UINT uScope, REFIID riid, LPVOID* ppvOut) PURE;
  224. STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery) PURE;
  225. STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery, LPCQSCOPE pScope) PURE;
  226. };
  227. #endif // GUID_DEFS_ONLY
  228. #endif