Next part of tree state icon patches

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2008-06-24 12:48:01 +00:00
parent dea482c985
commit 4754ab1630
10 changed files with 899 additions and 9 deletions

View File

@@ -2106,6 +2106,20 @@ void wxGenericTreeCtrl::CalculateLineHeight()
}
}
if ( m_imageListState )
{
// Calculate a m_lineHeight value from the state Image sizes.
// May be toggle off. Then wxGenericTreeCtrl will spread when
// necessary (which might look ugly).
int n = m_imageListState->GetImageCount();
for (int i = 0; i < n ; i++)
{
int width = 0, height = 0;
m_imageListState->GetSize(i, width, height);
if (height > m_lineHeight) m_lineHeight = height;
}
}
if (m_imageListButtons)
{
// Calculate a m_lineHeight value from the Button image sizes.
@@ -2143,6 +2157,11 @@ void wxGenericTreeCtrl::SetStateImageList(wxImageList *imageList)
if (m_ownsImageListState) delete m_imageListState;
m_imageListState = imageList;
m_ownsImageListState = false;
m_dirty = true;
// Don't do any drawing if we're setting the list to NULL,
// since we may be in the process of deleting the tree control.
if (imageList)
CalculateLineHeight();
}
void wxGenericTreeCtrl::SetButtonsImageList(wxImageList *imageList)
@@ -2355,7 +2374,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
{
dc.SetClippingRegion( item->GetX() + state_w, item->GetY(), image_w, total_h );
m_imageListNormal->Draw( image, dc,
item->GetX(),
item->GetX() + state_w,
item->GetY() + ((total_h > image_h)?((total_h-image_h)/2):0),
wxIMAGELIST_DRAW_TRANSPARENT );
dc.DestroyClippingRegion();