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
This commit is contained in:
@@ -138,6 +138,8 @@ void wxFrame::UpdateFrameNSView()
|
|||||||
NSView *tbarNSView = m_frameToolBar->GetNSViewForSuperview();
|
NSView *tbarNSView = m_frameToolBar->GetNSViewForSuperview();
|
||||||
if(![tbarNSView superview])
|
if(![tbarNSView superview])
|
||||||
[m_frameNSView addSubview: tbarNSView];
|
[m_frameNSView addSubview: tbarNSView];
|
||||||
|
// Do this after addSubView so that SetSize can work
|
||||||
|
m_frameToolBar->SetSize(m_frameToolBar->DoGetBestSize());
|
||||||
NSRect tbarRect = [tbarNSView frame];
|
NSRect tbarRect = [tbarNSView frame];
|
||||||
tbarRect.size.width = frameRect.size.width;
|
tbarRect.size.width = frameRect.size.width;
|
||||||
tbarRect.origin.x = 0.0;
|
tbarRect.origin.x = 0.0;
|
||||||
@@ -212,6 +214,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
|
|||||||
{
|
{
|
||||||
if(m_frameToolBar)
|
if(m_frameToolBar)
|
||||||
{
|
{
|
||||||
|
m_frameToolBar->SetOwningFrame(NULL);
|
||||||
[m_frameToolBar->GetNSViewForSuperview() removeFromSuperview];
|
[m_frameToolBar->GetNSViewForSuperview() removeFromSuperview];
|
||||||
[m_frameToolBar->GetNSViewForSuperview() setAutoresizingMask: NSViewMinYMargin];
|
[m_frameToolBar->GetNSViewForSuperview() setAutoresizingMask: NSViewMinYMargin];
|
||||||
if(m_frameToolBar->GetParent())
|
if(m_frameToolBar->GetParent())
|
||||||
@@ -221,6 +224,7 @@ void wxFrame::SetToolBar(wxToolBar *toolbar)
|
|||||||
if(m_frameToolBar)
|
if(m_frameToolBar)
|
||||||
{
|
{
|
||||||
m_frameToolBar->CocoaRemoveFromParent();
|
m_frameToolBar->CocoaRemoveFromParent();
|
||||||
|
m_frameToolBar->SetOwningFrame(this);
|
||||||
}
|
}
|
||||||
UpdateFrameNSView();
|
UpdateFrameNSView();
|
||||||
}
|
}
|
||||||
@@ -233,6 +237,7 @@ wxToolBar* wxFrame::CreateToolBar(long style,
|
|||||||
if(m_frameToolBar)
|
if(m_frameToolBar)
|
||||||
{
|
{
|
||||||
m_frameToolBar->CocoaRemoveFromParent();
|
m_frameToolBar->CocoaRemoveFromParent();
|
||||||
|
m_frameToolBar->SetOwningFrame(this);
|
||||||
}
|
}
|
||||||
UpdateFrameNSView();
|
UpdateFrameNSView();
|
||||||
return m_frameToolBar;
|
return m_frameToolBar;
|
||||||
|
Reference in New Issue
Block a user