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.

194 lines
4.4 KiB

  1. //
  2. // GRPTR.HPP
  3. // Graphic Pointer Class
  4. //
  5. // Copyright Microsoft 1998-
  6. //
  7. #ifndef __GRPTR_HPP_
  8. #define __GRPTR_HPP_
  9. typedef struct COLOREDICON
  10. {
  11. HICON hIcon;
  12. COLORREF color;
  13. } COLORED_ICON;
  14. //
  15. //
  16. // Class: DCWbGraphicPointer
  17. //
  18. // Purpose: Class representing a remote pointer.
  19. //
  20. // This is an internal object only - it is never passed to the
  21. // Whiteboard Core DLL.
  22. //
  23. //
  24. class DCWbGraphicPointer : public DCWbGraphic
  25. {
  26. friend class WbUser;
  27. public:
  28. //
  29. // Constructors
  30. //
  31. DCWbGraphicPointer(WbUser* _pUser);
  32. //
  33. // Destructor
  34. //
  35. ~DCWbGraphicPointer(void);
  36. UINT IsGraphicTool(void) { return enumGraphicPointer;}
  37. //
  38. // Return the rectangle in which the pointer was last drawn. The
  39. // rectangle will be empty if the pointer is not currently drawn. Use
  40. // BoundsRect to get the rectangle which will be occupied by the pointer
  41. // when it is next drawn.
  42. //
  43. void GetDrawnRect(LPRECT lprc);
  44. //
  45. // Activate and deactivate the pointer
  46. //
  47. BOOL IsActive(void) const { return m_bActive; }
  48. void SetActive(WB_PAGE_HANDLE hPage, POINT point);
  49. void SetInactive(void);
  50. //
  51. // Set the color of the pointer
  52. //
  53. void SetColor(COLORREF newColor);
  54. //
  55. // Get and set the current page of the pointer
  56. //
  57. WB_PAGE_HANDLE GetPage(void) const;
  58. void SetPage(WB_PAGE_HANDLE hNewPage);
  59. WbUser * GetUser(void) const { return(m_pUser); }
  60. //
  61. // Return TRUE if this is the local user's pointer
  62. //
  63. BOOL IsLocalPointer(void) const;
  64. //
  65. // Draw the pointer
  66. //
  67. void Draw(HDC hDC) { Draw(hDC, (WbDrawingArea *)NULL); }
  68. void Draw(HDC hDC, WbDrawingArea * pDrawingArea);
  69. //
  70. // Draw the pointer after saving the bits under it to memory
  71. //
  72. void DrawSave(HDC hDC, WbDrawingArea * pDrawingArea);
  73. //
  74. // Erase the pointer from its old position and redraw it in its current
  75. // position.
  76. //
  77. void Redraw(HDC hDC, WbDrawingArea * pDrawingArea);
  78. //
  79. // Undraw the pointer
  80. //
  81. void Undraw(HDC hDC, WbDrawingArea * pDrawingArea);
  82. //
  83. // Update the user information with the pointer position
  84. //
  85. virtual void Update(void);
  86. //
  87. // Operators
  88. //
  89. virtual BOOL operator!=(const DCWbGraphicPointer& pointer) const;
  90. virtual BOOL operator==(const DCWbGraphicPointer& pointer) const;
  91. protected:
  92. //
  93. // Zoom factor set from WBDRAW
  94. //
  95. int m_iZoomSaved;
  96. //
  97. // Create the icon of the correct color for this user
  98. //
  99. HICON CreateColoredIcon(COLORREF color);
  100. //
  101. // Create the bitmap for saving the screen data under the pointer
  102. //
  103. void CreateSaveBitmap(WbDrawingArea * pDrawingArea);
  104. //
  105. // Draw or undraw the pointer (screen and memory versions)
  106. //
  107. BOOL SaveScreen(HDC hDC, WbDrawingArea * pDrawingArea);
  108. BOOL UndrawScreen(HDC hDC, WbDrawingArea * pDrawingArea);
  109. BOOL CopyFromScreen(HDC hDC, WbDrawingArea * pDrawingArea);
  110. BOOL CopyToScreen(HDC hDC, WbDrawingArea * pDrawingArea);
  111. BOOL DrawMemory(void);
  112. BOOL UndrawMemory(void);
  113. BOOL SaveMemory(void);
  114. //
  115. // Manipulate the display DC for pointer operations
  116. //
  117. void PointerDC(HDC hDC, WbDrawingArea * pDrawingArea,
  118. LPRECT lprc, int zoom = 0);
  119. void SurfaceDC(HDC hDC, WbDrawingArea * pDrawingArea);
  120. //
  121. // The user associated with this pointer
  122. //
  123. WbUser* m_pUser;
  124. //
  125. // Flag indicating whether the pointer is active
  126. //
  127. BOOL m_bActive;
  128. //
  129. // Pointer to the bitmap used to save the data under the pointer
  130. //
  131. HBITMAP m_hSaveBitmap;
  132. //
  133. // Handle of bitmap originally supplied with memDC
  134. //
  135. HBITMAP m_hOldBitmap;
  136. //
  137. // Device context used for drawing and undrawing the pointer
  138. //
  139. HDC m_hMemDC;
  140. //
  141. // Handle of icon to be used for drawing
  142. //
  143. HICON m_hIcon;
  144. //
  145. // Width and height of the pointer
  146. //
  147. UINT m_uiIconWidth;
  148. UINT m_uiIconHeight;
  149. //
  150. // Flag indicating whether the pointer is drawn
  151. //
  152. BOOL m_bDrawn;
  153. //
  154. // Rectangle in which the pointer was last drawn
  155. //
  156. RECT m_rectLastDrawn;
  157. };
  158. #endif // __GRPTR_HPP_