]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/region.mm
The mmedia contrib requires sys/soundcard.h on unix, so disable it on unix
[wxWidgets.git] / src / cocoa / region.mm
index 170ef49b6f77637bdcc9951b7c8f6fa7226b534b..b8ed91676fdc735d3623f818fe37f9718d6e903b 100644 (file)
@@ -6,10 +6,31 @@
 // Created:     2004/04/12
 // RCS-ID:      $Id$
 // Copyright:   (c) 2004 David Elliott
-// Licence:     wxWindows licence
+// Licence:     wxWidgets licence
 /////////////////////////////////////////////////////////////////////////////
 
 #include "wx/region.h"
 
+#import <Foundation/NSGeometry.h>
+
 IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
 
+inline wxRect NSRectToWxRect(const NSRect& rect)
+{
+    return wxRect((wxCoord)rect.origin.x, (wxCoord)rect.origin.y,
+        (wxCoord)rect.size.width, (wxCoord)rect.size.height);
+}
+
+wxRegion::wxRegion(const NSRect& rect)
+{
+    Union(NSRectToWxRect(rect));
+}
+
+wxRegion::wxRegion(const NSRect *rects, int count)
+{
+    for(int i=0; i<count; i++)
+    {
+        Union(NSRectToWxRect(rects[i]));
+    }
+}
+