X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6b3b53c2c20fe75dc410a22a99b88a63653aef5..2f70baea2fa2aa1fbcdceb0121eea1cb5c9bedf0:/src/osx/carbon/toolbar.cpp diff --git a/src/osx/carbon/toolbar.cpp b/src/osx/carbon/toolbar.cpp index ca9c011d89..f0576260c5 100644 --- a/src/osx/carbon/toolbar.cpp +++ b/src/osx/carbon/toolbar.cpp @@ -927,6 +927,11 @@ bool wxToolBar::Create( wxToolBar::~wxToolBar() { #if wxOSX_USE_NATIVE_TOOLBAR + // We could be not using a native tool bar at all, this happens when we're + // created with something other than the frame as parent for example. + if ( !m_macToolbar ) + return; + CFIndex count = CFGetRetainCount( m_macToolbar ) ; // Leopard seems to have one refcount more, so we cannot check reliably at the moment if ( UMAGetSystemVersion() < 0x1050 ) @@ -1113,9 +1118,9 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) SetAutomaticControlDragTrackingEnabledForWindow( tlw, true ); - m_peer->Move(0,0,0,0 ); + GetPeer()->Move(0,0,0,0 ); SetSize( wxSIZE_AUTO_WIDTH, 0 ); - m_peer->SetVisibility( false ); + GetPeer()->SetVisibility( false ); wxToolBarBase::Show( false ); } } @@ -1130,7 +1135,7 @@ bool wxToolBar::MacInstallNativeToolbar(bool usesNative) ChangeWindowAttributes( tlw, 0, kWindowToolbarButtonAttribute ); MacUninstallNativeToolbar(); - m_peer->SetVisibility( true ); + GetPeer()->SetVisibility( true ); } } @@ -1145,7 +1150,7 @@ void wxToolBar::MacUninstallNativeToolbar() { if (!m_macToolbar) return; - + WindowRef tlw = MAC_WXHWND(MacGetTopLevelWindowRef()); if (tlw) SetWindowToolbar( tlw, NULL ); @@ -1317,6 +1322,10 @@ bool wxToolBar::Realize() wxFAIL_MSG("Reference count of native tool was illegal before removal"); } wxASSERT( IsValidControlHandle(tool->GetControl()->GetPeer()->GetControlRef() )) ; + + wxString label = tool->GetLabel(); + if ( !label.empty() ) + HIToolbarItemSetLabel( hiItemRef, wxCFStringRef(label, GetFont().GetEncoding()) ); } } @@ -1415,6 +1424,18 @@ bool wxToolBar::Realize() return true; } +void wxToolBar::DoLayout() +{ + // TODO port back osx_cocoa layout solution +} + +void wxToolBar::DoSetSize(int x, int y, int width, int height, int sizeFlags) +{ + wxToolBarBase::DoSetSize(x, y, width, height, sizeFlags); + + DoLayout(); +} + void wxToolBar::SetToolBitmapSize(const wxSize& size) { m_defaultWidth = size.x + kwxMacToolBorder;