+ if(!m_frameNSView)
+ { // NOTE: We only need a plain NSView here since we don't associate it with ourselves.
+ m_frameNSView = [[NSView alloc] initWithFrame:[[m_cocoaNSWindow contentView] frame]];
+ [m_cocoaNSWindow setContentView: m_frameNSView];
+ [m_frameNSView addSubview:m_cocoaNSView];
+ }
+ NSRect frameRect = [m_frameNSView frame];
+ float tbarheight = 0.0;
+#if wxUSE_TOOLBAR
+ if(m_frameToolBar)
+ {
+ NSView *tbarNSView = m_frameToolBar->GetNSViewForSuperview();
+ // If the toolbar doesn't have a superview then set it to our
+ // content view.
+ if(![tbarNSView superview])
+ [m_frameNSView addSubview: tbarNSView];
+ // Do this after addSubView so that SetSize can work
+ m_frameToolBar->SetSize(m_frameToolBar->DoGetBestSize());
+ NSRect tbarRect = [tbarNSView frame];
+ tbarRect.size.width = frameRect.size.width;
+ tbarRect.origin.x = 0.0;
+ tbarRect.origin.y = frameRect.size.height - tbarRect.size.height;
+ [tbarNSView setFrame:tbarRect];
+ // width expands, bottom margin expands
+ [tbarNSView setAutoresizingMask: NSViewWidthSizable|NSViewMinYMargin];
+ tbarheight = tbarRect.size.height;
+ }
+#endif //wxUSE_TOOLBAR
+ float sbarheight = 0.0;
+ if(m_frameStatusBar)