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.

132 lines
4.9 KiB

  1. /*--------------------------------------------------------------------------*
  2. *
  3. * Microsoft Windows
  4. * Copyright (C) Microsoft Corporation, 1999 - 1999
  5. *
  6. * File: viewset.h
  7. *
  8. * Contents: Declares a class that holds the settings needed to re-create a view.
  9. *
  10. * History: 21-April-99 vivekj Created
  11. * 03-Feb-2000 AnandhaG Added CResultViewType member
  12. *
  13. *--------------------------------------------------------------------------*/
  14. #ifndef _VIEWSET_H_
  15. #define _VIEWSET_H_
  16. //+-------------------------------------------------------------------
  17. //
  18. // Class: CViewSettings
  19. //
  20. // Purpose: The view information for a node (bookmark).
  21. // Stores result-view-type, taskpad-id and view mode.
  22. //
  23. // History: 01-27-1999 AnandhaG Created
  24. // 02-08-2000 AnandhaG Modified to include new result-view-type
  25. //
  26. //--------------------------------------------------------------------
  27. class CViewSettings : public CSerialObject, public CXMLObject
  28. {
  29. private:
  30. typedef std::wstring wstring;
  31. ///////////////////////////////////////////////////////////////////////////////////////////
  32. // View Types (These are meant for decoding MMC1.2 consoles, do not use them for MMC2.0. //
  33. ///////////////////////////////////////////////////////////////////////////////////////////
  34. typedef enum _VIEW_TYPE
  35. {
  36. VIEW_TYPE_OCX = MMCLV_VIEWSTYLE_ICON - 3, // -3 custom ocx view
  37. VIEW_TYPE_WEB = MMCLV_VIEWSTYLE_ICON - 2, // -2 custom web view
  38. VIEW_TYPE_DEFAULT = MMCLV_VIEWSTYLE_ICON - 1, // -1
  39. VIEW_TYPE_LARGE_ICON = MMCLV_VIEWSTYLE_ICON,
  40. VIEW_TYPE_REPORT = MMCLV_VIEWSTYLE_REPORT,
  41. VIEW_TYPE_SMALL_ICON = MMCLV_VIEWSTYLE_SMALLICON,
  42. VIEW_TYPE_LIST = MMCLV_VIEWSTYLE_LIST,
  43. VIEW_TYPE_FILTERED = MMCLV_VIEWSTYLE_FILTERED,
  44. } VIEW_TYPE;
  45. ///////////////////////////////////////////////////////////////////////////////////////////
  46. // CViewSetting Mask tells which members are valid. //
  47. ///////////////////////////////////////////////////////////////////////////////////////////
  48. static const DWORD VIEWSET_MASK_NONE = 0x0000;
  49. static const DWORD VIEWSET_MASK_VIEWMODE = 0x0001; // The ViewMode member is valid.
  50. static const DWORD VIEWSET_MASK_RVTYPE = 0x0002; // The CResultViewType is valid.
  51. static const DWORD VIEWSET_MASK_TASKPADID = 0x0004; // The taskpad id is valid.
  52. protected:
  53. virtual UINT GetVersion() { return 4;}
  54. virtual HRESULT ReadSerialObject(IStream &stm, UINT nVersion);
  55. public:
  56. virtual void Persist(CPersistor &persistor);
  57. DEFINE_XML_TYPE(XML_TAG_VIEW_SETTINGS);
  58. public:
  59. CViewSettings();
  60. bool operator == (const CViewSettings& viewSettings);
  61. bool operator != (const CViewSettings& viewSettings)
  62. {
  63. return (!operator==(viewSettings));
  64. }
  65. SC ScGetViewMode(ULONG& ulViewMode);
  66. SC ScSetViewMode(const ULONG ulViewMode);
  67. SC ScGetTaskpadID(GUID& guidTaskpad);
  68. SC ScSetTaskpadID(const GUID& guidTaskpad);
  69. SC ScGetResultViewType(CResultViewType& rvt);
  70. SC ScSetResultViewType(const CResultViewType& rvt);
  71. bool IsViewModeValid() const;
  72. bool IsTaskpadIDValid() const { return (m_dwMask & VIEWSET_MASK_TASKPADID);}
  73. bool IsResultViewTypeValid()const { return (m_dwMask & VIEWSET_MASK_RVTYPE);}
  74. void SetResultViewTypeValid(bool bSet = true) { SetMask(VIEWSET_MASK_RVTYPE, bSet);}
  75. void SetTaskpadIDValid(bool bSet = true) { SetMask(VIEWSET_MASK_TASKPADID, bSet);}
  76. void SetViewModeValid(bool bSet = true) { SetMask(VIEWSET_MASK_VIEWMODE, bSet);}
  77. bool operator<(const CViewSettings& viewSettings){ return (m_dwRank < viewSettings.m_dwRank);}
  78. SC ScInitialize(bool bViewTypeValid,
  79. const VIEW_TYPE& viewType,
  80. const long lViewOptions,
  81. const wstring& wstrViewName);
  82. private:
  83. void SetMask(DWORD dwMask, bool bSet = true)
  84. {
  85. if (bSet)
  86. m_dwMask |= dwMask;
  87. else
  88. m_dwMask &=(~dwMask);
  89. }
  90. private:
  91. CResultViewType m_RVType;
  92. ULONG m_ulViewMode;
  93. GUID m_guidTaskpad; // the guid of the taskpad, if any.
  94. DWORD m_dwMask; // VIEWSET_MASK
  95. // Book keeping members.
  96. public:
  97. DWORD GetUsageRank() const { return m_dwRank;}
  98. void SetUsageRank(DWORD dw) { m_dwRank = dw;}
  99. BOOL IsObjInvalid() const { return m_bInvalid;}
  100. void SetObjInvalid(BOOL b = TRUE) { m_bInvalid = b;}
  101. private:
  102. // Needed for book keeping.
  103. DWORD m_dwRank; // Usage rank.
  104. BOOL m_bInvalid; // For garbage collection.
  105. };
  106. #endif _VIEWSET_H_