Fix autoresizingMask when scrolling is used

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2003-08-20 16:02:31 +00:00
parent 3d8c1de070
commit 6f2ec3c3de

View File

@@ -165,6 +165,9 @@ wxWindowCocoaScroller::wxWindowCocoaScroller(wxWindow *owner)
void wxWindowCocoaScroller::Encapsulate()
{
// Set the scroll view autoresizingMask to match the current NSView
[m_cocoaNSScrollView setAutoresizingMask: [m_owner->GetNSView() autoresizingMask]];
[m_owner->GetNSView() setAutoresizingMask: NSViewNotSizable];
// NOTE: replaceSubView will cause m_cocaNSView to be released
// except when it hasn't been added into an NSView hierarchy in which
// case it doesn't need to be and this should work out to a no-op
@@ -178,6 +181,8 @@ void wxWindowCocoaScroller::Unencapsulate()
{
[m_cocoaNSScrollView setDocumentView: nil];
m_owner->CocoaReplaceView(m_cocoaNSScrollView, m_owner->GetNSView());
if(![[m_owner->GetNSView() superview] isFlipped])
[m_owner->GetNSView() setAutoresizingMask: NSViewMinYMargin];
}
wxWindowCocoaScroller::~wxWindowCocoaScroller()
@@ -591,13 +596,15 @@ void wxWindowCocoa::SetInitialFrameRect(const wxPoint& pos, const wxSize& size)
frameRect.size.height = size.y;
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];
// MUST set the mask before setFrame: which can generate a size event
// and cause a scroller to be added!
[nsview setFrame: frameRect];
}
// Get total size