+ if ( !col.IsOk() )
+ return false;
+
+ // we need to render selected and current items differently
+ const bool isSelected = IsSelected(n),
+ isCurrent = IsCurrent(n);
+ if ( isSelected || isCurrent )
+ {
+ if ( isSelected )
+ {
+ dc.SetBrush(wxBrush(col, wxSOLID));
+ }
+ else // !selected
+ {
+ dc.SetBrush(*wxTRANSPARENT_BRUSH);
+ }
+ dc.SetPen(*(isCurrent ? wxBLACK_PEN : wxTRANSPARENT_PEN));
+ dc.DrawRectangle(rect);
+ }
+ //else: do nothing for the normal items
+
+ return true;
+}
+
+void wxVListBox::OnDrawBackground(wxDC& dc, const wxRect& rect, size_t n) const
+{
+ // use wxRendererNative for more native look unless we use custom bg colour
+ if ( !DoDrawSolidBackground(m_colBgSel, dc, rect, n) )
+ {
+ int flags = 0;
+ if ( IsSelected(n) )
+ flags |= wxCONTROL_SELECTED;
+ if ( IsCurrent(n) )
+ flags |= wxCONTROL_CURRENT;
+ if ( wxWindow::FindFocus() == wx_const_cast(wxVListBox*, this) )
+ flags |= wxCONTROL_FOCUSED;
+
+ wxRendererNative::Get().DrawItemSelectionRect(
+ wx_const_cast(wxVListBox *, this), dc, rect, flags);
+ }
+}
+
+void wxVListBox::OnPaint(wxPaintEvent& WXUNUSED(event))
+{
+ wxSize clientSize = GetClientSize();
+
+ wxAutoBufferedPaintDC dc(this);