Fix for Bug #1432054: ToolBar controls not removed by ClearTools

Use DeleteTool in ClearTools instead of just destroying the internal
list, so the toolbar is kept fully in sync with the removal of all
tool types.  Also fix wxMSW version to actually Destroy() the controls
when they are deleted from the toolbar.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37615 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2006-02-16 03:03:43 +00:00
parent 3b6a117962
commit a3e9caa2b5
2 changed files with 5 additions and 1 deletions

View File

@@ -409,7 +409,10 @@ void wxToolBarBase::UnToggleRadioGroup(wxToolBarToolBase *tool)
void wxToolBarBase::ClearTools() void wxToolBarBase::ClearTools()
{ {
WX_CLEAR_LIST(wxToolBarToolsList, m_tools); while ( GetToolsCount() )
{
DeleteToolByPos(0);
}
} }
bool wxToolBarBase::Realize() bool wxToolBarBase::Realize()

View File

@@ -455,6 +455,7 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
{ {
nButtonsToDelete = ((wxToolBarTool *)tool)->GetSeparatorsCount(); nButtonsToDelete = ((wxToolBarTool *)tool)->GetSeparatorsCount();
width *= nButtonsToDelete; width *= nButtonsToDelete;
tool->GetControl()->Destroy();
} }
// do delete all buttons // do delete all buttons