X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/49cd56ef869ef65c7594de126f4717d53794588e..6b769f3d1f81ffebba557208083a1fc161dfbe23:/src/generic/treectrl.cpp diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index a367847fdb..4602d32e83 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -1036,6 +1036,7 @@ void wxTreeCtrl::SetImageList(wxImageList *imageList) for(int i = 0; i < n ; i++) { m_imageListNormal->GetSize(i, width, height); + height += height/5; //20% extra spacing if(height > m_lineHeight) m_lineHeight = height; } } @@ -1110,14 +1111,16 @@ void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) } int total_h = (image_h > text_h) ? image_h : text_h; - dc.DrawRectangle( item->GetX()-2, item->GetY()-2, image_w+text_w+4, total_h+4 ); + if(m_lineHeight > total_h) total_h = m_lineHeight; + + dc.DrawRectangle( item->GetX()-2, item->GetY(), image_w+text_w+2, total_h ); if ((item->IsExpanded()) && (item->GetSelectedImage() != -1)) { dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, total_h ); m_imageListNormal->Draw( item->GetSelectedImage(), dc, item->GetX(), - item->GetY()/* +((total_h > image_h)?((total_h-image_h)/2):0)*/, + item->GetY() +((total_h > image_h)?((total_h-image_h)/2):0), wxIMAGELIST_DRAW_TRANSPARENT ); dc.DestroyClippingRegion(); } @@ -1126,7 +1129,7 @@ void wxTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) dc.SetClippingRegion( item->GetX(), item->GetY(), image_w-2, total_h ); m_imageListNormal->Draw( item->GetImage(), dc, item->GetX(), - item->GetY() /*+((total_h > image_h)?((total_h-image_h)/2):0)*/, + item->GetY() +((total_h > image_h)?((total_h-image_h)/2):0), wxIMAGELIST_DRAW_TRANSPARENT ); dc.DestroyClippingRegion(); } @@ -1147,7 +1150,7 @@ void wxTreeCtrl::PaintLevel( wxGenericTreeItem *item, wxDC &dc, int level, int & int horizX = level*m_indent; item->SetX( horizX+33 ); - item->SetY( y-m_lineHeight/3 ); + item->SetY( y-m_lineHeight/2 ); item->SetHeight( m_lineHeight ); item->SetCross( horizX+15, y ); @@ -1521,7 +1524,7 @@ void wxTreeCtrl::CalculateLevel( wxGenericTreeItem *item, wxDC &dc, int level, i int horizX = level*m_indent; item->SetX( horizX+33 ); - item->SetY( y-m_lineHeight/3-2 ); + item->SetY( y-m_lineHeight/2 ); item->SetHeight( m_lineHeight ); if ( !item->IsExpanded() )