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.

234 lines
5.2 KiB

  1. /* @doc INTERNAL
  2. *
  3. * @module _DRWINFO.H Class to hold draw parameters |
  4. *
  5. * This declares a class that is used to hold parameters passed from
  6. * the host for drawing.
  7. *
  8. * Original Author: <nl>
  9. * Rick Sailor
  10. *
  11. * History: <nl>
  12. * 11/01/95 ricksa created
  13. */
  14. #ifndef _DRWINFO_H_
  15. #define _DRWINFO_H_
  16. /*
  17. * CArrayBase
  18. *
  19. * @class This class serves as a holder for all the parameters to a draw
  20. * except currently the HDC. Access to these parameters will actually come
  21. * through the display class.
  22. *
  23. * @devnote Although each operation that takes the parameters for drawing
  24. * will create one of these objects, the display keeps only one of these
  25. * objects because it will only use the last set of drawing parameters to
  26. * draw with. The depth count is used to tell draw whether it is appropriate
  27. * to draw or not.
  28. *
  29. */
  30. class CDrawInfo
  31. {
  32. //@access Public Methods
  33. public:
  34. CDrawInfo(CTxtEdit *ped); //@cmember Initialize object
  35. void Init( //@cmember Fills object
  36. //with draw data.
  37. DWORD dwDrawAspect,
  38. LONG lindex,
  39. void *pvAspect,
  40. DVTARGETDEVICE *ptd,
  41. HDC hicTargetDev);
  42. DWORD Release(); //@cmember Dec's ref count
  43. const CDevDesc * GetTargetDD(); //@cmember Gets target device
  44. DWORD GetDrawDepth() const; //@cmember Gets depth count
  45. DWORD GetDrawAspect() const; //@cmember Gets Draw aspect
  46. LONG GetLindex() const; //@cmember Gets lindex
  47. void * GetAspect() const; //@cmember Gets aspect
  48. DVTARGETDEVICE * GetPtd() const; //@cmember Gets target device
  49. // descriptor.
  50. //@access Private Data
  51. private:
  52. DWORD _dwDepth; //@cmember Max number of
  53. // users of this information
  54. DWORD _cRefs; //@cmember Number of current
  55. // users
  56. CDevDesc _ddTarget; //@cmember target device
  57. // (if any).
  58. DWORD _dwDrawAspect; //@cmember draw aspect
  59. LONG _lindex; //@cmember lindex
  60. void * _pvAspect; //@cmember aspect
  61. DVTARGETDEVICE * _ptd; //@cmember target device data
  62. };
  63. /*
  64. * CDrawInfo::CDrawInfo
  65. *
  66. * @mfunc Initializes structure with base required information
  67. *
  68. * @rdesc Initialized object
  69. *
  70. * @devnote This serves two purposes: (1) CDevDesc requires the ped to
  71. * initalize correctly and (2) We need to make sure that the ref counts
  72. * are set to zero since this is created on the stack.
  73. *
  74. */
  75. inline CDrawInfo::CDrawInfo(
  76. CTxtEdit *ped) //@parm Edit object used by the target device
  77. : _ddTarget(ped), _dwDepth(0), _cRefs(0)
  78. {
  79. // Header does the work
  80. }
  81. /*
  82. * CDrawInfo::Init
  83. *
  84. * @mfunc Initializes object with drawing data
  85. *
  86. * @rdesc void
  87. *
  88. * @devnote This is separated from the constructor because the display
  89. * only uses one copy of this object so the display may initialize
  90. * a different object than the one constructed.
  91. */
  92. inline void CDrawInfo::Init(
  93. DWORD dwDrawAspect, //@parm draw aspect
  94. LONG lindex, //@parm currently unused
  95. void *pvAspect, //@parm info for drawing optimizations (OCX 96)
  96. DVTARGETDEVICE *ptd,//@parm information on target device
  97. HDC hicTargetDev) //@parm target information context
  98. {
  99. _dwDepth++;
  100. _cRefs++;
  101. _dwDrawAspect = dwDrawAspect;
  102. _lindex = lindex;
  103. _pvAspect = pvAspect;
  104. _ptd = ptd;
  105. if (hicTargetDev != NULL)
  106. {
  107. _ddTarget.SetDC(hicTargetDev);
  108. }
  109. }
  110. /*
  111. * CDrawInfo::Release
  112. *
  113. * @mfunc Decrements the reference count
  114. *
  115. * @rdesc Number of outstanding references to this object
  116. *
  117. * @devnote This is used by the display to tell the display when it can NULL
  118. * its pointer to the display object.
  119. */
  120. inline DWORD CDrawInfo::Release()
  121. {
  122. AssertSz((_cRefs != 0), "CDrawInfo::Release invalid");
  123. return --_cRefs;
  124. }
  125. /*
  126. * CDrawInfo::GetTargetDD
  127. *
  128. * @mfunc Get pointer to target device
  129. *
  130. * @rdesc Returns pointer to target device if there is one
  131. *
  132. */
  133. inline const CDevDesc *CDrawInfo::GetTargetDD()
  134. {
  135. return (_ddTarget.IsValid())
  136. ? &_ddTarget
  137. : NULL;
  138. }
  139. /*
  140. * CDrawInfo::GetDrawDepth
  141. *
  142. * @mfunc Get number of uses of this object
  143. *
  144. * @rdesc Number of uses of this object
  145. *
  146. * @devnote This allows the draw routine to determine if a recursive draw
  147. * occurred.
  148. *
  149. */
  150. inline DWORD CDrawInfo::GetDrawDepth() const
  151. {
  152. return _dwDepth;
  153. }
  154. /*
  155. * CDrawInfo::GetDrawAspect
  156. *
  157. * @mfunc Get the draw aspect passed in on draw
  158. *
  159. * @rdesc Returns draw aspect
  160. *
  161. */
  162. inline DWORD CDrawInfo::GetDrawAspect() const
  163. {
  164. return _dwDrawAspect;
  165. }
  166. /*
  167. * CDrawInfo::GetLindex
  168. *
  169. * @mfunc Gets lindex passed from host
  170. *
  171. * @rdesc lindex passed from host
  172. *
  173. */
  174. inline LONG CDrawInfo::GetLindex() const
  175. {
  176. return _lindex;
  177. }
  178. /*
  179. * CDrawInfo::GetAspect
  180. *
  181. * @mfunc Gets pointer to aspect passed from host
  182. *
  183. * @rdesc Returns pointer to aspect structure
  184. *
  185. * @devnote this is data is currently not defined.
  186. *
  187. */
  188. inline void *CDrawInfo::GetAspect() const
  189. {
  190. return _pvAspect;
  191. }
  192. /*
  193. * CDrawInfo::GetPtd
  194. *
  195. * @mfunc Get device target data from host
  196. *
  197. * @rdesc Returns pointer to device target data
  198. *
  199. */
  200. inline DVTARGETDEVICE *CDrawInfo::GetPtd() const
  201. {
  202. return _ptd;
  203. }
  204. #endif // _DRWINFO_H_