X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7af79c94e6d64716bf120fcdf1e1dc9d78932686..d76240bfe106c10ca9a775448f712311fc5e1443:/src/mac/carbon/toolbar.cpp diff --git a/src/mac/carbon/toolbar.cpp b/src/mac/carbon/toolbar.cpp index 6bd7d0b114..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 ) @@ -333,7 +339,7 @@ void wxToolBar::MacHandleControlClick( WXWidget control , wxInt16 controlpart ) { 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(); } } @@ -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() ) ; } } }