From c5bd91912f76aa6bea64f510c1b59f96492dc1b1 Mon Sep 17 00:00:00 2001 From: David Elliott Date: Tue, 19 Aug 2003 04:08:27 +0000 Subject: [PATCH] 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 --- src/cocoa/frame.mm | 4 ++-- src/cocoa/window.mm | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cocoa/frame.mm b/src/cocoa/frame.mm index c9eec7426d..4f3d12062f 100644 --- a/src/cocoa/frame.mm +++ b/src/cocoa/frame.mm @@ -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); } diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index 1ef455d810..964d65e8da 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -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