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.

125 lines
4.1 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: histlist.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #pragma once
  11. #ifndef _HISTORY_LIST_H
  12. #define _HISTORY_LIST_H
  13. #include <exdisp.h>
  14. #include <mshtml.h>
  15. #include "amcview.h"
  16. #include "treectrl.h"
  17. #include "resultview.h"
  18. #include <windowsx.h> // for globalallocptr macro
  19. SC ScGetPageBreakURL(CStr& strResultPane);
  20. enum NavState
  21. {
  22. MMC_HISTORY_READY = 0,
  23. MMC_HISTORY_NAVIGATING = 1,
  24. MMC_HISTORY_BUSY = 2,
  25. MMC_HISTORY_PAGE_BREAK = 3
  26. };
  27. enum HistoryButton
  28. {
  29. HB_BACK = -1,
  30. HB_STOP = 0,
  31. HB_FORWARD = 1
  32. };
  33. class CHistoryEntry
  34. {
  35. public:
  36. bool operator == (const CHistoryEntry &other) const;
  37. bool operator != (const CHistoryEntry &other) const;
  38. bool IsWebEntry() {return resultViewType.HasWebBrowser();}
  39. bool IsListEntry() {return resultViewType.HasList();}
  40. bool IsOCXEntry() {return resultViewType.HasOCX();}
  41. public:
  42. int viewMode; // valid only if the result view is a list. This field is not a part of CResultViewType because the snapin does not specify this.
  43. HNODE hnode; // currently selected node in scope tree
  44. GUID guidTaskpad; // the selected taskpad
  45. CResultViewType resultViewType; // all the details about the result pane
  46. };
  47. /*+-------------------------------------------------------------------------*
  48. * class CHistoryList
  49. *
  50. *
  51. * PURPOSE: Maintains a list of all the states visited by the user for a view.
  52. *
  53. *+-------------------------------------------------------------------------*/
  54. class CHistoryList
  55. {
  56. typedef std::list<CHistoryEntry> HistoryEntryList;
  57. enum {MAX_HISTORY_ENTRIES = 100};
  58. public:
  59. typedef HistoryEntryList::iterator iterator;
  60. CHistoryList(CAMCView* pView);
  61. ~CHistoryList();
  62. void Attach (CAMCWebViewCtrl* pWebViewCtrl) {m_pWebViewCtrl = pWebViewCtrl;}
  63. BOOL IsFirst(); // should we light up the "Back" button?
  64. BOOL IsLast(); // should we light up the "Forward" button?
  65. HRESULT Back (bool &bHandled, bool bUseBrowserHistory = true);
  66. HRESULT Forward(bool &bHandled, bool bUseBrowserHistory = true);
  67. SC ScAddEntry (CResultViewType &rvt, int viewMode, GUID &guidTaskpad); // adds new entry at current location
  68. void DeleteEntry (HNODE hnode);
  69. SC ScModifyViewTab(const GUID& guidTab);
  70. SC ScChangeViewMode(int viewMode);
  71. void MaintainWebBar();
  72. void Compact();
  73. HRESULT ExecuteCurrent();
  74. void UpdateWebBar (HistoryButton button, BOOL bOn);
  75. void Clear();
  76. void OnBrowserStateChange(bool bEnableForward, bool bEnableBack);
  77. SC ScOnPageBreak();
  78. SC ScDoPageBreak();
  79. void OnPageBreakStateChange(bool bPageBreak);
  80. void DeleteSubsequentEntries();
  81. NavState GetNavigateState() { return m_navState; }
  82. void SetNavigateState(NavState state) { m_navState = state; }
  83. SC ScGetCurrentResultViewType (CResultViewType &rvt, int& viewMode, GUID &guidTaskpad);
  84. void SetCurrentViewMode (long nViewMode);
  85. private:
  86. CAMCWebViewCtrl* GetWebViewCtrl() {return m_pWebViewCtrl;}
  87. bool PreviousWebPagesExist();
  88. private:
  89. iterator m_iterCurrent; // current index
  90. HistoryEntryList m_entries; // array (note: using array-size doubling scheme)
  91. CAMCView* m_pView; // to get current node
  92. NavState m_navState; // TRUE when busy
  93. CAMCWebViewCtrl *m_pWebViewCtrl; // used to navigate to a page break.
  94. bool m_bBrowserForwardEnabled;
  95. bool m_bBrowserBackEnabled;
  96. bool m_bCurrentStateIsForward; // tells us if we're going forward or backward.
  97. bool m_bPageBreak; // are we sitting at a page break right now?
  98. bool m_bWithin_CHistoryList_Back; // to know "Back" is on stack
  99. bool m_bWithin_CHistoryList_Forward; // to know "Forward" is on stack
  100. };
  101. #endif