+#import <Foundation/NSException.h>
+#import <AppKit/NSApplication.h>
+#import <AppKit/NSWindow.h>
+
+// Turn this on to paint green over the dummy views for debugging
+#undef WXCOCOA_FILL_DUMMY_VIEW
+
+#ifdef WXCOCOA_FILL_DUMMY_VIEW
+#import <AppKit/NSBezierPath.h>
+#endif //def WXCOCOA_FILL_DUMMY_VIEW
+
+// A category for methods that are only present in Panther's SDK
+@interface NSView(wxNSViewPrePantherCompatibility)
+- (void)getRectsBeingDrawn:(const NSRect **)rects count:(int *)count;
+@end
+
+NSPoint CocoaTransformNSViewBoundsToWx(NSView *nsview, NSPoint pointBounds)
+{
+ wxCHECK_MSG(nsview, pointBounds, wxT("Need to have a Cocoa view to do translation"));
+ if([nsview isFlipped])
+ return pointBounds;
+ NSRect ourBounds = [nsview bounds];
+ return NSMakePoint
+ ( pointBounds.x
+ , ourBounds.size.height - pointBounds.y
+ );
+}
+
+NSRect CocoaTransformNSViewBoundsToWx(NSView *nsview, NSRect rectBounds)
+{
+ wxCHECK_MSG(nsview, rectBounds, wxT("Need to have a Cocoa view to do translation"));
+ if([nsview isFlipped])
+ return rectBounds;
+ NSRect ourBounds = [nsview bounds];
+ return NSMakeRect
+ ( rectBounds.origin.x
+ , ourBounds.size.height - (rectBounds.origin.y + rectBounds.size.height)
+ , rectBounds.size.width
+ , rectBounds.size.height
+ );
+}
+
+NSPoint CocoaTransformNSViewWxToBounds(NSView *nsview, NSPoint pointWx)
+{
+ wxCHECK_MSG(nsview, pointWx, wxT("Need to have a Cocoa view to do translation"));
+ if([nsview isFlipped])
+ return pointWx;
+ NSRect ourBounds = [nsview bounds];
+ return NSMakePoint
+ ( pointWx.x
+ , ourBounds.size.height - pointWx.y
+ );
+}
+
+NSRect CocoaTransformNSViewWxToBounds(NSView *nsview, NSRect rectWx)
+{
+ wxCHECK_MSG(nsview, rectWx, wxT("Need to have a Cocoa view to do translation"));
+ if([nsview isFlipped])
+ return rectWx;
+ NSRect ourBounds = [nsview bounds];
+ return NSMakeRect
+ ( rectWx.origin.x
+ , ourBounds.size.height - (rectWx.origin.y + rectWx.size.height)
+ , rectWx.size.width
+ , rectWx.size.height
+ );
+}