1/////////////////////////////////////////////////////////////////////////////
2// Name:        src/cocoa/region.mm
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
11// ============================================================================
12// declarations
13// ============================================================================
14
15// ----------------------------------------------------------------------------
16// headers
17// ----------------------------------------------------------------------------
18
19// For compilers that support precompilation, includes "wx.h".
20#include "wx/wxprec.h"
21
22#include "wx/region.h"
23
24#import <Foundation/NSGeometry.h>
25
26IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
27
28inline wxRect NSRectToWxRect(const NSRect& rect)
29{
30    return wxRect((wxCoord)rect.origin.x, (wxCoord)rect.origin.y,
31        (wxCoord)rect.size.width, (wxCoord)rect.size.height);
32}
33
34wxRegion::wxRegion(const NSRect& rect)
35{
36    Union(NSRectToWxRect(rect));
37}
38
39wxRegion::wxRegion(const NSRect *rects, int count)
40{
41    for(int i=0; i<count; i++)
42    {
43        Union(NSRectToWxRect(rects[i]));
44    }
45}
46