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.

213 lines
7.9 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Copyright (C) 1993-1998 Microsoft Corporation. All Rights Reserved.
  3. //
  4. // MODULE: find.h
  5. //
  6. // PURPOSE:
  7. //
  8. #pragma once
  9. #include "mru.h"
  10. #define CCHMAX_FIND 128
  11. class CMessageView;
  12. /////////////////////////////////////////////////////////////////////////////
  13. // Call this to create a finder
  14. //
  15. HRESULT DoFind(HWND hwnd, FOLDERID idFolder);
  16. /////////////////////////////////////////////////////////////////////////////
  17. // Thread entry point for the finder
  18. //
  19. typedef struct tagFINDPARAMS
  20. {
  21. FOLDERID idFolder;
  22. } FINDPARAMS, *PFINDPARAMS;
  23. unsigned int __stdcall FindThreadProc2(LPVOID lpvUnused);
  24. /////////////////////////////////////////////////////////////////////////////
  25. // Types used by the class
  26. //
  27. enum
  28. {
  29. PAGE_GENERAL = 0,
  30. PAGE_DATESIZE,
  31. PAGE_ADVANCED,
  32. PAGE_MAX
  33. };
  34. typedef struct tagPAGEINFO
  35. {
  36. LPTSTR pszTemplate;
  37. DLGPROC pfn; // Pointer to the callback for this page
  38. int idsTitle; // Title for this page
  39. } PAGEINFO, *PPAGEINFO;
  40. /////////////////////////////////////////////////////////////////////////////
  41. // Class CFinder
  42. //
  43. class CFinder : public IOleCommandTarget
  44. {
  45. public:
  46. /////////////////////////////////////////////////////////////////////////
  47. // Construction and Initialization
  48. //
  49. CFinder();
  50. ~CFinder();
  51. HRESULT Show(FINDPARAMS *pFindParams);
  52. /////////////////////////////////////////////////////////////////////////
  53. // IUnknown
  54. //
  55. STDMETHODIMP QueryInterface(THIS_ REFIID riid, LPVOID *ppvObj);
  56. STDMETHOD_(ULONG, AddRef)(THIS);
  57. STDMETHOD_(ULONG, Release)(THIS);
  58. /////////////////////////////////////////////////////////////////////////
  59. // IOleCommandTarget
  60. //
  61. STDMETHODIMP QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[], OLECMDTEXT *pCmdText);
  62. STDMETHODIMP Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut);
  63. /////////////////////////////////////////////////////////////////////////
  64. // Dialog & message handling stuff
  65. //
  66. static BOOL CALLBACK GeneralDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  67. static BOOL CALLBACK DateSizeDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  68. static BOOL CALLBACK AdvancedDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  69. protected:
  70. static INT_PTR CALLBACK FindDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  71. INT_PTR CALLBACK DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  72. BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam);
  73. void OnSize(HWND hwnd, UINT state, int cx, int cy);
  74. void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
  75. void OnNotify(HWND hwnd, int id, NMHDR *pnmhdr);
  76. void OnPaint(HWND hwnd);
  77. void OnClose(HWND hwnd);
  78. void OnGetMinMaxInfo(HWND hwnd, LPMINMAXINFO lpmmi);
  79. UINT OnNCHitTest(HWND hwnd, int x, int y);
  80. // void OnInitMenuPopup(HWND hwnd, HMENU hmenuPopup, UINT uPos, BOOL fSystemMenu);
  81. HRESULT CmdStop(DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut);
  82. HRESULT CmdClose(DWORD nCmdID, DWORD nCmdExecOpt, VARIANTARG *pvaIn, VARIANTARG *pvaOut);
  83. /////////////////////////////////////////////////////////////////////////
  84. // Individual pages
  85. //
  86. BOOL CALLBACK _GeneralDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  87. BOOL General_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam);
  88. void General_OnSize(HWND hwnd, UINT state, int cx, int cy);
  89. void General_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
  90. /////////////////////////////////////////////////////////////////////////
  91. // Utility Functions
  92. //
  93. HRESULT _InitMainResizingInfo(HWND hwnd);
  94. HRESULT _SelectPage(DWORD dwPage);
  95. /////////////////////////////////////////////////////////////////////////
  96. // Private class information
  97. //
  98. private:
  99. // General Info
  100. ULONG m_cRef; // Object reference count
  101. HWND m_hwnd; // Handle of the main finder window
  102. HWND m_rgPages[PAGE_MAX]; // Array of handles to the various pages in the dialog
  103. DWORD m_dwPageCurrent; // Currently visible page
  104. HACCEL m_hAccel; // Handle of the accelerator table used for the finder
  105. HICON m_hIconTitle; // Icon for the title bar of the dialog
  106. CMessageView *m_pMsgView;
  107. // State
  108. BOOL m_fInProgress; // TRUE if there is currently a find happening
  109. BOOL m_fShowResults; // TRUE if the dialog is expanded to show results
  110. // These will be handy to keep around
  111. HWND m_hwndTabs; // Handle of the tab control
  112. HWND m_hwndFindNow; // Handle of the Find Now button
  113. HWND m_hwndNewSearch; // Handle of the New Search button
  114. HWND m_hwndFindAni; // Handle of the Find animation
  115. // Resizing Info
  116. RECT m_rcTabs; // Position and size of the tab control
  117. RECT m_rcFindNow; // Position and size of the Find Now button
  118. RECT m_rcNewSearch; // Position and size of the New Search button
  119. RECT m_rcFindAni; // Position and size of the Find Animation
  120. POINT m_ptDragMin; // Minimum size of the dialog
  121. POINT m_ptWndDefault; // Default size of the dialog
  122. DWORD m_cyDlgFull; // Full height of the dialog
  123. };
  124. /////////////////////////////////////////////////////////////////////////////
  125. // Find / Find Next utility
  126. //
  127. interface IFindNext : public IUnknown
  128. {
  129. STDMETHOD(Show)(THIS_ HWND hwndParent, HWND *pHwnd) PURE;
  130. STDMETHOD(Close)(THIS) PURE;
  131. STDMETHOD(TranslateAccelerator)(THIS_ LPMSG pMsg) PURE;
  132. STDMETHOD(GetFindString)(THIS_ LPTSTR psz, DWORD cchMax, BOOL *pfBodies) PURE;
  133. };
  134. class CFindNext : public IFindNext
  135. {
  136. /////////////////////////////////////////////////////////////////////////
  137. // Construction and Initialization
  138. //
  139. public:
  140. CFindNext();
  141. ~CFindNext();
  142. /////////////////////////////////////////////////////////////////////////
  143. // IUnknown
  144. //
  145. STDMETHODIMP QueryInterface(THIS_ REFIID riid, LPVOID *ppvObj);
  146. STDMETHOD_(ULONG, AddRef)(THIS);
  147. STDMETHOD_(ULONG, Release)(THIS);
  148. /////////////////////////////////////////////////////////////////////////
  149. // IFindNext
  150. //
  151. STDMETHODIMP Show(HWND hwndParent, HWND *phWnd);
  152. STDMETHODIMP Close(void);
  153. STDMETHODIMP TranslateAccelerator(LPMSG pMsg);
  154. STDMETHODIMP GetFindString(LPTSTR psz, DWORD cchMax, BOOL *pfBodies);
  155. /////////////////////////////////////////////////////////////////////////
  156. // Dialog Callback goo
  157. //
  158. static INT_PTR CALLBACK FindDlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  159. INT_PTR CALLBACK DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
  160. BOOL OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam);
  161. void OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify);
  162. void OnFindNow(void);
  163. /////////////////////////////////////////////////////////////////////////
  164. // Private class information
  165. //
  166. private:
  167. ULONG m_cRef; // Object reference count
  168. HWND m_hwnd; // Handle of the find dialog
  169. HWND m_hwndParent; // Handle of the window that should get notifications
  170. CMRUList m_cMRUList; // MRU List
  171. BOOL m_fBodies; // Body Search
  172. };