X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/03966fcb3f5aeea7d8e6652d40e6804811a785d8..524c47aa3adf2af11a3069fd5da035a604f08f66:/src/generic/treectlg.cpp diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 16735f2591..b9f5f2cf16 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -792,7 +792,7 @@ void wxGenericTreeCtrl::Init() m_lastOnSame = false; -#ifdef __WXMAC__ +#if defined( __WXMAC__ ) && wxOSX_USE_COCOA_OR_CARBON m_normalFont.MacCreateFromThemeFont( kThemeViewsFont ) ; #else m_normalFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ); @@ -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();