+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
+}
+
+void wxGenericTreeCtrl::SetImageList(wxImageList *imageList)
+{
+ if (m_ownsImageListNormal) delete m_imageListNormal;
+ m_imageListNormal = imageList;
+ m_ownsImageListNormal = 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::SetStateImageList(wxImageList *imageList)
+{
+ if (m_ownsImageListState) delete m_imageListState;
+ m_imageListState = imageList;
+ m_ownsImageListState = FALSE;
+}
+
+void wxGenericTreeCtrl::SetButtonsImageList(wxImageList *imageList)
+{
+ if (m_ownsImageListButtons) delete m_imageListButtons;
+ m_imageListButtons = imageList;
+ m_ownsImageListButtons = FALSE;
+ m_dirty = TRUE;
+ CalculateLineHeight();
+}
+
+void wxGenericTreeCtrl::AssignImageList(wxImageList *imageList)