X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7934cbd11d86079e8d76b826810f78ec218d18b9..408ad8789c6834825d0a2792d43afd14e6f7acb2:/src/mac/toolbar.cpp?ds=sidebyside diff --git a/src/mac/toolbar.cpp b/src/mac/toolbar.cpp index 0ed2cc6b55..aa01c95226 100644 --- a/src/mac/toolbar.cpp +++ b/src/mac/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,7 +208,7 @@ bool wxToolBar::Realize() while (node) { - wxToolBarTool *tool = (wxToolBarTool *)node->Data(); + wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); if( !tool->IsSeparator() ) { @@ -281,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 ) @@ -332,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 ) ) ; @@ -356,7 +363,7 @@ void wxToolBar::SetRows(int nRows) void wxToolBar::MacSuperChangedPosition() { - if (m_tools.Number() > 0) + if (m_tools.GetCount() > 0) { Point localOrigin ; @@ -378,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() ; @@ -392,7 +399,7 @@ void wxToolBar::MacSuperChangedPosition() WindowRef rootwindow = (WindowRef) MacGetRootWindow() ; while (node) { - wxToolBarTool *tool = (wxToolBarTool *)node->Data(); + wxToolBarTool *tool = (wxToolBarTool *)node->GetData(); if( !tool->IsSeparator() ) { @@ -437,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(); } } @@ -486,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() ) ; } } }