+bool wxToolBar::HandlePaint(WXWPARAM wParam, WXLPARAM lParam)
+{
+ // erase any dummy separators which we used for aligning the controls if
+ // any here
+
+ // first of all, do we have any controls at all?
+ wxToolBarToolsList::compatibility_iterator node;
+ for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
+ {
+ if ( node->GetData()->IsControl() )
+ break;
+ }
+
+ if ( !node )
+ {
+ // no controls, nothing to erase
+ return FALSE;
+ }
+
+ // prepare the DC on which we'll be drawing
+ wxClientDC dc(this);
+ dc.SetBrush(wxBrush(GetBackgroundColour(), wxSOLID));
+ dc.SetPen(*wxTRANSPARENT_PEN);
+
+ RECT r;
+ if ( !GetUpdateRect(GetHwnd(), &r, FALSE) )
+ {
+ // nothing to redraw anyhow
+ return FALSE;
+ }
+
+ wxRect rectUpdate;
+ wxCopyRECTToRect(r, rectUpdate);
+
+ dc.SetClippingRegion(rectUpdate);
+
+ // draw the toolbar tools, separators &c normally
+ wxControl::MSWWindowProc(WM_PAINT, wParam, lParam);
+
+ // for each control in the toolbar find all the separators intersecting it
+ // and erase them
+ //
+ // NB: this is really the only way to do it as we don't know if a separator
+ // corresponds to a control (i.e. is a dummy one) or a real one
+ // otherwise
+ for ( node = m_tools.GetFirst(); node; node = node->GetNext() )
+ {
+ wxToolBarToolBase *tool = node->GetData();
+ if ( tool->IsControl() )
+ {
+ // get the control rect in our client coords
+ wxControl *control = tool->GetControl();
+ wxRect rectCtrl = control->GetRect();
+
+ // iterate over all buttons
+ TBBUTTON tbb;
+ int count = ::SendMessage(GetHwnd(), TB_BUTTONCOUNT, 0, 0);
+ for ( int n = 0; n < count; n++ )