+unsigned int wxTopLevelWindowCocoa::NSWindowStyleForWxStyle(long style)
+{
+ unsigned int styleMask = 0;
+ if(style & wxCAPTION)
+ styleMask |= NSTitledWindowMask;
+ if(style & wxMINIMIZE_BOX)
+ styleMask |= NSMiniaturizableWindowMask;
+ #if 0
+ if(style & wxMAXIMIZE_BOX)
+ styleMask |= NSWindowMask;
+ #endif
+ if(style & wxCLOSE_BOX)
+ styleMask |= NSClosableWindowMask;
+ if(style & wxRESIZE_BORDER)
+ styleMask |= NSResizableWindowMask;
+ if(style & wxSIMPLE_BORDER)
+ styleMask |= NSBorderlessWindowMask;
+ return styleMask;
+}
+
+NSRect wxTopLevelWindowCocoa::MakeInitialNSWindowContentRect(const wxPoint& pos, const wxSize& size, unsigned int cocoaStyleMask)
+{
+ // Arbitrarily use (100,100) as the origin when default coords are given.
+ wxCoord x = pos.x!=wxDefaultCoord ? pos.x : 100;
+ wxCoord y = pos.y!=wxDefaultCoord ? pos.y : 100;
+
+ wxCoord w = WidthDefault(size.x);
+ wxCoord h = HeightDefault(size.y);
+
+ NSPoint cocoaOrigin = OriginInCocoaScreenCoordinatesForRectInWxDisplayCoordinates(x,y,w,h,true);
+
+ return [NSWindow
+ contentRectForFrameRect:NSMakeRect(cocoaOrigin.x,cocoaOrigin.y,w,h)
+ styleMask:cocoaStyleMask];
+
+}
+