+static wxToolBarToolBase *GetItemSkippingDummySpacers( const wxToolBarToolsList& tools, size_t index )
+{
+ wxToolBarToolsList::Node* current = tools.GetFirst();
+
+ for( ; current != 0; current = current->GetNext() )
+ {
+ if( index == 0 )
+ return current->GetData();
+ 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;
+ }
+
+ return 0;
+}
+