1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/cocoa/region.h
3 // Purpose: wxRegion class
4 // Author: David Elliott
8 // Copyright: (c) 2004 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_COCOA_REGION_H__
13 #define _WX_COCOA_REGION_H__
15 #include "wx/generic/region.h"
17 typedef struct _NSRect NSRect
;
19 class WXDLLEXPORT wxRegion
: public wxRegionGeneric
21 DECLARE_DYNAMIC_CLASS(wxRegion
);
23 wxRegion(wxCoord x
, wxCoord y
, wxCoord w
, wxCoord h
)
24 : wxRegionGeneric(x
,y
,w
,h
)
26 wxRegion(const wxPoint
& topLeft
, const wxPoint
& bottomRight
)
27 : wxRegionGeneric(topLeft
, bottomRight
)
29 wxRegion(const wxRect
& rect
)
30 : wxRegionGeneric(rect
)
33 wxRegion(const wxBitmap
& bmp
,
34 const wxColour
& transColour
= wxNullColour
,
38 Union(bmp
, transColour
, tolerance
);
41 wxRegion(const wxRegion
& r
)
44 wxRegion
& operator= (const wxRegion
& r
)
45 { return *(wxRegion
*)&(this->wxRegionGeneric::operator=(r
)); }
47 // Cocoa-specific creation
48 wxRegion(const NSRect
& rect
);
49 wxRegion(const NSRect
*rects
, int count
);
51 // Use the non-transparent pixels of a wxBitmap for the region to combine
52 // with this region. If the bitmap has a mask then it will be used,
53 // otherwise the colour to be treated as transparent may be specified,
54 // along with an optional tolerance value.
55 // NOTE: implemented in common/rgncmn.cpp
56 bool Union(const wxBitmap
& bmp
,
57 const wxColour
& transColour
= wxNullColour
,
59 /* And because of function hiding: */
60 bool Union(long x
, long y
, long width
, long height
)
61 { return wxRegionGeneric::Union(x
,y
,width
,height
); }
62 bool Union(const wxRect
& rect
)
63 { return wxRegionGeneric::Union(rect
); }
64 bool Union(const wxRegion
& region
)
65 { return wxRegionGeneric::Union(region
); }
67 // Convert the region to a B&W bitmap with the black pixels being inside
69 // NOTE: implemented in common/rgncmn.cpp
70 wxBitmap
ConvertToBitmap() const;
74 class WXDLLEXPORT wxRegionIterator
: public wxRegionIteratorGeneric
76 // DECLARE_DYNAMIC_CLASS(wxRegionIteratorGeneric);
79 wxRegionIterator(const wxRegion
& region
)
80 : wxRegionIteratorGeneric(region
)
82 wxRegionIterator(const wxRegionIterator
& iterator
)
83 : wxRegionIteratorGeneric(iterator
)
85 ~wxRegionIterator() {}
87 wxRegionIterator
& operator=(const wxRegionIterator
& iter
)
88 { return *(wxRegionIterator
*)&(this->wxRegionIteratorGeneric::operator=(iter
)); }
91 #endif //ndef _WX_COCOA_REGION_H__