]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/treectlg.cpp
miscellaneous small enhancements
[wxWidgets.git] / src / generic / treectlg.cpp
index 4c0d7d69fe58a5daa381cc6f66a1349f0d8f8d09..5baa32ad7f29552fc90126b3cd0c73c5d91b8d2c 100644 (file)
@@ -877,10 +877,6 @@ wxGenericTreeItem::DoCalculateSize(wxGenericTreeCtrl* control,
             else
                 state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
         }
             else
                 state_w += MARGIN_BETWEEN_IMAGE_AND_TEXT;
         }
-        else
-        {
-            state = wxTREE_ITEMSTATE_NONE;
-        }
     }
 
     m_height = (image_h > text_h) ? image_h : text_h;
     }
 
     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);
 void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
 {
     item->SetFont(this, dc);
+    item->CalculateSize(this, dc);
 
     wxCoord text_h = item->GetTextHeight();
 
 
     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);
         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);
         if (!item->IsSelected())
         {
             dc.DrawRectangle(rect);
@@ -2557,9 +2551,8 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
             wxRendererNative::Get().
                 DrawItemSelectionRect(this, dc, rect, flags);
         }
             wxRendererNative::Get().
                 DrawItemSelectionRect(this, dc, rect, flags);
         }
-#endif
     }
     }
-    else
+    else // no full row highlight
     {
         if ( item->IsSelected() &&
                 (state != wxTREE_ITEMSTATE_NONE || image != NO_IMAGE) )
     {
         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 );
         {
             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 );
             }
             if ( hasBgColour )
             {
                 dc.DrawRectangle( rect );
             }
-            else
+            else // no specific background colour
             {
                 rect.x -= 1;
                 rect.width += 2;
             {
                 rect.x -= 1;
                 rect.width += 2;
@@ -2613,7 +2603,6 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
                 wxRendererNative::Get().
                     DrawItemSelectionRect(this, dc, rect, flags);
             }
                 wxRendererNative::Get().
                     DrawItemSelectionRect(this, dc, rect, flags);
             }
-#endif
         }
     }
 
         }
     }
 
@@ -3945,7 +3934,7 @@ wxGenericTreeCtrl::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
     return wxListBox::GetClassDefaultAttributes(variant);
 #else
     wxVisualAttributes attr;
     return wxListBox::GetClassDefaultAttributes(variant);
 #else
     wxVisualAttributes attr;
-    attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+    attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOXTEXT);
     attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
     attr.font  = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
     return attr;
     attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
     attr.font  = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
     return attr;