From a69cb1cc9d3ba8adab26d9778aedae49f3f43b7b Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Wed, 18 Apr 2001 17:13:31 +0000
Subject: [PATCH] No longer paint the selection background under the image

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9784 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/generic/treectlg.cpp | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp
index c7155ed9a2..19b6d7184f 100644
--- a/src/generic/treectlg.cpp
+++ b/src/generic/treectlg.cpp
@@ -1770,7 +1770,15 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
         dc.SetBrush(wxBrush(colBg, wxSOLID));
     }
 
-    dc.DrawRectangle( item->GetX()-2, item->GetY(), item->GetWidth()+2, total_h );
+    if (item->IsSelected() && image != NO_IMAGE)
+    {
+        // If it's selected, and there's an image, then we should
+        // take care to leave the area under the image painted in the
+        // background colour.
+        dc.DrawRectangle( item->GetX() + image_w - 2, item->GetY(), item->GetWidth() - image_w + 2, total_h );
+    }
+    else
+        dc.DrawRectangle( item->GetX()-2, item->GetY(), item->GetWidth()+2, total_h );
 
     if ( image != NO_IMAGE )
     {
-- 
2.45.2