]> git.saurik.com Git - wxWidgets.git/commitdiff
Improve appearance for themes that don't allow background colour change
authorJulian Smart <julian@anthemion.co.uk>
Sat, 23 Apr 2005 13:22:30 +0000 (13:22 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Sat, 23 Apr 2005 13:22:30 +0000 (13:22 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33845 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/treectlg.cpp

index 25d04b0dee37dbe9caeb28369bc7b79f475cd0fa..5d23d010161fa521bb97848135966219d22bda7f 100644 (file)
@@ -2255,6 +2255,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
     }
 
     int total_h = GetLineHeight(item);
+    bool hasCustomBackground = false;
 
     if ( item->IsSelected() )
     {
@@ -2277,7 +2278,10 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
     {
         wxColour colBg;
         if ( attr && attr->HasBackgroundColour() )
+       {
+           hasCustomBackground = true;
             colBg = attr->GetBackgroundColour();
+       }
         else
             colBg = m_backgroundColour;
         dc.SetBrush(wxBrush(colBg, wxSOLID));
@@ -2303,7 +2307,10 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
             dc.DrawRectangle( item->GetX() + image_w - 2, item->GetY()+offset,
                               item->GetWidth() - image_w + 2, total_h-offset );
         }
-        else
+        // 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 (hasCustomBackground)
         {
             dc.DrawRectangle( item->GetX()-2, item->GetY()+offset,
                               item->GetWidth()+2, total_h-offset );