]> git.saurik.com Git - wxWidgets.git/blobdiff - src/cocoa/region.mm
Rename delegates to try and stop name clashes, probably with wxWebKitCtrl.
[wxWidgets.git] / src / cocoa / region.mm
index 170ef49b6f77637bdcc9951b7c8f6fa7226b534b..f6d750010713dc6adeb0ec1acc3c7a8260d1850d 100644 (file)
@@ -1,15 +1,46 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        cocoa/region.mm
+// Name:        src/cocoa/region.mm
 // Purpose:     wxRegion class
 // Author:      David Elliott
-// Modified by: 
+// Modified by:
 // Created:     2004/04/12
 // RCS-ID:      $Id$
 // Copyright:   (c) 2004 David Elliott
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
 #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]));
+    }
+}