+void wxGenericTreeCtrl::CalculateLineHeight()
+{
+ wxClientDC dc(this);
+ m_lineHeight = (int)(dc.GetCharHeight() + 4);
+
+ if ( m_imageListNormal )
+ {
+ // Calculate a m_lineHeight value from the normal Image sizes.
+ // May be toggle off. Then wxGenericTreeCtrl will spread when
+ // necessary (which might look ugly).
+ int n = m_imageListNormal->GetImageCount();
+ for (int i = 0; i < n ; i++)
+ {
+ int width = 0, height = 0;
+ m_imageListNormal->GetSize(i, width, height);
+ if (height > m_lineHeight) m_lineHeight = height;
+ }
+ }
+
+ if (m_imageListButtons)
+ {
+ // Calculate a m_lineHeight value from the Button image sizes.
+ // May be toggle off. Then wxGenericTreeCtrl will spread when
+ // necessary (which might look ugly).
+ int n = m_imageListButtons->GetImageCount();
+ for (int i = 0; i < n ; i++)
+ {
+ int width = 0, height = 0;
+ m_imageListButtons->GetSize(i, width, height);
+ if (height > m_lineHeight) m_lineHeight = height;
+ }
+ }
+
+ if (m_lineHeight < 30)
+ m_lineHeight += 2; // at least 2 pixels
+ else
+ m_lineHeight += m_lineHeight/10; // otherwise 10% extra spacing
+}
+