Leaked source code of windows server 2003
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.

237 lines
6.6 KiB

  1. #if !defined(CTRL__OldAnimation_h__INCLUDED)
  2. #define CTRL__OldAnimation_h__INCLUDED
  3. #pragma once
  4. #include "SmObject.h"
  5. #include "OldExtension.h"
  6. /***************************************************************************\
  7. *****************************************************************************
  8. *
  9. * class OldAnimationT
  10. *
  11. * OldAnimationT defines a common implementation class for building
  12. * Animations in DirectUser.
  13. *
  14. *****************************************************************************
  15. \***************************************************************************/
  16. template <class base, class iface, class desc>
  17. class OldAnimationT : public SmObjectT<base, iface>
  18. {
  19. // Operations
  20. public:
  21. static HRESULT
  22. Build(GANI_DESC * pDesc, REFIID riid, void ** ppv)
  23. {
  24. AssertWritePtr(ppv);
  25. if (pDesc->cbSize != sizeof(desc)) {
  26. return E_INVALIDARG;
  27. }
  28. OldAnimationT<base, iface, desc> * pObj = new OldAnimationT<base, iface, desc>;
  29. if (pObj != NULL) {
  30. pObj->m_cRef = 1;
  31. HRESULT hr = pObj->Create(pDesc);
  32. if (SUCCEEDED(hr)) {
  33. //
  34. // Animations need to be AddRef()'d again (have a reference
  35. // count of 2) because they need to outlife the initial call
  36. // to Release() after the called has setup the animation
  37. // returned from BuildAnimation().
  38. //
  39. // This is because the Animation continues to life until it
  40. // has fully executed (or has been aborted).
  41. //
  42. hr = pObj->QueryInterface(riid, ppv);
  43. } else {
  44. pObj->Release();
  45. }
  46. return hr;
  47. } else {
  48. return E_OUTOFMEMORY;
  49. }
  50. }
  51. };
  52. //------------------------------------------------------------------------------
  53. class OldAnimation :
  54. public OldExtension,
  55. public IAnimation
  56. {
  57. // Construction
  58. protected:
  59. inline OldAnimation();
  60. virtual ~OldAnimation() PURE;
  61. HRESULT Create(const GUID * pguidID, PRID * pprid, GANI_DESC * pDesc);
  62. void Destroy(BOOL fFinal);
  63. // Operations
  64. public:
  65. STDMETHOD_(void, SetFunction)(IInterpolation * pipol);
  66. STDMETHOD_(void, SetTime)(IAnimation::ETime time);
  67. STDMETHOD_(void, SetCallback)(IAnimationCallback * pcb);
  68. // Implementation
  69. protected:
  70. static void CALLBACK
  71. RawActionProc(GMA_ACTIONINFO * pmai);
  72. virtual void Action(GMA_ACTIONINFO * pmai) PURE;
  73. static HRESULT GetInterface(HGADGET hgad, PRID prid, REFIID riid, void ** ppvUnk);
  74. virtual void OnRemoveExisting();
  75. virtual void OnDestroySubject();
  76. virtual void OnDestroyListener();
  77. virtual void OnComplete() { }
  78. virtual void OnAsyncDestroy();
  79. void CleanupChangeGadget();
  80. // Data
  81. protected:
  82. HACTION m_hact;
  83. IInterpolation *
  84. m_pipol;
  85. IAnimationCallback *
  86. m_pcb;
  87. IAnimation::ETime
  88. m_time; // Time when completed
  89. BOOL m_fStartDestroy:1;
  90. BOOL m_fProcessing:1;
  91. UINT m_DEBUG_cUpdates;
  92. };
  93. //------------------------------------------------------------------------------
  94. class OldAlphaAnimation : public OldAnimation
  95. {
  96. // Construction
  97. public:
  98. inline OldAlphaAnimation();
  99. virtual ~OldAlphaAnimation();
  100. HRESULT Create(GANI_DESC * pDesc);
  101. // Operations
  102. public:
  103. STDMETHOD_(UINT, GetID)() const;
  104. static HRESULT GetInterface(HGADGET hgad, REFIID riid, void ** ppvUnk);
  105. // Implementaton
  106. protected:
  107. virtual void Action(GMA_ACTIONINFO * pmai);
  108. virtual void OnComplete();
  109. // Data
  110. protected:
  111. static PRID s_pridAlpha;
  112. static const IID * s_rgpIID[];
  113. float m_flStart;
  114. float m_flEnd;
  115. BOOL m_fPushToChildren;
  116. UINT m_nOnComplete;
  117. };
  118. //------------------------------------------------------------------------------
  119. class OldScaleAnimation : public OldAnimation
  120. {
  121. // Construction
  122. public:
  123. inline OldScaleAnimation();
  124. virtual ~OldScaleAnimation();
  125. HRESULT Create(GANI_DESC * pDesc);
  126. // Operations
  127. public:
  128. STDMETHOD_(UINT, GetID)() const;
  129. static HRESULT GetInterface(HGADGET hgad, REFIID riid, void ** ppvUnk);
  130. // Implementaton
  131. protected:
  132. virtual void Action(GMA_ACTIONINFO * pmai);
  133. // Data
  134. protected:
  135. static PRID s_pridScale;
  136. static const IID * s_rgpIID[];
  137. GANI_SCALEDESC::EAlignment
  138. m_al;
  139. float m_flStart;
  140. float m_flEnd;
  141. POINT m_ptStart;
  142. SIZE m_sizeCtrl;
  143. };
  144. //------------------------------------------------------------------------------
  145. class OldRectAnimation : public OldAnimation
  146. {
  147. // Construction
  148. public:
  149. inline OldRectAnimation();
  150. virtual ~OldRectAnimation();
  151. HRESULT Create(GANI_DESC * pDesc);
  152. // Operations
  153. public:
  154. STDMETHOD_(UINT, GetID)() const;
  155. static HRESULT GetInterface(HGADGET hgad, REFIID riid, void ** ppvUnk);
  156. // Implementaton
  157. protected:
  158. virtual void Action(GMA_ACTIONINFO * pmai);
  159. // Data
  160. protected:
  161. static PRID s_pridRect;
  162. static const IID * s_rgpIID[];
  163. POINT m_ptStart;
  164. POINT m_ptEnd;
  165. SIZE m_sizeStart;
  166. SIZE m_sizeEnd;
  167. UINT m_nChangeFlags;
  168. };
  169. //------------------------------------------------------------------------------
  170. class OldRotateAnimation : public OldAnimation
  171. {
  172. // Construction
  173. public:
  174. inline OldRotateAnimation();
  175. virtual ~OldRotateAnimation();
  176. HRESULT Create(GANI_DESC * pDesc);
  177. // Operations
  178. public:
  179. STDMETHOD_(UINT, GetID)() const;
  180. static HRESULT GetInterface(HGADGET hgad, REFIID riid, void ** ppvUnk);
  181. // Implementaton
  182. protected:
  183. virtual void Action(GMA_ACTIONINFO * pmai);
  184. // Data
  185. protected:
  186. static PRID s_pridRotate;
  187. static const IID * s_rgpIID[];
  188. float m_flStart;
  189. float m_flEnd;
  190. UINT m_nDir;
  191. };
  192. #include "OldAnimation.inl"
  193. #endif // CTRL__OldAnimation_h__INCLUDED