From: David Elliott Date: Tue, 16 Dec 2003 17:26:37 +0000 (+0000) Subject: In UpdateFrameNSView size the toolbar to its best size. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6613dc3fd6027dae952372c0ed557bb9f4bdf215 In UpdateFrameNSView size the toolbar to its best size. When creating or setting a frame's toolbar, SetOwningFrame on it. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24885 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/cocoa/frame.mm b/src/cocoa/frame.mm index 9e529f1187..60069bd8ee 100644 --- a/src/cocoa/frame.mm +++ b/src/cocoa/frame.mm @@ -138,6 +138,8 @@ void wxFrame::UpdateFrameNSView() NSView *tbarNSView = m_frameToolBar->GetNSViewForSuperview(); 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; @@ -212,6 +214,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) { if(m_frameToolBar) { + m_frameToolBar->SetOwningFrame(NULL); [m_frameToolBar->GetNSViewForSuperview() removeFromSuperview]; [m_frameToolBar->GetNSViewForSuperview() setAutoresizingMask: NSViewMinYMargin]; if(m_frameToolBar->GetParent()) @@ -221,6 +224,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar) if(m_frameToolBar) { m_frameToolBar->CocoaRemoveFromParent(); + m_frameToolBar->SetOwningFrame(this); } UpdateFrameNSView(); } @@ -233,6 +237,7 @@ wxToolBar* wxFrame::CreateToolBar(long style, if(m_frameToolBar) { m_frameToolBar->CocoaRemoveFromParent(); + m_frameToolBar->SetOwningFrame(this); } UpdateFrameNSView(); return m_frameToolBar;