Use setAutoresizingMask: NSViewMinYMargin to keep subviews in the same

position relative to the wxWindows coordinate system


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott 2003-08-19 04:08:27 +00:00
parent b45ed7a273
commit c5bd91912f
2 changed files with 8 additions and 2 deletions

View File

@ -168,7 +168,7 @@ void wxFrame::SetStatusBar(wxStatusBar *statusbar)
if(m_frameStatusBar)
{
[m_frameStatusBar->GetNSViewForSuperview() removeFromSuperview];
[m_frameStatusBar->GetNSViewForSuperview() setAutoresizingMask: NSViewNotSizable];
[m_frameStatusBar->GetNSViewForSuperview() setAutoresizingMask: NSViewMinYMargin];
if(m_frameStatusBar->GetParent())
m_frameStatusBar->GetParent()->CocoaAddChild(m_frameToolBar);
}
@ -199,7 +199,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
if(m_frameToolBar)
{
[m_frameToolBar->GetNSViewForSuperview() removeFromSuperview];
[m_frameToolBar->GetNSViewForSuperview() setAutoresizingMask: NSViewNotSizable];
[m_frameToolBar->GetNSViewForSuperview() setAutoresizingMask: NSViewMinYMargin];
if(m_frameToolBar->GetParent())
m_frameToolBar->GetParent()->CocoaAddChild(m_frameToolBar);
}

View File

@ -524,6 +524,12 @@ void wxWindowCocoa::SetInitialFrameRect(const wxPoint& pos, const wxSize& size)
frameRect.origin.x = pos.x;
frameRect.origin.y = parentRect.size.height-(pos.y+frameRect.size.height);
[nsview setFrame: frameRect];
// Tell Cocoa to change the margin between the bottom of the superview
// and the bottom of the control. Keeps the control pinned to the top
// of its superview so that its position in the wxWindows coordinate
// system doesn't change.
if(![superview isFlipped])
[nsview setAutoresizingMask: NSViewMinYMargin];
}
// Get total size