region.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/cocoa/region.h
  3. // Purpose: 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_COCOA_REGION_H__
  11. #define _WX_COCOA_REGION_H__
  12. #include "wx/generic/region.h"
  13. #if defined(__LP64__) || defined(NS_BUILD_32_LIKE_64)
  14. typedef struct CGRect NSRect;
  15. #else
  16. typedef struct _NSRect NSRect;
  17. #endif
  18. class WXDLLIMPEXP_CORE wxRegion : public wxRegionGeneric
  19. {
  20. public:
  21. wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
  22. : wxRegionGeneric(x,y,w,h)
  23. {}
  24. wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
  25. : wxRegionGeneric(topLeft, bottomRight)
  26. {}
  27. wxRegion(const wxRect& rect)
  28. : wxRegionGeneric(rect)
  29. {}
  30. wxRegion() {}
  31. wxRegion(const wxBitmap& bmp)
  32. : wxRegionGeneric()
  33. { Union(bmp); }
  34. wxRegion(const wxBitmap& bmp,
  35. const wxColour& transColour, int tolerance = 0)
  36. : wxRegionGeneric()
  37. { Union(bmp, transColour, tolerance); }
  38. virtual ~wxRegion() {}
  39. wxRegion(const wxRegion& r)
  40. : wxRegionGeneric(r)
  41. {}
  42. wxRegion& operator= (const wxRegion& r)
  43. { return *(wxRegion*)&(this->wxRegionGeneric::operator=(r)); }
  44. // Cocoa-specific creation
  45. wxRegion(const NSRect& rect);
  46. wxRegion(const NSRect *rects, int count);
  47. private:
  48. DECLARE_DYNAMIC_CLASS(wxRegion);
  49. };
  50. class WXDLLIMPEXP_CORE wxRegionIterator : public wxRegionIteratorGeneric
  51. {
  52. // DECLARE_DYNAMIC_CLASS(wxRegionIteratorGeneric);
  53. public:
  54. wxRegionIterator() {}
  55. wxRegionIterator(const wxRegion& region)
  56. : wxRegionIteratorGeneric(region)
  57. {}
  58. wxRegionIterator(const wxRegionIterator& iterator)
  59. : wxRegionIteratorGeneric(iterator)
  60. {}
  61. virtual ~wxRegionIterator() {}
  62. wxRegionIterator& operator=(const wxRegionIterator& iter)
  63. { return *(wxRegionIterator*)&(this->wxRegionIteratorGeneric::operator=(iter)); }
  64. };
  65. #endif
  66. //ndef _WX_COCOA_REGION_H__