X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5115c51a822ab5a4d4184b4a07c97e6bddba8bef..d76240bfe106c10ca9a775448f712311fc5e1443:/src/mac/carbon/toolbar.cpp?ds=sidebyside diff --git a/src/mac/carbon/toolbar.cpp b/src/mac/carbon/toolbar.cpp index 27cd473d36..aa01c95226 100644 --- a/src/mac/carbon/toolbar.cpp +++ b/src/mac/carbon/toolbar.cpp @@ -159,13 +159,20 @@ bool wxToolBar::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, cons wxToolBar::~wxToolBar() { + size_t index = 0 ; + for ( index = 0 ; index < m_macToolHandles.Count() ; ++index ) + { + // Delete the control as we get ghosts otherwise + ::DisposeControl( (ControlHandle) m_macToolHandles[index] ); + } + // we must refresh the frame size when the toolbar is deleted but the frame // is not - otherwise toolbar leaves a hole in the place it used to occupy } bool wxToolBar::Realize() { - if (m_tools.Number() == 0) + if (m_tools.GetCount() == 0) return FALSE; Point localOrigin ; @@ -188,7 +195,7 @@ bool wxToolBar::Realize() controlstyle.flags = kControlUseFontMask ; controlstyle.font = kControlFontSmallSystemFont ; - wxNode *node = m_tools.First(); + wxToolBarToolsList::Node *node = m_tools.GetFirst(); int noButtons = 0; int x = 0 ; int y = 0 ; @@ -201,8 +208,7 @@ bool wxToolBar::Realize() while (node) { - wxToolBarTool *tool = (wxToolBarTool *)node->Data(); - wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetNormalBitmap().GetRefData()) ; + wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); if( !tool->IsSeparator() ) { @@ -282,7 +288,7 @@ bool wxToolBar::Realize() if (toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight) { maxHeight = toolbarrect.top + y + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v ; } - node = node->Next(); + node = node->GetNext(); } if ( GetWindowStyleFlag() & wxTB_HORIZONTAL ) @@ -328,12 +334,12 @@ wxSize wxToolBar::GetToolSize() const void wxToolBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) { - int index = 0 ; + size_t index = 0 ; for ( index = 0 ; index < m_macToolHandles.Count() ; ++index ) { if ( m_macToolHandles[index] == (void*) control ) { - wxToolBarTool *tool = (wxToolBarTool *)m_tools.Nth( index )->Data(); + wxToolBarTool *tool = (wxToolBarTool *)m_tools.Item( index )->GetData(); if ( tool->CanBeToggled() ) { tool->Toggle( GetControl32BitValue( (ControlHandle) control ) ) ; @@ -357,7 +363,7 @@ void wxToolBar::SetRows(int nRows) void wxToolBar::MacSuperChangedPosition() { - if (m_tools.Number() > 0) + if (m_tools.GetCount() > 0) { Point localOrigin ; @@ -379,7 +385,7 @@ void wxToolBar::MacSuperChangedPosition() controlstyle.flags = kControlUseFontMask ; controlstyle.font = kControlFontSmallSystemFont ; - wxNode *node = m_tools.First(); + wxToolBarToolsList::Node *node = m_tools.GetFirst(); int noButtons = 0; int x = 0 ; wxSize toolSize = GetToolSize() ; @@ -393,8 +399,7 @@ void wxToolBar::MacSuperChangedPosition() WindowRef rootwindow = (WindowRef) MacGetRootWindow() ; while (node) { - wxToolBarTool *tool = (wxToolBarTool *)node->Data(); - wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetNormalBitmap().GetRefData()) ; + wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); if( !tool->IsSeparator() ) { @@ -439,7 +444,7 @@ void wxToolBar::MacSuperChangedPosition() if (toolbarrect.top + m_yMargin + kwxMacToolBarTopMargin - m_y - localOrigin.v > maxHeight) maxHeight = toolbarrect.top + kwxMacToolBarTopMargin + m_yMargin - m_y - localOrigin.v ; - node = node->Next(); + node = node->GetNext(); } } @@ -479,7 +484,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const MacClientToRootWindow( &x , &y ) ; Point pt = { y ,x } ; - int index = 0 ; + size_t index = 0 ; for ( index = 0 ; index < m_macToolHandles.Count() ; ++index ) { if ( m_macToolHandles[index] ) @@ -488,7 +493,7 @@ wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord x, wxCoord y) const GetControlBounds((ControlHandle) m_macToolHandles[index], &bounds ) ; if ( PtInRect( pt , &bounds ) ) { - return (wxToolBarTool*) (m_tools.Nth( index )->Data() ) ; + return (wxToolBarTool*) (m_tools.Item( index )->GetData() ) ; } } } @@ -566,7 +571,7 @@ void wxToolBar::OnPaint(wxPaintEvent& event) dc.YLOG2DEVMAC(m_height) , dc.XLOG2DEVMAC(m_width) } ; UMADrawThemePlacard( &toolbarrect , IsEnabled() ? kThemeStateActive : kThemeStateInactive) ; { - int index = 0 ; + size_t index = 0 ; for ( index = 0 ; index < m_macToolHandles.Count() ; ++index ) { if ( m_macToolHandles[index] )