]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
there is no sqrt(int) in standard C++ (although glibc seems to provide it); select...
[wxWidgets.git] / src / generic / treectlg.cpp
index 4c0d7d69fe58a5daa381cc6f66a1349f0d8f8d09..52868f92265551d5f81a472282f5e1f6bb7bf4fc 100644 (file)
@@ -877,10 +877,6 @@ wxGenericTreeItem::DoCalculateSize(wxGenericTreeCtrl* control,
             else
                 state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
         }
-        else
-        {
-            state = wxTREE_ITEMSTATE_NONE;
-        }
     }
 
     m_height = (image_h > text_h) ? image_h : text_h;
@@ -2465,6 +2461,7 @@ int wxGenericTreeCtrl::GetLineHeight(wxGenericTreeItem *item) const
 void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
 {
     item->SetFont(this, dc);
+    item->CalculateSize(this, dc);
 
     wxCoord text_h = item->GetTextHeight();
 
@@ -2535,9 +2532,6 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
         x=0;
         GetVirtualSize(&w, &h);
         wxRect rect( x, item->GetY()+offset, w, total_h-offset);
-#if !defined(__WXGTK20__) && !defined(__WXMAC__)
-        dc.DrawRectangle(rect);
-#else
         if (!item->IsSelected())
         {
             dc.DrawRectangle(rect);
@@ -2557,9 +2551,8 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
             wxRendererNative::Get().
                 DrawItemSelectionRect(this, dc, rect, flags);
         }
-#endif
     }
-    else
+    else // no full row highlight
     {
         if ( item->IsSelected() &&
                 (state != wxTREE_ITEMSTATE_NONE || image != NO_IMAGE) )
@@ -2593,14 +2586,11 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
         {
             wxRect rect( item->GetX()-2, item->GetY()+offset,
                          item->GetWidth()+2, total_h-offset );
-#if !defined(__WXGTK20__) && !defined(__WXMAC__)
-            dc.DrawRectangle( rect );
-#else
             if ( hasBgColour )
             {
                 dc.DrawRectangle( rect );
             }
-            else
+            else // no specific background colour
             {
                 rect.x -= 1;
                 rect.width += 2;
@@ -2613,7 +2603,6 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
                 wxRendererNative::Get().
                     DrawItemSelectionRect(this, dc, rect, flags);
             }
-#endif
         }
     }