Don't make wxFrame grow when adding a native wxToolbar

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58110 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2009-01-14 23:45:08 +00:00
parent 1d0b79d8f3
commit b0184e5939

View File

@@ -1108,8 +1108,16 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative)
bResult = true; bResult = true;
SetWindowToolbar( tlw, (HIToolbarRef) m_macToolbar ); SetWindowToolbar( tlw, (HIToolbarRef) m_macToolbar );
// ShowHideWindowToolbar will make the wxFrame grow
// which we don't want in this case
wxSize sz = GetParent()->GetSize();
ShowHideWindowToolbar( tlw, true, false ); ShowHideWindowToolbar( tlw, true, false );
// Restore the orginal size
GetParent()->SetSize( sz );
ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 ); ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 );
SetAutomaticControlDragTrackingEnabledForWindow( tlw, true ); SetAutomaticControlDragTrackingEnabledForWindow( tlw, true );
m_peer->Move(0,0,0,0 ); m_peer->Move(0,0,0,0 );
@@ -1146,6 +1154,8 @@ bool wxToolBar::Realize()
if (m_tools.GetCount() == 0) if (m_tools.GetCount() == 0)
return false; return false;
wxSize tlw_sz = GetParent()->GetSize();
int maxWidth = 0; int maxWidth = 0;
int maxHeight = 0; int maxHeight = 0;
@@ -1353,6 +1363,9 @@ bool wxToolBar::Realize()
node = node->GetNext(); node = node->GetNext();
} }
if (m_macUsesNativeToolbar)
GetParent()->SetSize( tlw_sz );
if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) if ( GetWindowStyleFlag() & wxTB_HORIZONTAL )
{ {
// if not set yet, only one row // if not set yet, only one row