- size_t separators = ((wxToolBarTool*)current->GetData())->GetSeparatorsCount();
- // if it is a normal button, sepcount == 0, so skip 1
- // item ( the button )
- // otherwise, skip as many items as the separator count,
- // plus the control itself
- index -= separators ? separators + 1: 1;
+
+ wxToolBarTool *tool = (wxToolBarTool *)current->GetData();
+ size_t separators = tool->GetSeparatorsCount();
+
+ // if it is a normal button, sepcount == 0, so skip 1 item (the button)
+ // otherwise, skip as many items as the separator count, plus the
+ // control itself
+ index -= separators ? separators + 1 : 1;