+ {
+ colBg = GetBackgroundColour();
+ }
+ dc.SetBrush(wxBrush(colBg, wxBRUSHSTYLE_SOLID));
+ }
+
+ int offset = HasFlag(wxTR_ROW_LINES) ? 1 : 0;
+
+ if ( HasFlag(wxTR_FULL_ROW_HIGHLIGHT) )
+ {
+ int x, w, h;
+ x=0;
+ GetVirtualSize(&w, &h);
+ wxRect rect( x, item->GetY()+offset, w, total_h-offset);
+ if (!item->IsSelected())
+ {
+ dc.DrawRectangle(rect);
+ }
+ else
+ {
+ int flags = wxCONTROL_SELECTED;
+ if (m_hasFocus
+#if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__) && wxOSX_USE_CARBON // TODO CS
+ && IsControlActive( (ControlRef)GetHandle() )
+#endif
+ )
+ flags |= wxCONTROL_FOCUSED;
+ if ((item == m_current) && (m_hasFocus))
+ flags |= wxCONTROL_CURRENT;
+
+ wxRendererNative::Get().
+ DrawItemSelectionRect(this, dc, rect, flags);
+ }
+ }
+ else // no full row highlight
+ {
+ if ( item->IsSelected() &&
+ (state != wxTREE_ITEMSTATE_NONE || image != NO_IMAGE) )
+ {
+ // If it's selected, and there's an state image or normal image,
+ // then we should take care to leave the area under the image
+ // painted in the background colour.
+ wxRect rect( item->GetX() + state_w + image_w - 2,
+ item->GetY() + offset,
+ item->GetWidth() - state_w - image_w + 2,
+ total_h - offset );
+#if !defined(__WXGTK20__) && !defined(__WXMAC__)
+ dc.DrawRectangle( rect );
+#else
+ rect.x -= 1;
+ rect.width += 2;
+
+ int flags = wxCONTROL_SELECTED;
+ if (m_hasFocus)
+ flags |= wxCONTROL_FOCUSED;
+ if ((item == m_current) && (m_hasFocus))
+ flags |= wxCONTROL_CURRENT;
+ wxRendererNative::Get().
+ DrawItemSelectionRect(this, dc, rect, flags);
+#endif
+ }
+ // On GTK+ 2, drawing a 'normal' background is wrong for themes that
+ // don't allow backgrounds to be customized. Not drawing the background,
+ // except for custom item backgrounds, works for both kinds of theme.
+ else if (drawItemBackground)
+ {
+ wxRect rect( item->GetX() + state_w + image_w - 2,
+ item->GetY() + offset,
+ item->GetWidth() - state_w - image_w + 2,
+ total_h - offset );
+ if ( hasBgColour )
+ {
+ dc.DrawRectangle( rect );
+ }
+ else // no specific background colour
+ {
+ rect.x -= 1;
+ rect.width += 2;
+
+ int flags = wxCONTROL_SELECTED;
+ if (m_hasFocus)
+ flags |= wxCONTROL_FOCUSED;
+ if ((item == m_current) && (m_hasFocus))
+ flags |= wxCONTROL_CURRENT;
+ wxRendererNative::Get().
+ DrawItemSelectionRect(this, dc, rect, flags);
+ }
+ }