Fixed positioning controls on the toolbar after removing a tool.

When a tool is removed from the toolbar then all tools with controls on the right hand side have to be repositioned (shifted left) manually.
This commit is contained in:
Artur Wieczorek
2016-01-06 23:06:40 +01:00
parent dbd98a1078
commit 41e94974a0

View File

@@ -627,7 +627,23 @@ bool wxToolBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
static_cast<wxToolBarTool*>(tool)->ToBeDeleted();
// and finally rearrange the tools
// and finally rearrange the tools:
// by shifting left all controls on the right hand side
wxToolBarToolsList::compatibility_iterator node;
for ( node = m_tools.Find(tool); node; node = node->GetNext() )
{
wxToolBarTool * const tool = static_cast<wxToolBarTool*>(node->GetData());
if ( tool->IsToBeDeleted() )
continue;
if ( tool->IsControl() )
{
tool->MoveBy(-delta);
}
}
// by recalculating stretchable spacers, if there are any
UpdateStretchableSpacersSize();