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.

172 lines
5.3 KiB

  1. #ifndef _ADSEARCH_H__
  2. #define _ADSEARCH_H__
  3. ///////////////////////////////////////////////////////////
  4. //
  5. //
  6. // AdSearch.h - Advanced Search UI
  7. //
  8. // This header file defines the Advanced Search Navigation
  9. // pane class.
  10. #include "navui.h"
  11. // Other nav pane related structures.
  12. #include "navpane.h"
  13. ///////////////////////////////////////////////////////////
  14. //
  15. // Subset Dialog Removal
  16. //
  17. #define _SUBSETS__
  18. ///////////////////////////////////////////////////////////
  19. //
  20. // Forwards
  21. //
  22. class CFTSListView;
  23. ///////////////////////////////////////////////////////////
  24. //
  25. // Constants
  26. //
  27. typedef enum DlgItemInfoIndex
  28. {
  29. c_KeywordCombo,
  30. c_ConjunctionBtn,
  31. c_SearchBtn,
  32. c_DisplayBtn,
  33. c_FoundStatic,
  34. c_ResultsList,
  35. #ifdef __SUBSETS__
  36. c_SearchInStatic,
  37. c_SubsetsCombo,
  38. c_SubsetsBtn,
  39. #else
  40. c_PreviousCheck,
  41. #endif
  42. c_SimilarCheck,
  43. c_TitlesOnlyCheck,
  44. c_TypeInWordsStatic,
  45. c_NumDlgItems
  46. };
  47. ///////////////////////////////////////////////////////////
  48. //
  49. // CAdvancedSearchNavPane
  50. //
  51. class CAdvancedSearchNavPane : public INavUI
  52. {
  53. public:
  54. //---Construction
  55. CAdvancedSearchNavPane(CHHWinType* pWinType);
  56. virtual ~CAdvancedSearchNavPane() ;
  57. public:
  58. //--- INavUI Interface functions.
  59. virtual BOOL Create(HWND hwndParent);
  60. virtual LRESULT OnCommand(HWND hwnd, UINT id, UINT uNotifiyCode, LPARAM lParam);
  61. virtual void ResizeWindow();
  62. virtual void HideWindow() ;
  63. virtual void ShowWindow() ;
  64. virtual void SetPadding(int pad) ;
  65. virtual void SetTabPos(int tabpos) ;
  66. // Set focus to the most expected control, usually edit combo.
  67. virtual void SetDefaultFocus() ;
  68. // Process accelerator keys.
  69. virtual bool ProcessMenuChar(HWND hwndParent, int ch) ;
  70. // Process WM_NOTIFY messages. Used by embedded Tree and List view controls.
  71. virtual LRESULT OnNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) ;
  72. // Process WM_DRAWITEM messages.
  73. virtual void OnDrawItem(UINT id, LPDRAWITEMSTRUCT pdis) ;
  74. // Seed the nav ui with a search term or keyword.
  75. virtual void Seed(LPCSTR pszSeed) ;
  76. void OnVKListNotify(NMHDR* pNMHdr) {/*Not Implemented*/}
  77. public:
  78. // Called from code that may add or delete subsets so that we can update our list accordingly.
  79. void UpdateSSCombo(bool bInitialize = false);
  80. private:
  81. //--- Helper Functions.
  82. void SetFont (HFONT hfont) { m_hfont = hfont; }
  83. void InitDlgItemArray() ;
  84. void ShowDlgItemsEnabledState() ;
  85. void EnableDlgItem(DlgItemInfoIndex index, bool bEnabled) ;
  86. void AddKeywordToCombo(PCWSTR sz = NULL) ;
  87. void SaveKeywordCombo() ;
  88. void LoadKeywordCombo() ;
  89. protected:
  90. //--- Message Handler Functions
  91. void OnStartSearch() ;
  92. void OnDisplayTopic() ;
  93. void OnDefineSubsets() ;
  94. void OnConjunctions() ;
  95. void OnTab(HWND hwndReceivedTab, DlgItemInfoIndex index) ;
  96. void OnArrow(HWND hwndReceivedTab, DlgItemInfoIndex index, INT_PTR key) ;
  97. bool OnReturn(HWND hwndReceivedTab, DlgItemInfoIndex /*index*/);
  98. HFONT GetFont() { return m_pWinType->GetContentFont(); }
  99. HFONT GetAccessableContentFont() { return m_pWinType->GetAccessableContentFont(); }
  100. private:
  101. //--- Callbacks
  102. static INT_PTR CALLBACK s_DialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ;
  103. INT_PTR DialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ;
  104. static LRESULT WINAPI s_ListViewProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  105. static LRESULT WINAPI s_KeywordComboProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  106. static LRESULT WINAPI s_KeywordComboEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  107. #ifdef __SUBSETS__
  108. static LRESULT WINAPI s_SubsetsComboProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  109. #endif
  110. // shared by all btns.
  111. static LRESULT WINAPI s_GenericBtnProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  112. // shared by other ctrls to handle keyboard
  113. static LRESULT WINAPI s_GenericKeyboardProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  114. protected:
  115. //--- Statics
  116. static WNDPROC s_lpfnlListViewWndProc;
  117. static WNDPROC s_lpfnlKeywordComboProc ;
  118. static WNDPROC s_lpfnlKeywordComboEditProc ;
  119. #ifdef __SUBSETS__
  120. static WNDPROC s_lpfnlSubsetsComboProc ;
  121. #endif
  122. static WNDPROC s_lpfnlGenericBtnProc ; // Shared by all btns.
  123. static WNDPROC s_lpfnlGenericKeyboardProc ; // Shared by ctrls which don't use one of the other procs.
  124. private:
  125. //--- Member Functions.
  126. HWND m_hWnd;
  127. HFONT m_hfont; // author-specified font to use for child windows
  128. int m_padding;
  129. int m_NavTabPos; // location of parent tabs
  130. // Members supporting the Conj button.
  131. HBITMAP m_hbmConj ; // Bitmap
  132. // Array of dlgitems
  133. CDlgItemInfo m_aDlgItems[c_NumDlgItems] ;
  134. // Pointer to the TitleCollection on which we will search.
  135. CExCollection* m_pTitleCollection;
  136. // class to manage the list view control
  137. CFTSListView *m_plistview;
  138. // Handle to the edit control of the keyword combobox
  139. HWND m_hKeywordComboEdit ;
  140. // Cache for the last selection in the combobox
  141. DWORD m_dwKeywordComboEditLastSel ;
  142. // Holds a pointer to the wintype so we can send the WMP_HH_TAB_KEY message to it.
  143. CHHWinType* m_pWinType;
  144. };
  145. #endif //_ADSEARCH_H__