From: Robert Roebling Date: Wed, 14 Jan 2009 23:45:08 +0000 (+0000) Subject: Don't make wxFrame grow when adding a native wxToolbar X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b0184e5939c3c9d5fadea2b98225b1635236b36d 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 --- diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index 3a8dcab8cd..6907c5f12b 100644 --- a/src/osx/carbon/toolbar.cpp +++ b/src/osx/carbon/toolbar.cpp @@ -1108,10 +1108,18 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) bResult = true; 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 ); + // Restore the orginal size + GetParent()->SetSize( sz ); + ChangeWindowAttributes( tlw, kWindowToolbarButtonAttribute, 0 ); + SetAutomaticControlDragTrackingEnabledForWindow( tlw, true ); - + m_peer->Move(0,0,0,0 ); SetSize( wxSIZE_AUTO_WIDTH, 0 ); m_peer->SetVisibility( false ); @@ -1145,6 +1153,8 @@ bool wxToolBar::Realize() { if (m_tools.GetCount() == 0) return false; + + wxSize tlw_sz = GetParent()->GetSize(); int maxWidth = 0; int maxHeight = 0; @@ -1353,6 +1363,9 @@ bool wxToolBar::Realize() node = node->GetNext(); } + if (m_macUsesNativeToolbar) + GetParent()->SetSize( tlw_sz ); + if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) { // if not set yet, only one row