region.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/generic/region.h
  3. // Purpose: generic wxRegion class
  4. // Author: David Elliott
  5. // Modified by:
  6. // Created: 2004/04/12
  7. // Copyright: (c) 2004 David Elliott
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_GENERIC_REGION_H__
  11. #define _WX_GENERIC_REGION_H__
  12. class WXDLLIMPEXP_CORE wxRegionGeneric : public wxRegionBase
  13. {
  14. public:
  15. wxRegionGeneric(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
  16. wxRegionGeneric(const wxPoint& topLeft, const wxPoint& bottomRight);
  17. wxRegionGeneric(const wxRect& rect);
  18. wxRegionGeneric(size_t n, const wxPoint *points, wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
  19. wxRegionGeneric(const wxBitmap& bmp);
  20. wxRegionGeneric(const wxBitmap& bmp, const wxColour& transp, int tolerance = 0);
  21. wxRegionGeneric();
  22. virtual ~wxRegionGeneric();
  23. // wxRegionBase pure virtuals
  24. virtual void Clear();
  25. virtual bool IsEmpty() const;
  26. protected:
  27. virtual wxGDIRefData *CreateGDIRefData() const;
  28. virtual wxGDIRefData *CloneGDIRefData(const wxGDIRefData *data) const;
  29. // wxRegionBase pure virtuals
  30. virtual bool DoIsEqual(const wxRegion& region) const;
  31. virtual bool DoGetBox(wxCoord& x, wxCoord& y, wxCoord& w, wxCoord& h) const;
  32. virtual wxRegionContain DoContainsPoint(wxCoord x, wxCoord y) const;
  33. virtual wxRegionContain DoContainsRect(const wxRect& rect) const;
  34. virtual bool DoOffset(wxCoord x, wxCoord y);
  35. virtual bool DoUnionWithRect(const wxRect& rect);
  36. virtual bool DoUnionWithRegion(const wxRegion& region);
  37. virtual bool DoIntersect(const wxRegion& region);
  38. virtual bool DoSubtract(const wxRegion& region);
  39. virtual bool DoXor(const wxRegion& region);
  40. friend class WXDLLIMPEXP_FWD_CORE wxRegionIteratorGeneric;
  41. };
  42. class WXDLLIMPEXP_CORE wxRegionIteratorGeneric : public wxObject
  43. {
  44. public:
  45. wxRegionIteratorGeneric();
  46. wxRegionIteratorGeneric(const wxRegionGeneric& region);
  47. wxRegionIteratorGeneric(const wxRegionIteratorGeneric& iterator);
  48. virtual ~wxRegionIteratorGeneric();
  49. wxRegionIteratorGeneric& operator=(const wxRegionIteratorGeneric& iterator);
  50. void Reset() { m_current = 0; }
  51. void Reset(const wxRegionGeneric& region);
  52. operator bool () const { return HaveRects(); }
  53. bool HaveRects() const;
  54. wxRegionIteratorGeneric& operator++();
  55. wxRegionIteratorGeneric operator++(int);
  56. long GetX() const;
  57. long GetY() const;
  58. long GetW() const;
  59. long GetWidth() const { return GetW(); }
  60. long GetH() const;
  61. long GetHeight() const { return GetH(); }
  62. wxRect GetRect() const;
  63. private:
  64. long m_current;
  65. wxRegionGeneric m_region;
  66. };
  67. #endif // _WX_GENERIC_REGION_H__