]> git.saurik.com Git - wxWidgets.git/blob - src/cocoa/region.mm
Minor corrections to XRC format description.
[wxWidgets.git] / src / cocoa / region.mm
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
26 IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
27
28 inline 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
34 wxRegion::wxRegion(const NSRect& rect)
35 {
36 Union(NSRectToWxRect(rect));
37 }
38
39 wxRegion::wxRegion(const NSRect *rects, int count)
40 {
41 for(int i=0; i<count; i++)
42 {
43 Union(NSRectToWxRect(rects[i]));
44 }
45 }