region.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/region.h
  3. // Purpose: wxRegion class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/15/99
  7. // Copyright: (c) David Webster
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_OS2_REGION_H_
  11. #define _WX_OS2_REGION_H_
  12. #include "wx/list.h"
  13. #include "wx/os2/private.h"
  14. class WXDLLIMPEXP_CORE wxRegion : public wxRegionWithCombine
  15. {
  16. public:
  17. wxRegion( wxCoord x
  18. ,wxCoord y
  19. ,wxCoord vWidth
  20. ,wxCoord vHeight
  21. );
  22. wxRegion( const wxPoint& rTopLeft
  23. ,const wxPoint& rBottomRight
  24. );
  25. wxRegion(const wxRect& rRect);
  26. wxRegion(WXHRGN hRegion, WXHDC hPS); // Hangs on to this region
  27. wxRegion(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE );
  28. wxRegion( const wxBitmap& bmp)
  29. {
  30. Union(bmp);
  31. }
  32. wxRegion( const wxBitmap& bmp,
  33. const wxColour& transColour, int tolerance = 0)
  34. {
  35. Union(bmp, transColour, tolerance);
  36. }
  37. wxRegion();
  38. virtual ~wxRegion();
  39. //
  40. // Modify region
  41. //
  42. //
  43. // Clear current region
  44. //
  45. virtual void Clear();
  46. //
  47. // Is region empty?
  48. //
  49. virtual bool IsEmpty() const;
  50. //
  51. // Get internal region handle
  52. //
  53. WXHRGN GetHRGN() const;
  54. void SetPS(HPS hPS);
  55. protected:
  56. virtual wxGDIRefData* CreateGDIRefData(void) const;
  57. virtual wxGDIRefData* CloneGDIRefData(const wxGDIRefData* pData) const;
  58. virtual bool DoIsEqual(const wxRegion& region) const;
  59. virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
  60. virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
  61. virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
  62. virtual bool DoOffset(wxCoord x, wxCoord y);
  63. virtual bool DoCombine(const wxRegion& region, wxRegionOp op);
  64. friend class WXDLLIMPEXP_FWD_CORE wxRegionIterator;
  65. DECLARE_DYNAMIC_CLASS(wxRegion);
  66. }; // end of CLASS wxRegion
  67. class WXDLLIMPEXP_CORE wxRegionIterator : public wxObject
  68. {
  69. public:
  70. wxRegionIterator();
  71. wxRegionIterator(const wxRegion& rRegion);
  72. virtual ~wxRegionIterator();
  73. void Reset(void) { m_lCurrent = 0; }
  74. void Reset(const wxRegion& rRegion);
  75. operator bool (void) const { return m_lCurrent < m_lNumRects; }
  76. bool HaveRects(void) const { return m_lCurrent < m_lNumRects; }
  77. void operator ++ (void);
  78. void operator ++ (int);
  79. wxCoord GetX(void) const;
  80. wxCoord GetY(void) const;
  81. wxCoord GetW(void) const;
  82. wxCoord GetWidth(void) const { return GetW(); }
  83. wxCoord GetH(void) const;
  84. wxCoord GetHeight(void) const { return GetH(); }
  85. wxRect GetRect(void) const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
  86. private:
  87. long m_lCurrent;
  88. long m_lNumRects;
  89. wxRegion m_vRegion;
  90. wxRect* m_pRects;
  91. DECLARE_DYNAMIC_CLASS(wxRegionIterator)
  92. }; // end of wxRegionIterator
  93. #endif // _WX_OS2_REGION_H_