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.

180 lines
3.6 KiB

  1. helper EventGadget
  2. {
  3. typedef UINT (CALLBACK * EventHandler)(void * pvData, EventMsg * pmsg);
  4. };
  5. helper Visual
  6. {
  7. struct VisualCI : public DUser::Gadget::ConstructInfo
  8. {
  9. Visual * pgvParent;
  10. };
  11. inline HRESULT IsVisible(BOOL * pfVisible, UINT nFlags)
  12. {
  13. return IsParentChainStyle(GS_VISIBLE, pfVisible, nFlags);
  14. }
  15. inline HRESULT IsEnabled(BOOL * pfEnabled, UINT nFlags)
  16. {
  17. return IsParentChainStyle(GS_ENABLED, pfEnabled, nFlags);
  18. }
  19. inline HRESULT SetRect(UINT nFlags, int x, int y, int cx, int cy)
  20. {
  21. RECT rc;
  22. rc.left = x;
  23. rc.top = y;
  24. rc.right = x + cx;
  25. rc.bottom = y + cy;
  26. return SetRect(nFlags, &rc);
  27. }
  28. };
  29. helper Animation
  30. {
  31. enum ETime
  32. {
  33. tComplete, // Completed normally
  34. tEnd, // Jumped to end
  35. tAbort, // Aborted in place
  36. tReset, // Reset to beginning
  37. tDestroy // The Gadget being animationed has been destroyed
  38. };
  39. struct AniCI : public DUser::Gadget::ConstructInfo
  40. {
  41. DWORD cbSize;
  42. Visual * pgvSubject;
  43. GMA_ACTION act;
  44. Interpolation *
  45. pipol;
  46. Flow * pgflow;
  47. };
  48. static void Stop(Visual * pgvSubject, PRID prid)
  49. {
  50. DUserStopAnimation(pgvSubject, prid);
  51. }
  52. BEGIN_STRUCT(CompleteEvent, EventMsg)
  53. BOOL fNormal; // Sequenced finished normally
  54. END_STRUCT(CompleteEvent)
  55. DEFINE_EVENT(evComplete, "E90A6ABB-E4CF-4988-87EA-6D1EEDCD0097");
  56. };
  57. helper Flow
  58. {
  59. enum ETime
  60. {
  61. tBegin = 0,
  62. tEnd
  63. };
  64. struct FlowCI : public DUser::Gadget::ConstructInfo
  65. {
  66. DWORD cbSize;
  67. Visual * pgvSubject;
  68. };
  69. };
  70. helper AlphaFlow
  71. {
  72. static PRID GetPRID()
  73. {
  74. return DUserGetAlphaPRID();
  75. }
  76. struct AlphaKeyFrame : DUser::KeyFrame
  77. {
  78. float flAlpha;
  79. };
  80. };
  81. helper RectFlow
  82. {
  83. static PRID GetPRID()
  84. {
  85. return DUserGetRectPRID();
  86. }
  87. struct RectKeyFrame : DUser::KeyFrame
  88. {
  89. UINT nChangeFlags;
  90. RECT rcPxl;
  91. };
  92. };
  93. helper RotateFlow
  94. {
  95. enum EDirection
  96. {
  97. dMin = 0,
  98. dShort = 0, // Shortest arc
  99. dLong = 1, // Longer arc
  100. dCW = 2, // Clock-wise
  101. dCCW = 3, // Counter clock-wise
  102. dMax = 3,
  103. };
  104. static PRID GetPRID()
  105. {
  106. return DUserGetRotatePRID();
  107. }
  108. struct RotateKeyFrame : DUser::KeyFrame
  109. {
  110. float flRotation;
  111. EDirection nDir;
  112. };
  113. };
  114. helper ScaleFlow
  115. {
  116. static PRID GetPRID()
  117. {
  118. return DUserGetScalePRID();
  119. }
  120. struct ScaleKeyFrame : DUser::KeyFrame
  121. {
  122. UINT nChangeFlags;
  123. float flScale;
  124. };
  125. };
  126. helper Sequence
  127. {
  128. struct AnimationInfo
  129. {
  130. DWORD cbSize;
  131. };
  132. };
  133. helper DropTarget
  134. {
  135. struct DropCI : DUser::Gadget::ConstructInfo
  136. {
  137. HWND hwnd;
  138. Visual * pgvRoot;
  139. };
  140. static DropTarget *
  141. BuildDropTarget(HWND hwnd, Visual * pgvRoot)
  142. {
  143. DropTarget::DropCI ci;
  144. ZeroMemory(&ci, sizeof(ci));
  145. ci.hwnd = hwnd;
  146. ci.pgvRoot = pgvRoot;
  147. return DropTarget::Build(&ci);
  148. }
  149. };