1 /////////////////////////////////////////////////////////////////////////////
2 // Name: cocoa/region.mm
3 // Purpose: wxRegion class
4 // Author: David Elliott
8 // Copyright: (c) 2004 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/region.h"
14 #import <Foundation/NSGeometry.h>
16 IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
18 inline wxRect NSRectToWxRect(const NSRect& rect)
20 return wxRect((wxCoord)rect.origin.x, (wxCoord)rect.origin.y,
21 (wxCoord)rect.size.width, (wxCoord)rect.size.height);
24 wxRegion::wxRegion(const NSRect& rect)
26 Union(NSRectToWxRect(rect));
29 wxRegion::wxRegion(const NSRect *rects, int count)
31 for(int i=0; i<count; i++)
33 Union(NSRectToWxRect(rects[i]));