1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/region.mm
3 // Purpose: wxRegion class
4 // Author: David Elliott
7 // Copyright: (c) 2004 David Elliott
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // For compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
22 #include "wx/region.h"
24 #import <Foundation/NSGeometry.h>
26 IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
28 inline wxRect NSRectToWxRect(const NSRect& rect)
30 return wxRect((wxCoord)rect.origin.x, (wxCoord)rect.origin.y,
31 (wxCoord)rect.size.width, (wxCoord)rect.size.height);
34 wxRegion::wxRegion(const NSRect& rect)
36 Union(NSRectToWxRect(rect));
39 wxRegion::wxRegion(const NSRect *rects, int count)
41 for(int i=0; i<count; i++)
43 Union(NSRectToWxRect(rects[i]));