HStroke.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. // HStroke.h: interface for the HStroke class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_HSTROKE_H__D33B3CC5_37DF_4D35_82D3_515EF16125A0__INCLUDED_)
  5. #define AFX_HSTROKE_H__D33B3CC5_37DF_4D35_82D3_515EF16125A0__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include <afxwin.h>
  10. #include <math.h>
  11. enum HPicType{PIC_line, PIC_poly, PIC_ellipse, PIC_rect, PIC_text, PIC_select};
  12. //My Tracker
  13. class HStrokeTracker : public CRectTracker
  14. {
  15. public:
  16. int m_picExtra;
  17. HPicType m_picType;
  18. HStrokeTracker();
  19. void Draw( CDC* pDC ) const;
  20. };
  21. class HStroke : public CObject
  22. {
  23. public:
  24. virtual void ReSize(CRect newPos);
  25. HStrokeTracker m_tracker;
  26. virtual void Move(int x, int y);
  27. //attributes
  28. int m_penStyle;
  29. int m_penWidth;
  30. COLORREF m_penColor;
  31. HPicType m_picType;
  32. CArray<CPoint, CPoint> m_points;
  33. //state
  34. BOOL m_bSelected;
  35. BOOL m_bHighLight;
  36. virtual BOOL IsHightLight();
  37. virtual void SetHighLight(BOOL bHL);
  38. virtual BOOL IsPointIn(const CPoint &point);
  39. virtual void SetCurrentPoint(CPoint point);
  40. virtual void ReDrawStroke(CDC *pDC, CPoint point);
  41. virtual void DrawStroke(CDC *pDC);
  42. virtual void _Draw(CDC *pDC);
  43. HStroke();
  44. DECLARE_SERIAL(HStroke)
  45. virtual ~HStroke();
  46. virtual void Serialize(CArchive& ar);
  47. };
  48. class HStrokeLine : public HStroke
  49. {
  50. public:
  51. HStrokeLine();
  52. DECLARE_SERIAL(HStrokeLine)
  53. virtual ~HStrokeLine();
  54. virtual void SetCurrentPoint(CPoint point);
  55. virtual void ReDrawStroke(CDC *pDC, CPoint point);
  56. virtual void DrawStroke(CDC *pDC);
  57. virtual void _Draw(CDC *pDC);
  58. virtual BOOL IsPointIn(const CPoint &point);
  59. protected:
  60. };
  61. class HStrokePoly : public HStroke
  62. {
  63. public:
  64. HStrokePoly();
  65. DECLARE_SERIAL(HStrokePoly)
  66. virtual ~HStrokePoly();
  67. virtual void SetCurrentPoint(CPoint point);
  68. virtual void ReDrawStroke(CDC *pDC, CPoint point);
  69. virtual void _Draw(CDC *pDC);
  70. virtual BOOL IsPointIn(const CPoint &point);
  71. };
  72. class HStrokeRect : public HStrokeLine
  73. {
  74. public:
  75. DECLARE_SERIAL(HStrokeRect)
  76. HStrokeRect();
  77. virtual ~HStrokeRect();
  78. virtual void ReDrawStroke(CDC *pDC, CPoint point);
  79. virtual void _Draw(CDC *pDC);
  80. virtual BOOL IsPointIn(const CPoint &point);
  81. };
  82. class HStrokeEllipse : public HStrokeLine
  83. {
  84. public:
  85. HStrokeEllipse();
  86. DECLARE_SERIAL(HStrokeEllipse)
  87. virtual ~HStrokeEllipse();
  88. virtual void ReDrawStroke(CDC *pDC, CPoint point);
  89. virtual void _Draw(CDC *pDC);
  90. virtual BOOL IsPointIn(const CPoint &point);
  91. };
  92. class HStrokeText : public HStrokeLine
  93. {
  94. public:
  95. HStrokeText();
  96. HStrokeText(CString info);
  97. DECLARE_SERIAL(HStrokeText)
  98. virtual ~HStrokeText();
  99. virtual void ReDrawStroke(CDC *pDC, CPoint point);
  100. virtual void DrawStroke(CDC *pDC);
  101. virtual void Serialize(CArchive& ar);
  102. CString m_text;
  103. };
  104. class HStrokeSelect : public HStrokeRect
  105. {
  106. public:
  107. HStrokeSelect();
  108. virtual void DrawStroke(CDC *pDC);
  109. };
  110. #endif // !defined(AFX_HSTROKE_H__D33B3CC5_37DF_4D35_82D3_515EF16125A0__INCLUDED_)