1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/cocoa/region.mm
3 // Purpose: wxRegion class
4 // Author: David Elliott
8 // Copyright: (c) 2004 David Elliott
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
23 #include "wx/region.h"
25 #import <Foundation/NSGeometry.h>
27 IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
29 inline wxRect NSRectToWxRect(const NSRect& rect)
31 return wxRect((wxCoord)rect.origin.x, (wxCoord)rect.origin.y,
32 (wxCoord)rect.size.width, (wxCoord)rect.size.height);
35 wxRegion::wxRegion(const NSRect& rect)
37 Union(NSRectToWxRect(rect));
40 wxRegion::wxRegion(const NSRect *rects, int count)
42 for(int i=0; i<count; i++)
44 Union(NSRectToWxRect(rects[i]));