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.

167 lines
5.2 KiB

  1. #ifndef _TRSITE_H
  2. #define _TRSITE_H
  3. class CTransitionSite;
  4. class CTransitionSitePropertyBag;
  5. /////////////////////////////////////////////////////////////////////////////
  6. // Typedefs and Structs
  7. /////////////////////////////////////////////////////////////////////////////
  8. enum TransitionEvent // Transition Event type
  9. {
  10. teFirstEvent = 0,
  11. teSiteEnter = teFirstEvent,
  12. tePageEnter,
  13. teSiteExit,
  14. tePageExit,
  15. teNumEvents, // NOTE: Must follow last event!
  16. teUserDefault = teNumEvents
  17. };
  18. struct TRANSITIONINFO // Transition Event information
  19. {
  20. CLSID clsid;
  21. CTransitionSitePropertyBag * pPropBag;
  22. };
  23. struct NAMEVALUE
  24. {
  25. WCHAR * pwszName;
  26. VARIANT varValue;
  27. };
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CTransitionSite
  30. /////////////////////////////////////////////////////////////////////////////
  31. class CTransitionSite : public IViewFilter,
  32. public IViewFilterSite,
  33. public IAdviseSink,
  34. public IDispatch
  35. {
  36. // Construction/Destruction
  37. public:
  38. CTransitionSite(IShellBrowser * pcont);
  39. ~CTransitionSite();
  40. HRESULT _SetTransitionInfo(TransitionEvent te, TRANSITIONINFO * pti);
  41. HRESULT _ApplyTransition(BOOL bSiteChange);
  42. HRESULT _StartTransition();
  43. HRESULT _StopTransition();
  44. HRESULT _UpdateEventList();
  45. enum TRSTATE
  46. {
  47. TRSTATE_NONE = 0,
  48. TRSTATE_INITIALIZING = 1,
  49. TRSTATE_STARTPAINTING = 2,
  50. TRSTATE_PAINTING = 3
  51. };
  52. TRSTATE _uState;
  53. IShellView * _psvNew; // Valid only while we are playing
  54. IViewObject * _pvoNew;
  55. BOOL _fViewIsVisible;
  56. HWND _hwndViewNew;
  57. IViewFilter * _pTransition;
  58. IDispatch * _pDispTransition;
  59. DWORD _dwTransitionSink;
  60. // Data
  61. private:
  62. IShellBrowser * _pContainer; // CBaseBrowser container of parent
  63. IViewFilterSite * _pSite;
  64. TRANSITIONINFO * _ptiCurrent;
  65. TRANSITIONINFO _tiEventInfo[teNumEvents];
  66. // Internal methods
  67. private:
  68. HRESULT _LoadTransition();
  69. HRESULT _InitWait();
  70. HRESULT _OnComplete();
  71. // Interfaces
  72. public:
  73. // IUnknown
  74. STDMETHOD(QueryInterface) (REFIID riid, LPVOID * ppv);
  75. STDMETHOD_(ULONG, AddRef) (void);
  76. STDMETHOD_(ULONG, Release) (void);
  77. // IViewFilter
  78. STDMETHOD(SetSource) (IViewFilter *pFilter);
  79. STDMETHOD(GetSource) (IViewFilter **ppFilter);
  80. STDMETHOD(SetSite) (IViewFilterSite *pSink);
  81. STDMETHOD(GetSite) (IViewFilterSite **ppSink);
  82. STDMETHOD(SetPosition) (LPCRECT prc);
  83. STDMETHOD(Draw) (HDC hdc, LPCRECT prc);
  84. STDMETHOD(GetStatusBits) (DWORD *pdwFlags);
  85. // IViewFilterSite
  86. STDMETHOD(GetDC) (LPCRECT prc, DWORD dwFlags, HDC *phdc);
  87. STDMETHOD(ReleaseDC) (HDC hdc);
  88. STDMETHOD(InvalidateRect) (LPCRECT prc, BOOL fErase);
  89. STDMETHOD(InvalidateRgn) (HRGN hrgn, BOOL fErase);
  90. STDMETHOD(OnStatusBitsChange) (DWORD dwFlags);
  91. // IAdviseSink
  92. STDMETHOD_(void, OnDataChange) (FORMATETC * pFormatetc, STGMEDIUM * pStgmed) {}
  93. STDMETHOD_(void, OnViewChange) (DWORD dwAspect, LONG lindex);
  94. STDMETHOD_(void, OnRename) (IMoniker * pmk) {}
  95. STDMETHOD_(void, OnSave) () {}
  96. STDMETHOD_(void, OnClose) () {}
  97. // IDispatch
  98. STDMETHOD(GetTypeInfoCount) (UINT * pctinfo) { return E_NOTIMPL; }
  99. STDMETHOD(GetTypeInfo) (UINT itinfo, LCID lcid, ITypeInfo ** pptinfo) { return E_NOTIMPL; }
  100. STDMETHOD(GetIDsOfNames) (REFIID riid, OLECHAR ** rgszNames, UINT cNames, LCID lcid, DISPID * rgdispid) { return E_NOTIMPL; }
  101. STDMETHOD(Invoke) (DISPID dispidMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS * pdispparams, VARIANT * pvarResult, EXCEPINFO * pexcepinfo, UINT * puArgErr);
  102. };
  103. /////////////////////////////////////////////////////////////////////////////
  104. // CTransitionSitePropertyBag
  105. /////////////////////////////////////////////////////////////////////////////
  106. class CTransitionSitePropertyBag : public IPropertyBag
  107. {
  108. // Construction/Destruction
  109. public:
  110. CTransitionSitePropertyBag();
  111. virtual ~CTransitionSitePropertyBag();
  112. HRESULT _AddProperty(WCHAR * wszPropName, VARIANT * pvarValue);
  113. // Data
  114. protected:
  115. UINT _cRef;
  116. HDPA _hdpaProperties;
  117. // Implementation
  118. protected:
  119. static int _DPA_FreeProperties(LPVOID pv, LPVOID pData);
  120. // Interfaces
  121. public:
  122. // IUnknown
  123. STDMETHOD(QueryInterface) (REFIID riid, LPVOID * ppv);
  124. STDMETHOD_(ULONG, AddRef) (void);
  125. STDMETHOD_(ULONG, Release) (void);
  126. // IPropertyBag
  127. STDMETHOD(Read) (LPCOLESTR pszPropName, VARIANT * pVar, IErrorLog * pErrorLog);
  128. STDMETHOD(Write)(LPCOLESTR pszPropName, VARIANT * pVar)
  129. { return E_NOTIMPL; }
  130. };
  131. /////////////////////////////////////////////////////////////////////////////
  132. // Helper functions
  133. /////////////////////////////////////////////////////////////////////////////
  134. HRESULT CLSIDFromTransitionName(LPCTSTR pszName, LPCLSID clsidName);
  135. BOOL ParseTransitionInfo(WCHAR * pwz, TRANSITIONINFO * pti);
  136. #define ISSPACE(ch) (((ch) == 32) || ((unsigned)((ch) - 9)) <= 13 - 9)
  137. #endif // _TRSITE_H