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.

173 lines
5.3 KiB

  1. #ifndef __BOOKMARK_H__
  2. #define __BOOKMARK_H__
  3. ///////////////////////////////////////////////////////////
  4. //
  5. //
  6. // AdSearch.h - Advanced Search UI
  7. //
  8. // This header file defines the Advanced Search Navigation
  9. // pane class.
  10. // INavPaneUI Interface
  11. #include "navui.h"
  12. // Other nav pane related structures.
  13. #include "navpane.h"
  14. ///////////////////////////////////////////////////////////
  15. //
  16. // Forwards
  17. //
  18. ///////////////////////////////////////////////////////////
  19. //
  20. // Constants
  21. //
  22. ///////////////////////////////////////////////////////////
  23. //
  24. // CBookmarksNavPane
  25. //
  26. class CBookmarksNavPane : public INavUI
  27. {
  28. public:
  29. //---Construction
  30. CBookmarksNavPane(CHHWinType* pWinType);
  31. virtual ~CBookmarksNavPane() ;
  32. typedef enum BookmarkDlgItemInfoIndex
  33. {
  34. c_TopicsList, // The Bookmarks list view.
  35. c_DeleteBtn,
  36. c_DisplayBtn,
  37. c_CurrentTopicStatic,
  38. c_CurrentTopicEdit,
  39. c_AddBookmarkBtn,
  40. c_NumDlgItems
  41. };
  42. public:
  43. //--- INavUI Interface functions.
  44. virtual BOOL Create(HWND hwndParent);
  45. virtual LRESULT OnCommand(HWND hwnd, UINT id, UINT uNotifiyCode, LPARAM lParam);
  46. virtual void ResizeWindow();
  47. virtual void HideWindow() ;
  48. virtual void ShowWindow() ;
  49. virtual void SetPadding(int pad) ;
  50. virtual void SetTabPos(int tabpos) ;
  51. // Set focus to the most expected control, usually edit combo.
  52. virtual void SetDefaultFocus() ;
  53. // Process accelerator keys.
  54. virtual bool ProcessMenuChar(HWND hwndParent, int ch) ;
  55. // Process WM_NOTIFY messages. Used by embedded Tree and List view controls.
  56. virtual LRESULT OnNotify(HWND hwnd, WPARAM wParam, LPARAM lParam) ;
  57. // Process WM_DRAWITEM messages.
  58. virtual void OnDrawItem(UINT id, LPDRAWITEMSTRUCT pdis) ;
  59. // Seed the nav ui with a search term or keyword.
  60. virtual void Seed(LPCSTR pszSeed) ;
  61. virtual BOOL Synchronize(PSTR , CTreeNode* ) ;
  62. void OnVKListNotify(NMHDR* pNMHdr) {/*Not Implemented*/}
  63. private:
  64. //--- Helper Functions.
  65. void SetFont (HFONT hfont) { m_hfont = hfont; }
  66. void SaveBookmarks() ;
  67. void LoadBookmarks() ;
  68. void InitDlgItemArray() ;
  69. // Fill the edit control with the current topic.
  70. void FillCurrentTopicEdit() ;
  71. // Get the selected item
  72. int GetSelectedItem() const ;
  73. // Get the Url for the item;
  74. TCHAR* GetUrl(int index) const;
  75. // Get the URL for the selected item
  76. TCHAR* GetSelectedUrl() const {return GetUrl(GetSelectedItem()) ;}
  77. // Get the URL and the Topic name. --- See CPP file for more information.
  78. bool GetTopicAndUrl(int index, WCHAR* pTopicBuffer,int TopicBufferSize, TCHAR** pUrl) const ;
  79. // Display the context menu.
  80. void ContextMenu(bool bUseCursor = true) ;
  81. //--- Dirty Management.
  82. bool Changed() const {return m_bChanged; }
  83. void SetChanged(bool changed = true) {m_bChanged = changed;}
  84. //--- Share with AdSearch???
  85. void ShowDlgItemsEnabledState() ;
  86. void EnableDlgItem(BookmarkDlgItemInfoIndex index, bool bEnabled) ;
  87. HFONT GetFont() { return m_pWinType->GetContentFont(); }
  88. HFONT GetAccessableContentFont() { return m_pWinType->GetAccessableContentFont(); }
  89. protected:
  90. //--- Message Handler Functions
  91. void OnDelete() ;
  92. void OnDisplay() ;
  93. void OnAddBookmark();
  94. void OnEdit() ; // Edit menu item.
  95. void OnTab(HWND hwndReceivedTab, BookmarkDlgItemInfoIndex index) ;
  96. void OnArrow(HWND hwndReceivedTab, BookmarkDlgItemInfoIndex index, INT_PTR key) ;
  97. bool OnReturn(HWND hwndReceivedTab, BookmarkDlgItemInfoIndex /*index*/);
  98. LRESULT ListViewMsg(HWND hwnd, NM_LISTVIEW* lParam) ; // Handle the listview notification messages.
  99. private:
  100. //--- Callbacks
  101. static INT_PTR CALLBACK s_DialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ;
  102. INT_PTR DialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) ;
  103. static LRESULT WINAPI s_ListViewProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  104. static LRESULT WINAPI s_CurrentTopicEditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  105. // shared by all btns.
  106. static LRESULT WINAPI s_GenericBtnProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  107. // shared by other ctrls to handle keyboard
  108. //static LRESULT WINAPI s_GenericKeyboardProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
  109. protected:
  110. //--- Statics
  111. static WNDPROC s_lpfnlListViewWndProc;
  112. static WNDPROC s_lpfnlCurrentTopicEditProc;
  113. static WNDPROC s_lpfnlGenericBtnProc ; // Shared by all btns.
  114. static WNDPROC s_lpfnlGenericKeyboardProc ; // Shared by ctrls which don't use one of the other procs.
  115. private:
  116. //--- Member Functions.
  117. HWND m_hWnd;
  118. HFONT m_hfont; // author-specified font to use for child windows
  119. int m_padding;
  120. int m_NavTabPos; // location of parent tabs
  121. // Array of dlgitems
  122. CDlgItemInfo m_aDlgItems[c_NumDlgItems] ;
  123. // Pointer to the TitleCollection on which we will search.
  124. CExCollection* m_pTitleCollection;
  125. // Holds a pointer to the wintype so we can send the WMP_HH_TAB_KEY message to it.
  126. CHHWinType* m_pWinType;
  127. // The URL corresponding to the topic in the edit control.
  128. TCHAR* m_pszCurrentUrl;
  129. // If this is true we should save the bookmarks.
  130. bool m_bChanged ;
  131. };
  132. #endif //__BOOKMARK_H__